]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
* Se agrega vista del drenaje e imagenes
authorRicardo Markiewicz <gazer.arg@gmail.com>
Mon, 17 Nov 2003 02:13:14 +0000 (02:13 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Mon, 17 Nov 2003 02:13:14 +0000 (02:13 +0000)
 * Se carga drenajes desde el XML
 * Hago que el icono de conectado se vea mas lindo

Client/include/item_drain.h [new file with mode: 0644]
Client/include/principal.h
Client/pixmaps/drain_e.png [new file with mode: 0644]
Client/pixmaps/drain_n.png [new file with mode: 0644]
Client/pixmaps/drain_o.png [new file with mode: 0644]
Client/pixmaps/drain_s.png [new file with mode: 0644]
Client/src/Makefile.am
Client/src/client.glade
Client/src/item_drain.cpp [new file with mode: 0644]
Client/src/principal.cpp

diff --git a/Client/include/item_drain.h b/Client/include/item_drain.h
new file mode 100644 (file)
index 0000000..b501cf9
--- /dev/null
@@ -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
index a6daef37f901c12fcb05cbca37aef9286de7ea79..3aa1adaf8bbb67c213e512ce1be84d31ad8c04c2 100644 (file)
@@ -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<Gnome::Glade::Xml> refXml;
 
diff --git a/Client/pixmaps/drain_e.png b/Client/pixmaps/drain_e.png
new file mode 100644 (file)
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 (file)
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 (file)
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 (file)
index 0000000..8e8b9b5
Binary files /dev/null and b/Client/pixmaps/drain_s.png differ
index 686e9126d37b4afbe3a8a38ebb43ae08613d4e04..a7d52bfb66430a5561d52a33488779ab73f17a2c 100644 (file)
@@ -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++ 
 
index f83c0cff0d52d76754b6e30db13b4cb6e219ea64..7896363d3bea17f42e4f3e137470cdff9c676c04 100644 (file)
          </child>
 
          <child>
-           <widget class="GtkImage" id="ico_conected">
+           <widget class="GtkFrame" id="frame5">
              <property name="visible">True</property>
-             <property name="stock">gtk-no</property>
-             <property name="icon_size">3</property>
-             <property name="xalign">0.5</property>
-             <property name="yalign">0.5</property>
-             <property name="xpad">0</property>
-             <property name="ypad">0</property>
+             <property name="label_xalign">0</property>
+             <property name="label_yalign">0.5</property>
+             <property name="shadow_type">GTK_SHADOW_OUT</property>
+
+             <child>
+               <widget class="GtkImage" id="ico_conected">
+                 <property name="visible">True</property>
+                 <property name="stock">gtk-no</property>
+                 <property name="icon_size">3</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+             </child>
            </widget>
            <packing>
              <property name="padding">0</property>
diff --git a/Client/src/item_drain.cpp b/Client/src/item_drain.cpp
new file mode 100644 (file)
index 0000000..aa3b325
--- /dev/null
@@ -0,0 +1,27 @@
+
+#include "item_drain.h"
+#include <iostream>
+
+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()
+{
+}
+
index 05387367d5175332da9cf58f1344afae9c392f0f..67eed0946860a99b894452b3bd18974a160715c0 100644 (file)
@@ -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<Gnome::Glade::Xml> &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;
+}