*/
ConnectorType detect_click_position(int _a, int _b);
protected:
- /**Coordenadas de las entrada y salida logica.
- */
- int in_x, in_y, out_x, out_y;
/**Atributos que definen su comportamiento
*/
double capacidad, contenido_inicial;
virtual void on_main_menu_save();
virtual void on_edit_menu_del();
virtual void on_edit_menu_delete_all();
- virtual void on_chk_btn_clicked();
+ virtual void on_chk_btn_logica_clicked();
virtual void on_btn_open_cancel_clicked();
virtual void on_btn_file_ok_clicked();
virtual void on_btn_file_cancel_clicked();
void set_estado(bool _state);
bool get_estado();
protected:
- /**Coordenadas de las entrada y salida logica.
- */
- int in_x, in_y, out_x, out_y;
/**Imagenes en sus 2 posiciones
*/
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
*/
virtual void update_logic_position();
+ /**Dibuja los conectores logicos del Item, AZUL == ENTRADA, ROJO == SALIDA.
+ */
+ virtual void draw_connectors();
+
///Puntero al area de trabajo de la ventana principal
WorkPlace *workplace;
///Posicion del item en el area de trabajo
int x, y;
+
+ ///Posicion de los conectores logicos.
+ int in_x, in_y, out_x, out_y;
};
#endif
///Destructor
virtual ~Pump();
///Funciones redefinidas de CItem
- virtual bool on_expose_event(GdkEventExpose* event);
virtual bool on_button_press_event(GdkEventButton *event);
virtual void on_menu_popup_rotar();
virtual void on_menu_popup_propiedades();
///Detecta si el click fue en el area de entrada o salida logica, devuelve UNDEF si no fue ninguna de las dos
ConnectorType detect_click_position(int _a, int _b);
protected:
- ///Coordenadas de las entrada y salida logica.
- int in_x, in_y, out_x, out_y;
///Indica la maxima capacidad de entrega de la bomba
double entrega;
/// Indica el color del liquido que entrega
*conectarlo mediante una linea a un item de transporte
*/
static int pointed;
+
+ ///Estado de diseño
+ bool *logica;
};
#endif
Conduct::Conduct(int orientacion)
{
+ in_x = -1;
imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/canio_n.png");
imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/canio_s.png");
null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/null.png");
else return is_connected;
}
+/*si no estoy conectado pregunto por el del otro lado, y ahi puedo setear los dos
+ *si ya estoy devuelvo.
+*/
ConnectorType Conduct::get_connector_type(int _a, int _b)
{
CItem *_item;
}
return UNDEF;
}
-/*si no estoy conectado pregunto por el del otro lado, y ahi puedo setear los dos
- *si ya estoy devuelvo.
-*/
+
void Conduct::set_default_connector()
{
btn_check->signal_clicked().connect(SigC::slot(*this,&Constructor::on_btn_check_clicked));
btn_dlg_close->signal_clicked().connect(SigC::slot(*this,&Constructor::on_btn_dlg_connect_clicked));
btn_find->signal_clicked().connect(SigC::slot(*this,&Constructor::on_btn_find_clicked));
- chk_btn_logica->signal_clicked().connect(SigC::slot(*this, &Constructor::on_chk_btn_clicked));
+ chk_btn_logica->signal_clicked().connect(SigC::slot(*this, &Constructor::on_chk_btn_logica_clicked));
quick_btn_new->signal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_new_clicked));
quick_btn_save->signal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_save_clicked));
quick_btn_open->signal_clicked().connect(SigC::slot(*this, &Constructor::on_main_menu_open));
workplace->signal_drag_data_received().connect( SigC::slot(*this, &Constructor::on_item_drop_drag_received) );
workplace->listaItems = &listaItems;
workplace->lista_logic_Items = &lista_logic_Items;
+ workplace->logica = &logica;
logica = false;
}
id = 0;
}
-void Constructor::on_chk_btn_clicked()
+void Constructor::on_chk_btn_logica_clicked()
{
logica = !logica;
CItem::logic_connect = !CItem::logic_connect;
+ workplace->queue_draw();
}
void Constructor::on_load_from_xml()
Drain::Drain(int orientacion)
{
+ in_x = -1;
imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/drain_e.png");
imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/drain_o.png");
imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/drain_n.png");
void CItem::update_logic_position()
{
}
+
+void CItem::draw_connectors()
+{
+ GdkEventExpose event;
+ if ( in_x != -1 ) {
+ CItem::on_expose_event(&event);
+ Glib::RefPtr<Gdk::Window> window = get_window();
+
+ gc->set_foreground(red);
+ gc->set_background(red);
+ window->draw_rectangle(gc, 1, in_x-5-x, in_y-y, 10, 10);
+ gc->set_foreground(blue);
+ gc->set_background(blue);
+ window->draw_rectangle(gc, 1, out_x-5-x, out_y-y-10, 10, 10);
+ }
+}
combo_entry->set_text(name);
WorkPlace::pointed = ID;
if (CItem::logic_connect && CItem::gate_id != -1) {
- if ( detect_click_position(event->x, event->y) == IN) {
+ if ( detect_click_position((int)event->x, (int)event->y) == IN) {
tmp_line.logic_id = workplace->get_logic_item(CItem::gate_id)->get_id();
tmp_line.store_id = ID;
workplace->lista_lineas_in.push_back(tmp_line);
workplace->queue_draw();
- } else if (detect_click_position(event->x, event->y) == OUT) {
+ } else if (detect_click_position((int)event->x, (int)event->y) == OUT) {
tmp_line.logic_id = workplace->get_logic_item(CItem::gate_id)->get_id();
tmp_line.store_id = ID;
workplace->lista_lineas_out.push_back(tmp_line);
out_y = y + 32;
}
}
-
-bool Pump::on_expose_event(GdkEventExpose* event)
-{
- CItem::on_expose_event(event);
- Glib::RefPtr<Gdk::Window> window = get_window();
-
- gc->set_foreground(red);
- gc->set_background(red);
- window->draw_rectangle(gc, 1, image->get_width()-32, 0, 32, 16);
- gc->set_foreground(blue);
- gc->set_background(blue);
- window->draw_rectangle(gc, 1, image->get_width()-32, 16, 32, 16);
- return true;
-}
Splitter::Splitter(int orientacion)
{
+ in_x = -1;
imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/codo_n.png");
imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/codo_s.png");
imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/codo_e.png");
Union::Union(int orientacion)
{
+ in_x = -1;
imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/y_n.png");
imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/y_s.png");
imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/y_e.png");
get_window()->draw_point (get_style()->get_black_gc(), x-1,y);
}
- Glib::RefPtr<Gdk::GC> gc = get_style()->get_black_gc();
- Gdk::Color color;
- color.set_rgb(255,0,0);
- gc->set_rgb_bg_color(color);
- get_style()->set_black(color);
+ if ( *logica ) {
+ std::list<CItem *>::iterator j = listaItems->begin();
+ while ( j != listaItems->end() ) {
+ (*j)->draw_connectors();
+ j++;
+ }
+ }
+
int a, b, w, z;
std::list<t_line>::iterator i = lista_lineas_in.begin();
while ( i != lista_lineas_in.end() ) {