From: Nicolás Dimov Date: Mon, 1 Dec 2003 15:09:58 +0000 (+0000) Subject: se validan valores del tanque X-Git-Tag: svn_import~122 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/ce820fc7d9a8552468fe0e60f83d08c890270d38?ds=sidebyside se validan valores del tanque --- diff --git a/Constructor/dialogs/constructor.glade b/Constructor/dialogs/constructor.glade index 6c2ca14..631d18b 100644 --- a/Constructor/dialogs/constructor.glade +++ b/Constructor/dialogs/constructor.glade @@ -2105,4 +2105,73 @@ Ingrese un nombre distinto para este elemento + + 225 + 93 + Error + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + True + False + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_SPREAD + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 138 + 34 + True + El flotante Inferior debe ser menor + que el flotante Superior. + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + diff --git a/Constructor/include/cisternptywnd.h b/Constructor/include/cisternptywnd.h index e04d703..b62f5ec 100644 --- a/Constructor/include/cisternptywnd.h +++ b/Constructor/include/cisternptywnd.h @@ -22,10 +22,11 @@ class CisternPtyWnd : public PropertyWnd { ///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(); @@ -33,6 +34,7 @@ class CisternPtyWnd : public PropertyWnd { 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 diff --git a/Constructor/src/cistern.cpp b/Constructor/src/cistern.cpp index 060f524..812b88c 100644 --- a/Constructor/src/cistern.cpp +++ b/Constructor/src/cistern.cpp @@ -10,6 +10,8 @@ Cistern::Cistern(int orientacion) 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"); @@ -208,7 +210,7 @@ Gdk::Color Cistern::get_liquid_color() 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"+get_other_name(connect_vec[0].id_dest)+"\n"; con1 = "\t\t\t"+get_other_name(connect_vec[1].id_dest)+"\n"; @@ -220,7 +222,9 @@ void Cistern::save(FILE *archivo) sprintf(c_id,"%d",ID); sprintf(c_cap,"\t\t%.2f\n", capacidad); sprintf(c_ini,"\t\t%.2f\n", contenido_inicial); - sprintf(c_img,"\t\t%d\n",imgActual); + sprintf(c_float_s,"\t\t%.0f\n",flotante_sup); + sprintf(c_float_i,"\t\t\t%.0f\n",flotante_inf); + sprintf(c_img,"\t\t\t%d\n",imgActual); Glib::ustring dato; dato = "\t\n"; + dato += "\t\t"; + dato += c_float_s; + dato += c_float_i; + dato += "\t\t\n"; dato += c_img; dato += c_x; dato += c_y; diff --git a/Constructor/src/cisternptywnd.cpp b/Constructor/src/cisternptywnd.cpp index d12595c..c63c57f 100644 --- a/Constructor/src/cisternptywnd.cpp +++ b/Constructor/src/cisternptywnd.cpp @@ -15,6 +15,12 @@ CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtrget_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 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)); @@ -37,7 +43,7 @@ CisternPtyWnd::~CisternPtyWnd() 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(); } @@ -46,13 +52,17 @@ void CisternPtyWnd::on_btn_apply_clicked() 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() @@ -72,3 +82,8 @@ void CisternPtyWnd::on_dlg_select_color_ok_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(); +}