From: Nicolás Dimov Date: Wed, 19 Nov 2003 03:35:04 +0000 (+0000) Subject: -se pueden tirar cables de una manera mas comoda pero como diria TU SAM puede fallar... X-Git-Tag: svn_import~249 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/5042b6492969385725852d3cf90959abb52a7398?ds=inline -se pueden tirar cables de una manera mas comoda pero como diria TU SAM puede fallar... MODO DE USO -accionar el boton logica -click en una compuerta -click en la entrada o salida de un item esto es: exclusa entrada: al medio y arriba (en el pingorcho) salida: al medio y abajo bomba entrada: (en el conector) la mitad superior salida: mitad inferior tanque entrada conector superior salida conector inferior todo esto es aproximado igual se van a dar cuenta ojo que las primeras lineas las tira en cualquier lado (no se por que) pero cuando rota el item se acomodan -Se cuelga bastante, asi que tengan cuidado intenten eliminar lo menos posible chauuu --- diff --git a/Constructor/include/cistern.h b/Constructor/include/cistern.h index 1c874ea..793f2ba 100644 --- a/Constructor/include/cistern.h +++ b/Constructor/include/cistern.h @@ -41,10 +41,25 @@ class Cistern : public CItem { */ virtual ConnectorType get_connector_type(int _a, int _b); - /**Setea las coordenadas _a, _b en la posicion donde se deben conectar los cables logicos. + /**Setea las coordenadas _a, _b en la posicion donde se deben conectar los cables logicos a la entrada. */ - virtual void get_logic_connect_position(int& _a, int& _b); + virtual void get_in_logic_connect_position(int& _a, int& _b); + + /**Setea las coordenadas _a, _b en la posicion donde se deben conectar los cables logicos a la salida. + */ + virtual void get_out_logic_connect_position(int& _a, int& _b); + + /**Actualiza la posicion de los conectores logicos ante un movimiento. + */ + virtual void update_logic_position(); + + /**Detecta si el click fue en el area de entrada o salida logica, devuelve UNDEF si no fue ninguna de las dos + */ + ConnectorType detect_click_position(int _a, int _b); protected: + /**Coordenadas de las entrada y salida logica. + */ + int in_x, in_y, out_x, out_y; /**Atributos que definen su comportamiento */ double capacidad, contenido_inicial; diff --git a/Constructor/include/exclusa.h b/Constructor/include/exclusa.h index d2a6737..34e2fe9 100644 --- a/Constructor/include/exclusa.h +++ b/Constructor/include/exclusa.h @@ -31,15 +31,30 @@ class Exclusa : public CItem { */ virtual ConnectorType get_connector_type(int _a, int _b); - /**Los valores _a y _b se setean en el punto donde se deben conectar los cables logicos + /**Setea las coordenadas _a, _b en la posicion donde se deben conectar los cables logicos a la entrada. */ - virtual void get_logic_connect_position(int& _a, int& _b); - + virtual void get_in_logic_connect_position(int& _a, int& _b); + + /**Setea las coordenadas _a, _b en la posicion donde se deben conectar los cables logicos a la salida. + */ + virtual void get_out_logic_connect_position(int& _a, int& _b); + + /**Actualiza la posicion de los conectores logicos ante un movimiento. + */ + virtual void update_logic_position(); + + /**Detecta si el click fue en el area de entrada o salida logica, devuelve UNDEF si no fue ninguna de las dos + */ + ConnectorType detect_click_position(int _a, int _b); + /**Funciones para obtener y setear sus propiedades */ void set_estado(bool _state); bool get_estado(); - private: + protected: + /**Coordenadas de las entrada y salida logica. + */ + int in_x, in_y, out_x, out_y; /**Imagenes en sus 2 posiciones */ Glib::RefPtr imageN; // 0 diff --git a/Constructor/include/item.h b/Constructor/include/item.h index c7a4d47..4763bcb 100644 --- a/Constructor/include/item.h +++ b/Constructor/include/item.h @@ -94,7 +94,10 @@ public: ///TODO: hacer abstractas estas funciones... en item no hacen nada.... virtual void set_default_connector(); virtual ConnectorType get_connector_type( int _a, int _b ); - virtual void get_logic_connect_position(int& _a, int& _b); + + virtual void get_in_logic_connect_position(int& _a, int& _b); + virtual void get_out_logic_connect_position(int& _a, int& _b); + virtual void update_logic_position(); ///Puntero al area de trabajo de la ventana principal WorkPlace *workplace; @@ -119,7 +122,9 @@ public: ///Indica si puede realizarse la conexion logica con una compuerta static bool logic_connect; - static int quien; + + ///Almacena el ID de la compuerta logica seleccionada + static int gate_id; /**Vector de connectores donde se mantiene la siguiente referencia: * indice 0 = "arriba/izquierda" para la exclusa, el tubo, el codo, el empalme y el tanque. diff --git a/Constructor/include/pump.h b/Constructor/include/pump.h index 95cd6ab..dfe3452 100644 --- a/Constructor/include/pump.h +++ b/Constructor/include/pump.h @@ -30,8 +30,16 @@ class Pump : public CItem { ///Devuelve el tipo de conector que posee en las coordenadas (_a,_b) segun su orientacion virtual ConnectorType get_connector_type(int _a, int _b); ///Setea las coordenadas _a, _b en la posicion donde se deben conectar los cables logicos. - virtual void get_logic_connect_position(int& _a, int& _b); + virtual void get_in_logic_connect_position(int& _a, int& _b); + ///Setea las coordenadas _a, _b en la posicion donde se deben conectar los cables logicos. + virtual void get_out_logic_connect_position(int& _a, int& _b); + ///Actualiza la posicion de los conectores logicos ante un movimiento. + virtual void update_logic_position(); + ///Detecta si el click fue en el area de entrada o salida logica, devuelve UNDEF si no fue ninguna de las dos + ConnectorType detect_click_position(int _a, int _b); protected: + ///Coordenadas de las entrada y salida logica. + int in_x, in_y, out_x, out_y; ///Indica la maxima capacidad de entrega de la bomba double entrega; /// Indica el color del liquido que entrega diff --git a/Constructor/include/workplace.h b/Constructor/include/workplace.h index 9f96eb5..415368b 100644 --- a/Constructor/include/workplace.h +++ b/Constructor/include/workplace.h @@ -20,8 +20,11 @@ class WorkPlace:public Gtk::Fixed { void delete_item(int _id); void delete_line(int _id); CItem *get_logic_item(int _id); + void update_logic_position(); std::list *listaItems, *lista_logic_Items; - std::list lista_lineas; + /** Listas de lineas que van de una compuerta a un item y de un item a una compuerta + */ + std::list lista_lineas_in, lista_lineas_out; static int pointed; }; diff --git a/Constructor/src/and.cpp b/Constructor/src/and.cpp index 0d8a795..c73b062 100644 --- a/Constructor/src/and.cpp +++ b/Constructor/src/and.cpp @@ -22,7 +22,7 @@ bool And::on_button_press_event(GdkEventButton *event) { if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) { if (CItem::logic_connect) - CItem::quien = ID; + CItem::gate_id = ID; combo_entry->set_text(name); WorkPlace::pointed = ID; } @@ -52,6 +52,7 @@ bool And::on_button_press_event(GdkEventButton *event) menu_popup.popup(event->button, event->time); return true; //It has been handled. } + workplace->queue_draw(); return true; } void And::on_menu_popup_rotar() diff --git a/Constructor/src/cistern.cpp b/Constructor/src/cistern.cpp index d39a66c..ba58da5 100644 --- a/Constructor/src/cistern.cpp +++ b/Constructor/src/cistern.cpp @@ -3,6 +3,10 @@ Cistern::Cistern(int orientacion) { + in_x = x; + in_y = y+16; + out_x = x + 48; + out_y = y + 64; imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_e.png"); imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_o.png"); null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_null.png"); @@ -43,10 +47,17 @@ bool Cistern::on_button_press_event(GdkEventButton *event) combo_entry->set_text(name); WorkPlace::pointed = ID; if (CItem::logic_connect) { - tmp_line.logic = workplace->get_logic_item(CItem::quien); - tmp_line.store = this; - workplace->lista_lineas.push_back(tmp_line); - workplace->on_expose_event(&e); + if ( detect_click_position(event->x, event->y) == IN ){ + tmp_line.logic = workplace->get_logic_item(CItem::gate_id); + tmp_line.store = this; + workplace->lista_lineas_in.push_back(tmp_line); + workplace->queue_draw(); + } else { + tmp_line.logic = workplace->get_logic_item(CItem::gate_id); + tmp_line.store = this; + workplace->lista_lineas_out.push_back(tmp_line); + workplace->queue_draw(); + } } } @@ -57,10 +68,18 @@ bool Cistern::on_button_press_event(GdkEventButton *event) switch (imgActual) { case 1: image = imageO; + in_x = x + image->get_width(); + in_y = y + 16; + out_x = x+16; + out_y = y + image->get_height(); break; default: imgActual = 0; image = imageE; + in_x = x; + in_y = y+16; + out_x = x + image->get_width() -16; + out_y = y + image->get_height(); } set_size_request(image->get_width(),image->get_height()); image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0); @@ -77,7 +96,7 @@ bool Cistern::on_button_press_event(GdkEventButton *event) cistern_pty_wnd->txt_cistern_name->set_text( name ); cistern_pty_wnd->show(); } - workplace->on_expose_event(&e); + workplace->queue_draw(); return true; } @@ -204,15 +223,50 @@ void Cistern::set_default_connector() connect_vec[1].type = OUT; } -void Cistern::get_logic_connect_position(int& _a, int& _b) +void Cistern::get_in_logic_connect_position(int& _a, int& _b) { + _a = in_x; + _b = in_y; +} + +void Cistern::get_out_logic_connect_position(int& _a, int& _b) +{ + _a = out_x; + _b = out_y; +} + +ConnectorType Cistern::detect_click_position(int _a, int _b) +{ + //VER DONDE CAEN LOS CLICKS!!!!!!!!!!!!!! SI ES CON RESPECTO AL WORKPLACE O AL ITEM!!! switch(imgActual) { - case 0: - _a = x; - _b = y + 10; + case 0: + if ( (_a<=32) &&(_a>=0)&&(_b<=32)&&(_b>=0) ) + return IN; + if ( (_a<=image->get_width())&&(_a>=image->get_width()-32)&&(_b<=image->get_height())&&(_b>=image->get_height()-32) ) + return OUT; break; - case 1: - _a = x +image->get_width(); - _b = y + 10; + case 1: + if ( (_a<=image->get_width()) &&(_a>=image->get_width()-32)&&(_b<=32)&&(_b>=0) ) + return IN; + if ( (_a<=32)&&(_a>=0)&&(_b<=image->get_height())&&(_b>=image->get_height()-32) ) + return OUT; + } + return UNDEF; +} + +void Cistern::update_logic_position() +{ + switch (imgActual) { + case 1: + in_x = x + image->get_width(); + in_y = y + 16; + out_x = x+16; + out_y = y + image->get_height(); + break; + case 0: + in_x = x; + in_y = y+16; + out_x = x + image->get_width() -16; + out_y = y + image->get_height(); } } diff --git a/Constructor/src/constructor.cpp b/Constructor/src/constructor.cpp index 3447a2e..b2df77c 100644 --- a/Constructor/src/constructor.cpp +++ b/Constructor/src/constructor.cpp @@ -362,7 +362,8 @@ void Constructor::on_item_drag_begin(const Glib::RefPtr& conte { GdkEventExpose e; context->set_icon(item->get_image(), 5, 5); - workplace->on_expose_event(&e); + workplace->update_logic_position(); + workplace->queue_draw(); } void Constructor::on_item_drag_data_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) @@ -427,7 +428,7 @@ void Constructor::on_item_drop_drag_received(const Glib::RefPtrdata, "or_e.png")==0) { a = new Or(); a->is_logic = true; } else if (strcmp((const char *)selection_data->data, "not_e.png")==0) { - a = new Not(); a->is_logic = true; + a = new Not(); a->is_logic = true; } char char_id[10]; diff --git a/Constructor/src/exclusa.cpp b/Constructor/src/exclusa.cpp index ea152b3..c15db37 100644 --- a/Constructor/src/exclusa.cpp +++ b/Constructor/src/exclusa.cpp @@ -3,6 +3,10 @@ Exclusa::Exclusa(int orientacion) { + in_x = x + 48; + in_y = y; + out_x = in_x; + out_y = y + 32; imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/exclusa_h.png"); imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/exclusa_s.png"); null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/null.png"); @@ -35,17 +39,23 @@ Exclusa::~Exclusa() bool Exclusa::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); WorkPlace::pointed = ID; if (CItem::logic_connect) { - tmp_line.logic = workplace->get_logic_item(CItem::quien); - tmp_line.store = this; - workplace->lista_lineas.push_back(tmp_line); - workplace->on_expose_event(&e); - } + if ( detect_click_position(event->x, event->y) == IN) { + tmp_line.logic = workplace->get_logic_item(CItem::gate_id); + tmp_line.store = this; + workplace->lista_lineas_in.push_back(tmp_line); + workplace->queue_draw(); + } else { + tmp_line.logic = workplace->get_logic_item(CItem::gate_id); + tmp_line.store = this; + workplace->lista_lineas_out.push_back(tmp_line); + workplace->queue_draw(); + } + } } if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){ @@ -55,10 +65,18 @@ bool Exclusa::on_button_press_event(GdkEventButton *event) switch (imgActual) { case 1: image = imageS; + in_x = x + image->get_width(); + in_y = y + image->get_height()/2; + out_x = x; + out_y = in_y; break; default: imgActual = 0; image = imageN; + in_x = x + image->get_width()/2; + in_y = y; + out_x = in_x; + out_y = y +image->get_height(); } set_size_request(image->get_width(),image->get_height()); image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0); @@ -73,7 +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(); } - workplace->on_expose_event(&e); + workplace->queue_draw(); return true; } @@ -194,22 +212,56 @@ ConnectorType Exclusa::get_connector_type(int _a, int _b) } return UNDEF; } + +void Exclusa::set_default_connector() +{ + connect_vec[0].type = UNDEF; + connect_vec[1].type = UNDEF; +} -void Exclusa::get_logic_connect_position(int& _a, int& _b) +void Exclusa::get_in_logic_connect_position(int& _a, int& _b) +{ + _a = in_x; + _b = in_y; +} + +void Exclusa::get_out_logic_connect_position(int& _a, int& _b) +{ + _a = out_x; + _b = out_y; +} + +ConnectorType Exclusa::detect_click_position(int _a, int _b) { switch (imgActual) { - case 0: - _a = x + image->get_width()/2; - _b = y; + case 0: + if ( (_a <= image->get_width()/2+10)&&(_a>=image->get_width()/2-10)&&(_b<=16)&&(_b >= 0) ) + return IN; + if ( (_a <= image->get_width()/2+10)&&(_a>=image->get_width()/2-10)&&(_b<=32)&&(_b > 16) ) + return OUT; break; - case 1: - _a = x + image->get_width(); - _b = y + image->get_height()/2; - } + case 1: + if ( (_a <=32)&&(_a> 16)&&(_b<=image->get_height()/2+10)&&(_b >= image->get_height()/2-10) ) + return IN; + if ( (_a <= 16)&&(_a>=0)&&(_b<=image->get_height()/2+10)&&(_b >= image->get_height()/2-10) ) + return OUT; + } + return UNDEF; } - -void Exclusa::set_default_connector() + +void Exclusa::update_logic_position() { - connect_vec[0].type = UNDEF; - connect_vec[1].type = UNDEF; + switch (imgActual) { + case 1: + in_x = x + image->get_width(); + in_y = y + image->get_height()/2; + out_x = x; + out_y = in_y; + break; + case 0: + in_x = x + image->get_width()/2; + in_y = y; + out_x = in_x; + out_y = y +image->get_height(); + } } diff --git a/Constructor/src/item.cpp b/Constructor/src/item.cpp index 4c25467..b4bf541 100644 --- a/Constructor/src/item.cpp +++ b/Constructor/src/item.cpp @@ -1,7 +1,7 @@ #include "item.h" bool CItem::logic_connect = false; -int CItem::quien = -1; +int CItem::gate_id = -1; CItem::CItem(const char *filename):Gtk::DrawingArea() @@ -157,8 +157,18 @@ void CItem::set_default_connector() { } -void CItem::get_logic_connect_position(int& _a, int& _b) +void CItem::get_in_logic_connect_position(int& _a, int& _b) { _a = x; _b = y; } + +void CItem::get_out_logic_connect_position(int& _a, int& _b) +{ + _a = x; + _b = y; +} + +void CItem::update_logic_position() +{ +} diff --git a/Constructor/src/not.cpp b/Constructor/src/not.cpp index 34fccf7..dcf95c2 100644 --- a/Constructor/src/not.cpp +++ b/Constructor/src/not.cpp @@ -22,7 +22,7 @@ bool Not::on_button_press_event(GdkEventButton *event) { if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) { if (CItem::logic_connect) - CItem::quien = ID; + CItem::gate_id = ID; combo_entry->set_text(name); WorkPlace::pointed = ID; } @@ -52,6 +52,7 @@ bool Not::on_button_press_event(GdkEventButton *event) menu_popup.popup(event->button, event->time); return true; //It has been handled. } + workplace->queue_draw(); return true; } void Not::on_menu_popup_rotar() diff --git a/Constructor/src/or.cpp b/Constructor/src/or.cpp index 2dd66a0..60f8eed 100644 --- a/Constructor/src/or.cpp +++ b/Constructor/src/or.cpp @@ -22,7 +22,7 @@ bool Or::on_button_press_event(GdkEventButton *event) { if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) { if (CItem::logic_connect) - CItem::quien = ID; + CItem::gate_id = ID; combo_entry->set_text(name); WorkPlace::pointed = ID; } @@ -52,6 +52,7 @@ bool Or::on_button_press_event(GdkEventButton *event) menu_popup.popup(event->button, event->time); return true; //It has been handled. } + workplace->queue_draw(); return true; } diff --git a/Constructor/src/pump.cpp b/Constructor/src/pump.cpp index 5dd52c8..7526f6b 100644 --- a/Constructor/src/pump.cpp +++ b/Constructor/src/pump.cpp @@ -3,6 +3,10 @@ Pump::Pump(int orientacion) { + in_x = x + 48; + in_y = y; + out_x = in_x; + out_y = y + 32; imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/bomba_e.png"); imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/bomba_o.png"); null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/bomba_null.png"); @@ -34,16 +38,22 @@ Pump::~Pump() bool Pump::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); WorkPlace::pointed = ID; if (CItem::logic_connect) { - tmp_line.logic = workplace->get_logic_item(CItem::quien); - tmp_line.store = this; - workplace->lista_lineas.push_back(tmp_line); - workplace->on_expose_event(&e); + if ( detect_click_position(event->x, event->y) == IN) { + tmp_line.logic = workplace->get_logic_item(CItem::gate_id); + tmp_line.store = this; + workplace->lista_lineas_in.push_back(tmp_line); + workplace->queue_draw(); + } else { + tmp_line.logic = workplace->get_logic_item(CItem::gate_id); + tmp_line.store = this; + workplace->lista_lineas_out.push_back(tmp_line); + workplace->queue_draw(); + } } } @@ -54,10 +64,18 @@ bool Pump::on_button_press_event(GdkEventButton *event) switch (imgActual) { case 1: image = imageO; + in_x = x + 16; + in_y = y; + out_x = in_x; + out_y = y + 32; break; default: imgActual = 0; image = imageE; + in_x = x + image->get_width()-16; + in_y = y; + out_x = in_x; + out_y = y + 32; } set_size_request(image->get_width(),image->get_height()); image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0); @@ -73,7 +91,7 @@ bool Pump::on_button_press_event(GdkEventButton *event) pump_pty_wnd->txt_pump_name->set_text( name ); pump_pty_wnd->show(); } - workplace->on_expose_event(&e); + workplace->queue_draw(); return true; } @@ -182,15 +200,49 @@ void Pump::set_default_connector() connect_vec[0].type = OUT; } -void Pump::get_logic_connect_position(int& _a, int& _b) +void Pump::get_in_logic_connect_position(int& _a, int& _b) { - switch(imgActual) { - case 0: - _a = x + image->get_width() - 10; - _b = y; + _a = in_x; + _b = in_y; +} + +void Pump::get_out_logic_connect_position(int& _a, int& _b) +{ + _a = out_x; + _b = out_y; +} + +ConnectorType Pump::detect_click_position(int _a, int _b) +{ + switch (imgActual) { + case 0: + if ( (_a <=image->get_width())&&(_a>=image->get_width()-32)&&(_b<=16)&&(_b >= 0) ) + return IN; + if ( (_a <= image->get_width())&&(_a>=image->get_width()-32)&&(_b<=32)&&(_b > 16) ) + return OUT; break; - case 1: - _a = x + 10; - _b = y; + case 1: + if ( (_a <= 32)&&(_a>=0)&&(_b<=16)&&(_b >= 0) ) + return IN; + if ( (_a <= 32)&&(_a>=0)&&(_b<=32)&&(_b > 16) ) + return OUT; + } + return UNDEF; +} + +void Pump::update_logic_position() +{ + switch (imgActual) { + case 1: + in_x = x + 16; + in_y = y; + out_x = in_x; + out_y = y + 32; + break; + case 0: + in_x = x + image->get_width()-16; + in_y = y; + out_x = in_x; + out_y = y + 32; } } diff --git a/Constructor/src/workplace.cpp b/Constructor/src/workplace.cpp index 46b1bcd..f526cb5 100644 --- a/Constructor/src/workplace.cpp +++ b/Constructor/src/workplace.cpp @@ -30,13 +30,21 @@ bool WorkPlace::on_expose_event(GdkEventExpose *event) gc->set_rgb_bg_color(color); get_style()->set_black(color); int w, z; - std::list::iterator i = lista_lineas.begin(); - while ( i != lista_lineas.end() ) { + std::list::iterator i = lista_lineas_in.begin(); + while ( i != lista_lineas_in.end() ) { t_line temp = *i; - temp.store->get_logic_connect_position(w,z); + temp.store->get_in_logic_connect_position(w,z); get_window()->draw_line (get_style()->get_black_gc(), temp.logic->get_position_x(),temp.logic->get_position_y(), w,z); i++; } + i = lista_lineas_out.begin(); + while ( i != lista_lineas_out.end() ) { + t_line temp = *i; + temp.store->get_out_logic_connect_position(w,z); + get_window()->draw_line (get_style()->get_black_gc(), temp.logic->get_position_x(),temp.logic->get_position_y(), w,z); + i++; + } + return true; } @@ -82,20 +90,29 @@ CItem* WorkPlace::get_logic_item(int _id) void WorkPlace::delete_line(int _id) { - std::list::iterator i = lista_lineas.begin(); - while ( i != lista_lineas.end() ){ + std::list::iterator i = lista_lineas_in.begin(); + while ( i != lista_lineas_in.end() ){ if ( (*i).store->get_id() == _id ) { - lista_lineas.erase(i); - i = lista_lineas.begin(); + lista_lineas_in.erase(i); + i = lista_lineas_in.begin(); } i++; } - i = lista_lineas.begin(); - while ( i != lista_lineas.end() ){ + i = lista_lineas_in.begin(); + while ( i != lista_lineas_in.end() ){ if ( (*i).logic->get_id() == _id ) { - lista_lineas.erase(i); - i = lista_lineas.begin(); + lista_lineas_in.erase(i); + i = lista_lineas_in.begin(); } i++; } } + +void WorkPlace::update_logic_position() +{ + std::list::iterator i = listaItems->begin(); + while ( i != listaItems->end() ){ + (*i)->update_logic_position(); + i++; + } +}