]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
Luca, si podes lleva esto, no creo que termine nada mas hoy
authorNicolás Dimov <ndimov@gmail.com>
Thu, 13 Nov 2003 20:56:13 +0000 (20:56 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Thu, 13 Nov 2003 20:56:13 +0000 (20:56 +0000)
Constructor/activezone.cpp
Constructor/activezone.h
Constructor/constructor.cpp
Constructor/constructor.glade
Constructor/item.h
Constructor/workplace.cpp
Constructor/workplace.h

index ee426b099e2f7119a561625b98d0c6b2a0014b3e..f23eefcc2f8ac2130dd99d4ba271cb891883e383 100644 (file)
@@ -1,7 +1,9 @@
 #include "activezone.h"
+#include "workplace.h"
 
 ActiveZone::ActiveZone(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade):Gtk::Viewport(cobject)
 {
+       cant_click=1;
 }
 
 ActiveZone::~ActiveZone()
@@ -11,12 +13,19 @@ ActiveZone::~ActiveZone()
 bool ActiveZone::on_button_press_event(GdkEventButton *event)
 {
        if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) ) {
-               get_pointer(temp.x,temp.y);
+               if (cant_click ==2) {
+                       get_pointer(temp.w, temp.z);
+                       cant_click--;
+                       workplace->lista_lineas.push_back(temp);
+                       workplace->get_window()->draw_line (get_style()->get_black_gc(), temp.x,temp.y,temp.w,temp.z);
+               }
+       }
+       
+       if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) ) {
+               if (cant_click == 1) {
+                       get_pointer(temp.x,temp.y);
+                       cant_click++;
+               }
        }
-       return true;
-}
-                                                                                                                                            
-bool ActiveZone::on_button_release_event(GdkEventButton *event)
-{
        return true;
 }
index b2a2413a6774618d2f71a5dc4e05af902a388776..d4f468fe0d37431ab7c75d77ef30200f0cc68b07 100644 (file)
@@ -4,22 +4,20 @@
 #include <gtkmm.h>
 #include <gtkmm/viewport.h>
 #include <iostream>
-#include "workplace.h"
+
+class WorkPlace;
 
 typedef struct {
        int x,y,w,z;
 }t_line;
 
-class WorkPlace;
-
 class ActiveZone:public Gtk::Viewport {
        public:
                ActiveZone(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade);
                virtual ~ActiveZone();
                virtual bool on_button_press_event(GdkEventButton *e);
-               virtual bool on_button_release_event(GdkEventButton *e);
                t_line temp;
-               std::list<t_line> lista_lineas;
+               int cant_click;
                WorkPlace *workplace;
 };
 #endif
index 0278ec0bf2c1b16f7096ff7d06e93f8a1fcf5a9d..deb918d6e0dc93aeede3e880b527459b5a1a75c9 100644 (file)
@@ -162,8 +162,17 @@ void Constructor::on_main_menu_save()
 }
 
 void Constructor::on_edit_menu_del()
-{
-       // hay que meter algo aca.
+{  // OJO que borra al primero que encuentra con el mismo nombre!!!
+       std::list<CItem *>::iterator i = listaItems.begin();
+       Glib::ustring pointed = combo_entry->get_text();
+       while ( i != listaItems.end() ){
+               CItem *temp = *i;
+               if ( temp->get_name() == pointed ){ 
+                       workplace->delete_item(temp->get_id());
+                       break;
+               }
+       i++;
+       }
 }
 
 void Constructor::on_chk_btn_clicked()
index 81fb82d6b403b0c9ba4dfdfc46935d8edf4d45fa..cf1bea92d6da3383b67c38191f54846c7efe03b0 100644 (file)
                                  <property name="padding">0</property>
                                  <property name="expand">False</property>
                                  <property name="fill">False</property>
+                                 <property name="pack_type">GTK_PACK_END</property>
                                </packing>
                              </child>
                            </widget>
index cf9b714436478a46d6b8d92711b00abed1e99132..7c1e771e8c8643c0f85bc55a9de45d82d5637104 100644 (file)
@@ -30,6 +30,7 @@ public:
        int get_conector_in();
        int get_conector_out();
        int get_img_actual();
+       Glib::ustring get_name();
        double get_caudal();
        void set_position(int _x, int _y);
        void set_id(int _id);
@@ -42,7 +43,6 @@ public:
        virtual void save(FILE *archivo) = 0;
        virtual bool check_connection()=0;
        virtual bool is_connection_area(int _a, int _b)=0;
-       Glib::ustring get_name();
        WorkPlace *workplace;
        Gtk::Entry *combo_entry;
        std::list<CItem *> *listaItems;
index 418f6b79222fcadb7d8bf28b2f1836fb394ff01e..1e7ceab5d8affd4ede09abed62db8831bc71063d 100644 (file)
@@ -21,15 +21,13 @@ bool WorkPlace::on_expose_event(GdkEventExpose *event)
                        get_window()->draw_point (get_style()->get_black_gc(), x+1,y);
                        get_window()->draw_point (get_style()->get_black_gc(), x-1,y);
                }
-       return true;
-}
-
-bool WorkPlace::on_button_press_event(GdkEventButton *event)
-{
-       if ((event->type==GDK_BUTTON_RELEASE) && (event->button ==1)) {
-               get_pointer(viewport->temp.w, viewport->temp.z);        
-               get_window()->draw_line (get_style()->get_black_gc(), viewport->temp.x,viewport->temp.y,viewport->temp.w,viewport->temp.z);
-       }
+               
+/*     std::list<t_line>::iterator i = lista_lineas.begin();
+       while ( i != lista_lineas.end() ) {
+               t_line temp = *i;
+               get_window()->draw_line (get_style()->get_black_gc(), temp.x,temp.y,temp.w,temp.z);
+               i++;
+       }*/
        return true;
 }
 
index 0677da3011a0414e48357d31c98765ee092499b5..c3e290135690ea438ef3c167d1dec9a6b74c5be0 100644 (file)
@@ -16,9 +16,9 @@ class WorkPlace:public Gtk::Fixed {
                WorkPlace(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade);
                virtual ~WorkPlace();
                virtual bool on_expose_event(GdkEventExpose *event);
-               virtual bool on_button_press_event (GdkEventButton *event);
                void delete_item(int _id);      
                std::list<CItem *> *listaItems;
+               std::list<t_line> lista_lineas;
                ActiveZone *viewport;
 };