]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
* Se agrega dialogo de propiedades para setear la velocidad de actualizacion
authorRicardo Markiewicz <gazer.arg@gmail.com>
Thu, 27 Nov 2003 22:49:58 +0000 (22:49 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Thu, 27 Nov 2003 22:49:58 +0000 (22:49 +0000)
 * Se agregan botones "simular" y "pausar" para manejar la simulacion

Client/AUTHORS
Client/dialogs/client.glade
Client/include/principal.h
Client/src/Makefile.am
Client/src/principal.cpp

index 4b11b05814864c3baac0f871912ef9fa818f141e..baf43b5d1817f701744a9a8e37f110f76395eac8 100644 (file)
@@ -14,6 +14,6 @@ Special Thanks to
        Eric Raymond
        Linus Torvals
        Richard Stallman
-       Gtk+ Deleveloper Team
+       Gtk+ Delevelopment Team
        The Free Software community
 
index 1ca5be1062f47f07ced4d548792a3373fcf5bcc8..f141e549c325fef5b0fb259f3ae9bdab56672d53 100644 (file)
                  </child>
 
                  <child>
-                   <widget class="button" id="bar_disconect">
+                   <widget class="button" id="btn_simular">
                      <property name="visible">True</property>
-                     <property name="label" translatable="yes">Desconectar</property>
+                     <property name="label" translatable="yes">Simular</property>
                      <property name="use_underline">True</property>
+                     <property name="stock_pixmap">gtk-refresh</property>
+                     <property name="new_group">True</property>
                    </widget>
+                   <packing>
+                     <property name="new_group">True</property>
+                   </packing>
                  </child>
 
                  <child>
-                   <widget class="button" id="bar_exit">
+                   <widget class="button" id="btn_pausa">
                      <property name="visible">True</property>
-                     <property name="label">gtk-quit</property>
-                     <property name="use_stock">True</property>
-                     <property name="new_group">True</property>
+                     <property name="label" translatable="yes">Pausar</property>
+                     <property name="use_underline">True</property>
+                     <property name="stock_pixmap">gtk-cancel</property>
                    </widget>
-                   <packing>
-                     <property name="new_group">True</property>
-                   </packing>
                  </child>
                </widget>
              </child>
   </child>
 </widget>
 
+<widget class="GtkDialog" id="dlg_property">
+  <property name="title" translatable="yes">Propiedades</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_CENTER</property>
+  <property name="modal">True</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox2">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="dialog-action_area2">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="btn_prop_cancel">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-cancel</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="response_id">-6</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="btn_prop_ok">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-ok</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="response_id">-5</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkTable" id="table4">
+         <property name="visible">True</property>
+         <property name="n_rows">3</property>
+         <property name="n_columns">3</property>
+         <property name="homogeneous">False</property>
+         <property name="row_spacing">0</property>
+         <property name="column_spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="label19">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Velocidad de SimulaciĆ³n : </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>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkSpinButton" id="spn_velocity">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="climb_rate">1</property>
+             <property name="digits">0</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">1 0 100 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="GtkLabel" id="label20">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">veces/segundos</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>
+           </widget>
+           <packing>
+             <property name="left_attach">2</property>
+             <property name="right_attach">3</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>
index 55555242cab05a963dbd06570d0015be7b8d5957..5c8e3685a568d764e7b05fd2b3e33659b26ed4cc 100644 (file)
@@ -6,6 +6,7 @@
 #include <gtkmm.h>
 #include <libglademm.h>
 #include "dlg_conectar.h"
+#include "dlg_property.h"
 #include "plaqui/server/controlclient.h"
 #include <libxml/parser.h>
 #include <map>
@@ -50,12 +51,13 @@ protected:
        ViewItem *last_selected;
        // Dialogo de Conectar
        DlgConectar *dlg_conectar;
+       DlgProperty *dlg_property;
        Gtk::Entry *txt_target, *txt_command, *txt_args;
        Gtk::TextView *txt_view;
        Gtk::Fixed *work_place;
        Gtk::Label *lbl_nombre, *lbl_color, *lbl_flujo, *lbl_extra, *lbl_cap_flujo, *lbl_cap_extra;
        Gtk::Image *ico_conected;
-       Gtk::Button *btn_activar;
+       Gtk::Button *btn_activar, *btn_simulate, *btn_pause;
        Gtk::DrawingArea *color_preview;
 
        // Actualiza las propiedades en la ventana del item actual
@@ -66,10 +68,13 @@ protected:
        virtual void on_mnu_file_connect();
        virtual void on_mnu_file_disconnect();
        virtual void on_mnu_help_about();
+       virtual void on_mnu_property();
+       virtual void on_dlg_property_ok();
        virtual void on_dlg_connect_ok();
        virtual void on_get_clicked();
        virtual void on_btn_activar_clicked();
-
+       virtual void on_btn_simulate_clicked();
+       virtual void on_btn_pause_clicked();
        virtual bool on_item_clicked(GdkEventButton *, ViewItem *);
        
        // Callbacks para las conexiones
index c2e20b437c68ba7db03cdfa0d0f0ba2338717f22..608e64e46c3b33c4900337b65cd4f38de0404394 100644 (file)
@@ -12,6 +12,7 @@ bin_PROGRAMS = plaqui-client
 plaqui_client_SOURCES = main.cpp \
                                                                                                principal.cpp \
                                                                                                dlg_conectar.cpp \
+                                                                                               dlg_property.cpp \
                                                                                                item.cpp \
                                                                                                item_pump.cpp \
                                                                                                item_codo.cpp \
index fab75526ea72f3507c8d3311d4451ff291b0afc3..cb4a8532ed4f9b92b4211739f2418c13d7853952 100644 (file)
@@ -21,7 +21,10 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &
        txt_target = txt_command = txt_args = 0;
        work_place = 0;
        lbl_cap_flujo = lbl_cap_extra = lbl_extra = lbl_nombre = lbl_color = lbl_flujo = 0;
+       btn_simulate = btn_pause = 0;
 
+       rg->get_widget("btn_pausa", btn_pause);
+       rg->get_widget("btn_simular", btn_simulate);
        rg->get_widget("btn_activar", btn_activar);
        rg->get_widget("color_preview", color_preview);
        rg->get_widget("lbl_nombre", lbl_nombre);
@@ -34,6 +37,7 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &
        rg->get_widget("mnu_file_exit", exit);
        rg->get_widget("mnu_help_about", about);
        rg->get_widget("mnu_prop", mnu_prop);
+       rg->get_widget_derived("dlg_property", dlg_property);
        rg->get_widget_derived("dlgConectar", dlg_conectar);
        rg->get_widget("btn_get", btn_get);
        rg->get_widget("txt_view", txt_view);
@@ -44,7 +48,9 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &
        rg->get_widget("work_place", work_place);
        rg->get_widget("ico_conected", ico_conected);
 
+       dlg_property->get_ok_button()->signal_clicked().connect( SigC::slot(*this, &Principal::on_dlg_property_ok) );
        dlg_conectar->get_ok_button()->signal_clicked().connect( SigC::slot(*this, &Principal::on_dlg_connect_ok) );
+       mnu_prop->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_property));
        mnu_disconnect->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_disconnect));
        conect->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_connect));
        bar_connect->signal_clicked().connect( SigC::slot(*this, &Principal::on_mnu_file_connect));
