]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Constructor/src/union.cpp
-cambios en la implementacion de algunos items, get_connector_type..
[z.facultad/75.42/plaqui.git] / Constructor / src / union.cpp
index b10ea1287ef6d25d53f6aef7eda66ce056f4f064..dfbaa8874c77a9fdab6f43db8782566f1904ac5d 100644 (file)
@@ -1,14 +1,28 @@
 #include "union.h"
 
-Union::Union()
+Union::Union(int orientacion)
 {
+       in_x = -1;
        imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/y_n.png");
        imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/y_s.png");
        imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/y_e.png");
        imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/y_o.png");
        null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/null.png");
-       imgActual = 0;
-       image = imageN;
+       imgActual = orientacion;
+       switch (imgActual) {
+               case 1:
+                       image = imageE;
+                       break;
+               case 2:
+                       image = imageS;
+                       break;
+               case 3:
+                       image = imageO;
+                       break;
+               default: 
+                       imgActual = 0;
+                       image = imageN;                 
+       }
        set_size_request(image->get_width(), image->get_height());
        property_wnd->set_title("Propiedades del Empalme");
        property_wnd->rd_btn_division->property_visible() = true;
@@ -30,8 +44,13 @@ Union::~Union()
 
 bool Union::on_button_press_event(GdkEventButton *event)
 {
-       if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1))
-               combo_entry->set_text(name);
+       if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
+               list_pointed->push_back(name);
+               combo_entry->set_popdown_strings(*list_pointed);
+               combo_entry->get_entry()->set_text (name);
+               workplace->queue_draw();
+               WorkPlace::pointed = ID;
+       }
        
        if ((event->type == GDK_BUTTON_PRESS) && (event->button == 2 )){
                image = null;   
@@ -122,6 +141,7 @@ bool Union::check_connection()
 {
        CItem * _item0, *_item1, *_item2;
        ConnectorType temp0, temp1, temp2;
+       std::cout << get_img_actual() << std::endl;
        switch (get_img_actual()) {
                        case 0:
                                temp0 = is_other_connection_area( get_position_x() - 5, get_position_y() +16, &_item0);
@@ -140,8 +160,8 @@ bool Union::check_connection()
                                break;
                        case 3:
                                temp1 = is_other_connection_area( get_position_x()+16, get_position_y()-5, &_item1);
-                               temp2 = is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+get_image()->get_height()/2,& _item0);
-                               temp0 = is_other_connection_area( get_position_x()+16, get_position_y()+get_image()->get_height()+5, &_item1);
+                               temp2 = is_other_connection_area( get_position_x()+get_image()->get_width()+5, get_position_y()+get_image()->get_height()/2,& _item2);
+                               temp0 = is_other_connection_area( get_position_x()+16, get_position_y()+get_image()->get_height()+5, &_item0);
        }
        if ( is_union ) {
                if ( temp0 == OUT && temp1 == OUT && temp2 == IN ) {