3 Not::Not(int orientacion)
6 in_connected = out_connected = false;
7 imageN = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_n.png");
8 imageS = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_s.png");
9 imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_e.png");
10 imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/not_o.png");
11 null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/null.png");
12 imgActual = orientacion;
43 set_size_request(image->get_width(), image->get_height());
45 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Conectar", menu_image_linea,SigC::slot(*this, &CItem::on_menu_popup_conectar) ) ) ;
52 bool Not::on_button_press_event(GdkEventButton *event)
55 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
56 if ( CItem::logic_connect ) {
57 if ( detect_click_position((int)event->x, (int)event->y ) == OUT && !out_connected ) {
59 WorkPlace::pointed = ID;
61 if ( detect_click_position((int)event->x, (int)event->y ) == IN && !in_connected) {
63 WorkPlace::pointed = ID;
66 list_pointed->push_back(name);
67 combo_entry->set_popdown_strings(*list_pointed);
68 combo_entry->get_entry()->set_text (name);
69 workplace->queue_draw();
72 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
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);
106 set_size_request(image->get_width(),image->get_height());
107 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);
109 if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
110 menu_popup.popup(event->button, event->time);
111 return true; //It has been handled.
113 workplace->queue_draw();
116 void Not::on_menu_popup_rotar()
118 GdkEventButton event;
119 event.type = GDK_BUTTON_PRESS;
121 Not::on_button_press_event(&event);
124 void Not::save(FILE *archivo)
126 vec_connector.clear();
129 char c_img[50], c_x[50], c_y[50], c_id[50];
130 sprintf(c_id,"%d",ID);
131 sprintf(c_img,"\t\t<orientacion>%d</orientacion>\n",imgActual);
132 sprintf(c_x,"\t\t<x>%d</x>\n",x);
133 sprintf(c_y,"\t\t<y>%d</y>\n",y);
134 dato = "\t<not nombre=\""+name+"\" id=\"";
140 for ( int i=0; i<=vec_connector.size()-1&&!vec_connector.empty(); i++) {
141 if ( vec_connector[i].type == IN ) {
142 dato += "\t\t<entrada>";
143 dato += vec_connector[i].name_dest + "</entrada>\n";
145 dato += "\t\t<salida>";
146 dato += vec_connector[i].name_dest + "</salida>\n";
149 dato += "\t</not>\n";
150 fprintf(archivo, dato.c_str() );
153 bool Not::check_connection()
155 int cant_in = 0, cant_out =0;
156 t_logic_connector temp;
157 std::list<t_line>::iterator i = workplace->lista_lineas_in.begin();
158 while ( i != workplace->lista_lineas_in.end() ) {
159 if ( workplace->get_logic_item((*i).logic_id)->get_id() == ID ) {
161 temp.name_dest = workplace->get_item((*i).store_id)->get_name();
162 vec_connector.push_back(temp);
168 i = workplace->lista_lineas_out.begin();
169 while ( i != workplace->lista_lineas_out.end() ) {
170 if (workplace->get_logic_item((*i).logic_id)->get_id() == ID ) {
172 temp.name_dest = workplace->get_item((*i).store_id)->get_name();
173 vec_connector.push_back(temp);
178 return true;// (in_connected == out_connected ) ==true;
181 ConnectorType Not::detect_click_position(int _a, int _b)
185 if ( (_a<=32 )&&(_a>=22)&&(_b<=20)&&(_b>=10) )
187 if ( (_a<=10)&&(_a>=0)&&(_b<=20)&&(_b>=10) )
191 if ( (_a<=20 )&&(_a>=10)&&(_b<=32)&&(_b>=22) )
193 if ( (_a<=20)&&(_a>=10)&&(_b<=10)&&(_b>=0) )
197 if ( (_a<=10 )&&(_a>=0)&&(_b<=20)&&(_b>=10) )
199 if ( (_a<=32)&&(_a>=22)&&(_b<=20)&&(_b>=10) )
203 if ( (_a<=20 )&&(_a>=10)&&(_b<=10)&&(_b>=0) )
205 if ( (_a<=20)&&(_a>=10)&&(_b<=32)&&(_b>=22) )
211 void Not::update_logic_position()
240 void Not::get_in_logic_connect_position(int& _a, int& _b)
246 void Not::get_out_logic_connect_position(int& _a, int& _b)
252 void Not::set_out_connected(bool _o)
257 void Not::set_in_connected(bool _o)