]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/src/itemptywnd.cpp
Mini bugfix.
[z.facultad/75.42/plaqui.git] / Constructor / src / itemptywnd.cpp
1 #include "itemptywnd.h"
2 #include "item.h"
3
4 ItemPtyWnd::ItemPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):PropertyWnd(cobject,refGlade)
5 {
6         refGlade->get_widget("spin_caudal", spin_caudal);
7         refGlade->get_widget("txt_item_name",txt_item_name);
8         refGlade->get_widget("rd_btn_division", rd_btn_division);
9         refGlade->get_widget("rd_btn_union", rd_btn_union);
10         refGlade->get_widget("lb_type", lb_type);
11         refGlade->get_widget("lb_max_fluid", lb_max_fluid);
12         Gtk::RadioButton::Group group;
13         rd_btn_division->set_group( group );
14         rd_btn_union->set_group( group );
15         rd_btn_division->signal_clicked().connect(SigC::slot(*this,&ItemPtyWnd::on_rd_btn_division_clicked));
16         rd_btn_union->signal_clicked().connect(SigC::slot(*this,&ItemPtyWnd::on_rd_btn_union_clicked));
17 }
18
19 ItemPtyWnd::~ItemPtyWnd()
20 {
21 }
22
23 void ItemPtyWnd::on_btn_accept_clicked()
24 {
25         on_btn_apply_clicked();
26         if ( !item->workplace->chek_name(txt_item_name->get_text(), item->get_id()) ) 
27         hide();
28 }
29
30 void ItemPtyWnd::on_btn_apply_clicked()
31 {
32         item->set_caudal( spin_caudal->get_value() );   
33         item->set_name( txt_item_name->get_text() );    
34         if ( item->workplace->chek_name(txt_item_name->get_text(), item->get_id()) ) 
35                 dlg_name->show();
36         else 
37                 item->set_name( txt_item_name->get_text() );
38 }
39
40 void ItemPtyWnd::on_btn_cancel_clicked()
41 {
42         hide();
43 }
44
45 void ItemPtyWnd::on_rd_btn_union_clicked()
46 {
47         Glib::ustring name;
48         char char_id[10];
49         sprintf(char_id,"%d",item->get_id());
50         name = "union";
51         name += char_id;
52         item->connect_vec[0].type = IN;
53         item->connect_vec[1].type = IN; 
54         item->connect_vec[2].type = OUT;
55         item->set_name(name);
56         txt_item_name->set_text( item->get_name() );
57         item->is_union = true;
58 }
59
60 void ItemPtyWnd::on_rd_btn_division_clicked()
61 {
62         Glib::ustring name;
63         char char_id[10];
64         sprintf(char_id,"%d",item->get_id());
65         name = "division";
66         name += char_id;
67         item->connect_vec[0].type = OUT;
68         item->connect_vec[1].type = OUT;
69         item->connect_vec[2].type = IN;
70         item->set_name(name);
71         txt_item_name->set_text( item->get_name() );
72         item->is_union = false;
73 }