]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
* Se agregan archivos faltantes en el otro commit
authorRicardo Markiewicz <gazer.arg@gmail.com>
Fri, 28 Nov 2003 02:31:55 +0000 (02:31 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Fri, 28 Nov 2003 02:31:55 +0000 (02:31 +0000)
 * Se cargan compuertas logicas desde el XML y se dibujan las
   lineas de conexion.

15 files changed:
Client/include/dlg_property.h [new file with mode: 0644]
Client/include/item.h
Client/include/item_and.h [new file with mode: 0644]
Client/include/item_not.h [new file with mode: 0644]
Client/include/item_or.h [new file with mode: 0644]
Client/include/principal.h
Client/src/Makefile.am
Client/src/dlg_property.cpp [new file with mode: 0644]
Client/src/item_and.cpp [new file with mode: 0644]
Client/src/item_exclusa.cpp
Client/src/item_not.cpp [new file with mode: 0644]
Client/src/item_or.cpp [new file with mode: 0644]
Client/src/item_pump.cpp
Client/src/item_tank.cpp
Client/src/principal.cpp

diff --git a/Client/include/dlg_property.h b/Client/include/dlg_property.h
new file mode 100644 (file)
index 0000000..af0cb02
--- /dev/null
@@ -0,0 +1,33 @@
+
+
+#ifndef _DLG_PROPERTY_H_
+#define _DLG_PROPERTY_H_
+
+#include <gtkmm.h>
+#include <libglademm.h>
+
+/** Dialogo de Propiedades 
+ *
+ *  Este diálogo deja al usuario ingresar el nombre del servidor y
+ *  el puerto para inicializar una simulación.
+ */
+class DlgProperty:public Gtk::Dialog {
+public:
+       /// Constructor
+       DlgProperty(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg);
+       /// Destructor
+       virtual ~DlgProperty();
+
+       Gtk::Button *get_ok_button();
+
+       int get_velocity();
+
+       virtual void on_cancel_clicked();
+protected:
+       /// Referencia al XML desde donde fue creada la ventana
+       Glib::RefPtr<Gnome::Glade::Xml> refXml;
+       Gtk::Button *ok, *cancel;
+};
+
+#endif
+
index 02e62b95cddea9e46433285036b6f500acd829a4..d44f403337b103a7034c3b8cef9af9c8fac473ee 100644 (file)
@@ -2,6 +2,7 @@
 #define _ITEM_H_
 
 #include <iostream>
+#include <list>
 #include <gtkmm/drawingarea.h>
 #include <gtkmm.h>
 #include <gdkmm.h>
@@ -29,12 +30,22 @@ public:
        virtual std::string get_cap_flow() { return "Flujo Actual :"; }
        virtual std::string get_cap_extra() { return ""; }
        virtual std::string get_extra() { return ""; }
+
+       std::list<std::string> out_lines; // lineas que salen de una compuerta
+       std::list<std::string> in_lines; // lineas que entran a una compuerta
+
+       // Coordenadas para los conectores
+       int x,y;
+       int in_x, in_y;
+       int out_x, out_y;
+       int offset_x, offset_y;
+       int item_offset_x, item_offset_y;
 protected:
        Glib::ustring name;
        Gtk::Image image;
        Gdk::Color color;
        Glib::RefPtr<Gdk::GC> gc;
-       int x, y, m_or;
+       int m_or;
        float actual_flow, extra;
        bool open;
 };
