</child>
</widget>
+<widget class="GtkDialog" id="dlg_flot">
+ <property name="width_request">225</property>
+ <property name="height_request">93</property>
+ <property name="title" translatable="yes">Error</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">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox5">
+ <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_area4">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
+
+ <child>
+ <widget class="GtkButton" id="btn_dlg_flot_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="GtkLabel" id="label31">
+ <property name="width_request">138</property>
+ <property name="height_request">34</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">El flotante Inferior debe ser menor
+ que el flotante Superior.</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.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
///Objetos de la ventana.
Gtk::SpinButton *spin_inicial, *spin_capacidad, *spin_flot_sup, *spin_flot_inf;
- Gtk::Button *btn_select_color, *dlg_select_color_ok, *dlg_select_color_cancel;
+ Gtk::Button *btn_select_color, *dlg_select_color_ok, *dlg_select_color_cancel, *btn_dlg_flot_ok;
Gtk::Entry *txt_cistern_name;
Gtk::ColorSelectionDialog *color_select_dlg;
Gtk::DrawingArea *color_preview;
+ Gtk::Dialog *dlg_flot;
///Señales invocadas al presionarse algun boton.
virtual void on_btn_accept_clicked();
virtual void on_btn_select_color_clicked();
virtual void on_dlg_select_color_cancel_clicked();
virtual void on_dlg_select_color_ok_clicked();
+ virtual void on_btn_dlg_flot_ok_clicked();
};
#endif
out_y = y + 64;
capacidad = 100.0;
contenido_inicial = 0;
+ flotante_inf = 20;
+ flotante_sup = 80;
imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_e.png");
imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_o.png");
null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_null.png");
void Cistern::save(FILE *archivo)
{
- char c_id[50], c_cap[50], c_x[50], c_y[50], c_img[50], c_ini[50], c_red[50], c_green[50], c_blue[50];
+ char c_id[50], c_cap[50], c_x[50], c_y[50], c_img[50], c_ini[50], c_red[50], c_green[50], c_blue[50], c_float_s[50], c_float_i[50];
Glib::ustring con0, con1;
con0 = "\t\t\t<entrada>"+get_other_name(connect_vec[0].id_dest)+"</entrada>\n";
con1 = "\t\t\t<salida>"+get_other_name(connect_vec[1].id_dest)+"</salida>\n";
sprintf(c_id,"%d",ID);
sprintf(c_cap,"\t\t<capacidad>%.2f</capacidad>\n", capacidad);
sprintf(c_ini,"\t\t<inicial>%.2f</inicial>\n", contenido_inicial);
- sprintf(c_img,"\t\t<orientacion>%d</orientacion>\n",imgActual);
+ sprintf(c_float_s,"\t\t<superior>%.0f</superior>\n",flotante_sup);
+ sprintf(c_float_i,"\t\t\t<inferior>%.0f</inferior>\n",flotante_inf);
+ sprintf(c_img,"\t\t\t<orientacion>%d</orientacion>\n",imgActual);
Glib::ustring dato;
dato = "\t<tanque nombre=\""+name+"\" id=\"";
dato += c_id;
dato += c_blue;
dato += "\t\t</color>\n";
dato += "\t\t<conector>\n"+con0+con1+"\t\t</conector>\n";
+ dato += "\t\t<flotantes>";
+ dato += c_float_s;
+ dato += c_float_i;
+ dato += "\t\t</flotantes>\n";
dato += c_img;
dato += c_x;
dato += c_y;
ref->get_widget("color_select_dlg",color_select_dlg);
ref->get_widget("dlg_select_color_cancel",dlg_select_color_cancel);
ref->get_widget("dlg_select_color_ok",dlg_select_color_ok);
+
+ Glib::RefPtr<Gnome::Glade::Xml> ref2 = Gnome::Glade::Xml::create(PACKAGE_DATA_DIR"/plaqui-constructor/dialogs/constructor.glade", "dlg_flot");
+ ref2->get_widget("dlg_flot",dlg_flot);
+ ref2->get_widget("btn_dlg_flot_ok",btn_dlg_flot_ok);
+
+ btn_dlg_flot_ok->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_btn_dlg_flot_ok_clicked));
btn_select_color->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_btn_select_color_clicked));
dlg_select_color_cancel->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_cancel_clicked));
void CisternPtyWnd::on_btn_accept_clicked()
{
CisternPtyWnd::on_btn_apply_clicked();
- if ( !cistern->workplace->chek_name(txt_cistern_name->get_text(), cistern->get_id()) )
+ if ( !cistern->workplace->chek_name(txt_cistern_name->get_text(), cistern->get_id()) && ( spin_flot_inf->get_value() < spin_flot_sup->get_value() ) )
hide();
}
cistern->set_capacidad( spin_capacidad->get_value() );
cistern->set_contenido_inicial( spin_inicial->get_value() );
cistern->set_name( txt_cistern_name->get_text() );
- cistern->set_flotante_inf(spin_flot_inf->get_value() );
- cistern->set_flotante_sup(spin_flot_sup->get_value() );
color_select_dlg->get_colorsel()->set_current_color(cistern->get_liquid_color());
if ( cistern->workplace->chek_name(txt_cistern_name->get_text(), cistern->get_id()) )
dlg_name->show();
else
cistern->set_name( txt_cistern_name->get_text() );
+ if ( spin_flot_inf->get_value() >= spin_flot_sup->get_value() )
+ dlg_flot->show();
+ else {
+ cistern->set_flotante_inf(spin_flot_inf->get_value() );
+ cistern->set_flotante_sup(spin_flot_sup->get_value() );
+ }
}
void CisternPtyWnd::on_btn_select_color_clicked()
color_preview->modify_bg( Gtk::STATE_NORMAL , cistern->get_liquid_color() );
color_select_dlg->hide();
}
+
+void CisternPtyWnd::on_btn_dlg_flot_ok_clicked()
+{
+ dlg_flot->hide();
+}