]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
estoy completando un poco todo esto para ponerme a implementar el guardar y cargar...
authorNicolás Dimov <ndimov@gmail.com>
Sat, 8 Nov 2003 21:20:59 +0000 (21:20 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Sat, 8 Nov 2003 21:20:59 +0000 (21:20 +0000)
17 files changed:
Constructor/activezone.cpp
Constructor/activezone.h
Constructor/cistern.cpp
Constructor/cistern.h
Constructor/cisternptywnd.cpp [deleted file]
Constructor/cisternptywnd.h [deleted file]
Constructor/conduct.cpp
Constructor/constructor.cpp
Constructor/constructor.glade
Constructor/item.cpp
Constructor/item.h
Constructor/itemptywnd.cpp [new file with mode: 0644]
Constructor/itemptywnd.h [new file with mode: 0644]
Constructor/propertywnd.cpp
Constructor/propertywnd.h
Constructor/workplace.cpp
Constructor/workplace.h

index 014439e4db945167a670a6d7106bc1e1bf7486a5..ee426b099e2f7119a561625b98d0c6b2a0014b3e 100644 (file)
@@ -8,8 +8,15 @@ ActiveZone::~ActiveZone()
 {
 }
 
-bool ActiveZone::on_button_press_event(GdkEventButton *e)
+bool ActiveZone::on_button_press_event(GdkEventButton *event)
+{
+       if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) ) {
+               get_pointer(temp.x,temp.y);
+       }
+       return true;
+}
+                                                                                                                                            
+bool ActiveZone::on_button_release_event(GdkEventButton *event)
 {
-       std::cout<< "hola vieja"<<std::endl;
        return true;
 }
index 56431bf6fc31daa17320122068706f8dba6917cf..b2a2413a6774618d2f71a5dc4e05af902a388776 100644 (file)
@@ -1,12 +1,25 @@
+#ifndef _ACTIVEZONE_H_
+#define _ACTIVEZONE_H_
 #include <libglademm.h>
 #include <gtkmm.h>
 #include <gtkmm/viewport.h>
 #include <iostream>
+#include "workplace.h"
+
+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;
+               WorkPlace *workplace;
 };
-
+#endif
index 14954432d94f98730168761ee476db33af5df69d..fdb9aa1d0346470e9ca7faafe595f21b0d7904f0 100644 (file)
@@ -2,8 +2,6 @@
 
 Cistern::Cistern()
 {
-       caudal = 56;
-       fluido_max = 23;
        imageE = Gdk::Pixbuf::create_from_file("tanque_e.png");
        imageO = Gdk::Pixbuf::create_from_file("tanque_o.png");
        null = Gdk::Pixbuf::create_from_file("tanque_null.png");
@@ -11,14 +9,9 @@ Cistern::Cistern()
        image = imageE;
        set_size_request(image->get_width(), image->get_height());
        
-       Glib::RefPtr<Gnome::Glade::Xml> ref;
-       try {
-               ref = Gnome::Glade::Xml::create("constructor.glade", "cistern_pty_wnd");
-       }
-       catch(const Gnome::Glade::XmlError &ex) {
-               std::cerr << ex.what() << std::endl;
-       }
+       Glib::RefPtr<Gnome::Glade::Xml> ref = Gnome::Glade::Xml::create("constructor.glade", "cistern_pty_wnd");
        ref->get_widget_derived("cistern_pty_wnd",cistern_pty_wnd);
+       cistern_pty_wnd->cistern = this;
 }
 
 Cistern::~Cistern()
@@ -49,8 +42,9 @@ bool Cistern::on_button_press_event(GdkEventButton *event)
        }
        
        if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
-               cistern_pty_wnd->spin_caudal->set_value((double)x);
-               cistern_pty_wnd->spin_fluido_max->set_value((double)y);
+               cistern_pty_wnd->spin_capacidad->set_value( capacidad );
+               cistern_pty_wnd->spin_inicial->set_value( contenido_inicial );
+               cistern_pty_wnd->txt_cistern_name->set_text( name );
                cistern_pty_wnd->show();
        }               
        return true;
