]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
la ultima subida antes de irme a dormir
authorNicolás Dimov <ndimov@gmail.com>
Wed, 19 Nov 2003 05:34:27 +0000 (05:34 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Wed, 19 Nov 2003 05:34:27 +0000 (05:34 +0000)
Constructor/src/and.cpp
Constructor/src/cistern.cpp
Constructor/src/exclusa.cpp
Constructor/src/not.cpp
Constructor/src/or.cpp
Constructor/src/pump.cpp
Constructor/src/workplace.cpp

index c73b062c8d804df6efdc69f9b7e9d943a909302e..2477df0f498bc4aee48c36f76332950d876f3051 100644 (file)
@@ -21,8 +21,8 @@ And::~And()
 bool And::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
 bool And::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               if (CItem::logic_connect)
-                       CItem::gate_id = ID;
+               CItem::logic_connect = true;
+               CItem::gate_id = ID;
                combo_entry->set_text(name);
                WorkPlace::pointed = ID;
        }
                combo_entry->set_text(name);
                WorkPlace::pointed = ID;
        }
index ba58da5dee6dd32b014c974acd671d1b54c448ac..5ad6ecb985542211229765ec4d3af3dc53440095 100644 (file)
@@ -52,7 +52,7 @@ bool Cistern::on_button_press_event(GdkEventButton *event)
                                tmp_line.store = this;
                                workplace->lista_lineas_in.push_back(tmp_line);
                                workplace->queue_draw();
                                tmp_line.store = this;
                                workplace->lista_lineas_in.push_back(tmp_line);
                                workplace->queue_draw();
-                       } else { 
+                       } else if (detect_click_position(event->x, event->y) == OUT) 
                                tmp_line.logic =  workplace->get_logic_item(CItem::gate_id);
                                tmp_line.store = this;
                                workplace->lista_lineas_out.push_back(tmp_line);
                                tmp_line.logic =  workplace->get_logic_item(CItem::gate_id);
                                tmp_line.store = this;
                                workplace->lista_lineas_out.push_back(tmp_line);
@@ -96,6 +96,7 @@ bool Cistern::on_button_press_event(GdkEventButton *event)
                cistern_pty_wnd->txt_cistern_name->set_text( name );
                cistern_pty_wnd->show();
        }               
                cistern_pty_wnd->txt_cistern_name->set_text( name );
                cistern_pty_wnd->show();
        }               
+       CItem::logic_connect =false;
        workplace->queue_draw();
        return true;
 }
        workplace->queue_draw();
        return true;
 }
index c15db37f8a17bf19f8f5004039996f23a9a40804..365b6e45675355de3b1a6a41659f028849952ad6 100644 (file)
@@ -49,7 +49,7 @@ bool Exclusa::on_button_press_event(GdkEventButton *event)
                                tmp_line.store = this;
                                workplace->lista_lineas_in.push_back(tmp_line);
                                workplace->queue_draw();        
                                tmp_line.store = this;
                                workplace->lista_lineas_in.push_back(tmp_line);
                                workplace->queue_draw();        
-                       } else {        
+                       } else if (detect_click_position(event->x, event->y) == OUT) {  
                                tmp_line.logic =  workplace->get_logic_item(CItem::gate_id);
                                tmp_line.store = this;
                                workplace->lista_lineas_out.push_back(tmp_line);
                                tmp_line.logic =  workplace->get_logic_item(CItem::gate_id);
                                tmp_line.store = this;
                                workplace->lista_lineas_out.push_back(tmp_line);
@@ -91,6 +91,7 @@ bool Exclusa::on_button_press_event(GdkEventButton *event)
                if (estado) exclusa_pty_wnd->rd_btn_open->set_active(true);
                exclusa_pty_wnd->show();
        }
                if (estado) exclusa_pty_wnd->rd_btn_open->set_active(true);
                exclusa_pty_wnd->show();
        }
+       CItem::logic_connect =false;
        workplace->queue_draw();
        return true;
 }
        workplace->queue_draw();
        return true;
 }
index dcf95c207d90b0edfef453f557b77b705057f636..2a4b277e2f9ce09103ffbacbb98a23544cd4d51d 100644 (file)
@@ -20,9 +20,10 @@ Not::~Not()
 
 bool Not::on_button_press_event(GdkEventButton *event)
 {
 
 bool Not::on_button_press_event(GdkEventButton *event)
 {
+
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               if (CItem::logic_connect)
-                       CItem::gate_id = ID;
+               CItem::logic_connect = true;
+               CItem::gate_id = ID;
                combo_entry->set_text(name);
                WorkPlace::pointed = ID;
        }
                combo_entry->set_text(name);
                WorkPlace::pointed = ID;
        }
