///Destructor.
virtual ~CisternPtyWnd();
-
+
+ virtual void show();
+
///Puntero al Tanque que se le modificaran sus propiedades.
Cistern *cistern;
And *loadAnd(xmlNodePtr nodo);
Not *loadNot(xmlNodePtr nodo);
Or *loadOr(xmlNodePtr nodo);
+ Gdk::Color loadColor(xmlNodePtr nodo);
};
#endif
///Destructor.
virtual ~PumpPtyWnd();
-
+
+ virtual void show();
+
///Puntero al item al cual se le modifcan las propiedades.
Pump *pump;
btn_select_color->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_btn_select_color_clicked));
dlg_select_color_cancel->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_cancel_clicked));
dlg_select_color_ok->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_ok_clicked));
+ cistern = NULL;
+}
+
+void CisternPtyWnd::show()
+{
+ if (cistern != NULL) {
+ color_preview->modify_bg( Gtk::STATE_NORMAL , cistern->get_liquid_color() );
+ }
+ PropertyWnd::show();
}
CisternPtyWnd::~CisternPtyWnd()
std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
int orientacion=0, x, y;
float flujo;
+ Gdk::Color color;
nodo = nodo->children;
while (nodo != NULL) {
} else if (xmlStrcmp(nodo->name, BAD_CAST"entrega") == 0) {
flujo = atof( (char *)XML_GET_CONTENT(nodo->children) );
} else if (xmlStrcmp(nodo->name, BAD_CAST"color") == 0) {
- // FIXME !
+ color = loadColor(nodo->children);
}
}
nodo = nodo->next;
p->set_entrega(flujo);
p->set_id( atoi(id.c_str()) );
p->set_name(name);
+ p->set_liquid_color(color);
return p;
}
+Gdk::Color Constructor::loadColor(xmlNodePtr nodo)
+{
+ gushort r,g,b;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"rojo")==0)
+ r = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ if (xmlStrcmp(nodo->name, BAD_CAST"verde")==0)
+ g = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ if (xmlStrcmp(nodo->name, BAD_CAST"azul")==0)
+ b = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ }
+ nodo = nodo->next;
+ }
+ Gdk::Color c;
+ c.set_rgb(r,g,b);
+ std::cout << r << " " << g << " " << b << std::endl;
+ return c;
+}
+
Conduct *Constructor::loadConduct(xmlNodePtr nodo)
{
std::string name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
std::string id = (char *)xmlGetProp(nodo, BAD_CAST"id");
int orientacion=0, x, y;
float liquido,capacidad;
+ Gdk::Color color;
nodo = nodo->children;
while (nodo != NULL) {
capacidad = atof ((char *)XML_GET_CONTENT(nodo->children) );
} else if (xmlStrcmp(nodo->name, BAD_CAST"inicial") == 0) {
liquido = atof ((char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"color") == 0) {
+ color = loadColor(nodo->children);
}
}
nodo = nodo->next;
p->set_name(name);
p->set_capacidad(capacidad);
p->set_contenido_inicial(liquido);
-
+ p->set_liquid_color(color);
return p;
}
CItem *_item;
switch (imgActual) {
case 1:
- if ( (_a <= x+image->get_width()-10 )&&(_a >= x + 10) && (_b <= y+10) &&(_b > 0 ) ){ //arriba
+ if ( (_a <= x+image->get_width()-10 )&&(_a >= x + 10) && (_b <= y+10) &&(_b > y ) ){ //arriba
if ( is_connected ) return connect_vec[0].type;
connect_vec[1].type = is_other_connection_area(get_position_x()+16, get_position_y()+get_image()->get_height() +5, &_item); //pregunto que hay abajo
switch ( connect_vec[1].type ) {
}
break;
case 0:
- if ((_a <= x+10 )&&(_a > 0) && (_b <= y+image->get_height()-10) &&(_b >= y+10 )){ //izquierda
+ if ((_a <= x+10 )&&(_a > x) && (_b <= y+image->get_height()-10) &&(_b >= y+10 )){ //izquierda
if ( is_connected ) return connect_vec[0].type;
connect_vec[1].type = is_other_connection_area(get_position_x()+get_image()->get_width()+5, get_position_y()+16, &_item);//pregunto por la derecha
switch ( connect_vec[1].type ) {
Glib::ustring CItem::get_other_name(int _id)
{
std::list<CItem *>::iterator i = listaItems->begin();
+ std::cout << name << " " << _id << std::endl;
while ( i != listaItems->end() ) {
if ( (*i)->get_id() == _id )
return (*i)->get_name();
temp = is_other_connection_area( get_position_x() -5, get_position_y() +16, &_item);
}
if (is_connected = ( temp == IN) ) {
+ std::cout << "PUMP " << _item->get_id() << std::endl;
connect_vec[0].id_dest = _item->get_id();
return is_connected;
}
btn_select_color->signal_clicked().connect(SigC::slot(*this,&PumpPtyWnd::on_btn_select_color_clicked));
dlg_select_color_cancel->signal_clicked().connect(SigC::slot(*this,&PumpPtyWnd::on_dlg_select_color_cancel_clicked));
dlg_select_color_ok->signal_clicked().connect(SigC::slot(*this,&PumpPtyWnd::on_dlg_select_color_ok_clicked));
+ pump = NULL;
}
PumpPtyWnd::~PumpPtyWnd()
{
}
+void PumpPtyWnd::show()
+{
+ if (pump != NULL) {
+ color_preview->modify_bg( Gtk::STATE_NORMAL , pump->get_liquid_color() );
+ }
+ PropertyWnd::show();
+}
+
void PumpPtyWnd::on_btn_accept_clicked()
{
PumpPtyWnd::on_btn_apply_clicked();