@@ -66,11 +60,28 @@ void Cistern::on_menu_popup_rotar()
 
 void Cistern::on_menu_popup_propiedades()
 {
-//     cistern_pty_wnd->spin_caudal->set_value(caudal);
-//     cistern_pty_wnd->spin_fluido_max->set_value(fluido_max);
-       std::cout<< "posicion = "<< x <<" "<< y <<std::endl;
        GdkEventButton event; 
                event.type = GDK_2BUTTON_PRESS;
                event.button = 1;
        Cistern::on_button_press_event(&event);
 }
+
+void Cistern::set_capacidad(double _cap)
+{
+       capacidad = _cap;
+}
+
+double Cistern::get_capacidad()
+{
+       return capacidad;
+}
+
+void Cistern::set_contenido_inicial(double _ini)
+{
+       contenido_inicial = _ini;
+}
+
+double Cistern::get_contenido_inicial()
+{
+       return contenido_inicial;
+}
index 151d60fb6deba299544e65abd13efc4539b6dceb..3dca54310b01a8d631249f0f385a9883cba0958e 100644 (file)
@@ -1,4 +1,3 @@
-// cistern.h
 #ifndef _CISTERN_H_
 #define _CISTERN_H_
 
@@ -6,6 +5,8 @@
 #include "cisternptywnd.h"
 #include <iostream>
 
+class CisternPtyWnd;
+
 class Cistern : public CItem {
        public:
                Cistern();
@@ -13,13 +14,16 @@ class Cistern : public CItem {
                virtual bool on_button_press_event(GdkEventButton *event);
                virtual void on_menu_popup_rotar();
                virtual void on_menu_popup_propiedades();
+               void set_capacidad(double _cap);
+               double get_capacidad();
+               void set_contenido_inicial(double _ini);
+               double get_contenido_inicial();
        protected:
-               double caudal, fluido_max;
+               double capacidad, contenido_inicial;
                int imgActual;  
                Glib::RefPtr<Gdk::Pixbuf> imageE; // 0 
                Glib::RefPtr<Gdk::Pixbuf> imageO; // 1
                Glib::RefPtr<Gdk::Pixbuf> null; 
-       
                CisternPtyWnd *cistern_pty_wnd;
 };
 #endif
diff --git a/Constructor/cisternptywnd.cpp b/Constructor/cisternptywnd.cpp
deleted file mode 100644 (file)
index 5ef0ec1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "cisternptywnd.h"
-
-CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):PropertyWnd(cobject,refGlade)
-{
-       refGlade->get_widget("spin_caudal", spin_caudal);
-       refGlade->get_widget("spin_fluido_max", spin_fluido_max);
-}
-
-CisternPtyWnd::~CisternPtyWnd()
-{
-}
-
-void CisternPtyWnd::on_btn_accept_clicked()
-{
-       hide();
-}
diff --git a/Constructor/cisternptywnd.h b/Constructor/cisternptywnd.h
deleted file mode 100644 (file)
index e910ac7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-//cisternptywnd.h
-#ifndef _CISTERNPTYWND_H_
-#define _CISTERNPTYWND_H_
-
-#include "propertywnd.h"
-
-class CisternPtyWnd : public PropertyWnd {
-       public:
-               CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
-               virtual ~CisternPtyWnd();
-       //protected:
-               Gtk::SpinButton *spin_caudal, *spin_fluido_max;
-               virtual void on_btn_accept_clicked();
-};
-       
-
-#endif
index a28aa7923b1303a053f729f00792598218b89852..61d39225f2fd774d04b52cf3231491c23e57aaeb 100644 (file)
@@ -8,15 +8,6 @@ Conduct::Conduct()
        imgActual = 0;
        image = imageN;
        set_size_request(image->get_width(), image->get_height());