index 60f8eedc8e21b1114ea1a62740e875931762bd3a..66ee10871bfefc45224a6da1d4e074c0885bd5f5 100644 (file)
@@ -21,8 +21,9 @@ Or::~Or()
 bool Or::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
 bool Or::on_button_press_event(GdkEventButton *event)
 {
        if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
-               if (CItem::logic_connect)
-                       CItem::gate_id = ID;
+               CItem::logic_connect = true;
+               CItem::gate_id = ID;
+               //if ( detect_click_position(event->x, event->y) == IN ) {
                combo_entry->set_text(name);
                WorkPlace::pointed = ID;
        }
                combo_entry->set_text(name);
                WorkPlace::pointed = ID;
        }
index 7526f6b86aa6703932c666806c73606041ec9a3d..9d2a95a0bc6e416cbbf747d4f53e50a229e26cfb 100644 (file)
@@ -48,7 +48,7 @@ bool Pump::on_button_press_event(GdkEventButton *event)
                                tmp_line.store = this;
                                workplace->lista_lineas_in.push_back(tmp_line);
                                workplace->queue_draw();
                                tmp_line.store = this;
                                workplace->lista_lineas_in.push_back(tmp_line);
                                workplace->queue_draw();
-                       } else {
+                       } else if (detect_click_position(event->x, event->y) == OUT) {
                                tmp_line.logic =  workplace->get_logic_item(CItem::gate_id);
                                tmp_line.store = this;
                                workplace->lista_lineas_out.push_back(tmp_line);
                                tmp_line.logic =  workplace->get_logic_item(CItem::gate_id);
                                tmp_line.store = this;
                                workplace->lista_lineas_out.push_back(tmp_line);
@@ -91,6 +91,7 @@ bool Pump::on_button_press_event(GdkEventButton *event)
                pump_pty_wnd->txt_pump_name->set_text( name );
                pump_pty_wnd->show();
        }               
                pump_pty_wnd->txt_pump_name->set_text( name );
                pump_pty_wnd->show();
        }               
+       CItem::logic_connect =false;
        workplace->queue_draw();
        return true;
 }
        workplace->queue_draw();
        return true;
 }
index 62757d2a17e3a2ea5f2e7199d3b648cb3dadd379..e19ae3b1ecf3ec369950d1b91b19f699cea7030b 100644 (file)
@@ -92,20 +92,39 @@ void WorkPlace::delete_line(int _id)
 {
        std::list<t_line>::iterator i = lista_lineas_in.begin();
        while ( i != lista_lineas_in.end() ){
 {
        std::list<t_line>::iterator i = lista_lineas_in.begin();
        while ( i != lista_lineas_in.end() ){
-               if ( (*i).store->get_id() == _id || (*i).logic->get_id() == _id ) {
+               if ( (*i).store->get_id() == _id ) {
                        lista_lineas_in.erase(i);
                        i = lista_lineas_in.begin();
                }
                i++;
        }
                        lista_lineas_in.erase(i);
                        i = lista_lineas_in.begin();
                }
                i++;
        }
+
+       i = lista_lineas_in.begin();
+       while ( i != lista_lineas_in.end() ){
+               if ( (*i).logic->get_id() == _id ) {
+                       lista_lineas_in.erase(i);
+                       i = lista_lineas_in.begin();
+               }
+               i++;
+       }
+
        i = lista_lineas_out.begin();
        while ( i != lista_lineas_out.end() ){
        i = lista_lineas_out.begin();
        while ( i != lista_lineas_out.end() ){
-               if ( (*i).store->get_id() == _id || (*i).logic->get_id() == _id ) {
+               if ( (*i).store->get_id() == _id ) {
                        lista_lineas_out.erase(i);
                        i = lista_lineas_out.begin();
                }
                i++;
        }       
                        lista_lineas_out.erase(i);
                        i = lista_lineas_out.begin();
                }
                i++;
        }       
+       i = lista_lineas_out.begin();
+       while ( i != lista_lineas_out.end() ){
+               if ( (*i).logic->get_id() == _id ) {
+                       lista_lineas_out.erase(i);
+                       i = lista_lineas_out.begin();
+               }
+               i++;
+       }       
+
 }
 
 void WorkPlace::update_logic_position()
 }
 
 void WorkPlace::update_logic_position()