@@ -52,7 +58,9 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &
        about->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_help_about));
        btn_get->signal_clicked().connect( SigC::slot(*this, &Principal::on_get_clicked) );
        btn_activar->signal_clicked().connect( SigC::slot(*this, &Principal::on_btn_activar_clicked) );
-
+       btn_simulate->signal_clicked().connect( SigC::slot(*this, &Principal::on_btn_simulate_clicked) );
+       btn_pause->signal_clicked().connect( SigC::slot(*this, &Principal::on_btn_pause_clicked) );
+       
        conexion = NULL;
        is_xml_loaded = false;
        last_selected = NULL;
@@ -138,7 +146,7 @@ void Principal::on_mnu_file_disconnect()
        c2.add_arg(conexion->get_host());
        c2.add_arg(conexion->get_port());
        conexion->send(c2);
-       //conexion->finish();
+
 }
 
 void Principal::on_mnu_file_connect()
@@ -223,6 +231,12 @@ void Principal::on_conexion_finished()
        txt_view->get_buffer()->insert_at_cursor("HANG UP\n");
        ico_conected->set( Gtk::Stock::NO , Gtk::IconSize(Gtk::ICON_SIZE_LARGE_TOOLBAR));
        conexion = NULL;
+       // Elimino la planta    
+       std::map<const std::string, ViewItem *>::iterator i;
+       for(i=mapItems.begin(); i!=mapItems.end(); i++) {
+               delete i->second;
+       }
+       mapItems.clear();
 }
 
 void Principal::on_conexion_ok(const std::string &body)
@@ -641,3 +655,38 @@ bool Principal::get_bool_from_xml(xmlNodePtr nodo)
        return tmp == "true";
 }
 
+void Principal::on_mnu_property()
+{
+       dlg_property->show();
+}
+
+void Principal::on_dlg_property_ok()
+{
+       if (conexion) {
+               PlaQui::Server::Command c("plant", "set_frequency");
+               c.add_arg("default");
+               c.add_arg( dlg_property->get_velocity() );
+
+               conexion->send(c);
+       }
+       dlg_property->hide();
+}
+
+void Principal::on_btn_simulate_clicked()
+{
+       if (conexion == NULL) return;
+
+       PlaQui::Server::Command c("plant", "start");
+       c.add_arg("default");
+       conexion->send(c);
+}
+
+void Principal::on_btn_pause_clicked()
+{
+       if (conexion == NULL) return;
+
+       PlaQui::Server::Command c("plant", "stop");
+       c.add_arg("default");
+       conexion->send(c);
+}
+