]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/src/pumpptywnd.cpp
- Se agrega TODO del proyecto.
[z.facultad/75.42/plaqui.git] / Constructor / src / pumpptywnd.cpp
1 #include "pumpptywnd.h"
2 #include "pump.h"
3
4 PumpPtyWnd::PumpPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):PropertyWnd(cobject, refGlade)
5 {
6         refGlade->get_widget("btn_select_color",btn_select_color);
7         refGlade->get_widget("spin_fluid",spin_fluid);
8         refGlade->get_widget("txt_pump_name",txt_pump_name);
9         refGlade->get_widget("color_preview",color_preview);
10         
11         Glib::RefPtr<Gnome::Glade::Xml> ref = Gnome::Glade::Xml::create(PACKAGE_DATA_DIR"/plaqui-constructor/dialogs/constructor.glade", "color_select_dlg");
12         ref->get_widget("color_select_dlg",color_select_dlg);
13         ref->get_widget("dlg_select_color_cancel",dlg_select_color_cancel);
14         ref->get_widget("dlg_select_color_ok",dlg_select_color_ok);
15
16         btn_select_color->signal_clicked().connect(SigC::slot(*this,&PumpPtyWnd::on_btn_select_color_clicked));
17         dlg_select_color_cancel->signal_clicked().connect(SigC::slot(*this,&PumpPtyWnd::on_dlg_select_color_cancel_clicked));
18         dlg_select_color_ok->signal_clicked().connect(SigC::slot(*this,&PumpPtyWnd::on_dlg_select_color_ok_clicked));
19         pump = NULL;
20 }
21
22 PumpPtyWnd::~PumpPtyWnd()
23 {
24 }
25  
26 void PumpPtyWnd::show()
27 {
28         if (pump != NULL) {
29                 color_preview->modify_bg( Gtk::STATE_NORMAL , pump->get_liquid_color() );
30         }
31         PropertyWnd::show();
32 }
33
34 void PumpPtyWnd::on_btn_accept_clicked()
35 {
36         PumpPtyWnd::on_btn_apply_clicked();
37         if ( !pump->workplace->chek_name(txt_pump_name->get_text(), pump->get_id()) ) 
38         hide();
39 }
40
41 void PumpPtyWnd::on_btn_apply_clicked()
42 {
43         pump->set_entrega( spin_fluid->get_value() );
44         color_select_dlg->get_colorsel()->set_current_color(pump->get_liquid_color());
45         if ( pump->workplace->chek_name(txt_pump_name->get_text(), pump->get_id()) ) 
46                 dlg_name->show();
47         else 
48                 pump->set_name( txt_pump_name->get_text() );
49 }
50
51 void PumpPtyWnd::on_btn_select_color_clicked()
52 {
53         // poner un preview del color seleccionado
54         color_select_dlg->get_colorsel()->set_current_color(pump->get_liquid_color());
55         color_select_dlg->show();
56 }
57
58 void PumpPtyWnd::on_dlg_select_color_cancel_clicked()
59 {
60         color_select_dlg->hide();
61 }
62
63 void PumpPtyWnd::on_dlg_select_color_ok_clicked()
64 {       
65         pump->set_liquid_color( color_select_dlg->get_colorsel()->get_current_color() );
66         color_preview->modify_bg( Gtk::STATE_NORMAL , pump->get_liquid_color() );
67         color_select_dlg->hide();
68 }