virtual ~ViewPump();
virtual std::string get_cap_extra() { return "Estado"; }
virtual std::string get_extra() { return (open)?"Encendida":"Apagada"; }
+ bool on_image_expose_event(GdkEventExpose *e);
};
#endif
{
Glib::RefPtr<Gdk::Colormap> colormap = image.get_colormap();
Gdk::Color blanco = Gdk::Color("white");
- colormap->alloc_color(blanco);
colormap->alloc_color(color);
- gc->set_foreground(blanco);
- gc->set_background(blanco);
+ 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;
switch (m_or) {
case 0:
image.get_window()->draw_arc(gc, 0, -16, 16, w, h, 0, 90*64);
- gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
- gc->set_foreground(color);
- image.get_window()->draw_arc(gc, 0, -16, 16, w, h, 0, 90*64);
+ image.get_window()->draw_line(gc, 0, 16, 16, 16);
+ image.get_window()->draw_line(gc, 64-16, 64-16, 64-16, 64);
break;
case 1:
image.get_window()->draw_arc(gc, 0, -16, -16, w, h, 0*64, -90*64);
- gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
- gc->set_foreground(color);
- image.get_window()->draw_arc(gc, 0, -16, -16, w, h, 0*64, -90*64);
+ image.get_window()->draw_line(gc, 64-16, 0, 64-16, 16);
+ image.get_window()->draw_line(gc, 0, 64-16, 16, 64-16);
break;
case 2:
image.get_window()->draw_arc(gc, 0, 16, -16, w, h, -90*64, -90*64);
- gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
- gc->set_foreground(color);
- image.get_window()->draw_arc(gc, 0, 16, -16, w, h, -90*64, -90*64);
+ image.get_window()->draw_line(gc, 16, 0, 16, 16);
+ image.get_window()->draw_line(gc, 64-16, 64-16, 64, 64-16);
break;
case 3:
image.get_window()->draw_arc(gc, 0, 16, 16, w, h, 90*64, 90*64);
- gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
- gc->set_foreground(color);
- image.get_window()->draw_arc(gc, 0, 16, 16, w, h, 90*64, 90*64);
+ image.get_window()->draw_line(gc, 16, 64-16, 16, 64);
+ image.get_window()->draw_line(gc, 64-16, 16, 64, 16);
}
+ return true;
}
int w,h;
w = image.get_width();
h = image.get_height();
+ if (actual_flow == 0) return true;
switch (m_or) {
case 0: // Vertical
- image.get_window()->draw_rectangle(gc, 1, w/2-2, 0, 4, h-1);
- gc->set_foreground(blanco);
- image.get_window()->draw_rectangle(gc, 0, w/2-3, 0, 6, h-1);
+ image.get_window()->draw_rectangle(gc, 1, w/2-3, 0, 6, h);
break;
case 1: // Horizontal
- image.get_window()->draw_rectangle(gc, 1, 0, h/2-2, w-1, 4);
- gc->set_foreground(blanco);
- image.get_window()->draw_rectangle(gc, 0, 0, h/2-3, w-1, 6);
+ image.get_window()->draw_rectangle(gc, 1, 0, h/2-3, w, 6);
}
+ return true;
}
+
int w,h;
w = image.get_width();
h = image.get_height();
+ if (actual_flow == 0) return true;
switch (m_or) {
case 1: // Vertical
- image.get_window()->draw_rectangle(gc, 1, w/2-2, 0, 4, h);
+ image.get_window()->draw_rectangle(gc, 1, w/2-3, 0, 6, h);
break;
case 0: // Horizontal
- image.get_window()->draw_rectangle(gc, 1, 0, h/2-2, w, 4);
+ image.get_window()->draw_rectangle(gc, 1, 0, h/2-3, w, 6);
}
+ return true;
}
item_offset_x = 0;
item_offset_y = -15;
}
+ m_or = orientacion;
image.show();
set_size_request();
}
{
}
+bool ViewPump::on_image_expose_event(GdkEventExpose *e)
+{
+ Glib::RefPtr<Gdk::Colormap> colormap = image.get_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);
+ if (actual_flow == 0) return true;
+ switch (m_or) {
+ case 0:
+ image.get_window()->draw_arc(gc, 1, 8, 8, 16, 16, 0, 360*64);
+ image.get_window()->draw_line(gc, 16, 16, 96, 16);
+ break;
+ case 1:
+ image.get_window()->draw_arc(gc, 1, 72, 8, 16, 16, 0, 360*64);
+ image.get_window()->draw_line(gc, 80, 16, 0, 16);
+ }
+ return true;
+}
bool ViewUnion::on_image_expose_event(GdkEventExpose *e)
{
Glib::RefPtr<Gdk::Colormap> colormap = image.get_colormap();
- Gdk::Color blanco = Gdk::Color("white");
colormap->alloc_color(color);
- colormap->alloc_color(blanco);
gc->set_foreground(color);
gc->set_background(color);
int w,h;
w = image.get_width();
h = image.get_height();
- switch (m_or) {
- case 0:
- image.get_window()->draw_rectangle(gc, 1, w/2-2, h/2, 4, h/2);
- gc->set_foreground(blanco);
- image.get_window()->draw_rectangle(gc, 0, w/2-3, h/2-1, 6, h/2);
- break;
- case 1:
- image.get_window()->draw_rectangle(gc, 1, 0, h/2-2, w/2, 4);
- break;
- case 2:
- image.get_window()->draw_rectangle(gc, 1, w/2-2, 0, 4, h/2);
- break;
- case 3:
- image.get_window()->draw_rectangle(gc, 1, w/2, h/2-2, w/2, 4);
+ if (actual_flow > 0) {
+ switch (m_or) {
+ case 0:
+ image.get_window()->draw_rectangle(gc, 1, w/2-3, 16, 6, h-16);
+ image.get_window()->draw_rectangle(gc, 1, 0, 13, w, 6);
+ break;
+ case 1:
+ image.get_window()->draw_rectangle(gc, 1, 0, h/2-3, w/2, 6);
+ image.get_window()->draw_rectangle(gc, 1, 51, 0, 6, h);
+ break;
+ case 2:
+ image.get_window()->draw_rectangle(gc, 1, w/2-3, 0, 6, h/2);
+ image.get_window()->draw_rectangle(gc, 1, 0, 51, w, 6);
+ break;
+ case 3:
+ image.get_window()->draw_rectangle(gc, 1, w/2, h/2-3, w/2, 6);
+ image.get_window()->draw_rectangle(gc, 1, 16, 0, 6, h);
+ }
}
+ return true;
}
+
Gdk::Color Principal::get_rgb_from_xml(xmlNodePtr nodo)
{
- unsigned r,g,b;
+ gushort r,g,b;
while (nodo != NULL) {
if (nodo->type == XML_ELEMENT_NODE) {
if (xmlStrcmp(nodo->name, BAD_CAST"r")==0)
}
nodo = nodo->next;
}
- r = 65535 * r / 255;
- g = 65535 * g / 255;
- b = 65535 * b / 255;
+ r = static_cast<gushort>(65535 * (r / 255.0f));
+ g = static_cast<gushort>(65535 * (g / 255.0f));
+ b = static_cast<gushort>(65535 * (b / 255.0f));
Gdk::Color c;
c.set_rgb(r,g,b);
-
return c;
}
+
float Principal::get_float_from_xml(xmlNodePtr nodo)
{
float tmp = -1;
return (*this);
}
+ bool operator == (const RGB &c) {
+ return ((r()==c.r()) && (g() == c.g()) && (b() == c.b()));
+ }
+
color r() const { return my_r; }
color g() const { return my_g; }
color b() const { return my_b; }
int in_colors;
RGB color1, color2;
float flow1, flow2;
+ PlantItem *entrada1;
private:
Union(const Union &):Transport("null") {}
Union &operator = (const Union &) { return *this; }
case MSG_RESPONSE_COLOR:
if (in_colors == 0) {
color1 = *((RGB *)data);
- flow1 = static_cast<PlantItem *>(who)->get_actual_flow();
+ entrada1 = static_cast<PlantItem *>(who);
+ flow1 = entrada1->get_actual_flow();
in_colors++;
- } else {
+ } else if ((in_colors == 1) && (entrada1 != who)) {
color2 = *((RGB *)data);
flow2 = static_cast<PlantItem *>(who)->get_actual_flow();
+ in_colors++;
+ if (color1 == color2) {
+ std::cout << "TODO MAL" << std::endl << std::endl;
+ }
/* Ya tengo mis 2 colores, los sumo */
int r,g,b;