From 4675818d2893c57a409498cd39dba6f9c18b6fe9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicol=C3=A1s=20Dimov?= Date: Mon, 17 Nov 2003 01:14:53 +0000 Subject: [PATCH] ahora hay que arreglar muchos bugs, pero hay circuitos simples que andan --- Constructor/and.cpp | 21 ------------------ Constructor/and.h | 1 - Constructor/cistern.cpp | 23 ++++---------------- Constructor/cistern.h | 2 +- Constructor/conduct.cpp | 18 ++++------------ Constructor/conduct.h | 2 +- Constructor/constructor.cpp | 17 +++++++++------ Constructor/drain.cpp | 5 +++++ Constructor/drain.h | 2 +- Constructor/exclusa.cpp | 26 +++++++++------------- Constructor/exclusa.h | 2 +- Constructor/item.cpp | 8 ++++--- Constructor/item.h | 2 +- Constructor/not.cpp | 22 ------------------- Constructor/not.h | 1 - Constructor/or.cpp | 43 ------------------------------------- Constructor/or.h | 1 - Constructor/pump.cpp | 13 +++-------- Constructor/pump.h | 1 + Constructor/splitter.cpp | 21 +++--------------- Constructor/splitter.h | 2 +- Constructor/union.cpp | 32 +++++++++------------------ Constructor/union.h | 2 +- 23 files changed, 63 insertions(+), 204 deletions(-) diff --git a/Constructor/and.cpp b/Constructor/and.cpp index 768390a..01f8ac0 100644 --- a/Constructor/and.cpp +++ b/Constructor/and.cpp @@ -87,24 +87,3 @@ bool And::check_connection() return false;*/ return true; } - -/* -bool And::is_connection_area(int _a, int _b) -{ - switch (imgActual) { - case 0: if ( ( (_a <= x+10)&&(_a > x) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - case 1: if ( ( (_a <= x+image->get_width()-10)&&(_a >= x+image->get_width()-22) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 2: if ( ( (_a <= x+22)&&(_a >= x+10) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 3: if ( ( (_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - } - return false; -} -*/ diff --git a/Constructor/and.h b/Constructor/and.h index 2895668..4ab0f17 100644 --- a/Constructor/and.h +++ b/Constructor/and.h @@ -11,7 +11,6 @@ class And : public CItem { virtual void on_menu_popup_rotar(); virtual void save(FILE *archivo); virtual bool check_connection(); -// virtual bool is_connection_area(int _a, int _b); private: Glib::RefPtr imageN; // 0 Glib::RefPtr imageS; // 1 diff --git a/Constructor/cistern.cpp b/Constructor/cistern.cpp index b42f690..fd49a6e 100644 --- a/Constructor/cistern.cpp +++ b/Constructor/cistern.cpp @@ -171,24 +171,9 @@ ConnectorType Cistern::get_connector_type(int _a, int _b) } return UNDEF; } - -/* -ConnectorType Cistern::is_connection_area(int _a, int _b) + +void Cistern::set_default_connector() { - switch (imgActual) { - case 0: - if ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+10)&&(_b > y) ) - return connect_vec[0].type; - if ( (_a <= x+image->get_width()-1)&&(_a >=x+image->get_width()-10)&&(_b<=y+image->get_height()-10)&&(_b >=y+image->get_height()-22) ) - return connect_vec[1].type; - break; - case 1: - if ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+10)&&(_b > y) ) - return connect_vec[0].type; - if ( (_a <= x +10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b >=y+image->get_height()-22) ) - return connect_vec[1].type; - break; - } - return UNDEF; + connect_vec[0].type = IN; + connect_vec[1].type = OUT; } -*/ diff --git a/Constructor/cistern.h b/Constructor/cistern.h index 67184c2..330d239 100644 --- a/Constructor/cistern.h +++ b/Constructor/cistern.h @@ -21,7 +21,7 @@ class Cistern : public CItem { Gdk::Color get_liquid_color(); virtual void save(FILE *archivo); virtual bool check_connection(); -// virtual ConnectorType is_connection_area(int _a, int _b); + virtual void set_default_connector(); virtual ConnectorType get_connector_type(int _a, int _b); protected: double capacidad, contenido_inicial; diff --git a/Constructor/conduct.cpp b/Constructor/conduct.cpp index c2ca140..1e5bde3 100644 --- a/Constructor/conduct.cpp +++ b/Constructor/conduct.cpp @@ -144,19 +144,9 @@ ConnectorType Conduct::get_connector_type(int _a, int _b) /*si no estoy conectado pregunto por el del otro lado, y ahi puedo setear los dos *si ya estoy devuelvo. */ -/* -bool Conduct::is_connection_area(int _a, int _b) + +void Conduct::set_default_connector() { - switch (imgActual){ - case 0: - if ( ((_a <= x+image->get_width()-10 )&&(_a >= x + 10) && (_b <= y+10) &&(_b > 0 )) || - ((_a <= x+22 )&&(_a >= x + 10) && (_b <= y+image->get_height()-1) &&(_b >= y+image->get_height()-10 )) ) - return true; - case 1: - if ( ((_a <= x+10 )&&(_a > 0) && (_b <= y+image->get_height()-10) &&(_b >= y+10 )) || - ((_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <= y+image->get_height()-10) &&(_b >= y +10 )) ) - return true; - } - return false; + connect_vec[0].type = UNDEF; + connect_vec[1].type = UNDEF; } -*/ diff --git a/Constructor/conduct.h b/Constructor/conduct.h index 21773ed..3ba3ab6 100644 --- a/Constructor/conduct.h +++ b/Constructor/conduct.h @@ -12,7 +12,7 @@ class Conduct : public CItem { virtual void on_menu_popup_propiedades(); virtual void save(FILE *archivo); virtual bool check_connection(); -// virtual bool is_connection_area(int _a, int _b); + virtual void set_default_connector(); virtual ConnectorType get_connector_type(int _a, int _b); private: Glib::RefPtr imageN; // 0 diff --git a/Constructor/constructor.cpp b/Constructor/constructor.cpp index 8aa6655..aa162e9 100644 --- a/Constructor/constructor.cpp +++ b/Constructor/constructor.cpp @@ -110,32 +110,32 @@ Constructor::~Constructor() void Constructor::on_btn_canio_drag_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) { - gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar*)"canio_n.png", 14); + gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar*)"canio_n.png", 12); } void Constructor::on_btn_y_drag_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) { - gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"y_n.png",10); + gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"y_n.png",8); } void Constructor::on_btn_codo_drag_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) { - gtk_selection_data_set(selection_data, selection_data->target, 8 ,(const guchar*)"codo_o.png",13); + gtk_selection_data_set(selection_data, selection_data->target, 8 ,(const guchar*)"codo_o.png",10); } void Constructor::on_btn_tanque_drag_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) { - gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"tanque_e.png",15); + gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"tanque_e.png",12); } void Constructor::on_btn_bomba_drag_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) { - gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"bomba_e.png",15); + gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"bomba_e.png",11); } void Constructor::on_btn_exclusa_drag_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) { - gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"exclusa_h.png",15); + gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"exclusa_h.png",13); } void Constructor::on_btn_drain_drag_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) @@ -272,6 +272,11 @@ void Constructor::on_not_drag_begin(const Glib::RefPtr& contex void Constructor::on_item_drag_begin(const Glib::RefPtr& context, CItem *item) { context->set_icon(item->get_image(), 5, 5); + std::list::iterator i = listaItems.begin(); + while ( i != listaItems.end() ){ + (*i)->set_default_connector(); + i++; + } } void Constructor::on_item_drag_data_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) diff --git a/Constructor/drain.cpp b/Constructor/drain.cpp index e1f0792..cd4ee57 100644 --- a/Constructor/drain.cpp +++ b/Constructor/drain.cpp @@ -138,3 +138,8 @@ ConnectorType Drain::get_connector_type(int _a, int _b) } return UNDEF; } + +void Drain::set_default_connector() +{ + connect_vec[0].type = IN; +} diff --git a/Constructor/drain.h b/Constructor/drain.h index 2c6ab7b..697a217 100644 --- a/Constructor/drain.h +++ b/Constructor/drain.h @@ -16,7 +16,7 @@ class Drain : public CItem { double get_capacidad(); virtual void save(FILE *archivo); virtual bool check_connection(); - //virtual ConnectorType is_connection_area(int _a, int _b); + virtual void set_default_connector(); virtual ConnectorType get_connector_type(int _a, int _b); protected: Glib::RefPtr imageE; // 0 diff --git a/Constructor/exclusa.cpp b/Constructor/exclusa.cpp index 6a386d1..b759ea7 100644 --- a/Constructor/exclusa.cpp +++ b/Constructor/exclusa.cpp @@ -14,6 +14,12 @@ Exclusa::Exclusa() ref->get_widget_derived("exclusa_pty_wnd",exclusa_pty_wnd); exclusa_pty_wnd->exclusa = this; name = "exclusa"; + + Connector temp; + temp.id_dest = -1; + temp.type = UNDEF; + connect_vec.push_back(temp); + connect_vec.push_back(temp); } Exclusa::~Exclusa() @@ -153,21 +159,9 @@ ConnectorType Exclusa::get_connector_type(int _a, int _b) } return UNDEF; } -/*si no estoy conectado pregunto por el del otro lado, y ahi puedo setear los dos - *si ya estoy devuelvo. -*/ -/*bool Exclusa::is_connection_area(int _a, int _b) + +void Exclusa::set_default_connector() { - switch (imgActual){ - case 0: - if ( ((_a <= x+10 )&&(_a > 0) && (_b <= y+image->get_height()-10) &&(_b >= y+10 )) || - ((_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <= y+image->get_height()-10) &&(_b >= y +10 )) ) - return true; - case 1: - if ( ((_a <= x+image->get_width()-10 )&&(_a >= x + 10) && (_b <= y+10) &&(_b > 0 )) || - ((_a <= x+22 )&&(_a >= x + 10) && (_b <= y+image->get_height()-1) &&(_b >= y+image->get_height()-10 )) ) - return true; - } - return false; + connect_vec[0].type = UNDEF; + connect_vec[1].type = UNDEF; } -*/ diff --git a/Constructor/exclusa.h b/Constructor/exclusa.h index b65e616..5ea2ddd 100644 --- a/Constructor/exclusa.h +++ b/Constructor/exclusa.h @@ -14,7 +14,7 @@ class Exclusa : public CItem { virtual void on_menu_popup_propiedades(); virtual void save(FILE *archivo); virtual bool check_connection(); -// virtual ConnectorType is_connection_area(int _a, int _b); + virtual void set_default_connector(); virtual ConnectorType get_connector_type(int _a, int _b); void set_estado(bool _state); bool get_estado(); diff --git a/Constructor/item.cpp b/Constructor/item.cpp index 72f6393..de9c4cd 100644 --- a/Constructor/item.cpp +++ b/Constructor/item.cpp @@ -126,11 +126,10 @@ ConnectorType CItem::is_other_connection_area(int _a, int _b) std::list::iterator i = listaItems->begin(); while ( i != listaItems->end() ) { CItem *temp = *i; - if (temp != this) { + if (temp != this) if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF ) return temp2; - i++; - } + i++; } return UNDEF; } @@ -138,3 +137,6 @@ ConnectorType CItem::get_connector_type( int _a, int _b ) { return UNDEF; } +void CItem::set_default_connector() +{ +} diff --git a/Constructor/item.h b/Constructor/item.h index 1654bf3..10070b8 100644 --- a/Constructor/item.h +++ b/Constructor/item.h @@ -52,7 +52,7 @@ public: ConnectorType is_other_connection_area(int _a, int _b); virtual void save(FILE *archivo) = 0; virtual bool check_connection()=0; -// virtual ConnectorType is_connection_area(int _a, int _b)=0; + virtual void set_default_connector(); virtual ConnectorType get_connector_type( int _a, int _b ); WorkPlace *workplace; Gtk::Entry *combo_entry; diff --git a/Constructor/not.cpp b/Constructor/not.cpp index ca112fe..04e8ffc 100644 --- a/Constructor/not.cpp +++ b/Constructor/not.cpp @@ -90,25 +90,3 @@ bool Not::check_connection() return false;*/ return true; } - -/* -bool Not::is_connection_area(int _a, int _b) -{ - /*switch (imgActual) { - case 0: if ( ( (_a <= x+10)&&(_a > x) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - case 1: if ( ( (_a <= x+image->get_width()-10)&&(_a >= x+image->get_width()-22) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 2: if ( ( (_a <= x+22)&&(_a >= x+10) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 3: if ( ( (_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - } - return false; - return true; -} -*/ diff --git a/Constructor/not.h b/Constructor/not.h index 4e0480c..6b427fe 100644 --- a/Constructor/not.h +++ b/Constructor/not.h @@ -11,7 +11,6 @@ class Not : public CItem { virtual void on_menu_popup_rotar(); virtual void save(FILE *archivo); virtual bool check_connection(); - //virtual bool is_connection_area(int _a, int _b); private: Glib::RefPtr imageN; // 0 Glib::RefPtr imageS; // 1 diff --git a/Constructor/or.cpp b/Constructor/or.cpp index c162ecb..cd86e23 100644 --- a/Constructor/or.cpp +++ b/Constructor/or.cpp @@ -66,48 +66,5 @@ void Or::save(FILE *archivo) // CAMBIAR TODO ESTO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! bool Or::check_connection() { - /*switch (get_img_actual()) { - case 0: - if ( is_other_connection_area( get_position_x()-5, get_position_y()+16) && - is_other_connection_area( get_position_x()+get_image()->get_width()-16, +get_position_y()+get_image()->get_height() + 5) ) - return true; - break; - case 1: - if ( is_other_connection_area( get_position_x()+get_image()->get_width() - 16, get_position_y() -5) && - is_other_connection_area( get_position_x()-5, get_position_y()+get_image()->get_height()-16) ) - return true; - break; - case 2: - if ( is_other_connection_area( get_position_x() + 16, get_position_y() -5) && - is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+get_image()->get_height()-16) ) - return true; - break; - case 3: - if ( is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y() +16) && - is_other_connection_area( get_position_x() + 16, get_position_y()+get_image()->get_height() + 5) ) - return true; - } - return false;*/ return true; } - -/* -bool Or::is_connection_area(int _a, int _b) -{ - /*switch (imgActual) { - case 0: if ( ( (_a <= x+10)&&(_a > x) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - case 1: if ( ( (_a <= x+image->get_width()-10)&&(_a >= x+image->get_width()-22) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 2: if ( ( (_a <= x+22)&&(_a >= x+10) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 3: if ( ( (_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - } - return false; -} -*/ diff --git a/Constructor/or.h b/Constructor/or.h index 617ab1b..9da1cd2 100644 --- a/Constructor/or.h +++ b/Constructor/or.h @@ -11,7 +11,6 @@ class Or : public CItem { virtual void on_menu_popup_rotar(); virtual void save(FILE *archivo); virtual bool check_connection(); - //virtual ConnectorType is_connection_area(int _a, int _b); private: Glib::RefPtr imageN; // 0 Glib::RefPtr imageS; // 1 diff --git a/Constructor/pump.cpp b/Constructor/pump.cpp index fbc0937..515dc90 100644 --- a/Constructor/pump.cpp +++ b/Constructor/pump.cpp @@ -149,15 +149,8 @@ ConnectorType Pump::get_connector_type(int _a, int _b) } return UNDEF; } -/* -bool Pump::is_connection_area(int _a, int _b) + +void Pump::set_default_connector() { - switch (imgActual) { - case 0: if ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+22)&&(_b > y) ) - return true; - case 1: if ( (_a <= x+10)&&(_a > x)&&(_b<=y+22)&&(_b > y) ) - return true; - } - return false; + connect_vec[0].type = OUT; } -*/ diff --git a/Constructor/pump.h b/Constructor/pump.h index 201475f..cdf8bba 100644 --- a/Constructor/pump.h +++ b/Constructor/pump.h @@ -19,6 +19,7 @@ class Pump : public CItem { Gdk::Color get_liquid_color(); virtual void save(FILE *archivo); virtual bool check_connection(); + virtual void set_default_connector(); virtual ConnectorType get_connector_type(int _a, int _b); protected: double entrega; diff --git a/Constructor/splitter.cpp b/Constructor/splitter.cpp index 2e11992..4804849 100644 --- a/Constructor/splitter.cpp +++ b/Constructor/splitter.cpp @@ -179,23 +179,8 @@ ConnectorType Splitter::get_connector_type(int _a, int _b) return UNDEF; } -/* -bool Splitter::is_connection_area(int _a, int _b) +void Splitter::set_default_connector() { - switch (imgActual) { - case 0: if ( ( (_a <= x+10)&&(_a > x) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+image->get_width()-10)&&(_a>=x+image->get_width()-22)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - case 1: if ( ( (_a <= x+image->get_width()-10)&&(_a >= x+image->get_width()-22) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+10)&&(_a > x)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 2: if ( ( (_a <= x+22)&&(_a >= x+10) && (_b <=y+10)&&(_b > y) ) || - ( (_a <= x+image->get_width()-1)&&(_a>=x+image->get_width()-10)&&(_b<=y+image->get_height()-10)&&(_b>=y+image->get_height()-22) ) ) - return true; - case 3: if ( ( (_a <= x+image->get_width()-1)&&(_a >= x+image->get_width()-10) && (_b <=y+22)&&(_b>=y+10) ) || - ( (_a <= x+22)&&(_a>=x+10)&&(_b<=y+image->get_height()-1)&&(_b>=y+image->get_height()-10) ) ) - return true; - } - return false; + connect_vec[0].type = UNDEF; + connect_vec[1].type = UNDEF; } -*/ diff --git a/Constructor/splitter.h b/Constructor/splitter.h index bcd13e4..ef526d5 100644 --- a/Constructor/splitter.h +++ b/Constructor/splitter.h @@ -12,7 +12,7 @@ class Splitter : public CItem { virtual void on_menu_popup_propiedades(); virtual void save(FILE *archivo); virtual bool check_connection(); -// virtual ConnectorType is_connection_area(int _a, int _b); + virtual void set_default_connector(); virtual ConnectorType get_connector_type(int _a, int _b); private: Glib::RefPtr imageN; // 0 diff --git a/Constructor/union.cpp b/Constructor/union.cpp index b7b97bd..1311bd5 100644 --- a/Constructor/union.cpp +++ b/Constructor/union.cpp @@ -176,27 +176,15 @@ ConnectorType Union::get_connector_type(int _a, int _b) return UNDEF; } -/* -ConnectorType Union::is_connection_area(int _a, int _b) +void Union::set_default_connector() { - switch ( imgActual) { - case 0: if ( ((_a <= x+10) && (_a > x+1) && (_b<= y + 22) && (_b >= y+10)) - retur - ((_a <= x+image->get_width()-1) && (_a >= x+image->get_width()-10)&&(_b <= y+22) && (_b >= y+10)) || - ((_a <= x+image->get_width()/2 + 5)&&( _a>= x+image->get_width()/2 - 5) && (_b<=y+image->get_height()-1)&&(_b >= y+image->get_height()-10)) ) - return true; - case 1: if ( ((_a <= x+image->get_width()-10) && (_a >= x+image->get_width() -22) && (_b<= y + 10) && (_b > y )) || - ((_a <= x +10) && (_a > x )&&(_b <= y+image->get_height()/2+5 ) && (_b >= y+image->get_height()/2-5)) || - ((_a <= x+image->get_width() - 10)&&( _a>= x+image->get_width()-22) && (_b<=y+image->get_height()-1)&&(_b >= y+image->get_height()-10)) ) - return true; - case 2: if ( ((_a <= x+10) && (_a > x) && (_b<= y+image->get_height()-10) && (_b >= y+image->get_height()-22)) || - ((_a <= x+image->get_width()-1) && (_a >= x+image->get_width()-10)&&(_b <= y+image->get_height()-10) && (_b >= y+image->get_height()-22)) || - ((_a <= x+image->get_width()/2 + 5)&&( _a>= x+image->get_width()/2 - 5) && (_b<=y+10)&&(_b > y)) ) - return true; - case 3: if ( ((_a <= x+22) && (_a >= x+10) && (_b<= y + 10) && (_b > y )) || - ((_a <= x+22) && (_a >= x+10 )&&(_b <= y+image->get_height()-1 ) && (_b >= y+image->get_height()-10)) || - ((_a <= x+image->get_width() -1)&&( _a>= x+image->get_width()-10) && (_b<=y+image->get_height()/2+5)&&(_b >= y+image->get_height()/2-5)) ) - return true; + if (is_union) { + connect_vec[0].type = IN; + connect_vec[1].type = IN; + connect_vec[2].type = OUT; + } else { + connect_vec[0].type = OUT; + connect_vec[1].type = OUT; + connect_vec[2].type = IN; } - return false; -}*/ +} diff --git a/Constructor/union.h b/Constructor/union.h index 18aba4f..e58a5d0 100644 --- a/Constructor/union.h +++ b/Constructor/union.h @@ -13,7 +13,7 @@ class Union : public CItem { virtual void on_menu_popup_propiedades(); virtual void save(FILE *archivo); virtual bool check_connection(); - //virtual ConnectorType is_connection_area(int _a, int _b); + virtual void set_default_connector(); virtual ConnectorType get_connector_type(int _a, int _b); private: Glib::RefPtr imageN; // 0 -- 2.43.0