From: Nicolás Dimov Date: Wed, 19 Nov 2003 05:34:27 +0000 (+0000) Subject: la ultima subida antes de irme a dormir X-Git-Tag: svn_import~242 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/fc802b7aea75e90b19cd22d3e5e752620a416af8?ds=sidebyside la ultima subida antes de irme a dormir --- diff --git a/Constructor/src/and.cpp b/Constructor/src/and.cpp index c73b062..2477df0 100644 --- a/Constructor/src/and.cpp +++ b/Constructor/src/and.cpp @@ -21,8 +21,8 @@ And::~And() 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; } diff --git a/Constructor/src/cistern.cpp b/Constructor/src/cistern.cpp index ba58da5..5ad6ecb 100644 --- a/Constructor/src/cistern.cpp +++ b/Constructor/src/cistern.cpp @@ -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(); - } 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); @@ -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(); } + CItem::logic_connect =false; workplace->queue_draw(); return true; } diff --git a/Constructor/src/exclusa.cpp b/Constructor/src/exclusa.cpp index c15db37..365b6e4 100644 --- a/Constructor/src/exclusa.cpp +++ b/Constructor/src/exclusa.cpp @@ -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(); - } 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); @@ -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(); } + CItem::logic_connect =false; workplace->queue_draw(); return true; } diff --git a/Constructor/src/not.cpp b/Constructor/src/not.cpp index dcf95c2..2a4b277 100644 --- a/Constructor/src/not.cpp +++ b/Constructor/src/not.cpp @@ -20,9 +20,10 @@ Not::~Not() bool Not::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; } diff --git a/Constructor/src/or.cpp b/Constructor/src/or.cpp index 60f8eed..66ee108 100644 --- a/Constructor/src/or.cpp +++ b/Constructor/src/or.cpp @@ -21,8 +21,9 @@ Or::~Or() 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; } diff --git a/Constructor/src/pump.cpp b/Constructor/src/pump.cpp index 7526f6b..9d2a95a 100644 --- a/Constructor/src/pump.cpp +++ b/Constructor/src/pump.cpp @@ -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(); - } 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); @@ -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(); } + CItem::logic_connect =false; workplace->queue_draw(); return true; } diff --git a/Constructor/src/workplace.cpp b/Constructor/src/workplace.cpp index 62757d2..e19ae3b 100644 --- a/Constructor/src/workplace.cpp +++ b/Constructor/src/workplace.cpp @@ -92,20 +92,39 @@ void WorkPlace::delete_line(int _id) { std::list::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++; } + + 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() ){ - 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++; } + 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()