-       
-       Glib::RefPtr<Gnome::Glade::Xml> ref;
-       try {
-               ref = Gnome::Glade::Xml::create("constructor.glade", "conduct_pty_wnd");
-       }
-       catch(const Gnome::Glade::XmlError &ex) {
-               std::cerr << ex.what() << std::endl;
-       }
-       ref->get_widget_derived("conduct_pty_wnd",property_wnd);
 }
 
 Conduct::~Conduct()
@@ -48,7 +39,9 @@ bool Conduct::on_button_press_event(GdkEventButton *event)
        }
        
        if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
-                       property_wnd->show();
+               property_wnd->spin_caudal->set_value( caudal_max );
+               property_wnd->txt_item_name->set_text (name);
+               property_wnd->show();
        }
        return true;
 }
index af1263ba7b031b84b3f0f8215ab50e590c650d40..7553c9126bb2cc77895064bc6db79abd94cf845e 100644 (file)
@@ -176,17 +176,19 @@ void Constructor::on_item_drop_drag_received(const Glib::RefPtr<Gdk::DragContext
                if ((selection_data->length >= 0) && (selection_data->format == 8))     {
                        CItem *a;
                        if (strcmp((const char *)selection_data->data, "item_codo.png")==0) 
-                               a = new Splitter();//Gtk::manage( new Splitter() );
+                               a = new Splitter();
                                        else    if (strcmp((const char *)selection_data->data, "item_canio.png")==0) 
-                                               a = new Conduct();//Gtk::manage( new Conduct() );
+                                               a = new Conduct();
                                                        else if (strcmp((const char *)selection_data->data, "item_y.png")==0) 
-                                                               a = new Union();//Gtk::manage( new Union() );
+                                                               a = new Union();
                                                                        else if (strcmp((const char *)selection_data->data, "item_tanque.png")==0) 
-                                                                               a = new Cistern();//Gtk::manage( new Cistern() );
+                                                                               a = new Cistern();
                                                                                        else
-                                                                                               a = new CItem();//Gtk::manage( new CItem((const char *)selection_data->data) );
+                                                                                               a = new CItem();
                        //Seteo el ID del item
+                       Glib::ustring name("item");
                        a->set_id(++id);                
+                       a->set_name( name );
                        if ( can_drop(a, i*32, j*32) ) {
                                workplace->put(*a, i*32, j*32);
                                //Apunto al workplace
index 94c1976e76d7cfad94af550687651f87f6305939..532532854fff323a944ab24644909aaca9911844 100644 (file)
                  <child>
                    <widget class="GtkVButtonBox" id="vbuttonbox1">
                      <property name="visible">True</property>
-                     <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
-                     <property name="spacing">0</property>
+                     <property name="layout_style">GTK_BUTTONBOX_START</property>
+                     <property name="spacing">5</property>
 
                      <child>
                        <widget class="GtkButton" id="btn_canio">
              <child>
                <widget class="GtkVButtonBox" id="vbuttonbox2">
                  <property name="visible">True</property>
-                 <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
-                 <property name="spacing">0</property>
+                 <property name="layout_style">GTK_BUTTONBOX_START</property>
+                 <property name="spacing">5</property>
 
                  <child>
                    <widget class="GtkButton" id="button2">
          <property name="row_spacing">0</property>
          <property name="column_spacing">0</property>
 
-         <child>
-           <widget class="GtkSpinButton" id="spin_caudal">
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="climb_rate">1</property>
-             <property name="digits">1</property>
-             <property name="numeric">True</property>
-             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-             <property name="snap_to_ticks">False</property>
-             <property name="wrap">False</property>
-             <property name="adjustment">0 0 10000 0.1 10 10</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">0</property>
-             <property name="bottom_attach">1</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkSpinButton" id="spin_fluido_max">
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="climb_rate">1</property>
-             <property name="digits">1</property>
-             <property name="numeric">True</property>
-             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-             <property name="snap_to_ticks">False</property>
-             <property name="wrap">False</property>
-             <property name="adjustment">0 0 10000 0.1 10 10</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">1</property>
-             <property name="bottom_attach">2</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkSpinButton" id="spinbutton9">
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="climb_rate">1</property>
-             <property name="digits">1</property>
-             <property name="numeric">True</property>
-             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-             <property name="snap_to_ticks">False</property>
-             <property name="wrap">False</property>
-             <property name="adjustment">0 0 100 0.1 10 10</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">2</property>
-             <property name="bottom_attach">3</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
          <child>
            <widget class="GtkLabel" id="label14">
              <property name="visible">True</property>
-             <property name="label" translatable="yes">Capacidad Máxima</property>
+             <property name="label" translatable="yes">Contenido Inicial</property>
              <property name="use_underline">False</property>
              <property name="use_markup">False</property>
              <property name="justify">GTK_JUSTIFY_LEFT</property>
          <child>
            <widget class="GtkLabel" id="label15">
              <property name="visible">True</property>
-             <property name="label" translatable="yes">Fluido Máximo</property>
+             <property name="label" translatable="yes">Capacidad Máxima</property>
              <property name="use_underline">False</property>
              <property name="use_markup">False</property>
              <property name="justify">GTK_JUSTIFY_LEFT</property>
          </child>
 
          <child>
-           <widget class="GtkLabel" id="label16">
+           <widget class="GtkLabel" id="label19">
              <property name="visible">True</property>
-             <property name="label" translatable="yes">Otro</property>
+             <property name="label" translatable="yes">Nombre</property>
              <property name="use_underline">False</property>
              <property name="use_markup">False</property>
              <property name="justify">GTK_JUSTIFY_LEFT</property>
              <property name="y_options"></property>
            </packing>
          </child>
+
+         <child>
+           <widget class="GtkEntry" id="txt_cistern_name">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char" translatable="yes">*</property>
+             <property name="activates_default">False</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">2</property>
+             <property name="bottom_attach">3</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkSpinButton" id="spin_capacidad">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="climb_rate">1</property>
+             <property name="digits">1</property>
+             <property name="numeric">False</property>
+             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+             <property name="snap_to_ticks">False</property>
+             <property name="wrap">False</property>
+             <property name="adjustment">0 0 100 0.1 10 10</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">1</property>
+             <property name="bottom_attach">2</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkSpinButton" id="spin_inicial">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="climb_rate">1</property>
+             <property name="digits">1</property>
+             <property name="numeric">False</property>
+             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+             <property name="snap_to_ticks">False</property>
+             <property name="wrap">False</property>
+             <property name="adjustment">0 0 100 0.1 10 10</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
        </widget>
        <packing>
          <property name="padding">0</property>
   </child>
 </widget>
 
-<widget class="GtkDialog" id="conduct_pty_wnd">
-  <property name="title" translatable="yes">Propiedades del Tubo</property>
+<widget class="GtkDialog" id="item_pty_wnd">
+  <property name="title" translatable="yes">Propiedades del </property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_CENTER</property>
   <property name="modal">False</property>
       <child>
        <widget class="GtkTable" id="table1">
          <property name="visible">True</property>
-         <property name="n_rows">3</property>
+         <property name="n_rows">2</property>
          <property name="n_columns">2</property>
          <property name="homogeneous">True</property>
          <property name="row_spacing">0</property>
          <property name="column_spacing">0</property>
 
          <child>
-           <widget class="GtkSpinButton" id="spinbutton4">
+           <widget class="GtkSpinButton" id="spin_caudal">
              <property name="visible">True</property>
              <property name="can_focus">True</property>
              <property name="climb_rate">1</property>
          </child>
 
          <child>
-           <widget class="GtkSpinButton" id="spinbutton5">
+           <widget class="GtkLabel" id="label20">
              <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="climb_rate">1</property>
-             <property name="digits">1</property>
-             <property name="numeric">False</property>
-             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-             <property name="snap_to_ticks">False</property>
-             <property name="wrap">False</property>
-             <property name="adjustment">0 0 100 0.1 10 10</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">1</property>
-             <property name="bottom_attach">2</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkSpinButton" id="spinbutton6">
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="climb_rate">1</property>
-             <property name="digits">1</property>
-             <property name="numeric">False</property>
-             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-             <property name="snap_to_ticks">False</property>
-             <property name="wrap">False</property>
-             <property name="adjustment">0 0 100 0.1 10 10</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">2</property>
-             <property name="bottom_attach">3</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkLabel" id="label12">
-             <property name="visible">True</property>
-             <property name="label" translatable="yes">Longitud</property>
+             <property name="label" translatable="yes">Nombre</property>
              <property name="use_underline">False</property>
              <property name="use_markup">False</property>
              <property name="justify">GTK_JUSTIFY_LEFT</property>
          </child>
 
          <child>
-           <widget class="GtkLabel" id="label13">
+           <widget class="GtkEntry" id="txt_item_name">
              <property name="visible">True</property>
-             <property name="label" translatable="yes">Otro</property>
-             <property name="use_underline">False</property>
-             <property name="use_markup">False</property>
-             <property name="justify">GTK_JUSTIFY_LEFT</property>
-             <property name="wrap">False</property>
-             <property name="selectable">False</property>
-             <property name="xalign">0</property>
-             <property name="yalign">0.5</property>
-             <property name="xpad">0</property>
-             <property name="ypad">0</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char" translatable="yes">*</property>
+             <property name="activates_default">False</property>
            </widget>
            <packing>
-             <property name="left_attach">0</property>
-             <property name="right_attach">1</property>
-             <property name="top_attach">2</property>
-             <property name="bottom_attach">3</property>
-             <property name="x_options">fill</property>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">1</property>
+             <property name="bottom_attach">2</property>
              <property name="y_options"></property>
            </packing>
          </child>
   </child>
 </widget>
 
+<widget class="GtkFileSelection" id="fileselection1">
+  <property name="border_width">10</property>
+  <property name="title" translatable="yes">Select File</property>
+  <property name="type">GTK_WINDOW_POPUP</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="show_fileops">True</property>
+
+  <child internal-child="cancel_button">
+    <widget class="GtkButton" id="cancel_button1">
+      <property name="visible">True</property>
+      <property name="can_default">True</property>
+      <property name="can_focus">True</property>
+      <property name="relief">GTK_RELIEF_NORMAL</property>
+    </widget>
+  </child>
+
+  <child internal-child="ok_button">
+    <widget class="GtkButton" id="ok_button1">
+      <property name="visible">True</property>
+      <property name="can_default">True</property>
+      <property name="can_focus">True</property>
+      <property name="relief">GTK_RELIEF_NORMAL</property>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>
index b4a42fe9bba9371bc4f9a76c39fbca0f1fcde74e..c2410d54e31a8b8b3729c47781913b7f9d4ca828 100644 (file)
@@ -9,6 +9,11 @@ CItem::CItem(const char *filename):Gtk::DrawingArea()
 
 CItem::CItem()
 {
+       Glib::RefPtr<Gnome::Glade::Xml> ref;
+       ref = Gnome::Glade::Xml::create("constructor.glade", "item_pty_wnd");
+       ref->get_widget_derived("item_pty_wnd",property_wnd);
+       caudal_max = 0.0;
+       property_wnd->item = this;
        menu_image_propiedades.set(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_MENU);
        menu_image_delete.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU);
        menu_image_rotar.set(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU);
@@ -86,3 +91,23 @@ int CItem::get_id()
 {
        return ID;
 }
+
+void CItem::set_caudal(double _caudal)
+{
+        caudal_max = _caudal;
+}
+
+double CItem::get_caudal()
+{
+       return caudal_max;
+}
+
+void CItem::set_name(Glib::ustring _name)
+{
+       name = _name;
+}
+
+Glib::ustring CItem::get_name()
+{
+       return name;
+}
index 87aaaed403ff24310b563d799c93d9734542ccd9..f9e460cc3750979b3e308ea20e7b4c7168324370 100644 (file)
@@ -8,7 +8,7 @@
 #include <gtkmm.h>
 #include <gdkmm.h>
 #include <libglademm.h>
-#include "propertywnd.h"
+#include "itemptywnd.h"
 #include "workplace.h"
 
 class WorkPlace;
@@ -30,13 +30,19 @@ public:
        bool is_occupied_area(int _a, int _b);
        void set_id(int _id);
        int get_id();
+       void set_caudal(double _caudal);
+       double get_caudal();
+       void set_name(Glib::ustring _name);
+       Glib::ustring get_name();
        WorkPlace *workplace;
 protected:
        int ID; 
+       Glib::ustring name;
+       double caudal_max;
        Gtk::Menu menu_popup;
        Gtk::Image menu_image_delete, menu_image_rotar, menu_image_propiedades, menu_image_linea;
        Glib::RefPtr<Gdk::Pixbuf> image;
-       PropertyWnd *property_wnd;
+       ItemPtyWnd *property_wnd;
        int x, y;
 };
 
diff --git a/Constructor/itemptywnd.cpp b/Constructor/itemptywnd.cpp
new file mode 100644 (file)
index 0000000..d1d00c8
--- /dev/null
@@ -0,0 +1,29 @@
+#include "itemptywnd.h"
+
+ItemPtyWnd::ItemPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):PropertyWnd(cobject,refGlade)
+{
+       refGlade->get_widget("spin_caudal", spin_caudal);
+       refGlade->get_widget("txt_item_name",txt_item_name);
+}
+
+ItemPtyWnd::~ItemPtyWnd()
+{
+}
+
+void ItemPtyWnd::on_btn_accept_clicked()
+{
+       item->set_caudal( spin_caudal->get_value() );   
+       item->set_name( txt_item_name->get_text() );
+       hide();
+}
+
+void ItemPtyWnd::on_btn_apply_clicked()
+{
+       item->set_caudal( spin_caudal->get_value() );   
+       item->set_name( txt_item_name->get_text() );    
+}
+
+void ItemPtyWnd::on_btn_cancel_clicked()
+{
+       hide();
+}
diff --git a/Constructor/itemptywnd.h b/Constructor/itemptywnd.h
new file mode 100644 (file)
index 0000000..daaa32e
--- /dev/null
@@ -0,0 +1,19 @@
+//cisternptywnd.h
+#ifndef _CISTERNPTYWND_H_
+#define _CISTERNPTYWND_H_
+
+#include "propertywnd.h"
+
+class ItemPtyWnd : public PropertyWnd {
+       public:
+               ItemPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
+               virtual ~ItemPtyWnd();
+               Gtk::SpinButton *spin_caudal;
+               Gtk::Entry *txt_item_name;
+               virtual void on_btn_cancel_clicked();
+               virtual void on_btn_accept_clicked();
+               virtual void on_btn_apply_clicked();
+};
+       
+
+#endif
index 7c0c00003bc62f8d97a23ff0ef10b50ad7c79d98..1bd3643df2c7b568ddde790ea6f9f9192f1fafc9 100644 (file)
@@ -1,5 +1,3 @@
-//propertywnd.cpp
-
 #include "propertywnd.h"
 
 PropertyWnd::PropertyWnd()
@@ -14,6 +12,7 @@ PropertyWnd::PropertyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
                
        btn_cancel->signal_clicked().connect(SigC::slot(*this, &PropertyWnd::on_btn_cancel_clicked));
        btn_accept->signal_clicked().connect(SigC::slot(*this, &PropertyWnd::on_btn_accept_clicked));
+       btn_apply->signal_clicked().connect(SigC::slot(*this, &PropertyWnd::on_btn_apply_clicked));
 }
 
 PropertyWnd::~PropertyWnd()
