static void gimp_align_tool_oper_update (GimpTool *tool, const GimpCoords *coords, GdkModifierType state, gboolean proximity, GimpDisplay *display) { GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool); GimpDisplayShell *shell = gimp_display_get_shell (display); GimpImage *image = gimp_display_get_image (display); gint snap_distance = display->config->snap_distance; gboolean add; add = ((state & gimp_get_extend_selection_mask ()) && align_tool->selected_objects); if (gimp_draw_tool_on_vectors (GIMP_DRAW_TOOL (tool), display, coords, snap_distance, snap_distance, NULL, NULL, NULL, NULL, NULL, NULL)) { if (add) align_tool->function = ALIGN_TOOL_ADD_PATH; else align_tool->function = ALIGN_TOOL_PICK_PATH; } else if (gimp_display_shell_get_show_guides (shell) && gimp_image_find_guide (image, coords->x, coords->y, FUNSCALEX (shell, snap_distance), FUNSCALEY (shell, snap_distance))) { if (add) align_tool->function = ALIGN_TOOL_ADD_GUIDE; else align_tool->function = ALIGN_TOOL_PICK_GUIDE; } else { GimpLayer *layer; layer = gimp_image_pick_layer_by_bounds (image, coords->x, coords->y); if (layer) { if (add) align_tool->function = ALIGN_TOOL_ADD_LAYER; else align_tool->function = ALIGN_TOOL_PICK_LAYER; } else { align_tool->function = ALIGN_TOOL_IDLE; } } gimp_align_tool_status_update (tool, display, state, proximity); }
static void gimp_align_tool_oper_update (GimpTool *tool, GimpCoords *coords, GdkModifierType state, gboolean proximity, GimpDisplay *display) { GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool); GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell); gint snap_distance; snap_distance = GIMP_DISPLAY_CONFIG (display->image->gimp->config)->snap_distance; if (gimp_draw_tool_on_vectors (GIMP_DRAW_TOOL (tool), display, coords, snap_distance, snap_distance, NULL, NULL, NULL, NULL, NULL, NULL)) { if ((state & GDK_SHIFT_MASK) && align_tool->selected_objects) align_tool->function = ALIGN_TOOL_ADD_PATH; else align_tool->function = ALIGN_TOOL_PICK_PATH; } else if (gimp_display_shell_get_show_guides (shell) && (NULL != gimp_image_find_guide (display->image, coords->x, coords->y, FUNSCALEX (shell, snap_distance), FUNSCALEY (shell, snap_distance)))) { if ((state & GDK_SHIFT_MASK) && align_tool->selected_objects) align_tool->function = ALIGN_TOOL_ADD_GUIDE; else align_tool->function = ALIGN_TOOL_PICK_GUIDE; } else { GimpLayer *layer = select_layer_by_coords (display->image, coords->x, coords->y); if (layer) { if ((state & GDK_SHIFT_MASK) && align_tool->selected_objects) align_tool->function = ALIGN_TOOL_ADD_LAYER; else align_tool->function = ALIGN_TOOL_PICK_LAYER; } else { align_tool->function = ALIGN_TOOL_IDLE; } } gimp_align_tool_status_update (tool, display, state, proximity); }