public:
ViewDrain(Glib::ustring _name, int orientacion);
virtual ~ViewDrain();
+ bool on_image_expose_event(GdkEventExpose *e);
};
#endif
virtual std::string get_cap_flow() { return "Capacidad :"; }
virtual std::string get_cap_extra() { return "Liquido :"; }
virtual std::string get_extra();
+ bool on_image_expose_event(GdkEventExpose *e);
};
#endif
bool ViewCodo::on_image_expose_event(GdkEventExpose *e)
{
Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
- Gdk::Color blanco = Gdk::Color("white");
colormap->alloc_color(color);
gc->set_foreground(color);
gc->set_background(color);
{
}
+bool ViewDrain::on_image_expose_event(GdkEventExpose *e)
+{
+ Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
+ colormap->alloc_color(color);
+ gc->set_foreground(color);
+ gc->set_background(color);
+ gc->set_line_attributes(6, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
+ int w,h;
+ w = image.get_width();
+ h = image.get_height();
+ // TODO : hacer que dibuje arcos en el sentido del codo!
+ if (actual_flow == 0) return true;
+ image.get_window()->draw_arc(gc, 1, 8, 8, 16, 16, 0, 360*64);
+ return true;
+}
return s;
}
+bool ViewTank::on_image_expose_event(GdkEventExpose *e)
+{
+ Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
+ colormap->alloc_color(color);
+ gc->set_foreground(color);
+ gc->set_background(color);
+ gc->set_line_attributes(6, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
+ int w,h;
+ w = image.get_width();
+ h = image.get_height();
+ // TODO : hacer que dibuje arcos en el sentido del codo!
+ if (actual_flow == 0) return true;
+ image.get_window()->draw_arc(gc, 1, w/2-7, h/2-7, 14, 14, 0, 360*64);
+ return true;
+}
#endif
updated = false;
color_updated = false;
- actual_flow = 0;
}
void Drainage::recieve_msg(int msg, IConector *who, void *data)
case MSG_QUERY_COLOR:
if (color_updated) {
who->recieve_msg(MSG_RESPONSE_COLOR, this, &fluid_color);
+ return;
}
update_color();
who->recieve_msg(MSG_RESPONSE_COLOR, this, &fluid_color);
{
if (color_updated) return;
- send_msg(IConector::IN, MSG_QUERY_COLOR);
color_updated = true;
+ send_msg(IConector::IN, MSG_QUERY_COLOR);
}
void PlantItem::get_state_as_xml(std::stringstream &out)
capacidad = atoi( (char *)XML_GET_CONTENT(nodo->children) );
} else if (xmlStrcmp(nodo->name, BAD_CAST"inicial") == 0) {
inicial = atof( (char *)XML_GET_CONTENT(nodo->children) );
- } else if (xmlStrcmp(nodo->name, BAD_CAST"") == 0) {
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"color") == 0) {
color = loadRGB(nodo->children);
}
}
if (*((float *)data) < actual_in_flow)
actual_in_flow = *((float *)data);
actual_out_flow = litros;
+ updated = true;
send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_out_flow);
who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &actual_in_flow);
- updated = true;
break;
case MSG_RESPONSE_MAX_FLOW:
if (pos == OUT) {
}
break;
case MSG_RESPONSE_COLOR:
+ {
RGB c = *((RGB *)data);
PlantItem *ic = static_cast<PlantItem *>(*(in_list.begin()));
int r,g,b;
g %= 256;
b %= 256;
set_color(RGB(r,g,b));
+ color_updated = true;
+ }
+ break;
+ default:
+ Control::recieve_msg(msg, who, data);
}
}
float m_data = *((float *)data)*2;
float tmp;
- if (updated) {
- float tmp = actual_flow/2.0f;
+/* if (updated) {
+ if (m_data == 0) {
+ tmp = 0;
+ actual_flow /= 2.0f;
+ } else {
+ tmp = actual_flow/2.0f;
+ }
who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &tmp);
break;
- }
+ }*/
updated = true;
if (m_data == 0) {
in_on_zero++;
case 2:
actual_flow = 0;
}
- send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_flow);
+ if (!updated)
+ send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_flow);
tmp = (in_on_zero==0)?actual_flow/2.0f:actual_flow;
who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &tmp);
}