@@ -29,3 +28,7 @@ void PropertyWnd::on_btn_cancel_clicked()
 void PropertyWnd::on_btn_accept_clicked()
 {
 }
+
+void PropertyWnd::on_btn_apply_clicked()
+{
+}
index 2c068a8486cb9c5c1993caf2a970c0be9abd9ee2..ef8fbdfb904f41fbd215f72f3fb199fea885db2a 100644 (file)
@@ -1,23 +1,26 @@
-//propertywnd.h
 #ifndef _PROPERTYWND_H_
 #define _PROPERTYWND_H_
 
 #include <gtkmm/window.h>
 #include <gtkmm/button.h>
 #include <gtkmm/spinbutton.h>
+#include <gtkmm/entry.h>
 #include <libglademm.h>
+#include "item.h"
 
+class CItem;
+       
 class PropertyWnd : public Gtk::Window{
        public:
                PropertyWnd();
                PropertyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
                virtual ~PropertyWnd();
-               
+               CItem *item;            
        protected:
                Gtk::Button *btn_cancel, *btn_accept, *btn_apply;
                virtual void on_btn_cancel_clicked();
                virtual void on_btn_accept_clicked();
-       
+               virtual void on_btn_apply_clicked();
        
 };
 
index 3baa40894635939479e6e18dc4e8efdea255b534..418f6b79222fcadb7d8bf28b2f1836fb394ff01e 100644 (file)
@@ -3,7 +3,7 @@
 WorkPlace::WorkPlace( BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade):Gtk::Fixed(cobject)
 {
        refGlade->get_widget_derived("viewport",viewport);
-       this->signal_button_press_event().connect(SigC::slot(*this,&WorkPlace::on_button_press_event));
+       viewport->workplace = this;
 }
 
 WorkPlace::~WorkPlace()
