From 1855f998e5c0e51e2c1958724ac84cc13a87d84c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicol=C3=A1s=20Dimov?= Date: Sat, 29 Nov 2003 18:31:56 +0000 Subject: [PATCH] cuando se eliminann items las compuetas ponen sus estados de las salidas o entradas en false para que se pueda realizar una nueva... esto no anda del todo bien --- Constructor/src/and.cpp | 5 +++++ Constructor/src/cistern.cpp | 10 ++++------ Constructor/src/not.cpp | 5 +++++ Constructor/src/or.cpp | 5 +++++ Constructor/src/pump.cpp | 7 +++---- Constructor/src/workplace.cpp | 30 +++++++++++++++++++++++++++--- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/Constructor/src/and.cpp b/Constructor/src/and.cpp index 927aa61..15230c0 100644 --- a/Constructor/src/and.cpp +++ b/Constructor/src/and.cpp @@ -76,6 +76,11 @@ bool And::on_button_press_event(GdkEventButton *event) combo_entry->set_popdown_strings(*list_pointed); combo_entry->get_entry()->set_text (name); workplace->queue_draw(); + char f[20]; + Glib::ustring text; + sprintf(f," Conector OUT = %d",out_connected); + text = name+f; + status_bar->push ( text, 0); } if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){ diff --git a/Constructor/src/cistern.cpp b/Constructor/src/cistern.cpp index b363855..78b0355 100644 --- a/Constructor/src/cistern.cpp +++ b/Constructor/src/cistern.cpp @@ -76,13 +76,11 @@ bool Cistern::on_button_press_event(GdkEventButton *event) } CItem::gate_id = -1; } - char f[10], g[10]; + char f[20], g[25]; Glib::ustring text; - sprintf(f,"%.1f ",capacidad); - sprintf(g,"%.1f",contenido_inicial); - text = name+" Capacidad: "; - text += f; - text += "Contenido Inicial: "; + sprintf(f," Capacidad: %.1f ",capacidad); + sprintf(g,"Contenido Inicial: %.1f",contenido_inicial); + text = name+ f; text += g; status_bar->push ( text, 0); } diff --git a/Constructor/src/not.cpp b/Constructor/src/not.cpp index a946d8c..3fd6b7c 100644 --- a/Constructor/src/not.cpp +++ b/Constructor/src/not.cpp @@ -79,6 +79,11 @@ bool Not::on_button_press_event(GdkEventButton *event) combo_entry->set_popdown_strings(*list_pointed); combo_entry->get_entry()->set_text (name); workplace->queue_draw(); + char f[40]; + Glib::ustring text; + sprintf(f," Conector OUT = %d Conector IN = %d",out_connected, in_connected); + text = name+f; + status_bar->push ( text, 0); } if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){ diff --git a/Constructor/src/or.cpp b/Constructor/src/or.cpp index a96d48f..7be809e 100644 --- a/Constructor/src/or.cpp +++ b/Constructor/src/or.cpp @@ -74,6 +74,11 @@ bool Or::on_button_press_event(GdkEventButton *event) list_pointed->push_back(name); combo_entry->set_popdown_strings(*list_pointed); combo_entry->get_entry()->set_text (name); + char f[20]; + Glib::ustring text; + sprintf(f," Conector OUT = %d",out_connected); + text = name+f; + status_bar->push ( text, 0); } if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){ diff --git a/Constructor/src/pump.cpp b/Constructor/src/pump.cpp index cafa7d5..793df76 100644 --- a/Constructor/src/pump.cpp +++ b/Constructor/src/pump.cpp @@ -73,11 +73,10 @@ bool Pump::on_button_press_event(GdkEventButton *event) } CItem::gate_id = -1; } - char f[10]; + char f[20]; Glib::ustring text; - sprintf(f,"%.1f",entrega); - text = name+" Entrega: "; - text += f; + sprintf(f," Entrega:%.1f",entrega); + text = name+f; status_bar->push ( text, 0); } diff --git a/Constructor/src/workplace.cpp b/Constructor/src/workplace.cpp index 206bca3..2dccaa3 100644 --- a/Constructor/src/workplace.cpp +++ b/Constructor/src/workplace.cpp @@ -210,6 +210,7 @@ void WorkPlace::delete_line(int _id) while ( i != lista_lineas_in.end() ){ if (get_item( (*i).store_id ) != NULL) if ( get_item( (*i).store_id )->get_id() == _id ) { + get_logic_item((*i).logic_id)->set_out_connected(false); lista_lineas_in.erase(i); i = lista_lineas_in.begin(); } @@ -220,7 +221,6 @@ void WorkPlace::delete_line(int _id) while ( i != lista_lineas_in.end() ){ if ( get_logic_item((*i).logic_id) != NULL) if ( get_logic_item((*i).logic_id)->get_id() == _id) { - get_logic_item((*i).logic_id)->set_out_connected(false); lista_lineas_in.erase(i); i = lista_lineas_in.begin(); } @@ -231,6 +231,8 @@ void WorkPlace::delete_line(int _id) while ( j != lista_lineas_out.end() ){ if ( get_item((*j).store_id) != NULL ) if ( get_item((*j).store_id)->get_id() == _id ) { + if (dynamic_cast(get_logic_item((*j).logic_id))) + get_logic_item((*j).logic_id)->set_in_connected(false); lista_lineas_out.erase(j); j = lista_lineas_out.begin(); } @@ -241,13 +243,35 @@ void WorkPlace::delete_line(int _id) while ( j != lista_lineas_out.end() ){ if ( get_logic_item((*j).logic_id) != NULL ) if ( get_logic_item((*j).logic_id)->get_id() == _id ) { - if (dynamic_cast(get_logic_item((*i).logic_id))) - get_logic_item((*j).logic_id)->set_in_connected(false); lista_lineas_out.erase(j); j = lista_lineas_out.begin(); } j++; } + + std::list::iterator k = lista_lineas_logic.begin(); + while ( k != lista_lineas_logic.end() ){ + if ( get_logic_item((*k).store_id) != NULL ) + if ( get_logic_item((*k).store_id)->get_id() == _id ) { + get_logic_item((*k).logic_id)->set_out_connected(false); + std::cout<< get_logic_item((*k).logic_id)->get_name() <get_id() == _id ) { + if (dynamic_cast(get_logic_item((*k).store_id))) + get_logic_item((*k).store_id)->set_in_connected(false); + lista_lineas_logic.erase(k); + k = lista_lineas_logic.begin(); + } + k++; + } } void WorkPlace::update_logic_position() -- 2.43.0