mirror of https://github.com/GNOME/gimp.git
app: add gimp_display_shell_selection_pause() and _resume()
and use them instead of gimp_display_shell_selection_control() with the resp. enum values. Remove the GIMP_SELECTION_PAUSE and _RESUME enums values and thus the presence of this concept in the core.
This commit is contained in:
parent
e11ca44ba0
commit
545e65dda6
|
@ -645,8 +645,6 @@ gimp_selection_control_get_type (void)
|
|||
{
|
||||
{ GIMP_SELECTION_OFF, "GIMP_SELECTION_OFF", "off" },
|
||||
{ GIMP_SELECTION_ON, "GIMP_SELECTION_ON", "on" },
|
||||
{ GIMP_SELECTION_PAUSE, "GIMP_SELECTION_PAUSE", "pause" },
|
||||
{ GIMP_SELECTION_RESUME, "GIMP_SELECTION_RESUME", "resume" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -654,8 +652,6 @@ gimp_selection_control_get_type (void)
|
|||
{
|
||||
{ GIMP_SELECTION_OFF, "GIMP_SELECTION_OFF", NULL },
|
||||
{ GIMP_SELECTION_ON, "GIMP_SELECTION_ON", NULL },
|
||||
{ GIMP_SELECTION_PAUSE, "GIMP_SELECTION_PAUSE", NULL },
|
||||
{ GIMP_SELECTION_RESUME, "GIMP_SELECTION_RESUME", NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -297,9 +297,7 @@ GType gimp_selection_control_get_type (void) G_GNUC_CONST;
|
|||
typedef enum /*< pdb-skip >*/
|
||||
{
|
||||
GIMP_SELECTION_OFF,
|
||||
GIMP_SELECTION_ON,
|
||||
GIMP_SELECTION_PAUSE,
|
||||
GIMP_SELECTION_RESUME
|
||||
GIMP_SELECTION_ON
|
||||
} GimpSelectionControl;
|
||||
|
||||
|
||||
|
|
|
@ -1044,8 +1044,8 @@ gimp_display_shell_ants_speed_notify_handler (GObject *config,
|
|||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_PAUSE);
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
gimp_display_shell_selection_pause (shell);
|
||||
gimp_display_shell_selection_resume (shell);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -65,9 +65,6 @@ struct _Selection
|
|||
static void selection_start (Selection *selection);
|
||||
static void selection_stop (Selection *selection);
|
||||
|
||||
static void selection_pause (Selection *selection);
|
||||
static void selection_resume (Selection *selection);
|
||||
|
||||
static void selection_draw (Selection *selection);
|
||||
static void selection_undraw (Selection *selection);
|
||||
|
||||
|
@ -162,14 +159,6 @@ gimp_display_shell_selection_control (GimpDisplayShell *shell,
|
|||
case GIMP_SELECTION_ON:
|
||||
selection_start (selection);
|
||||
break;
|
||||
|
||||
case GIMP_SELECTION_PAUSE:
|
||||
selection_pause (selection);
|
||||
break;
|
||||
|
||||
case GIMP_SELECTION_RESUME:
|
||||
selection_resume (selection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (shell->selection)
|
||||
|
@ -179,6 +168,34 @@ gimp_display_shell_selection_control (GimpDisplayShell *shell,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_selection_pause (GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (shell->selection && gimp_display_get_image (shell->display))
|
||||
{
|
||||
if (shell->selection->paused == 0)
|
||||
selection_stop (shell->selection);
|
||||
|
||||
shell->selection->paused++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_selection_resume (GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (shell->selection && gimp_display_get_image (shell->display))
|
||||
{
|
||||
shell->selection->paused--;
|
||||
|
||||
if (shell->selection->paused == 0)
|
||||
selection_start (shell->selection);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_selection_set_show (GimpDisplayShell *shell,
|
||||
gboolean show)
|
||||
|
@ -226,24 +243,6 @@ selection_stop (Selection *selection)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
selection_pause (Selection *selection)
|
||||
{
|
||||
if (selection->paused == 0)
|
||||
selection_stop (selection);
|
||||
|
||||
selection->paused++;
|
||||
}
|
||||
|
||||
static void
|
||||
selection_resume (Selection *selection)
|
||||
{
|
||||
selection->paused--;
|
||||
|
||||
if (selection->paused == 0)
|
||||
selection_start (selection);
|
||||
}
|
||||
|
||||
static void
|
||||
selection_draw (Selection *selection)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,9 @@ void gimp_display_shell_selection_free (GimpDisplayShell *shell);
|
|||
void gimp_display_shell_selection_control (GimpDisplayShell *shell,
|
||||
GimpSelectionControl control);
|
||||
|
||||
void gimp_display_shell_selection_pause (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_selection_resume (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_selection_set_show (GimpDisplayShell *shell,
|
||||
gboolean show);
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ gimp_color_tool_button_press (GimpTool *tool,
|
|||
|
||||
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
|
||||
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_PAUSE);
|
||||
gimp_display_shell_selection_pause (shell);
|
||||
|
||||
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
|
||||
|
||||
|
@ -277,7 +277,7 @@ gimp_color_tool_button_release (GimpTool *tool,
|
|||
color_tool->sample_point_x = SAMPLE_POINT_POSITION_INVALID;
|
||||
color_tool->sample_point_y = SAMPLE_POINT_POSITION_INVALID;
|
||||
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
gimp_display_shell_selection_resume (shell);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ gimp_color_tool_button_release (GimpTool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
gimp_display_shell_selection_resume (shell);
|
||||
gimp_image_flush (image);
|
||||
|
||||
color_tool->moving_sample_point = FALSE;
|
||||
|
@ -784,8 +784,7 @@ gimp_color_tool_start_sample_point (GimpTool *tool,
|
|||
|
||||
color_tool = GIMP_COLOR_TOOL (tool);
|
||||
|
||||
gimp_display_shell_selection_control (gimp_display_get_shell (display),
|
||||
GIMP_SELECTION_PAUSE);
|
||||
gimp_display_shell_selection_pause (gimp_display_get_shell (display));
|
||||
|
||||
tool->display = display;
|
||||
gimp_tool_control_activate (tool->control);
|
||||
|
|
|
@ -445,7 +445,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
|||
tool_manager_push_tool (display->gimp, tool);
|
||||
|
||||
/* pause the current selection */
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_PAUSE);
|
||||
gimp_display_shell_selection_pause (shell);
|
||||
|
||||
/* initialize the statusbar display */
|
||||
gimp_tool_push_status_coords (tool, display,
|
||||
|
@ -470,7 +470,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|||
GimpItem *active_item;
|
||||
|
||||
/* resume the current selection */
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
gimp_display_shell_selection_resume (shell);
|
||||
|
||||
gimp_tool_pop_status (tool, display);
|
||||
|
||||
|
|
|
@ -239,8 +239,7 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
|
||||
gimp_tool_control_activate (tool->control);
|
||||
|
||||
gimp_display_shell_selection_control (shell,
|
||||
GIMP_SELECTION_PAUSE);
|
||||
gimp_display_shell_selection_pause (shell);
|
||||
|
||||
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
|
||||
|
||||
|
@ -352,7 +351,7 @@ gimp_move_tool_button_release (GimpTool *tool,
|
|||
move->guide_position = GUIDE_POSITION_INVALID;
|
||||
move->guide_orientation = GIMP_ORIENTATION_UNKNOWN;
|
||||
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
gimp_display_shell_selection_resume (shell);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -413,7 +412,7 @@ gimp_move_tool_button_release (GimpTool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
gimp_display_shell_selection_resume (shell);
|
||||
gimp_image_flush (image);
|
||||
|
||||
move->moving_guide = FALSE;
|
||||
|
@ -802,8 +801,7 @@ gimp_move_tool_start_guide (GimpMoveTool *move,
|
|||
{
|
||||
GimpTool *tool = GIMP_TOOL (move);
|
||||
|
||||
gimp_display_shell_selection_control (gimp_display_get_shell (display),
|
||||
GIMP_SELECTION_PAUSE);
|
||||
gimp_display_shell_selection_pause (gimp_display_get_shell (display));
|
||||
|
||||
tool->display = display;
|
||||
gimp_tool_control_activate (tool->control);
|
||||
|
|
|
@ -346,7 +346,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
press_type, display);
|
||||
|
||||
/* pause the current selection */
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_PAUSE);
|
||||
gimp_display_shell_selection_pause (shell);
|
||||
|
||||
/* Let the specific painting function initialize itself */
|
||||
gimp_paint_core_paint (core, drawable, paint_options,
|
||||
|
@ -400,7 +400,7 @@ gimp_paint_tool_button_release (GimpTool *tool,
|
|||
GIMP_PAINT_STATE_FINISH, time);
|
||||
|
||||
/* resume the current selection */
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
gimp_display_shell_selection_resume (shell);
|
||||
|
||||
/* chain up to halt the tool */
|
||||
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
|
||||
|
|
Loading…
Reference in New Issue