From 9350f4883b2e1eb780bd3a30c801fe9eaaaf5f4f Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Mon, 17 Nov 2003 02:13:14 +0000 Subject: [PATCH] * Se agrega vista del drenaje e imagenes * Se carga drenajes desde el XML * Hago que el icono de conectado se vea mas lindo --- Client/include/item_drain.h | 13 +++++++++++++ Client/include/principal.h | 3 ++- Client/pixmaps/drain_e.png | Bin 0 -> 236 bytes Client/pixmaps/drain_n.png | Bin 0 -> 236 bytes Client/pixmaps/drain_o.png | Bin 0 -> 237 bytes Client/pixmaps/drain_s.png | Bin 0 -> 232 bytes Client/src/Makefile.am | 3 ++- Client/src/client.glade | 23 ++++++++++++++++------- Client/src/item_drain.cpp | 27 +++++++++++++++++++++++++++ Client/src/principal.cpp | 32 ++++++++++++++++++++++++++++++++ 10 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 Client/include/item_drain.h create mode 100644 Client/pixmaps/drain_e.png create mode 100644 Client/pixmaps/drain_n.png create mode 100644 Client/pixmaps/drain_o.png create mode 100644 Client/pixmaps/drain_s.png create mode 100644 Client/src/item_drain.cpp 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 0000000000000000000000000000000000000000..bc3d60b7b2ec5c6e596475b2796e3cf7c6828437 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o{+5N5n|x9$&6kiEpy*OmP;H$OL<^_-I~sz4#x64!_l=ltB<)VvY~=c3falGGH1 z^30M9g^-L?1$R&1fcGh?c|e5$o-U3d6}OUerceKW-k_nOGqK^|3T8Li15LggK0S06 zsoTBBCNSwqN59*_2J42x1>T1)x>&qw01~s<+=L%yD9MyEJkB_ta)og*pF{>b14FEh W6N~OFr&U0+89ZJ6T-G@yGywp0x=hOe literal 0 HcmV?d00001 diff --git a/Client/pixmaps/drain_n.png b/Client/pixmaps/drain_n.png new file mode 100644 index 0000000000000000000000000000000000000000..2f11c9b6b7b41e765487519639e072467e9cdab7 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o{+5N5n|x9$&6kiEpy*OmP;H$OL<-baxI=YT@8C9V-A&iT2ysd*&~&PAz-C8;S2 z<(VZJ3LzP(3hti10q;{(^MDEiJY5_^DsCm`OrQS$d;@EUT}{WK{OQw|d+>-SBuOL~ zylP-9XHZ_};-P<_$veqJyvHg5NIYu_WCs!#V+>|-xC=kbP?9n1EHL46lVxBykl}V) U^u(M^K(iSp64!_l=ltB<)VvY~=c3falGGH1 z^30M9g^-L?1$R&1fcGh?c|e6eo-U3d6}OUerceKW-k_nOGqK^|3TC!Dj5bP0l+XkKhk;2k literal 0 HcmV?d00001 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; +} -- 2.43.0