diff --git a/Client/include/item_and.h b/Client/include/item_and.h
new file mode 100644 (file)
index 0000000..ff67ec5
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _ITEM_AND_H_
+#define _ITEM_AND_H_
+
+#include "item.h" 
+
+class ViewAnd:public ViewItem{
+public:
+       ViewAnd(Glib::ustring _name, int orientacion);
+       virtual ~ViewAnd();
+       
+       virtual bool on_image_expose_event(GdkEventExpose *e);
+};
+
+#endif
+
diff --git a/Client/include/item_not.h b/Client/include/item_not.h
new file mode 100644 (file)
index 0000000..129ebd9
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _ITEM_NOT_H_
+#define _ITEM_NOT_H_
+
+#include "item.h" 
+
+class ViewNot:public ViewItem{
+public:
+       ViewNot(Glib::ustring _name, int orientacion);
+       virtual ~ViewNot();
+       
+       virtual bool on_image_expose_event(GdkEventExpose *e);
+};
+
+#endif
+
diff --git a/Client/include/item_or.h b/Client/include/item_or.h
new file mode 100644 (file)
index 0000000..2c83025
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _ITEM_OR_H_
+#define _ITEM_OR_H_
+
+#include "item.h" 
+
+class ViewOr:public ViewItem{
+public:
+       ViewOr(Glib::ustring _name, int orientacion);
+       virtual ~ViewOr();
+       
+       virtual bool on_image_expose_event(GdkEventExpose *e);
+};
+
+#endif
+
index 5c8e3685a568d764e7b05fd2b3e33659b26ed4cc..e781d427fd9f8dfec0ebb4ff69fc0272c70da161 100644 (file)
@@ -17,6 +17,7 @@ public:
        Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg);
        virtual ~Principal();
 
+       virtual void on_realize();
 protected:
        PlaQui::Server::ControlClient *conexion;
        // Utilizo un map para no tener que buscar un item
@@ -40,7 +41,10 @@ protected:
        void loadTank(xmlNodePtr nodo);
        void loadUnion(xmlNodePtr nodo);
        void loadDrain(xmlNodePtr nodo);
-
+       void loadOr(xmlNodePtr nodo);
+       void loadNot(xmlNodePtr nodo);
+       void loadAnd(xmlNodePtr nodo);
+       
        Glib::Dispatcher load_xml_dispatch, update_ui;
        std::string xml_body;
 
@@ -59,10 +63,12 @@ protected:
        Gtk::Image *ico_conected;
        Gtk::Button *btn_activar, *btn_simulate, *btn_pause;
        Gtk::DrawingArea *color_preview;
+       Glib::RefPtr<Gdk::GC> gc;
 
        // Actualiza las propiedades en la ventana del item actual
        void update_items_prop();
-       
+       ViewItem *find_item(std::string &_name);        
+
        // Callbacks del menu y la barra
        virtual void on_mnu_file_exit();
        virtual void on_mnu_file_connect();
@@ -76,6 +82,7 @@ protected:
        virtual void on_btn_simulate_clicked();
        virtual void on_btn_pause_clicked();
        virtual bool on_item_clicked(GdkEventButton *, ViewItem *);
+       virtual bool on_workplace_expose_event(GdkEventExpose *);
        
        // Callbacks para las conexiones
        void on_conexion_finished();
index 608e64e46c3b33c4900337b65cd4f38de0404394..045a53ee382aaf0491782a2631406d3f6a3c9247 100644 (file)
@@ -20,7 +20,10 @@ plaqui_client_SOURCES = main.cpp \
                                                                                                item_exclusa.cpp \
                                                                                                item_tank.cpp \
                                                                                                item_union.cpp \
-                                                                                               item_drain.cpp
+                                                                                               item_drain.cpp \
+                                                                                               item_or.cpp \
+                                                                                               item_and.cpp \
+                                                                                               item_not.cpp
 
 plaqui_client_LDADD = @PACKAGE_LIBS@ ../../Server/src/libplaquiserver.a -lsocket++ 
 
