static void scroll_button_press(ScrollTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint; tool->use_hand = (event->state & GDK_SHIFT_MASK) != 0; if (tool->use_hand) { if (!closed_hand_cursor) closed_hand_cursor = create_cursor(ddisp->canvas->window, hand_closed_data_bits, hand_closed_data_width, hand_closed_data_height, hand_closed_mask_bits, hand_closed_data_width/2, hand_closed_data_height/2); ddisplay_set_all_cursor(closed_hand_cursor); } else ddisplay_set_all_cursor(scroll_cursor); ddisplay_untransform_coords(ddisp, (int)event->x, (int)event->y, &clickedpoint.x, &clickedpoint.y); tool->scrolling = TRUE; tool->last_pos = clickedpoint; }
static void modify_double_click(ModifyTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint; DiaObject *clicked_obj; ddisplay_untransform_coords(ddisp, (int)event->x, (int)event->y, &clickedpoint.x, &clickedpoint.y); clicked_obj = click_select_object(ddisp, &clickedpoint, event); if ( clicked_obj != NULL ) { object_list_properties_show(ddisp->diagram, ddisp->diagram->data->selected); } else { /* No object selected */ /*printf("didn't select object\n");*/ if (!(event->state & GDK_SHIFT_MASK)) { /* Not Multi-select => Remove all selected */ ddisplay_do_update_menu_sensitivity(ddisp); diagram_remove_all_selected(ddisp->diagram, TRUE); diagram_flush(ddisp->diagram); } } }
static void modify_button_press(ModifyTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint; DiaObject *clicked_obj; gboolean some_selected; ddisplay_untransform_coords(ddisp, (int)event->x, (int)event->y, &clickedpoint.x, &clickedpoint.y); /* don't got to single handle movement if there is more than one object selected */ some_selected = g_list_length (ddisp->diagram->data->selected) > 1; if (!some_selected && do_if_clicked_handle(ddisp, tool, &clickedpoint, event)) return; clicked_obj = click_select_object(ddisp, &clickedpoint, event); if (!some_selected && do_if_clicked_handle(ddisp, tool, &clickedpoint, event)) return; if ( clicked_obj != NULL ) { tool->state = STATE_MOVE_OBJECT; tool->object = clicked_obj; tool->move_compensate = clicked_obj->position; point_sub(&tool->move_compensate, &clickedpoint); tool->break_connections = TRUE; /* unconnect when not grabbing handles, just setting to * FALSE is not enough. Need to refine the move op, too. */ gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE, GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time); tool->start_at = clickedpoint; tool->start_time = time_micro(); ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL)); } else { tool->state = STATE_BOX_SELECT; tool->start_box = clickedpoint; tool->end_box = clickedpoint; tool->x1 = tool->x2 = (int) event->x; tool->y1 = tool->y2 = (int) event->y; if (tool->gc == NULL) { tool->gc = gdk_gc_new(gtk_widget_get_window(ddisp->canvas)); gdk_gc_set_line_attributes(tool->gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_BUTT, GDK_JOIN_MITER); gdk_gc_set_foreground(tool->gc, &color_gdk_white); gdk_gc_set_function(tool->gc, GDK_XOR); } gdk_draw_rectangle (gtk_widget_get_window (ddisp->canvas), tool->gc, FALSE, tool->x1, tool->y1, tool->x2 - tool->x1, tool->y2 - tool->y1); gdk_pointer_grab (gtk_widget_get_window (ddisp->canvas), FALSE, GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time); } }
/*! * Remember the last clicked point given in pixel coodinates */ void ddisplay_set_clicked_point(DDisplay *ddisp, int x, int y) { Point pt; ddisplay_untransform_coords(ddisp, x, y, &pt.x, &pt.y); ddisp->clicked_position = pt; }
static void scroll_motion(ScrollTool *tool, GdkEventMotion *event, DDisplay *ddisp) { Point to; Point delta; /* set the cursor appropriately, and change use_hand if needed */ if (!tool->scrolling) { /* try to minimise the number of cursor type changes */ if ((event->state & GDK_SHIFT_MASK) != 0) { if (!tool->use_hand) { tool->use_hand = TRUE; if (!open_hand_cursor) open_hand_cursor = create_cursor(ddisp->canvas->window, hand_open_data_bits, hand_open_data_width, hand_open_data_height, hand_open_mask_bits, hand_open_data_width/2, hand_open_data_height/2); ddisplay_set_all_cursor(open_hand_cursor); } } else if (tool->use_hand) { tool->use_hand = FALSE; ddisplay_set_all_cursor(scroll_cursor); } return; } ddisplay_untransform_coords(ddisp, event->x, event->y, &to.x, &to.y); if (tool->use_hand) { delta = tool->last_pos; point_sub(&delta, &to); tool->last_pos = to; point_add(&tool->last_pos, &delta); /* we use this so you can scroll past the edge of the image */ point_add(&delta, &ddisp->origo); ddisplay_set_origo(ddisp, delta.x, delta.y); ddisplay_update_scrollbars(ddisp); ddisplay_add_update_all(ddisp); } else { delta = to; point_sub(&delta, &tool->last_pos); point_scale(&delta, 0.5); ddisplay_scroll(ddisp, &delta); tool->last_pos = to; } ddisplay_flush(ddisp); }
static void modify_button_press(ModifyTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint; DiaObject *clicked_obj; gboolean some_selected; ddisplay_untransform_coords(ddisp, (int)event->x, (int)event->y, &clickedpoint.x, &clickedpoint.y); /* don't got to single handle movement if there is more than one object selected */ some_selected = g_list_length (ddisp->diagram->data->selected) > 1; if (!some_selected && do_if_clicked_handle(ddisp, tool, &clickedpoint, event)) return; clicked_obj = click_select_object(ddisp, &clickedpoint, event); if (!some_selected && do_if_clicked_handle(ddisp, tool, &clickedpoint, event)) return; if ( clicked_obj != NULL ) { tool->state = STATE_MOVE_OBJECT; tool->object = clicked_obj; tool->move_compensate = clicked_obj->position; point_sub(&tool->move_compensate, &clickedpoint); tool->break_connections = TRUE; /* unconnect when not grabbing handles, just setting to * FALSE is not enough. Need to refine the move op, too. */ gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE, GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time); tool->start_at = clickedpoint; tool->start_time = time_micro(); ddisplay_set_all_cursor_name (NULL, "move"); } else { tool->state = STATE_BOX_SELECT; tool->start_box = clickedpoint; tool->end_box = clickedpoint; tool->x1 = tool->x2 = (int) event->x; tool->y1 = tool->y2 = (int) event->y; dia_interactive_renderer_set_selection (ddisp->renderer, TRUE, tool->x1, tool->y1, tool->x2 - tool->x1, tool->y2 - tool->y1); ddisplay_flush (ddisp); gdk_pointer_grab (gtk_widget_get_window (ddisp->canvas), FALSE, GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time); } }
static void modify_button_hold(ModifyTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint; switch (tool->state) { case STATE_MOVE_OBJECT: /* A button hold is as if user was moving object - if it is * a text object and can be edited, then the move is cancelled */ ddisplay_untransform_coords(ddisp, (int)event->x, (int)event->y, &clickedpoint.x, &clickedpoint.y); if (tool->object != NULL && diagram_is_selected(ddisp->diagram, tool->object)) { if (textedit_activate_object(ddisp, tool->object, &clickedpoint)) { /* Return tool to normal state - object is text and is in edit */ gdk_pointer_ungrab (event->time); tool->orig_pos = NULL; tool->state = STATE_NONE; /* Activate Text Edit */ gtk_action_activate (menus_get_action ("ToolsTextedit")); } } break; case STATE_MOVE_HANDLE: break; case STATE_BOX_SELECT: break; case STATE_NONE: break; default: message_error("Internal error: Strange state in modify_tool (button_hold)\n"); } }
static void modify_button_release(ModifyTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point *dest_pos, to; GList *list; int i; ObjectChange *objchange; tool->break_connections = FALSE; ddisplay_set_all_cursor(default_cursor); /* remove position from status bar */ { GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status); guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos"); gtk_statusbar_pop (statusbar, context_id); } switch (tool->state) { case STATE_MOVE_OBJECT: /* Return to normal state */ gdk_pointer_ungrab (event->time); ddisplay_untransform_coords(ddisp, event->x, event->y, &to.x, &to.y); if (!modify_move_already(tool, ddisp, &to)) { tool->orig_pos = NULL; tool->state = STATE_NONE; return; } diagram_update_connections_selection(ddisp->diagram); if (tool->orig_pos != NULL) { /* consider the non-selected children affected */ list = parent_list_affected(ddisp->diagram->data->selected); dest_pos = g_new(Point, g_list_length(list)); i=0; while (list != NULL) { DiaObject *obj = (DiaObject *) list->data; dest_pos[i] = obj->position; list = g_list_next(list); i++; } undo_move_objects(ddisp->diagram, tool->orig_pos, dest_pos, parent_list_affected(ddisp->diagram->data->selected)); } ddisplay_connect_selected(ddisp); /* pushes UNDO info */ diagram_update_extents(ddisp->diagram); diagram_modified(ddisp->diagram); diagram_flush(ddisp->diagram); undo_set_transactionpoint(ddisp->diagram->undo); tool->orig_pos = NULL; tool->state = STATE_NONE; break; case STATE_MOVE_HANDLE: gdk_pointer_ungrab (event->time); tool->state = STATE_NONE; if (tool->orig_pos != NULL) { undo_move_handle(ddisp->diagram, tool->handle, tool->object, *tool->orig_pos, tool->last_to, gdk_event_to_dia_ModifierKeys(event->state)); } /* Final move: */ object_add_updates(tool->object, ddisp->diagram); objchange = tool->object->ops->move_handle(tool->object, tool->handle, &tool->last_to, NULL, HANDLE_MOVE_USER_FINAL,gdk_event_to_dia_ModifierKeys(event->state)); if (objchange != NULL) { undo_object_change(ddisp->diagram, tool->object, objchange); } object_add_updates(tool->object, ddisp->diagram); /* Connect if possible: */ if (tool->handle->connect_type != HANDLE_NONCONNECTABLE) { object_connect_display(ddisp, tool->object, tool->handle, TRUE); /* pushes UNDO info */ diagram_update_connections_selection(ddisp->diagram); } highlight_reset_all(ddisp->diagram); diagram_flush(ddisp->diagram); diagram_modified(ddisp->diagram); diagram_update_extents(ddisp->diagram); undo_set_transactionpoint(ddisp->diagram->undo); if (tool->orig_pos != NULL) { g_free(tool->orig_pos); tool->orig_pos = NULL; } break; case STATE_BOX_SELECT: gdk_pointer_ungrab (event->time); /* Remove last box: */ dia_interactive_renderer_set_selection (ddisp->renderer, FALSE, 0, 0, 0, 0); { GList *list, *list_to_free; list = list_to_free = find_selected_objects(ddisp, tool); if (selection_style == SELECT_REPLACE && !(event->state & GDK_SHIFT_MASK)) { /* Not Multi-select => Remove all selected */ diagram_remove_all_selected(ddisp->diagram, TRUE); } if (selection_style == SELECT_INTERSECTION) { GList *intersection = NULL; while (list != NULL) { DiaObject *obj = (DiaObject *)list->data; if (diagram_is_selected(ddisp->diagram, obj)) { intersection = g_list_append(intersection, obj); } list = g_list_next(list); } list = intersection; diagram_remove_all_selected(ddisp->diagram, TRUE); while (list != NULL) { DiaObject *obj = (DiaObject *)list->data; diagram_select(ddisp->diagram, obj); list = g_list_next(list); } g_list_free(intersection); } else { while (list != NULL) { DiaObject *obj = (DiaObject *)list->data; if (selection_style == SELECT_REMOVE) { if (diagram_is_selected(ddisp->diagram, obj)) diagram_unselect_object(ddisp->diagram, obj); } else if (selection_style == SELECT_INVERT) { if (diagram_is_selected(ddisp->diagram, obj)) diagram_unselect_object(ddisp->diagram, obj); else diagram_select(ddisp->diagram, obj); } else { if (!diagram_is_selected(ddisp->diagram, obj)) diagram_select(ddisp->diagram, obj); } list = g_list_next(list); } } g_list_free(list_to_free); } ddisplay_do_update_menu_sensitivity(ddisp); ddisplay_flush(ddisp); tool->state = STATE_NONE; break; case STATE_NONE: break; default: message_error("Internal error: Strange state in modify_tool\n"); } }
static void modify_motion (ModifyTool *tool, GdkEventMotion *event, DDisplay *ddisp) { Point to; Point now, delta, full_delta; gboolean auto_scroll, vertical = FALSE; ConnectionPoint *connectionpoint = NULL; ObjectChange *objchange = NULL; ddisplay_untransform_coords(ddisp, event->x, event->y, &to.x, &to.y); if (tool->state==STATE_NONE) { DiaObject *obj = NULL; Handle *handle = NULL; diagram_find_closest_handle (ddisp->diagram, &handle, &obj, &to); if (handle && handle->type != HANDLE_NON_MOVABLE && handle->id >= HANDLE_RESIZE_NW && handle->id <= HANDLE_RESIZE_SE && handle_is_clicked(ddisp, handle, &to) && g_list_length (ddisp->diagram->data->selected) == 1) ddisplay_set_all_cursor (get_direction_cursor (CURSOR_DIRECTION_0 + handle->id)); else ddisplay_set_all_cursor_name (NULL, "default"); return; /* Fast path... */ } auto_scroll = ddisplay_autoscroll(ddisp, event->x, event->y); if (!modify_move_already(tool, ddisp, &to)) return; switch (tool->state) { case STATE_MOVE_OBJECT: if (tool->orig_pos == NULL) { GList *list, *pla; int i; DiaObject *obj; /* consider non-selected children affected */ pla = list = parent_list_affected(ddisp->diagram->data->selected); tool->orig_pos = g_new(Point, g_list_length(list)); i=0; while (list != NULL) { obj = (DiaObject *) list->data; tool->orig_pos[i] = obj->position; list = g_list_next(list); i++; } g_list_free (pla); } if (tool->break_connections) diagram_unconnect_selected(ddisp->diagram); /* Pushes UNDO info */ if (gdk_event_to_dia_ModifierKeys (event->state) & MODIFIER_CONTROL) { full_delta = to; point_sub(&full_delta, &tool->start_at); vertical = (fabs(full_delta.x) < fabs(full_delta.y)); } point_add(&to, &tool->move_compensate); snap_to_grid(ddisp, &to.x, &to.y); now = tool->object->position; delta = to; point_sub(&delta, &now); if (gdk_event_to_dia_ModifierKeys (event->state) & MODIFIER_CONTROL) { /* Up-down or left-right */ if (vertical) { delta.x = tool->start_at.x + tool->move_compensate.x - now.x; } else { delta.y = tool->start_at.y + tool->move_compensate.y - now.y; } } object_add_updates_list(ddisp->diagram->data->selected, ddisp->diagram); objchange = object_list_move_delta(ddisp->diagram->data->selected, &delta); if (objchange != NULL) { undo_object_change(ddisp->diagram, tool->object, objchange); } object_add_updates_list(ddisp->diagram->data->selected, ddisp->diagram); object_add_updates(tool->object, ddisp->diagram); /* Put current mouse position in status bar */ { gchar *postext; GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status); guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos"); gtk_statusbar_pop (statusbar, context_id); postext = g_strdup_printf("%.3f, %.3f - %.3f, %.3f", tool->object->bounding_box.left, tool->object->bounding_box.top, tool->object->bounding_box.right, tool->object->bounding_box.bottom); gtk_statusbar_pop (statusbar, context_id); gtk_statusbar_push (statusbar, context_id, postext); g_free(postext); } diagram_update_connections_selection(ddisp->diagram); diagram_flush(ddisp->diagram); break; case STATE_MOVE_HANDLE: full_delta = to; point_sub(&full_delta, &tool->start_at); /* make sure resizing is restricted to its parent */ /* if resize was blocked by parent, that means the resizing was outward, thus it won't bother the children so we don't have to check the children */ if (!parent_handle_move_out_check(tool->object, &to)) parent_handle_move_in_check(tool->object, &to, &tool->start_at); if (gdk_event_to_dia_ModifierKeys (event->state) & MODIFIER_CONTROL) vertical = (fabs(full_delta.x) < fabs(full_delta.y)); highlight_reset_all(ddisp->diagram); if ((tool->handle->connect_type != HANDLE_NONCONNECTABLE)) { /* Move to ConnectionPoint if near: */ connectionpoint = object_find_connectpoint_display (ddisp, &to, tool->object, TRUE); if (connectionpoint != NULL) { DiaHighlightType type; to = connectionpoint->pos; if (connectionpoint->flags & CP_FLAGS_MAIN) { type = DIA_HIGHLIGHT_CONNECTIONPOINT_MAIN; } else { type = DIA_HIGHLIGHT_CONNECTIONPOINT; } highlight_object(connectionpoint->object, type, ddisp->diagram); ddisplay_set_all_cursor_name (NULL, "crosshair"); } } if (connectionpoint == NULL) { /* No connectionopoint near, then snap to grid (if enabled) */ snap_to_grid(ddisp, &to.x, &to.y); ddisplay_set_all_cursor_name (NULL, "move"); } if (tool->break_connections) { /* break connections to the handle currently selected. */ if (tool->handle->connected_to!=NULL) { Change *change = undo_unconnect (ddisp->diagram, tool->object, tool->handle); (change->apply)(change, ddisp->diagram); } } if (gdk_event_to_dia_ModifierKeys (event->state) & MODIFIER_CONTROL) { /* Up-down or left-right */ if (vertical) { to.x = tool->start_at.x; } else { to.y = tool->start_at.y; } } if (tool->orig_pos == NULL) { tool->orig_pos = g_new(Point, 1); *tool->orig_pos = tool->handle->pos; } /* Put current mouse position in status bar */ { gchar *postext; GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status); guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos"); if (tool->object) { /* play safe */ real w = tool->object->bounding_box.right - tool->object->bounding_box.left; real h = tool->object->bounding_box.bottom - tool->object->bounding_box.top; postext = g_strdup_printf("%.3f, %.3f (%.3fx%.3f)", to.x, to.y, w, h); } else { postext = g_strdup_printf("%.3f, %.3f", to.x, to.y); } gtk_statusbar_pop (statusbar, context_id); gtk_statusbar_push (statusbar, context_id, postext); g_free(postext); } object_add_updates(tool->object, ddisp->diagram); /* Handle undo */ if (tool->object) objchange = tool->object->ops->move_handle(tool->object, tool->handle, &to, connectionpoint, HANDLE_MOVE_USER, gdk_event_to_dia_ModifierKeys(event->state)); if (objchange != NULL) { undo_object_change(ddisp->diagram, tool->object, objchange); } object_add_updates(tool->object, ddisp->diagram); diagram_update_connections_selection(ddisp->diagram); diagram_flush(ddisp->diagram); break; case STATE_BOX_SELECT: tool->end_box = to; ddisplay_transform_coords (ddisp, MIN (tool->start_box.x, tool->end_box.x), MIN (tool->start_box.y, tool->end_box.y), &tool->x1, &tool->y1); ddisplay_transform_coords (ddisp, MAX (tool->start_box.x, tool->end_box.x), MAX (tool->start_box.y, tool->end_box.y), &tool->x2, &tool->y2); dia_interactive_renderer_set_selection (ddisp->renderer, TRUE, tool->x1, tool->y1, tool->x2 - tool->x1, tool->y2 - tool->y1); ddisplay_flush (ddisp); break; case STATE_NONE: break; default: message_error("Internal error: Strange state in modify_tool\n"); } tool->last_to = to; tool->auto_scrolled = auto_scroll; }
static void create_object_button_press(CreateObjectTool *tool, GdkEventButton *event, DDisplay *ddisp) { Point clickedpoint, origpoint; Handle *handle1; Handle *handle2; DiaObject *obj; real click_distance; ddisplay_untransform_coords(ddisp, (int)event->x, (int)event->y, &clickedpoint.x, &clickedpoint.y); origpoint = clickedpoint; snap_to_grid(ddisp, &clickedpoint.x, &clickedpoint.y); click_distance = ddisplay_untransform_length(ddisp, 3.0); obj = dia_object_default_create (tool->objtype, &clickedpoint, tool->user_data, &handle1, &handle2); tool->obj = obj; /* ensure that tool->obj is initialised in case we return early. */ if (!obj) { tool->moving = FALSE; tool->handle = NULL; message_error(_("'%s' creation failed"), tool->objtype ? tool->objtype->name : "NULL"); return; } diagram_add_object(ddisp->diagram, obj); /* Try a connect */ if (handle1 != NULL && handle1->connect_type != HANDLE_NONCONNECTABLE) { ConnectionPoint *connectionpoint; connectionpoint = object_find_connectpoint_display(ddisp, &origpoint, obj, TRUE); if (connectionpoint != NULL) { (obj->ops->move)(obj, &origpoint); } } if (!(event->state & GDK_SHIFT_MASK)) { /* Not Multi-select => remove current selection */ diagram_remove_all_selected(ddisp->diagram, TRUE); } diagram_select(ddisp->diagram, obj); /* Connect first handle if possible: */ if ((handle1!= NULL) && (handle1->connect_type != HANDLE_NONCONNECTABLE)) { object_connect_display(ddisp, obj, handle1, TRUE); } object_add_updates(obj, ddisp->diagram); ddisplay_do_update_menu_sensitivity(ddisp); diagram_flush(ddisp->diagram); if (handle2 != NULL) { tool->handle = handle2; tool->moving = TRUE; tool->last_to = handle2->pos; gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE, GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time); ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL)); } else { diagram_update_extents(ddisp->diagram); tool->moving = FALSE; } }
static void create_object_motion(CreateObjectTool *tool, GdkEventMotion *event, DDisplay *ddisp) { Point to; ConnectionPoint *connectionpoint = NULL; gchar *postext; GtkStatusbar *statusbar; guint context_id; if (!tool->moving) return; ddisplay_untransform_coords(ddisp, event->x, event->y, &to.x, &to.y); /* make sure the new object is restricted to its parent */ parent_handle_move_out_check(tool->obj, &to); /* Move to ConnectionPoint if near: */ if (tool->handle != NULL && tool->handle->connect_type != HANDLE_NONCONNECTABLE) { connectionpoint = object_find_connectpoint_display(ddisp, &to, tool->obj, TRUE); if (connectionpoint != NULL) { to = connectionpoint->pos; highlight_object(connectionpoint->object, DIA_HIGHLIGHT_CONNECTIONPOINT, ddisp->diagram); ddisplay_set_all_cursor(get_cursor(CURSOR_CONNECT)); } } if (connectionpoint == NULL) { /* No connectionopoint near, then snap to grid (if enabled) */ snap_to_grid(ddisp, &to.x, &to.y); highlight_reset_all(ddisp->diagram); ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL)); } object_add_updates(tool->obj, ddisp->diagram); tool->obj->ops->move_handle(tool->obj, tool->handle, &to, connectionpoint, HANDLE_MOVE_CREATE, 0); object_add_updates(tool->obj, ddisp->diagram); /* Put current mouse position in status bar */ statusbar = GTK_STATUSBAR (ddisp->modified_status); context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos"); postext = g_strdup_printf("%.3f, %.3f - %.3f, %.3f", tool->obj->bounding_box.left, tool->obj->bounding_box.top, tool->obj->bounding_box.right, tool->obj->bounding_box.bottom); gtk_statusbar_pop (statusbar, context_id); gtk_statusbar_push (statusbar, context_id, postext); g_free(postext); diagram_flush(ddisp->diagram); tool->last_to = to; return; }