+
+ConnectorType Or::detect_click_position(int _a, int _b)
+{
+ switch (imgActual) {
+ case 0:
+ if ( (_a<=32 )&&(_a>=22)&&(_b<=20)&&(_b>=10) )
+ return OUT;
+ if ( (_a<=10)&&(_a>=0)&&(_b<=20)&&(_b>=10) )
+ return IN;
+ break;
+ case 1:
+ if ( (_a<=20 )&&(_a>=10)&&(_b<=32)&&(_b>=22) )
+ return OUT;
+ if ( (_a<=20)&&(_a>=10)&&(_b<=10)&&(_b>=0) )
+ return IN;
+ break;
+ case 2:
+ if ( (_a<=10 )&&(_a>=0)&&(_b<=20)&&(_b>=10) )
+ return OUT;
+ if ( (_a<=32)&&(_a>=22)&&(_b<=20)&&(_b>=10) )
+ return IN;
+ break;
+ case 3:
+ if ( (_a<=20 )&&(_a>=10)&&(_b<=10)&&(_b>=0) )
+ return OUT;
+ if ( (_a<=20)&&(_a>=10)&&(_b<=32)&&(_b>=22) )
+ return IN;
+ }
+ return UNDEF;
+}
+
+void Or::update_logic_position()
+{
+ switch (imgActual) {
+ case 0:
+ in_x = x;
+ in_y = y+16;
+ out_x = x+32;
+ out_y = y+16;
+ break;
+ case 1:
+ in_x = x+16;
+ in_y = y;
+ out_x = x+16;
+ out_y = y+32;
+ break;
+ case 2:
+ in_x = x+32;
+ in_y = y+16;
+ out_x = x;
+ out_y = y+16;
+ break;
+ case 3:
+ in_x = x+16;
+ in_y = y+32;
+ out_x = x+16;
+ out_y = y;
+ }
+}
+
+void Or::get_in_logic_connect_position(int& _a, int& _b)
+{
+ _a = in_x;
+ _b = in_y;
+}
+
+void Or::get_out_logic_connect_position(int& _a, int& _b)
+{
+ _a =out_x;
+ _b =out_y;
+}
+
+void Or::set_out_connected(bool _o)
+{
+ out_connected = _o;
+}
+
+bool Or::get_out_logic_connect()
+{
+ return out_connected;
+}
+
+void Or::draw_connectors()
+{
+ Glib::RefPtr<Gdk::Window> window = get_window();
+ int a,b,c,d;
+ switch (imgActual) {
+ case 0:
+ a = in_x-x;
+ b = in_y-y-5;
+ c = out_x-x-10;
+ d = out_y-y-5;
+ break;
+ case 1:
+ a = in_x-x-5;
+ b = in_y-y;
+ c = out_x-x-5;
+ d = out_y-y-10;
+ break;
+ case 2:
+ a = in_x-x-10;
+ b = in_y-y-5;
+ c = out_x-x;
+ d = out_y-y-5;
+ break;
+ case 3:
+ a = in_x-x-5;
+ b = in_y-y-10;
+ c = out_x-x-5;
+ d = out_y-y;
+ }
+ gc->set_foreground(red);
+ gc->set_background(red);
+ window->draw_rectangle(gc, 1, a, b, 10, 10);
+ gc->set_foreground(blue);
+ gc->set_background(blue);
+ window->draw_rectangle(gc, 1, c, d, 10, 10);
+ queue_draw();
+}