</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>
#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>
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
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
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);
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);
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));
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;
c2.add_arg(conexion->get_host());
c2.add_arg(conexion->get_port());
conexion->send(c2);
- //conexion->finish();
+
}
void Principal::on_mnu_file_connect()
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)
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);
+}
+