diff --git a/Client/src/dlg_property.cpp b/Client/src/dlg_property.cpp
new file mode 100644 (file)
index 0000000..8957625
--- /dev/null
@@ -0,0 +1,33 @@
+
+#include "dlg_property.h"
+
+DlgProperty::DlgProperty(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Dialog(co),refXml(rg)
+{
+       ok = cancel = 0;
+       refXml->get_widget("btn_prop_cancel", cancel);
+       refXml->get_widget("btn_prop_ok", ok);
+
+       cancel->signal_clicked().connect( SigC::slot(*this, &DlgProperty::on_cancel_clicked) );
+}
+
+DlgProperty::~DlgProperty()
+{
+}
+
+void DlgProperty::on_cancel_clicked()
+{
+       hide();
+}
+
+Gtk::Button *DlgProperty::get_ok_button()
+{
+       return ok;
+}
+
+int DlgProperty::get_velocity()
+{
+       Gtk::SpinButton *vel = 0;
+       refXml->get_widget("spn_velocity", vel);
+       return vel->get_value_as_int();
+}
+
diff --git a/Client/src/item_and.cpp b/Client/src/item_and.cpp
new file mode 100644 (file)
index 0000000..ee3bdcc
--- /dev/null
@@ -0,0 +1,57 @@
+
+#include "item_and.h"
+#include <sstream>
+#include <string>
+
+ViewAnd::ViewAnd(Glib::ustring _name, int orientacion):ViewItem(_name)
+{
+       switch (orientacion) {
+               case 0:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/and_e.png");
+                       in_x = 0;
+                       in_y = 16;
+                       out_x = 32;
+                       out_y = 16;
+                       offset_x = 15;
+                       offset_y = 0;
+               break;
+               case 1:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/and_s.png");
+                       in_x = 16;
+                       in_y = 0;
+                       out_x = 16;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 15;
+               break;
+               case 2:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/and_o.png");
+                       in_x = 32;
+                       in_y = 16;
+                       out_x = 0;
+                       out_y = 16;
+                       offset_x = -15;
+                       offset_y = 0;
+               break;
+               case 3:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/and_n.png");
+                       in_x = 16;
+                       in_y = 32;
+                       out_x = 16;
+                       out_y = 0;
+                       offset_x = 0;
+                       offset_y = -15;
+       }
+       m_or = orientacion;
+       image.show();
+       set_size_request();
+}
+
+ViewAnd::~ViewAnd()
+{
+}
+
+bool ViewAnd::on_image_expose_event(GdkEventExpose *e)
+{
+}
+
index 39f2a880b2ca8d9f866697feb7d996899e8a8b6f..d318ac4cc610a4ec79d62df66f0f8f432ac1a7a7 100644 (file)
@@ -6,9 +6,25 @@ ViewExclusa::ViewExclusa(Glib::ustring _name, int orientacion):ViewItem(_name)
        switch (orientacion) {
                case 0:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/exclusa_h.png");
+                       in_x = 32;
+                       in_y = 0;
+                       out_x = 32;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = -15;
                break;
                case 1:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/exclusa_s.png");
+                       in_x = 32;
+                       in_y = 32;
+                       out_x = 0;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = 15;
        }
        m_or = orientacion;
        image.show();
diff --git a/Client/src/item_not.cpp b/Client/src/item_not.cpp
new file mode 100644 (file)
index 0000000..0b61440
--- /dev/null
@@ -0,0 +1,65 @@
+
+#include "item_not.h"
+#include <sstream>
+#include <string>
+
+ViewNot::ViewNot(Glib::ustring _name, int orientacion):ViewItem(_name)
+{
+       switch (orientacion) {
+               case 0:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/not_e.png");
+                       in_x = 0;
+                       in_y = 16;
+                       out_x = 32;
+                       out_y = 16;
+                       offset_x = 15;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+               break;
+               case 1:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/not_s.png");
+                       in_x = 16;
+                       in_y = 0;
+                       out_x = 16;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 15;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+               break;
+               case 2:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/not_o.png");
+                       in_x = 32;
+                       in_y = 16;
+                       out_x = 0;
+                       out_y = 16;
+                       offset_x = -15;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+               break;
+               case 3:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/not_n.png");
+                       in_x = 16;
+                       in_y = 32;
+                       out_x = 16;
+                       out_y = 0;
+                       offset_x = 0;
+                       offset_y = -15;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+       }
+       m_or = orientacion;
+       image.show();
+       set_size_request();
+}
+
+ViewNot::~ViewNot()
+{
+}
+
+bool ViewNot::on_image_expose_event(GdkEventExpose *e)
+{
+}
+
diff --git a/Client/src/item_or.cpp b/Client/src/item_or.cpp
new file mode 100644 (file)
index 0000000..79aecc1
--- /dev/null
@@ -0,0 +1,65 @@
+
+#include "item_or.h"
+#include <sstream>
+#include <string>
+
+ViewOr::ViewOr(Glib::ustring _name, int orientacion):ViewItem(_name)
+{
+       switch (orientacion) {
+               case 0:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/or_e.png");
+                       in_x = 0;
+                       in_y = 16;
+                       out_x = 32;
+                       out_y = 16;
+                       offset_x = 15;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+               break;
+               case 1:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/or_s.png");
+                       in_x = 16;
+                       in_y = 0;
+                       out_x = 16;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 15;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+               break;
+               case 2:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/or_o.png");
+                       in_x = 32;
+                       in_y = 16;
+                       out_x = 0;
+                       out_y = 16;
+                       offset_x = -15;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+               break;
+               case 3:
+                       image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/or_n.png");
+                       in_x = 16;
+                       in_y = 32;
+                       out_x = 16;
+                       out_y = 0;
+                       offset_x = 0;
+                       offset_y = -15;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
+       }
+       m_or = orientacion;
+       image.show();
+       set_size_request();
+}
+
+ViewOr::~ViewOr()
+{
+}
+
+bool ViewOr::on_image_expose_event(GdkEventExpose *e)
+{
+}
+
index 1c25011e9ed609d8abf48738368433368e7daa3d..abb1b0c5c55ce50216363775091005c79e07955e 100644 (file)
@@ -6,9 +6,25 @@ ViewPump::ViewPump(Glib::ustring _name, int orientacion):ViewItem(_name)
        switch (orientacion) {
                case 0:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/bomba_e.png");
+                       in_x = 96-16;
+                       in_y = 0;
+                       out_x = in_x;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = -15;
                break;
                case 1:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/bomba_o.png");
+                       in_x = 16;
+                       in_y = 0;                       
+                       out_x = 16;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = -15;
        }
        image.show();
        set_size_request();
index b22b337bb21d993eb7d4b21fa61bf9c7b69df132..28cd57644c5900dde19819e74e1bbf0860b04621 100644 (file)
@@ -7,9 +7,25 @@ ViewTank::ViewTank(Glib::ustring _name, int orientacion):ViewItem(_name)
        switch (orientacion) {
                case 0:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/tanque_e.png");
+                       in_x = 5;
+                       in_y = 16;
+                       out_x = 64-16;
+                       out_y = 64;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
                break;
                case 1:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/tanque_o.png");
+                       in_x = 64-5;
+                       in_y = 16;
+                       out_x = 16;
+                       out_y = 64;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = 0;
        }
        image.show();
        set_size_request();
index cb4a8532ed4f9b92b4211739f2418c13d7853952..6a085837e561b16f0909ba4910992379fb16dd2a 100644 (file)
@@ -11,6 +11,9 @@
 #include "item_pump.h"
 #include "item_union.h"
 #include "item_drain.h"
+#include "item_not.h"
+#include "item_or.h"
+#include "item_and.h"
 #include <unistd.h>
 
 Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Window(co),refXml(rg)
@@ -48,6 +51,7 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &
        rg->get_widget("work_place", work_place);
        rg->get_widget("ico_conected", ico_conected);
 
+       work_place->signal_expose_event().connect( SigC::slot(*this, &Principal::on_workplace_expose_event) );
        dlg_property->get_ok_button()->signal_clicked().connect( SigC::slot(*this, &Principal::on_dlg_property_ok) );
        dlg_conectar->get_ok_button()->signal_clicked().connect( SigC::slot(*this, &Principal::on_dlg_connect_ok) );
        mnu_prop->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_property));
