static void gimp_color_tool_cursor_update (GimpTool *tool, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool); GimpImage *image = gimp_display_get_image (display); if (color_tool->enabled) { if (color_tool->sample_point) { gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_COLOR_PICKER, GIMP_CURSOR_MODIFIER_MOVE); } else { GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD; if (gimp_image_coords_in_active_pickable (image, coords, color_tool->options->sample_merged, FALSE)) { switch (color_tool->pick_mode) { case GIMP_COLOR_PICK_MODE_NONE: modifier = GIMP_CURSOR_MODIFIER_NONE; break; case GIMP_COLOR_PICK_MODE_FOREGROUND: modifier = GIMP_CURSOR_MODIFIER_FOREGROUND; break; case GIMP_COLOR_PICK_MODE_BACKGROUND: modifier = GIMP_CURSOR_MODIFIER_BACKGROUND; break; case GIMP_COLOR_PICK_MODE_PALETTE: modifier = GIMP_CURSOR_MODIFIER_PLUS; break; } } gimp_tool_set_cursor (tool, display, GIMP_CURSOR_COLOR_PICKER, GIMP_TOOL_CURSOR_COLOR_PICKER, modifier); } return; /* don't chain up */ } GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display); }
void gimp_color_tool_start_sample_point (GimpTool *tool, GimpDisplay *display) { GimpColorTool *color_tool; g_return_if_fail (GIMP_IS_COLOR_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); color_tool = GIMP_COLOR_TOOL (tool); gimp_display_shell_selection_pause (gimp_display_get_shell (display)); tool->display = display; gimp_tool_control_activate (tool->control); gimp_tool_control_set_scroll_lock (tool->control, TRUE); if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool))) gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool)); color_tool->sample_point = NULL; color_tool->moving_sample_point = TRUE; color_tool->sample_point_x = SAMPLE_POINT_POSITION_INVALID; color_tool->sample_point_y = SAMPLE_POINT_POSITION_INVALID; gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_COLOR_PICKER, GIMP_CURSOR_MODIFIER_MOVE); gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display); }
static void gimp_move_tool_start_guide (GimpMoveTool *move, GimpDisplay *display, GimpOrientationType orientation) { GimpTool *tool = GIMP_TOOL (move); gimp_display_shell_selection_pause (gimp_display_get_shell (display)); tool->display = display; gimp_tool_control_activate (tool->control); gimp_tool_control_set_scroll_lock (tool->control, TRUE); if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool))) gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool)); move->guide = NULL; move->moving_guide = TRUE; move->guide_position = GUIDE_POSITION_INVALID; move->guide_orientation = orientation; gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_HAND, GIMP_CURSOR_MODIFIER_MOVE); gimp_draw_tool_start (GIMP_DRAW_TOOL (move), display); }
void gimp_color_tool_start_sample_point (GimpTool *tool, GimpDisplay *display) { GimpColorTool *color_tool; g_return_if_fail (GIMP_IS_COLOR_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); color_tool = GIMP_COLOR_TOOL (tool); gimp_display_shell_selection_control (GIMP_DISPLAY_SHELL (display->shell), GIMP_SELECTION_PAUSE); tool->display = display; gimp_tool_control_activate (tool->control); if (color_tool->sample_point) gimp_display_shell_draw_sample_point (GIMP_DISPLAY_SHELL (display->shell), color_tool->sample_point, FALSE); color_tool->sample_point = NULL; color_tool->moving_sample_point = TRUE; color_tool->sample_point_x = -1; color_tool->sample_point_y = -1; gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_COLOR_PICKER, GIMP_CURSOR_MODIFIER_MOVE); gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display); }
static void gimp_paint_tool_cursor_update (GimpTool *tool, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool); GimpCursorModifier modifier; GimpCursorModifier toggle_modifier; GimpCursorModifier old_modifier; GimpCursorModifier old_toggle_modifier; modifier = tool->control->cursor_modifier; toggle_modifier = tool->control->toggle_cursor_modifier; old_modifier = modifier; old_toggle_modifier = toggle_modifier; if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool))) { GimpImage *image = gimp_display_get_image (display); GimpDrawable *drawable = gimp_image_get_active_drawable (image); if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) || gimp_item_is_content_locked (GIMP_ITEM (drawable)) || ! gimp_item_is_visible (GIMP_ITEM (drawable))) { modifier = GIMP_CURSOR_MODIFIER_BAD; toggle_modifier = GIMP_CURSOR_MODIFIER_BAD; } if (! paint_tool->show_cursor && modifier != GIMP_CURSOR_MODIFIER_BAD) { gimp_tool_set_cursor (tool, display, GIMP_CURSOR_NONE, GIMP_TOOL_CURSOR_NONE, GIMP_CURSOR_MODIFIER_NONE); return; } gimp_tool_control_set_cursor_modifier (tool->control, modifier); gimp_tool_control_set_toggle_cursor_modifier (tool->control, toggle_modifier); } GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display); /* reset old stuff here so we are not interferring with the modifiers * set by our subclasses */ gimp_tool_control_set_cursor_modifier (tool->control, old_modifier); gimp_tool_control_set_toggle_cursor_modifier (tool->control, old_toggle_modifier); }
static void gimp_tool_real_cursor_update (GimpTool *tool, GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { gimp_tool_set_cursor (tool, display, gimp_tool_control_get_cursor (tool->control), gimp_tool_control_get_tool_cursor (tool->control), gimp_tool_control_get_cursor_modifier (tool->control)); }
static void gimp_image_map_tool_cursor_update (GimpTool *tool, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool); if (! gimp_image_map_tool_on_guide (im_tool, coords, display)) { GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display); } else { gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_HAND, GIMP_CURSOR_MODIFIER_MOVE); } }
static void gimp_brush_tool_cursor_update (GimpTool *tool, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool); GimpBrushCore *brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core); if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool))) { if (! brush_core->main_brush || ! brush_core->dynamics) { gimp_tool_set_cursor (tool, display, gimp_tool_control_get_cursor (tool->control), gimp_tool_control_get_tool_cursor (tool->control), GIMP_CURSOR_MODIFIER_BAD); return; } } GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display); }
static void gimp_flip_tool_cursor_update (GimpTool *tool, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool); GimpFlipTool *flip = GIMP_FLIP_TOOL (tool); if (! gimp_transform_tool_check_active_item (tr_tool, display, NULL)) { gimp_tool_set_cursor (tool, display, gimp_tool_control_get_cursor (tool->control), gimp_tool_control_get_tool_cursor (tool->control), GIMP_CURSOR_MODIFIER_BAD); return; } gimp_tool_control_set_toggled (tool->control, gimp_flip_tool_get_flip_type (flip) == GIMP_ORIENTATION_VERTICAL); GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display); }
static void gimp_selection_tool_cursor_update (GimpTool *tool, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { GimpSelectionTool *selection_tool = GIMP_SELECTION_TOOL (tool); GimpSelectionOptions *options; GimpToolCursorType tool_cursor; GimpCursorModifier modifier; options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool); tool_cursor = gimp_tool_control_get_tool_cursor (tool->control); modifier = GIMP_CURSOR_MODIFIER_NONE; switch (selection_tool->function) { case SELECTION_SELECT: switch (options->operation) { case GIMP_CHANNEL_OP_REPLACE: break; case GIMP_CHANNEL_OP_ADD: modifier = GIMP_CURSOR_MODIFIER_PLUS; break; case GIMP_CHANNEL_OP_SUBTRACT: modifier = GIMP_CURSOR_MODIFIER_MINUS; break; case GIMP_CHANNEL_OP_INTERSECT: modifier = GIMP_CURSOR_MODIFIER_INTERSECT; break; } break; case SELECTION_MOVE_MASK: modifier = GIMP_CURSOR_MODIFIER_MOVE; break; case SELECTION_MOVE: case SELECTION_MOVE_COPY: tool_cursor = GIMP_TOOL_CURSOR_MOVE; break; case SELECTION_ANCHOR: modifier = GIMP_CURSOR_MODIFIER_ANCHOR; break; } /* we don't set the bad modifier ourselves, so a subclass has set * it, always leave it there since it's more important than what we * have to say. */ if (gimp_tool_control_get_cursor_modifier (tool->control) == GIMP_CURSOR_MODIFIER_BAD) { modifier = GIMP_CURSOR_MODIFIER_BAD; } gimp_tool_set_cursor (tool, display, gimp_tool_control_get_cursor (tool->control), tool_cursor, modifier); }
static void gimp_guide_tool_start (GimpTool *parent_tool, GimpDisplay *display, GimpGuide *guide, GimpOrientationType orientation) { GimpGuideTool *guide_tool; GimpTool *tool; guide_tool = g_object_new (GIMP_TYPE_GUIDE_TOOL, "tool-info", parent_tool->tool_info, NULL); tool = GIMP_TOOL (guide_tool); gimp_display_shell_selection_pause (gimp_display_get_shell (display)); if (guide) { guide_tool->guide = guide; guide_tool->guide_old_position = gimp_guide_get_position (guide); guide_tool->guide_position = gimp_guide_get_position (guide); guide_tool->guide_orientation = gimp_guide_get_orientation (guide); guide_tool->guide_custom = gimp_guide_is_custom (guide); } else { guide_tool->guide = NULL; guide_tool->guide_old_position = 0; guide_tool->guide_position = GIMP_GUIDE_POSITION_UNDEFINED; guide_tool->guide_orientation = orientation; guide_tool->guide_custom = FALSE; } gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_HAND, GIMP_CURSOR_MODIFIER_MOVE); tool_manager_push_tool (display->gimp, tool); tool->display = display; gimp_tool_control_activate (tool->control); gimp_draw_tool_start (GIMP_DRAW_TOOL (guide_tool), display); if (guide_tool->guide) { gimp_tool_push_status_length (tool, display, _("Move Guide: "), SWAP_ORIENT (guide_tool->guide_orientation), guide_tool->guide_position - guide_tool->guide_old_position, NULL); } else { gimp_tool_push_status_length (tool, display, _("Add Guide: "), SWAP_ORIENT (guide_tool->guide_orientation), guide_tool->guide_position, NULL); } }
static void gimp_sample_point_tool_start (GimpTool *parent_tool, GimpDisplay *display, GimpSamplePoint *sample_point) { GimpSamplePointTool *sp_tool; GimpTool *tool; sp_tool = g_object_new (GIMP_TYPE_SAMPLE_POINT_TOOL, "tool-info", parent_tool->tool_info, NULL); tool = GIMP_TOOL (sp_tool); gimp_display_shell_selection_pause (gimp_display_get_shell (display)); if (sample_point) { sp_tool->sample_point = sample_point; gimp_sample_point_get_position (sample_point, &sp_tool->sample_point_old_x, &sp_tool->sample_point_old_y); sp_tool->sample_point_x = sp_tool->sample_point_old_x; sp_tool->sample_point_y = sp_tool->sample_point_old_y; } else { sp_tool->sample_point = NULL; sp_tool->sample_point_old_x = 0; sp_tool->sample_point_old_y = 0; sp_tool->sample_point_x = GIMP_SAMPLE_POINT_POSITION_UNDEFINED; sp_tool->sample_point_y = GIMP_SAMPLE_POINT_POSITION_UNDEFINED; } gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_COLOR_PICKER, GIMP_CURSOR_MODIFIER_MOVE); tool_manager_push_tool (display->gimp, tool); tool->display = display; gimp_tool_control_activate (tool->control); gimp_draw_tool_start (GIMP_DRAW_TOOL (sp_tool), display); if (sp_tool->sample_point) { gimp_tool_push_status_coords (tool, display, gimp_tool_control_get_precision (tool->control), _("Move Sample Point: "), sp_tool->sample_point_x - sp_tool->sample_point_old_x, ", ", sp_tool->sample_point_y - sp_tool->sample_point_old_y, NULL); } else { gimp_tool_push_status_coords (tool, display, gimp_tool_control_get_precision (tool->control), _("Add Sample Point: "), sp_tool->sample_point_x, ", ", sp_tool->sample_point_y, NULL); } }