#include <unistd.h>
#include <glibmm/thread.h>
+#define INFINITO 99999999
+
Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Window(co),refXml(rg)
{
Gtk::MenuItem *conect=0, *exit=0, *about=0, *mnu_prop=0, *mnu_disconnect=0;
update_ui.connect( SigC::slot(*this, &Principal::update_items_prop ) );
load_xml_dispatch.connect( SigC::slot(*this, &Principal::loadXML ) );
gc = Gdk::GC::create(get_window());
+ color_low = Gdk::Color("blue");
+ color_high = Gdk::Color("red");
+ Gtk::Widget::get_default_colormap()->alloc_color(color_low);
+ Gtk::Widget::get_default_colormap()->alloc_color(color_high);
}
Principal::~Principal()
ViewItem *tmp = find_item(*linea);
x2 = tmp->x + tmp->out_x;
y2 = tmp->y + tmp->out_y;
+ if (tmp->get_open()) {
+ gc->set_foreground(color_high);
+ } else {
+ gc->set_foreground(color_low);
+ }
gc->set_line_attributes(3, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
window->draw_line(gc, x2+tmp->item_offset_x, y2+tmp->item_offset_y, x2+tmp->item_offset_x, y1+i->second->offset_y);
window->draw_line(gc, x2+tmp->item_offset_x, y1+i->second->offset_y, x1+i->second->offset_x, y1+i->second->offset_y);
ViewItem *tmp = find_item(*linea);
x2 = tmp->x + tmp->in_x;
y2 = tmp->y + tmp->in_y;
+ if (i->second->get_open()) {
+ gc->set_foreground(color_high);
+ } else {
+ gc->set_foreground(color_low);
+ }
gc->set_line_attributes(3, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
window->draw_line(gc, x1+i->second->offset_x, y1+i->second->offset_y, x1+i->second->offset_x, y2+tmp->item_offset_y);
window->draw_line(gc, x1+i->second->offset_x, y2+tmp->item_offset_y, x2+tmp->item_offset_x, y2+tmp->item_offset_y);
for(i=mapItems.begin(); i!=mapItems.end(); i++) {
i->second->queue_draw();
}
-
+ work_place->queue_draw();
}
void Principal::on_conexion_frame(const std::string &frame)
tmp_b = get_bool_from_xml(items->children);
item_name = (char *)xmlGetProp(items, BAD_CAST"name");
mapItems[item_name]->set_open(tmp_b);
- } else if (xmlStrcmp(items->name, BAD_CAST"color")==0) {
+ } else if (xmlStrcmp(items->name, BAD_CAST"logic")==0) {
+ tmp_b = get_bool_from_xml(items->children);
+ item_name = (char *)xmlGetProp(items, BAD_CAST"name");
+ mapItems[item_name]->set_open(tmp_b);
+ } else if (xmlStrcmp(items->name, BAD_CAST"color")==0) {
item_name = (char *)xmlGetProp(items, BAD_CAST"name");
mapItems[item_name]->set_color( get_rgb_from_xml(items->children) );
} else if (xmlStrcmp(items->name, BAD_CAST"tank")==0) {
}
nodo = nodo->next;
}
+ if (tmp == INFINITO) tmp = 0;
return tmp;
}