9 imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/and_n.png");
10 imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/and_s.png");
11 imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/and_e.png");
12 imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/and_o.png");
13 null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/null.png");
16 set_size_request(image->get_width(), image->get_height());
18 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Conectar", menu_image_linea,SigC::slot(*this, &CItem::on_menu_popup_conectar) ) ) ;
25 bool And::on_button_press_event(GdkEventButton *event)
27 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
28 CItem::logic_connect = true;
30 combo_entry->set_text(name);
31 WorkPlace::pointed = ID;
34 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
36 image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
68 set_size_request(image->get_width(),image->get_height());
69 image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
71 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
72 menu_popup.popup(event->button, event->time);
73 return true; //It has been handled.
75 workplace->queue_draw();
78 void And::on_menu_popup_rotar()
81 event.type = GDK_BUTTON_PRESS;
83 And::on_button_press_event(&event);
86 void And::save(FILE *archivo)
88 vec_connector.clear();
91 char c_img[50], c_x[50], c_y[50], c_id[50];
92 sprintf(c_id,"%d",ID);
93 sprintf(c_img,"\t\t<orientacion>%d</orientacion>\n",imgActual);
94 sprintf(c_x,"\t\t<x>%d</x>\n",x);
95 sprintf(c_y,"\t\t<y>%d</y>\n",y);
96 dato = "\t<and nombre=\""+name+"\" id=\"";
102 for ( int i=0; i<=vec_connector.size()-1; i++) {
103 if ( vec_connector[i].type == IN ) {
104 dato += "\t\t<entrada>";
105 dato += vec_connector[i].name_dest + "</entrada>\n";
107 dato += "\t\t<salida>";
108 dato += vec_connector[i].name_dest + "</salida>\n";
111 dato += "\t</and>\n";
112 fprintf(archivo, dato.c_str() );
115 bool And::check_connection()
117 int cant_in = 0, cant_out =0;
118 t_logic_connector temp;
119 std::list<t_line>::iterator i = workplace->lista_lineas_in.begin();
120 while ( i != workplace->lista_lineas_in.end() ) {
121 if ( (*i).logic->get_id() == ID ) {
123 temp.name_dest = (*i).store->get_name();
124 vec_connector.push_back(temp);
130 i = workplace->lista_lineas_out.begin();
131 while ( i != workplace->lista_lineas_out.end() ) {
132 if ( (*i).logic->get_id() == ID ) {
134 temp.name_dest = (*i).store->get_name();
135 vec_connector.push_back(temp);
140 //FIXME la and tiene n entradas y una salida!!!!!!!!!!!!!!!
141 return true;// (cant_in == cant_out );
144 ConnectorType And::detect_click_position(int _a, int _b)
148 if ( (_a<=32 )&&(_a>=22)&&(_b<=20)&&(_b>=10) )
150 if ( (_a<=10)&&(_a>=0)&&(_b<=20)&&(_b>=10) )
154 if ( (_a<=20 )&&(_a>=10)&&(_b<=32)&&(_b>=22) )
156 if ( (_a<=20)&&(_a>=10)&&(_b<=10)&&(_b>=0) )
160 if ( (_a<=10 )&&(_a>=0)&&(_b<=20)&&(_b>=10) )
162 if ( (_a<=32)&&(_a>=22)&&(_b<=20)&&(_b>=10) )
166 if ( (_a<=20 )&&(_a>=10)&&(_b<=10)&&(_b>=0) )
168 if ( (_a<=20)&&(_a>=10)&&(_b<=32)&&(_b>=22) )
174 void And::update_logic_position()
203 void And::get_in_logic_connect_position(int& _a, int& _b)
209 void And::get_out_logic_connect_position(int& _a, int& _b)