9 imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_n.png");
10 imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_s.png");
11 imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_e.png");
12 imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_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 Not::on_button_press_event(GdkEventButton *event)
28 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
29 if ( CItem::logic_connect ) {
31 WorkPlace::pointed = ID;
33 list_pointed->push_back(name);
34 combo_entry->set_popdown_strings(*list_pointed);
35 combo_entry->get_entry()->set_text (name);
36 workplace->queue_draw();
39 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
41 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);
73 set_size_request(image->get_width(),image->get_height());
74 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);
76 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
77 menu_popup.popup(event->button, event->time);
78 return true; //It has been handled.
80 workplace->queue_draw();
83 void Not::on_menu_popup_rotar()
86 event.type = GDK_BUTTON_PRESS;
88 Not::on_button_press_event(&event);
91 void Not::save(FILE *archivo)
93 vec_connector.clear();
96 char c_img[50], c_x[50], c_y[50], c_id[50];
97 sprintf(c_id,"%d",ID);
98 sprintf(c_img,"\t\t<orientacion>%d</orientacion>\n",imgActual);
99 sprintf(c_x,"\t\t<x>%d</x>\n",x);
100 sprintf(c_y,"\t\t<y>%d</y>\n",y);
101 dato = "\t<not nombre=\""+name+"\" id=\"";
107 for ( int i=0; i<=vec_connector.size()-1&&!vec_connector.empty(); i++) {
108 if ( vec_connector[i].type == IN ) {
109 dato += "\t\t<entrada>";
110 dato += vec_connector[i].name_dest + "</entrada>\n";
112 dato += "\t\t<salida>";
113 dato += vec_connector[i].name_dest + "</salida>\n";
116 dato += "\t</not>\n";
117 fprintf(archivo, dato.c_str() );
120 bool Not::check_connection()
122 int cant_in = 0, cant_out =0;
123 t_logic_connector temp;
124 std::list<t_line>::iterator i = workplace->lista_lineas_in.begin();
125 while ( i != workplace->lista_lineas_in.end() ) {
126 if ( workplace->get_logic_item((*i).logic_id)->get_id() == ID ) {
128 temp.name_dest = workplace->get_item((*i).store_id)->get_name();
129 vec_connector.push_back(temp);
135 i = workplace->lista_lineas_out.begin();
136 while ( i != workplace->lista_lineas_out.end() ) {
137 if (workplace->get_logic_item((*i).logic_id)->get_id() == ID ) {
139 temp.name_dest = workplace->get_item((*i).store_id)->get_name();
140 vec_connector.push_back(temp);
146 //FIXME la not tiene que tener una sola salida y una sola entrada!!!!!
147 return true;// (cant_in == cant_out );
150 ConnectorType Not::detect_click_position(int _a, int _b)
154 if ( (_a<=32 )&&(_a>=22)&&(_b<=20)&&(_b>=10) )
156 if ( (_a<=10)&&(_a>=0)&&(_b<=20)&&(_b>=10) )
160 if ( (_a<=20 )&&(_a>=10)&&(_b<=32)&&(_b>=22) )
162 if ( (_a<=20)&&(_a>=10)&&(_b<=10)&&(_b>=0) )
166 if ( (_a<=10 )&&(_a>=0)&&(_b<=20)&&(_b>=10) )
168 if ( (_a<=32)&&(_a>=22)&&(_b<=20)&&(_b>=10) )
172 if ( (_a<=20 )&&(_a>=10)&&(_b<=10)&&(_b>=0) )
174 if ( (_a<=20)&&(_a>=10)&&(_b<=32)&&(_b>=22) )
180 void Not::update_logic_position()
209 void Not::get_in_logic_connect_position(int& _a, int& _b)
215 void Not::get_out_logic_connect_position(int& _a, int& _b)