]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
-Arregle un poco el tema de que cada compuerta puede tener una sola salida
authorNicolás Dimov <ndimov@gmail.com>
Sat, 29 Nov 2003 17:14:11 +0000 (17:14 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Sat, 29 Nov 2003 17:14:11 +0000 (17:14 +0000)
pero la NOT esta fallando a veces
creo que las demas andan bien

- Falta hacer que las conexiones se guarden en el XML y un par de cositas mas
relacionado con eso mismo..

Constructor/include/and.h
Constructor/include/item.h
Constructor/include/or.h
Constructor/src/and.cpp
Constructor/src/cistern.cpp
Constructor/src/exclusa.cpp
Constructor/src/item.cpp
Constructor/src/not.cpp
Constructor/src/or.cpp
Constructor/src/pump.cpp

index 56be2e92031d0f9c6f7877d241bb1dc564bdc568..a71b536dfc7ec02df5762eba272ca29df8a66c21 100644 (file)
@@ -15,6 +15,7 @@ class And : public CItem {
                virtual void update_logic_position();
                virtual void get_in_logic_connect_position(int& _a, int& _b);
                virtual void get_out_logic_connect_position(int& _a, int& _b);  
+               virtual bool get_out_logic_connect();
                virtual void set_out_connected(bool _o);
                virtual void draw_connectors();
        private:
index 140629b03009dc9325ac86e07c524f7e9617721e..7b277e3f08549b986b951ae421700f8e9540ea1b 100644 (file)
@@ -126,6 +126,7 @@ public:
        virtual void set_out_connected(bool _o);
        virtual void set_in_connected(bool _o);
        
+       virtual bool get_out_logic_connect();
        /**Dibuja los conectores logicos del Item, AZUL == SALIDA, ROJO == ENTRADA.
        */
        virtual void draw_connectors();
index 177f69988a9d57d5363ee403c44c5f88722f7d2b..069190344bc03d9e791186ee5a2167fbf1112000 100644 (file)
@@ -15,6 +15,7 @@ class Or : public CItem {
                virtual void update_logic_position();
                virtual void get_in_logic_connect_position(int& _a, int& _b);
                virtual void get_out_logic_connect_position(int& _a, int& _b);  
+               virtual bool get_out_logic_connect();
                virtual void set_out_connected(bool _o);
                virtual void draw_connectors();
        private:
index 3e5287695cbfc2d7f243d50b45d2f443b128157c..927aa6158f00171ab3c189f21041efc2a3dfe220 100644 (file)
@@ -57,7 +57,7 @@ bool And::on_button_press_event(GdkEventButton *event)
                std::cout << CItem::gate_id << std::endl;
                if (CItem::logic_connect) {
                        if (CItem::gate_id != -1 ) {
-                               if ( detect_click_position((int)event->x, (int)event->y ) == IN && CItem::gate_id != ID ) {
+                               if ( detect_click_position((int)event->x, (int)event->y ) == IN && CItem::gate_id != ID && !workplace->get_logic_item(CItem::gate_id)->get_out_logic_connect()) {
                                        tmp_line.logic_id =  CItem::gate_id;
                                        workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
                                        tmp_line.store_id = ID;
@@ -263,6 +263,11 @@ void And::set_out_connected(bool _o)
        out_connected = _o;
 }
 
+bool And::get_out_logic_connect()
+{
+       return out_connected;
+}
+
 void And::draw_connectors()
 {
        Glib::RefPtr<Gdk::Window> window = get_window();
index 628d69fa78529190d4263e72be50a606e8f1cb35..b3638554ef9301737d95f938685acc58a6116cf7 100644 (file)
@@ -52,7 +52,7 @@ bool Cistern::on_button_press_event(GdkEventButton *event)
                combo_entry->set_popdown_strings(*list_pointed);
                combo_entry->get_entry()->set_text (name);
                if (CItem::logic_connect && CItem::gate_id != -1) {
-                       if ( detect_click_position((int)event->x, (int)event->y) == IN ){
+                       if ( detect_click_position((int)event->x, (int)event->y) == IN && !workplace->get_logic_item(CItem::gate_id)->get_out_logic_connect()){
                                tmp_line.logic_id =  workplace->get_logic_item(CItem::gate_id)->get_id();
                                workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
                                tmp_line.store_id = ID;
index 048dd6c4c8376a0a1078ca5ea91798a556c874f6..5fc6ceee9ce225476ebb744ec0ac249ebb005436 100644 (file)
@@ -47,8 +47,8 @@ bool Exclusa::on_button_press_event(GdkEventButton *event)
                combo_entry->set_popdown_strings(*list_pointed);
                combo_entry->get_entry()->set_text (name);
                if (CItem::logic_connect && CItem::gate_id != -1) {
-                       if ( detect_click_position((int)event->x, (int)event->y) == IN) {
-                               tmp_line.logic_id =  workplace->get_logic_item(CItem::gate_id)->get_id();
+                       if ( detect_click_position((int)event->x, (int)event->y) == IN && !workplace->get_logic_item(CItem::gate_id)->get_out_logic_connect()) {
+                               tmp_line.logic_id =  CItem::gate_id;
                                workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
                                tmp_line.store_id = ID;
                                workplace->lista_lineas_in.push_back(tmp_line);
index e5027e00ed790e78ef8d8fa1f3dcff92af2996ff..0bbf005e592373959652f49f2e4ea1ad8acdad06 100644 (file)
@@ -197,6 +197,11 @@ void CItem::get_out_logic_connect_position(int& _a, int& _b)
        _b = y;
 }
 
+bool CItem::get_out_logic_connect()
+{
+       return false;
+}
+
 void CItem::update_logic_position()
 {
 }
index 8a33e1cf113d423272b5e762afb044b99e2b9c59..a946d8cc4888848d04837a15229e9895fb76a327 100644 (file)
@@ -57,7 +57,7 @@ bool Not::on_button_press_event(GdkEventButton *event)
                t_line tmp_line;
                if (CItem::logic_connect) {
                        if (CItem::gate_id != -1) {
-                               if ( detect_click_position((int)event->x, (int)event->y) == IN && !in_connected) {
+                               if ( detect_click_position((int)event->x, (int)event->y) == IN && !in_connected && !workplace->get_logic_item(CItem::gate_id)->get_out_logic_connect()) {
                                        tmp_line.logic_id =  CItem::gate_id;
                                        workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
                                        set_in_connected(true);
@@ -68,8 +68,6 @@ bool Not::on_button_press_event(GdkEventButton *event)
                                }
                        } else
                                CItem::gate_id = ID;
-               }               
-               if ( CItem::logic_connect ) {
                        if ( detect_click_position((int)event->x, (int)event->y ) == OUT && !out_connected )  {
                                CItem::gate_id = ID;
                        }
index 50ad73fa1adc955025a72943a863ba614006c890..a96d48f335b10a1babfdf60d97e349e79aeaf3ca 100644 (file)
@@ -56,7 +56,7 @@ bool Or::on_button_press_event(GdkEventButton *event)
                t_line tmp_line;
                if (CItem::logic_connect) {
                        if (CItem::gate_id != -1) {
-                               if ( detect_click_position((int)event->x, (int)event->y) == IN) {
+                               if ( detect_click_position((int)event->x, (int)event->y) == IN && !workplace->get_logic_item(CItem::gate_id)->get_out_logic_connect()) {
                                        tmp_line.logic_id =  CItem::gate_id;
                                        workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
                                        tmp_line.store_id = ID;
@@ -264,6 +264,11 @@ void Or::set_out_connected(bool _o)
        out_connected = _o;
 }
 
+bool Or::get_out_logic_connect()
+{
+       return out_connected;
+}
+
 void Or::draw_connectors()
 {
        Glib::RefPtr<Gdk::Window> window = get_window();
index 47cf1b96bba57bc74615a7a8c33682ce06029737..cafa7d5f039e8ee9c0c300bd9d924a7e935ba9ff 100644 (file)
@@ -49,7 +49,7 @@ bool Pump::on_button_press_event(GdkEventButton *event)
                WorkPlace::pointed = ID;
                std::cout<< "CItem::gate_id = "<<CItem::gate_id<<std::endl;
                if (CItem::logic_connect && CItem::gate_id != -1) {
-                       if ( detect_click_position((int)event->x, (int)event->y) == IN) {
+                       if ( detect_click_position((int)event->x, (int)event->y) == IN && !workplace->get_logic_item(CItem::gate_id)->get_out_logic_connect()) {
                                tmp_line.logic_id =  CItem::gate_id;
                                workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
                                tmp_line.store_id = ID;