]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Constructor/src/constructor.cpp
Se agrega diagrama de clases del modelo.
[z.facultad/75.42/plaqui.git] / Constructor / src / constructor.cpp
index e352f4a6225df02af7915720d353913a1c223a9d..facfd8d1164204df6534c893cf7ba48d62857360 100644 (file)
@@ -5,6 +5,28 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
        id = 0;
        saved = false;
        set_title("Constructor");
        id = 0;
        saved = false;
        set_title("Constructor");
+       Gtk::Label *lbl_plaqui_version;
+       Gtk::Image *plaqui_logo;
+       Gtk::MenuItem *mnu_about;
+       Gtk::Button *close_about;
+       
+       plaqui_logo = 0;
+       lbl_plaqui_version = 0;
+       refGlade->get_widget("lbl_plaqui_version", lbl_plaqui_version);
+       refGlade->get_widget("plaqui_logo", plaqui_logo);
+       plaqui_logo->set(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/logo.png");
+
+       refGlade->get_widget("plaqui_logo", plaqui_logo);
+       // Calculo número de revisión.
+       std::string rev = "$Rev$";
+       rev = rev.substr(6, rev.length() - 8);
+       std::string s = "PlaQui Constructor versión " VERSION " (revisión ";
+       s += rev + ")"; 
+       lbl_plaqui_version->set_text(Glib::locale_to_utf8(s));
+       
+       refGlade->get_widget("dlgAbout", dlg_about);
+       refGlade->get_widget("close_about", close_about);
+       refGlade->get_widget("mnu_about", mnu_about);
        
        // Cargo todas las imagenes de los iconos de los botones
        ico_canio = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/canio_n.png");
        
        // Cargo todas las imagenes de los iconos de los botones
        ico_canio = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/canio_n.png");
@@ -59,6 +81,8 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
        listTargets.push_back( Gtk::TargetEntry("application/pointer") );
        
        // Le indico cuales son los botones  desde los cuales se puede hacer un drag.
        listTargets.push_back( Gtk::TargetEntry("application/pointer") );
        
        // Le indico cuales son los botones  desde los cuales se puede hacer un drag.
+       mnu_about->signal_activate().connect( SigC::slot(*dlg_about, &Gtk::Widget::show) );
+       close_about->signal_clicked().connect( SigC::slot(*dlg_about, &Gtk::Widget::hide) );
        btn_canio->drag_source_set(listTargets);
        btn_y->drag_source_set(listTargets);
        btn_codo->drag_source_set(listTargets);
        btn_canio->drag_source_set(listTargets);
        btn_y->drag_source_set(listTargets);
        btn_codo->drag_source_set(listTargets);
@@ -1055,16 +1079,36 @@ void Constructor::create_line(xmlNodePtr nodo, int logic_id)
                                t_line tmp_line;
                                tmp_line.logic_id = logic_id;
                                //workplace->get_logic_item(logic_id)->set_out_connected(true);
                                t_line tmp_line;
                                tmp_line.logic_id = logic_id;
                                //workplace->get_logic_item(logic_id)->set_out_connected(true);
-                               tmp_line.store_id = workplace->get_item_id(otro);
-                               std::cout << otro << " " << tmp_line.logic_id << " " << tmp_line.store_id << std::endl;
-                               workplace->lista_lineas_in.push_back(tmp_line);
+                               if (workplace->get_item_id(otro) != -1) {
+                                       tmp_line.store_id = workplace->get_item_id(otro);
+                                       std::cout << otro << " se conecta a una compuerta" << std::endl;
+                                       workplace->lista_lineas_in.push_back(tmp_line);
+                               } else {
+                                       /* Como no era un item, debe ser una compuerta */
+                                       tmp_line.store_id = workplace->get_logic_id(otro);
+                                       workplace->lista_lineas_logic.push_back(tmp_line);
+                               }
                        } else if (xmlStrcmp(nodo->name, BAD_CAST"entrada")==0) {
                                otro = (char *)XML_GET_CONTENT(nodo->children);
                                t_line tmp_line;
                                tmp_line.logic_id = logic_id;
                        } else if (xmlStrcmp(nodo->name, BAD_CAST"entrada")==0) {
                                otro = (char *)XML_GET_CONTENT(nodo->children);
                                t_line tmp_line;
                                tmp_line.logic_id = logic_id;
-                               tmp_line.store_id = workplace->get_item_id(otro);
-                               workplace->lista_lineas_out.push_back(tmp_line);
-                               std::cout << otro << " " << tmp_line.logic_id << " " << tmp_line.store_id << std::endl;
+                               if (workplace->get_item_id(otro) != -1) {
+                                       tmp_line.store_id = workplace->get_item_id(otro);
+                                       /* Tengo que ver si es un tanque, para setearlo correctamente */
+                                       if (dynamic_cast<Cistern *>(workplace->get_item(workplace->get_item_id(otro)))) {
+                                               std::string donde = (char *)xmlGetProp(nodo, BAD_CAST"id");
+                                               tmp_line.cistern_out1 = true;
+                                               if (donde == "inferior") {
+                                                       tmp_line.cistern_out1 = false;
+                                               }
+                                       }
+                                       workplace->lista_lineas_out.push_back(tmp_line);
+                                       std::cout << otro << " se conecta a una compuerta" << std::endl;
+                               } else {
+                                       /* Como no era un item, debe ser una compuerta */
+                                       tmp_line.store_id = workplace->get_logic_id(otro);
+                                       workplace->lista_lineas_logic.push_back(tmp_line);
+                               }
                        }
                }
                nodo = nodo->next;
                        }
                }
                nodo = nodo->next;