@@ -21,28 +21,14 @@ 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);
                }
-       //TODO recorer la lista_lineas y dibujar todas          
-       get_window()->draw_line (get_style()->get_black_gc(), temp.x,temp.y,temp.w,temp.z);
        return true;
 }
 
-
 bool WorkPlace::on_button_press_event(GdkEventButton *event)
 {
-       std::cout<< temp.x<<"    "<<temp.y<< std::endl;
-       if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) ) {
-               get_pointer(temp.x,temp.y);
-               std::cout<< temp.x<<"    "<<temp.y<< std::endl;
-       }
-       return true;
-}
-
-bool WorkPlace::on_button_release_event(GdkEventButton *event)
-{
-       if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) ) {
-               get_pointer(temp.w,temp.z);     
-               lista_lineas.push_back(temp);
-               get_window()->draw_line (get_style()->get_black_gc(), temp.x,temp.y,temp.w,temp.z);
+       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);
        }
        return true;
 }
index 6d81e4f0ff9f091af1ca0ff7a55729c83afb35f7..0677da3011a0414e48357d31c98765ee092499b5 100644 (file)
@@ -8,22 +8,16 @@
 #include "activezone.h"
 #include "item.h"
 
-typedef struct {
-       int x,y,w,z;
-}t_line;
-
 class CItem;
+class ActiveZone;
 
 class WorkPlace:public Gtk::Fixed {
        public:
                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);
-               virtual bool on_button_release_event(GdkEventButton *event);
+               virtual bool on_button_press_event (GdkEventButton *event);
                void delete_item(int _id);      
-               std::list<t_line> lista_lineas;
-               t_line temp;
                std::list<CItem *> *listaItems;
                ActiveZone *viewport;
 };