From 41db5fd837b5e51244fb37ae3e016cc630c3a872 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicol=C3=A1s=20Dimov?= Date: Tue, 18 Nov 2003 04:19:35 +0000 Subject: [PATCH 1/1] es precario pero se tiran los cablecitos, iupi --- Constructor/and.cpp | 1 + Constructor/exclusa.cpp | 16 ++++++++++++---- Constructor/item.cpp | 2 ++ Constructor/not.cpp | 1 + Constructor/or.cpp | 10 +--------- Constructor/or.h | 2 -- Constructor/pump.cpp | 12 +++++++++++- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Constructor/and.cpp b/Constructor/and.cpp index 01f8ac0..801cfd5 100644 --- a/Constructor/and.cpp +++ b/Constructor/and.cpp @@ -11,6 +11,7 @@ And::And() image = imageE; set_size_request(image->get_width(), image->get_height()); name = "and"; + menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Conectar", menu_image_linea,SigC::slot(*this, &CItem::on_menu_popup_conectar) ) ) ; } And::~And() diff --git a/Constructor/exclusa.cpp b/Constructor/exclusa.cpp index f615e4d..0ffb1a6 100644 --- a/Constructor/exclusa.cpp +++ b/Constructor/exclusa.cpp @@ -28,9 +28,18 @@ Exclusa::~Exclusa() bool Exclusa::on_button_press_event(GdkEventButton *event) { - int w, h; - if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) + GdkEventExpose e; + t_line tmp_line; + if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) { combo_entry->set_text(name); + 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); + } + CItem::logic_connect = false; + } if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){ image = null; @@ -44,8 +53,7 @@ bool Exclusa::on_button_press_event(GdkEventButton *event) imgActual = 0; image = imageN; } - get_size_request(w, h); - set_size_request(h, w); + 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); } if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){ diff --git a/Constructor/item.cpp b/Constructor/item.cpp index 77eefda..bab22b4 100644 --- a/Constructor/item.cpp +++ b/Constructor/item.cpp @@ -62,6 +62,8 @@ void CItem::on_menu_popup_eliminar() void CItem::on_menu_popup_conectar() { + CItem::logic_connect = true; + CItem::quien = ID; } int CItem::get_position_x() diff --git a/Constructor/not.cpp b/Constructor/not.cpp index 04e8ffc..187ccc3 100644 --- a/Constructor/not.cpp +++ b/Constructor/not.cpp @@ -11,6 +11,7 @@ Not::Not() image = imageE; set_size_request(image->get_width(), image->get_height()); name = "not"; + menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Conectar", menu_image_linea,SigC::slot(*this, &CItem::on_menu_popup_conectar) ) ) ; } Not::~Not() diff --git a/Constructor/or.cpp b/Constructor/or.cpp index 0c0631b..cf4fe97 100644 --- a/Constructor/or.cpp +++ b/Constructor/or.cpp @@ -20,10 +20,8 @@ Or::~Or() bool Or::on_button_press_event(GdkEventButton *event) { - if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) { - std::cout<type == GDK_BUTTON_PRESS) && ( event->button == 1)) combo_entry->set_text(name); - } if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){ image = null; @@ -61,12 +59,6 @@ void Or::on_menu_popup_rotar() Or::on_button_press_event(&event); } -void Or::on_menu_popup_conectar() -{ - CItem::logic_connect = true; - CItem::quien = ID; -} - void Or::save(FILE *archivo) { diff --git a/Constructor/or.h b/Constructor/or.h index 10b9234..9da1cd2 100644 --- a/Constructor/or.h +++ b/Constructor/or.h @@ -9,10 +9,8 @@ class Or : public CItem { virtual ~Or(); virtual bool on_button_press_event(GdkEventButton *event); virtual void on_menu_popup_rotar(); - virtual void on_menu_popup_conectar(); virtual void save(FILE *archivo); virtual bool check_connection(); - std::list connected_items; private: Glib::RefPtr imageN; // 0 Glib::RefPtr imageS; // 1 diff --git a/Constructor/pump.cpp b/Constructor/pump.cpp index b26cda1..664b55d 100644 --- a/Constructor/pump.cpp +++ b/Constructor/pump.cpp @@ -27,8 +27,18 @@ Pump::~Pump() bool Pump::on_button_press_event(GdkEventButton *event) { - if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) + GdkEventExpose e; + t_line tmp_line; + if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) { combo_entry->set_text(name); + 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); + } + CItem::logic_connect = false; + } if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){ image = null; -- 2.43.0