@@ -66,6 +70,7 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &
        last_selected = NULL;
        update_ui.connect( SigC::slot(*this, &Principal::update_items_prop ) );
        load_xml_dispatch.connect( SigC::slot(*this, &Principal::loadXML ) );
+       gc = Gdk::GC::create(get_window());
 }
 
 Principal::~Principal()
@@ -79,6 +84,60 @@ Principal::~Principal()
        }
 }
 
+void Principal::on_realize()
+{
+       Gtk::Window::on_realize();
+}
+
+bool Principal::on_workplace_expose_event(GdkEventExpose *e)
+{
+       Glib::RefPtr<Gdk::Window> window = work_place->get_window();
+
+       int x1, y1, x2, y2;
+       // Dibujo las lineas
+       std::map<const std::string, ViewItem *>::iterator i;
+       for(i=mapItems.begin(); i!=mapItems.end(); i++) {
+               if (dynamic_cast<ViewAnd *>(i->second) || dynamic_cast<ViewOr *>(i->second) || dynamic_cast<ViewNot *>(i->second)) {
+                       x1 = i->second->x + i->second->in_x;
+                       y1 = i->second->y + i->second->in_y;
+                       std::list<std::string>::iterator linea;
+                       for(linea=i->second->in_lines.begin(); linea!=i->second->in_lines.end(); linea++) {
+                               ViewItem *tmp = find_item(*linea);
+                               x2 = tmp->x + tmp->out_x;
+                               y2 = tmp->y + tmp->out_y;
+                               gc->set_line_attributes(3, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
+                               window->draw_line(gc, x2+tmp->item_offset_x, y2+tmp->item_offset_y, x2+tmp->item_offset_x, y1+i->second->offset_y);
+                               window->draw_line(gc, x2+tmp->item_offset_x, y1+i->second->offset_y, x1+i->second->offset_x, y1+i->second->offset_y);
+                               window->draw_line(gc, x1, y1, x1+i->second->offset_x, y1+i->second->offset_y);
+                               window->draw_line(gc, x2, y2, x2+tmp->item_offset_x, y2+tmp->item_offset_y);
+                       }
+                       x1 = i->second->x + i->second->out_x;
+                       y1 = i->second->y + i->second->out_y;
+                       for(linea=i->second->out_lines.begin(); linea!=i->second->out_lines.end(); linea++) {
+                               ViewItem *tmp = find_item(*linea);
+                               x2 = tmp->x + tmp->in_x;
+                               y2 = tmp->y + tmp->in_y;
+                               gc->set_line_attributes(3, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
+                               window->draw_line(gc, x1+i->second->offset_x, y1+i->second->offset_y, x1+i->second->offset_x, y2+tmp->item_offset_y);
+                               window->draw_line(gc, x1+i->second->offset_x, y2+tmp->item_offset_y, x2+tmp->item_offset_x, y2+tmp->item_offset_y);
+                               window->draw_line(gc, x1, y1, x1+i->second->offset_x, y1+i->second->offset_y);
+                               window->draw_line(gc, x2, y2, x2+tmp->item_offset_x, y2+tmp->item_offset_y);
+                       }
+               }
+       }
+}
+
+ViewItem *Principal::find_item(std::string &_name)
+{
+       std::map<const std::string, ViewItem *>::iterator i;
+       for(i=mapItems.begin(); i!=mapItems.end(); i++) {
+               if (i->second->get_name() == _name) {
+                       return i->second;
+               }
+       }
+       return NULL;
+}
+
 void Principal::on_dlg_connect_ok()
 {
        if (conexion == NULL) {
@@ -320,6 +379,12 @@ void Principal::loadXML()
                                        loadUnion(items);
                                } else if (xmlStrcmp(items->name, BAD_CAST"drenaje")==0) {
                                        loadDrain(items);
+                               } else if (xmlStrcmp(items->name, BAD_CAST"and")==0) {
+                                       loadAnd(items);
+                               } else if (xmlStrcmp(items->name, BAD_CAST"or")==0) {
+                                       loadOr(items);
+                               } else if (xmlStrcmp(items->name, BAD_CAST"not")==0) {
+                                       loadNot(items);
                                }
 
                        }
@@ -337,6 +402,112 @@ void Principal::loadXML()
        conexion->send(c);
 }
 
+void Principal::loadNot(xmlNodePtr nodo)
+{
+       std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+       std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+       int orientacion=0, x, y;
+
+       ViewNot *p;
+       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) );
+                               p = new ViewNot(name, orientacion);
+                       } 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) );
+                       } else if (xmlStrcmp(nodo->name, BAD_CAST"salida") == 0) {
+                               p->out_lines.push_back((char *)XML_GET_CONTENT(nodo->children));
+                       } else if (xmlStrcmp(nodo->name, BAD_CAST"entrada") == 0) {
+                               p->in_lines.push_back((char *)XML_GET_CONTENT(nodo->children));
+                       }
+               }
+               nodo = nodo->next;
+       }
+       
+       p->signal_button_press_event().connect(SigC::bind( SigC::slot(*this, &Principal::on_item_clicked), p) );
+       p->set_position(x,y);
+       work_place->put(*p, x, y);
+       p->show();
+       // los agrego al hash
+       mapItems[name] = p;
+}
+
+void Principal::loadOr(xmlNodePtr nodo)
+{
+       std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+       std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+       int orientacion=0, x, y;
+
+       ViewOr *p;
+
+       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) );
+                               p = new ViewOr(name, orientacion);
+                       } 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) );
+                       } else if (xmlStrcmp(nodo->name, BAD_CAST"salida") == 0) {
+                               p->out_lines.push_back((char *)XML_GET_CONTENT(nodo->children));
+                       } else if (xmlStrcmp(nodo->name, BAD_CAST"entrada") == 0) {
+                               p->in_lines.push_back((char *)XML_GET_CONTENT(nodo->children));
+                       }
+               }
+               nodo = nodo->next;
+       }
+
+       p->signal_button_press_event().connect(SigC::bind( SigC::slot(*this, &Principal::on_item_clicked), p) );
+       p->set_position(x,y);
+       work_place->put(*p, x, y);
+       p->show();
+       // los agrego al hash
+       mapItems[name] = p;
+}
+
+void Principal::loadAnd(xmlNodePtr nodo)
+{
+       std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+       std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
+       int orientacion=0, x, y;
+       float flujo;
+       xmlNodePtr inicial = nodo;
+
+       ViewAnd *p;
+       
+       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) );
+                               p = new ViewAnd(name, orientacion);
+                       } 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) );
+                       } else if (xmlStrcmp(nodo->name, BAD_CAST"salida") == 0) {
+                               p->out_lines.push_back((char *)XML_GET_CONTENT(nodo->children));
+                       } else if (xmlStrcmp(nodo->name, BAD_CAST"entrada") == 0) {
+                               p->in_lines.push_back((char *)XML_GET_CONTENT(nodo->children));
+                       }
+               }
+               nodo = nodo->next;
+       }
+
+       p->signal_button_press_event().connect(SigC::bind( SigC::slot(*this, &Principal::on_item_clicked), p) );
+       p->set_position(x,y);
+       work_place->put(*p, x, y);
+       p->show();
+       // los agrego al hash
+       mapItems[name] = p;
+}
+
 void Principal::loadBomba(xmlNodePtr nodo)
 {
        Glib::ustring name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");