2 #include "pumpptywnd.h"
6 imageE = Gdk::Pixbuf::create_from_file("bomba_e.png");
7 imageO = Gdk::Pixbuf::create_from_file("bomba_o.png");
8 null = Gdk::Pixbuf::create_from_file("bomba_null.png");
11 set_size_request(image->get_width(), image->get_height());
13 Glib::RefPtr<Gnome::Glade::Xml> ref = Gnome::Glade::Xml::create("constructor.glade", "item_pty_wnd");
14 ref->get_widget_derived("item_pty_wnd",pump_pty_wnd);
15 pump_pty_wnd->pump = this;
16 pump_pty_wnd->set_title("Propiedades de la Bomba");
24 bool Pump::on_button_press_event(GdkEventButton *event)
26 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1))
27 combo_entry->set_text(name);
29 if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
31 image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
41 set_size_request(image->get_width(),image->get_height());
42 image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
45 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
46 menu_popup.popup(event->button, event->time);
47 return true; //It has been handled.
50 if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
51 pump_pty_wnd->spin_caudal->set_value( entrega );
52 pump_pty_wnd->txt_item_name->set_text( name );
58 void Pump::on_menu_popup_rotar()
61 event.type = GDK_BUTTON_PRESS;
63 Pump::on_button_press_event(&event);
66 void Pump::on_menu_popup_propiedades()
69 event.type = GDK_2BUTTON_PRESS;
71 Pump::on_button_press_event(&event);
74 void Pump::set_entrega(double _ent)
79 double Pump::get_entrega()
84 void Pump::save(FILE *archivo)
86 char c_id[50], c_entrega[50], c_x[50], c_y[50], c_img[50];
87 sprintf(c_x,"\t\t<x>%d</x>\n",x);
88 sprintf(c_y,"\t\t<y>%d</y>\n",y);
89 sprintf(c_id,"%d",ID);
90 sprintf(c_entrega,"\t\t<entrega>%.2f</entrega>\n", entrega);
91 sprintf(c_img,"\t\t<orientacion>%d</orientacion>\n",imgActual);
93 dato = "\t<bomba nombre=\""+name+"\" id=\"";
100 dato += "\t</bomba>\n";
101 fprintf(archivo,dato.c_str());
104 bool Pump::check_connection()
106 switch (get_img_actual()) {
108 if ( is_other_occupied_area( get_position_x()+get_image()->get_width()+10 , get_position_y() +10) )
112 if ( is_other_occupied_area( get_position_x() -10, get_position_y() -10) )