From: Ricardo Markiewicz Date: Mon, 17 Nov 2003 02:13:14 +0000 (+0000) Subject: * Se agrega vista del drenaje e imagenes X-Git-Tag: svn_import~287 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/9350f4883b2e1eb780bd3a30c801fe9eaaaf5f4f * Se agrega vista del drenaje e imagenes * Se carga drenajes desde el XML * Hago que el icono de conectado se vea mas lindo --- diff --git a/Client/include/item_drain.h b/Client/include/item_drain.h new file mode 100644 index 0000000..b501cf9 --- /dev/null +++ b/Client/include/item_drain.h @@ -0,0 +1,13 @@ +#ifndef _ITEM_DRAIN_H_ +#define _ITEM_DRAIN_H_ + +#include "item.h" + +// Hago una clase porque despues van a tener comportamientos distintos! +class ViewDrain:public ViewItem { +public: + ViewDrain(Glib::ustring _name, int orientacion); + virtual ~ViewDrain(); +}; + +#endif diff --git a/Client/include/principal.h b/Client/include/principal.h index a6daef3..3aa1ada 100644 --- a/Client/include/principal.h +++ b/Client/include/principal.h @@ -30,7 +30,8 @@ protected: void loadExclusa(xmlNodePtr nodo); void loadTank(xmlNodePtr nodo); void loadUnion(xmlNodePtr nodo); - + void loadDrain(xmlNodePtr nodo); + // Archivo XML del Padre Glib::RefPtr refXml; diff --git a/Client/pixmaps/drain_e.png b/Client/pixmaps/drain_e.png new file mode 100644 index 0000000..bc3d60b Binary files /dev/null and b/Client/pixmaps/drain_e.png differ diff --git a/Client/pixmaps/drain_n.png b/Client/pixmaps/drain_n.png new file mode 100644 index 0000000..2f11c9b Binary files /dev/null and b/Client/pixmaps/drain_n.png differ diff --git a/Client/pixmaps/drain_o.png b/Client/pixmaps/drain_o.png new file mode 100644 index 0000000..9138db7 Binary files /dev/null and b/Client/pixmaps/drain_o.png differ diff --git a/Client/pixmaps/drain_s.png b/Client/pixmaps/drain_s.png new file mode 100644 index 0000000..8e8b9b5 Binary files /dev/null and b/Client/pixmaps/drain_s.png differ diff --git a/Client/src/Makefile.am b/Client/src/Makefile.am index 686e912..a7d52bf 100644 --- a/Client/src/Makefile.am +++ b/Client/src/Makefile.am @@ -18,7 +18,8 @@ plaqui_client_SOURCES = main.cpp \ item_conduct.cpp \ item_exclusa.cpp \ item_tank.cpp \ - item_union.cpp + item_union.cpp \ + item_drain.cpp plaqui_client_LDADD = @PACKAGE_LIBS@ ../../Server/src/server.a -lsocket++ diff --git a/Client/src/client.glade b/Client/src/client.glade index f83c0cf..7896363 100644 --- a/Client/src/client.glade +++ b/Client/src/client.glade @@ -237,14 +237,23 @@ - + True - gtk-no - 3 - 0.5 - 0.5 - 0 - 0 + 0 + 0.5 + GTK_SHADOW_OUT + + + + True + gtk-no + 3 + 0.5 + 0.5 + 0 + 0 + + 0 diff --git a/Client/src/item_drain.cpp b/Client/src/item_drain.cpp new file mode 100644 index 0000000..aa3b325 --- /dev/null +++ b/Client/src/item_drain.cpp @@ -0,0 +1,27 @@ + +#include "item_drain.h" +#include + +ViewDrain::ViewDrain(Glib::ustring _name, int orientacion):ViewItem(_name) +{ + switch (orientacion) { + case 0: + image.set("drain_n.png"); + break; + case 1: + image.set("drain_e.png"); + break; + case 2: + image.set("drain_s.png"); + break; + case 3: + image.set("drain_o.png"); + } + image.show(); + set_size_request(); +} + +ViewDrain::~ViewDrain() +{ +} + diff --git a/Client/src/principal.cpp b/Client/src/principal.cpp index 0538736..67eed09 100644 --- a/Client/src/principal.cpp +++ b/Client/src/principal.cpp @@ -11,6 +11,7 @@ #include "item_tank.h" #include "item_pump.h" #include "item_union.h" +#include "item_drain.h" Principal::Principal(BaseObjectType *co, const Glib::RefPtr &rg):Gtk::Window(co),refXml(rg) { @@ -212,7 +213,10 @@ void Principal::on_mnu_prop() loadTank(items); } else if (xmlStrcmp(items->name, BAD_CAST"empalme")==0) { loadUnion(items); + } else if (xmlStrcmp(items->name, BAD_CAST"drenaje")==0) { + loadDrain(items); } + } items = items->next; } @@ -393,3 +397,31 @@ void Principal::loadUnion(xmlNodePtr nodo) mapItems[name] = b; } +void Principal::loadDrain(xmlNodePtr nodo) +{ + Glib::ustring name = (char *)xmlGetProp(nodo, BAD_CAST"nombre"); + int orientacion=0, x, y; + + nodo = nodo->children; + while (nodo != NULL) { + if (nodo->type == XML_ELEMENT_NODE) { + if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) { + orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) ); + } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) { + x = atoi( (char *)XML_GET_CONTENT(nodo->children) ); + } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) { + y = atoi( (char *)XML_GET_CONTENT(nodo->children) ); + } + } + nodo = nodo->next; + } + + // listo, ya recolecte todos los datos, ahora creo el objeto! + ViewDrain *b = Gtk::manage( new ViewDrain(name, orientacion) ); + b->signal_button_release_event().connect(SigC::bind( SigC::slot(*this, &Principal::on_item_clicked), b) ); + b->set_position(x,y); + work_place->put(*b, x, y); + b->show(); + // los agrego al hash + mapItems[name] = b; +}