1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-22 14:44:04 +02:00

- zoom and center changed the coordinate system and did a redraw while

hovering, upsetting the overlays



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5408 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-08-08 19:01:45 +00:00
parent 751e845250
commit 3dd46bb1c4

View File

@ -190,8 +190,10 @@ static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event,
redraw(); redraw();
break; break;
case 2: case 2:
tool_dehover();
draw_ctx.center = pos; draw_ctx.center = pos;
redraw(); redraw();
tool_hover(canvas_to_coord(event->x, event->y));
break; break;
} }
return TRUE; return TRUE;
@ -228,11 +230,13 @@ static void zoom_in(struct coord pos)
{ {
if (draw_ctx.scale < 2) if (draw_ctx.scale < 2)
return; return;
tool_dehover();
draw_ctx.scale /= 2; draw_ctx.scale /= 2;
draw_ctx.center.x = (draw_ctx.center.x+pos.x)/2; draw_ctx.center.x = (draw_ctx.center.x+pos.x)/2;
draw_ctx.center.y = (draw_ctx.center.y+pos.y)/2; draw_ctx.center.y = (draw_ctx.center.y+pos.y)/2;
update_zoom(); update_zoom();
redraw(); redraw();
tool_hover(pos);
} }
@ -248,11 +252,13 @@ static void zoom_out(struct coord pos)
bbox.max.x < draw_ctx.widget->allocation.width-ZOOM_STOP_BORDER && bbox.max.x < draw_ctx.widget->allocation.width-ZOOM_STOP_BORDER &&
bbox.min.y < draw_ctx.widget->allocation.height-ZOOM_STOP_BORDER) bbox.min.y < draw_ctx.widget->allocation.height-ZOOM_STOP_BORDER)
return; return;
tool_dehover();
draw_ctx.scale *= 2; draw_ctx.scale *= 2;
draw_ctx.center.x = 2*draw_ctx.center.x-pos.x; draw_ctx.center.x = 2*draw_ctx.center.x-pos.x;
draw_ctx.center.y = 2*draw_ctx.center.y-pos.y; draw_ctx.center.y = 2*draw_ctx.center.y-pos.y;
update_zoom(); update_zoom();
redraw(); redraw();
tool_hover(pos);
} }
@ -296,18 +302,24 @@ static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event,
zoom_out(pos); zoom_out(pos);
break; break;
case '*': case '*':
tool_dehover();
center(NULL); center(NULL);
auto_scale(NULL); auto_scale(NULL);
redraw(); redraw();
tool_hover(canvas_to_coord(curr_pos.x, curr_pos.y));
break; break;
case '#': case '#':
tool_dehover();
center(&active_frame_bbox); center(&active_frame_bbox);
auto_scale(&active_frame_bbox); auto_scale(&active_frame_bbox);
redraw(); redraw();
tool_hover(canvas_to_coord(curr_pos.x, curr_pos.y));
break; break;
case '.': case '.':
tool_dehover();
draw_ctx.center = pos; draw_ctx.center = pos;
redraw(); redraw();
tool_hover(canvas_to_coord(curr_pos.x, curr_pos.y));
break; break;
case GDK_BackSpace: case GDK_BackSpace:
case GDK_Delete: case GDK_Delete: