]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
-Se carga la lista de items al ir haciendo click sobre ellos
authorNicolás Dimov <ndimov@gmail.com>
Mon, 24 Nov 2003 03:55:12 +0000 (03:55 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Mon, 24 Nov 2003 03:55:12 +0000 (03:55 +0000)
-Se corrige una huevada cuando se dibujan los conectores logicos
-No se por que cuando un item rota se borran los conectores
-No se que mas cambie

15 files changed:
Constructor/dialogs/constructor.glade
Constructor/include/constructor.h
Constructor/include/item.h
Constructor/src/and.cpp
Constructor/src/cistern.cpp
Constructor/src/conduct.cpp
Constructor/src/constructor.cpp
Constructor/src/drain.cpp
Constructor/src/exclusa.cpp
Constructor/src/not.cpp
Constructor/src/or.cpp
Constructor/src/pump.cpp
Constructor/src/splitter.cpp
Constructor/src/union.cpp
Constructor/src/workplace.cpp

index e64fc7eca754e1ae86c5ad3180f84493cb76a505..1dd2fd1a1af00ebc6f2f0b9179940794f7965457 100644 (file)
          </child>
 
          <child>
-           <widget class="GtkCombo" id="combo1">
+           <widget class="GtkCombo" id="combo_entry">
              <property name="visible">True</property>
              <property name="value_in_list">False</property>
              <property name="allow_empty">True</property>
              <property name="enable_arrows_always">False</property>
 
              <child internal-child="entry">
-               <widget class="GtkEntry" id="combo_entry">
+               <widget class="GtkEntry" id="entry">
                  <property name="visible">True</property>
                  <property name="can_focus">True</property>
                  <property name="editable">True</property>
index 9e4fac2293098a0d6a783e21ae0f0493e11cd20b..a9c1cbf1571afe48992b475473c6c62a94266168 100644 (file)
@@ -11,7 +11,7 @@
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/checkbutton.h>
 #include <gtkmm/fileselection.h>
-#include <gtkmm/entry.h>
+#include <gtkmm/combo.h>
 #include "workplace.h"
 #include "item.h"
 #include "splitter.h"
@@ -42,13 +42,14 @@ class Constructor : public Gtk::Window {
        Gtk::ImageMenuItem *main_menu_quit,*main_menu_new, *edit_menu_del, *edit_menu_delete_all, *main_menu_save, *main_menu_open;
        Gtk::CheckButton *chk_btn_logica;
        Gtk::FileSelection *file_selection, *file_open_selection;
-       Gtk::Entry *combo_entry;
+       Gtk::Combo *combo_entry;
        Gtk::Dialog *dlg_connect;
        Gtk::Label *dlg_label;
        Glib::RefPtr<Gdk::Pixbuf> ico_canio, ico_y, ico_codo, ico_tanque, ico_bomba, ico_exclusa, ico_drain, ico_and, ico_or, ico_not;
        Glib::RefPtr<Gdk::Pixbuf> ico_last;
        std::list<Gtk::TargetEntry> listTargets;
        std::list<CItem *> listaItems, lista_logic_Items;
+       std::list<Glib::ustring> list_pointed;
        WorkPlace *workplace;
        bool logica;
        bool can_drop(CItem *, int , int);
index 83aa0b2d57459854ef99683b907aa120ec417284..d0ed6139e46b89f667851e060876b8fef5e5e604 100644 (file)
@@ -127,7 +127,7 @@ public:
        WorkPlace *workplace;
        
        ///Puntero al cuadro de texto de la ventana principal
-       Gtk::Entry *combo_entry;
+       Gtk::Combo *combo_entry;
        
        ///Puntero a la lista de items
        std::list<CItem *> *listaItems;
@@ -163,6 +163,9 @@ public:
        std::vector<Connector> connect_vec;
 
        void set_img_actual(int i) { imgActual = i; }
+       
+       ///Puntero al cuadro de texo de la ventana principal.
+       std::list<Glib::ustring> *list_pointed;
 protected:
        ///Indica el numero que le corresponde a la imagen actual del item.
        int imgActual;
@@ -172,6 +175,8 @@ protected:
 
        Glib::RefPtr<Gdk::GC> gc;
 
+       Gdk::Color blue, red;
+
        ///Nombre del item
        Glib::ustring name;
        
@@ -193,8 +198,6 @@ protected:
        ///Puntero a la ventana de propiedades del item
        ItemPtyWnd *property_wnd;
 
-       Gdk::Color blue, red;
-
        ///Posicion del item en el area de trabajo
        int x, y;
        
index 4e0534ebe312a1176562e99e0a37f428dcfb8cec..2862eaaf2b90db7ad121e0904cdb0325130bf8aa 100644 (file)
@@ -29,8 +29,10 @@ bool And::on_button_press_event(GdkEventButton *event)
                        CItem::gate_id = ID;
                        WorkPlace::pointed = ID;
                }
-               combo_entry->set_text(name);
-               
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
+               workplace->queue_draw();
        }
        
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
index 147cc5b693522392b44203caf811ba89323dffd3..f58df18b44a432e056ae9a6c7e6154bebc693fd9 100644 (file)
@@ -44,7 +44,9 @@ bool Cistern::on_button_press_event(GdkEventButton *event)
        GdkEventExpose e;
        t_line tmp_line;
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
                WorkPlace::pointed = ID;
                if (CItem::logic_connect && CItem::gate_id != -1) {
                        if ( detect_click_position((int)event->x, (int)event->y) == IN ){
@@ -258,13 +260,13 @@ void Cistern::update_logic_position()
 {
        switch (imgActual) {
                case 1:
-                       in_x = x + image->get_width();
+                       in_x = x + image->get_width()-5;
                        in_y = y + 16;
                        out_x = x+16;
                        out_y = y + image->get_height();
                        break;
                case 0: 
-                       in_x = x;
+                       in_x = x+5;
                        in_y = y+16;
                        out_x = x + image->get_width() -16;
                        out_y = y + image->get_height();
index b4c911ce66063eb06d64f3ea4c192baf508d0cbb..c6dd0743270bb0499db9abae7a5b7a6b547824ea 100644 (file)
@@ -32,8 +32,11 @@ Conduct::~Conduct()
 bool Conduct::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
                WorkPlace::pointed = ID;
+               combo_entry->get_entry()->set_text (name);
+               workplace->queue_draw();
        }
        
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
index 6cc741b98cc568f93f3af05adfc885a04ccbe211..21bdbca48bb699f7c5b063756d4873db15ef337f 100644 (file)
@@ -278,6 +278,8 @@ void Constructor::on_load_from_xml()
                                        current->workplace= workplace;
                                        //Apunto a la lista.
                                        current->combo_entry = combo_entry;
+                                       //Apunto a la lista de apuntados
+                                       current->list_pointed = &list_pointed;
                                        //Apunto a la listaItems.
                                        current->listaItems = &listaItems;
                                        //Apunto a la lista de items logicos
@@ -363,13 +365,21 @@ void Constructor::on_btn_find_clicked()
        CItem * temp = NULL;
        std::list<CItem *>::iterator i = listaItems.begin();
        while ( i !=listaItems.end() ) {
-               if ( (*i)->get_name()  == combo_entry->get_text() ) {
+               if ( (*i)->get_name()  == combo_entry->get_entry()->get_text() ) {
                        temp = *i;
                        break;
                }
                i++;
        }
        
+       i = lista_logic_Items.begin();
+       while ( i !=lista_logic_Items.end() ) {
+               if ( (*i)->get_name()  == combo_entry->get_entry()->get_text() ) {
+                       temp = *i;
+                       break;
+               }
+               i++;
+       }
        if ( temp != NULL )
        workplace->get_window()->draw_rectangle(workplace->get_style()->get_black_gc(), false , temp->get_position_x()-5, temp->get_position_y()-5,
                                                                                                                                                temp->get_image()->get_width()+10, temp->get_image()->get_height()+10);
@@ -519,9 +529,11 @@ void Constructor::on_item_drop_drag_received(const Glib::RefPtr<Gdk::DragContext
                        if ( can_drop(a, i*32, j*32) ) {
                                workplace->put(*a, i*32, j*32);
                                //Apunto al workplace
-                               a->workplace= workplace;
+                               a->workplace = workplace;
                                //Apunto a la lista.
                                a->combo_entry = combo_entry;
+                               //Apunto a la lista de apuntados
+                               a->list_pointed = &list_pointed;
                                //Apunto a la listaItems.
                                a->listaItems = &listaItems;
                                //Apunto a la lista de items logicos
index 202c6f3062cdb03955f5d2ffa47757db62c38bad..3154ded696fa216232c81d62d4820bd7bc7b6233 100644 (file)
@@ -42,7 +42,10 @@ Drain::~Drain()
 bool Drain::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
+               workplace->queue_draw();
                WorkPlace::pointed = ID;
        }
        
index 7c7084842f10e922dc0ee53c8c094aae0e4f94a1..b0210f27dc137f271671e70d8e58158890be1d9e 100644 (file)
@@ -41,7 +41,9 @@ bool Exclusa::on_button_press_event(GdkEventButton *event)
 {
        t_line tmp_line;
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
                WorkPlace::pointed = ID;
                if (CItem::logic_connect && CItem::gate_id != -1) {
                        if ( detect_click_position((int)event->x, (int)event->y) == IN) {
@@ -253,10 +255,10 @@ void Exclusa::update_logic_position()
 {
        switch (imgActual) {
                case 1:
-                       in_x = x + image->get_width();
-                       in_y = y + image->get_height()/2;
-                       out_x = x;
-                       out_y = in_y;
+                       in_x = x + image->get_width()-5;
+                       in_y = y + image->get_height()/2-5;
+                       out_x = x+5;
+                       out_y = in_y+10;
                        break;
                case 0: 
                        in_x = x + image->get_width()/2;
index 463a91a8aaaa1c20889cd38dbf8afcc15c16367c..0a7c8c707748c459b4db250da5a9ad85644b156c 100644 (file)
@@ -30,7 +30,10 @@ bool Not::on_button_press_event(GdkEventButton *event)
                        CItem::gate_id = ID;
                        WorkPlace::pointed = ID;
                }
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
+               workplace->queue_draw();
        }
        
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
index fbd2152f99f5aa51dc0bee3c1e52ec9c29cbed10..d7e8a780ac4b48d0906ea10091677fc426abb9cd 100644 (file)
@@ -28,8 +28,11 @@ bool Or::on_button_press_event(GdkEventButton *event)
                if ( CItem::logic_connect ) {
                        CItem::gate_id = ID;
                        WorkPlace::pointed = ID;
+                       workplace->queue_draw();
                }
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
        }
        
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
index 26a2841a64f962e4ace2fc7d548547da5f527a38..48435cc44eba955a9104873a6ba14b59af23dcc3 100644 (file)
@@ -41,7 +41,9 @@ bool Pump::on_button_press_event(GdkEventButton *event)
 {
        t_line tmp_line;
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
                WorkPlace::pointed = ID;
                if (CItem::logic_connect && CItem::gate_id != -1) {
                        if ( detect_click_position((int)event->x, (int)event->y) == IN) {
index d0dc0638c43b9def7322ce0bc79ea1f9e61a7455..6cd6b3c05a98ba30ae8d74b4ac054cdc4b89fe27 100644 (file)
@@ -40,7 +40,10 @@ Splitter::~Splitter()
 bool Splitter::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
+               workplace->queue_draw();
                WorkPlace::pointed = ID;
        }
        
index 61e583816eececb3a070d9127e6b32dc5466afd4..3e98e6d0258c7c14a2897ee39a721c8f297eb0d5 100644 (file)
@@ -45,7 +45,10 @@ Union::~Union()
 bool Union::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               combo_entry->set_text(name);
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
+               workplace->queue_draw();
                WorkPlace::pointed = ID;
        }
        
index fd9b898375724df18178b01a854b711233024bdf..94e3934f7b48da4640544bbdbcb999c29ad1799e 100644 (file)
@@ -26,6 +26,7 @@ bool WorkPlace::on_expose_event(GdkEventExpose *event)
        if ( *logica ) {        
                std::list<CItem *>::iterator j = listaItems->begin();
                while ( j != listaItems->end() ) {
+                       (*j)->update_logic_position();
                        (*j)->draw_connectors();
                        j++;
                }
@@ -167,4 +168,3 @@ void WorkPlace::draw_line(int x1, int y1, int x2, int y2)
        get_window()->draw_line (get_style()->get_black_gc(), x1, y1, x1, y2);
        get_window()->draw_line (get_style()->get_black_gc(), x1, y2, x2, y2);
 }
-