Commit 1082ee6b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

remember the last used GimpCursorFormat so changing the format in prefs

2004-06-14  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell.[ch]: remember the last used
	GimpCursorFormat so changing the format in prefs applies
	instantly, and not after the next tool change.

	* app/display/gimpdisplayshell-cursor.[ch]
	* app/tools/gimptool.[ch]
	* app/tools/gimptoolcontrol.[ch]
	* app/tools/gimpclonetool.c
	* app/tools/gimpcolortool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimptransformtool.c: s/GdkCursorType/GimpCursorType/g
parent 71b4d891
2004-06-14 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell.[ch]: remember the last used
GimpCursorFormat so changing the format in prefs applies
instantly, and not after the next tool change.
* app/display/gimpdisplayshell-cursor.[ch]
* app/tools/gimptool.[ch]
* app/tools/gimptoolcontrol.[ch]
* app/tools/gimpclonetool.c
* app/tools/gimpcolortool.c
* app/tools/gimpcroptool.c
* app/tools/gimpcurvestool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/tools/gimptransformtool.c: s/GdkCursorType/GimpCursorType/g
2004-06-14 Philip Lafleur <plafleur@cvs.gnome.org>
* app/tools/gimptransformtool.c (gimp_transform_tool_doit): Preview
......
......@@ -44,7 +44,7 @@
static void gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
GdkCursorType cursor_type,
GimpCursorType cursor_type,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier,
gboolean always_install);
......@@ -52,7 +52,7 @@ static void gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
void
gimp_display_shell_set_cursor (GimpDisplayShell *shell,
GdkCursorType cursor_type,
GimpCursorType cursor_type,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier)
{
......@@ -70,7 +70,7 @@ gimp_display_shell_set_cursor (GimpDisplayShell *shell,
void
gimp_display_shell_set_override_cursor (GimpDisplayShell *shell,
GdkCursorType cursor_type)
GimpCursorType cursor_type)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
......@@ -82,7 +82,7 @@ gimp_display_shell_set_override_cursor (GimpDisplayShell *shell,
shell->using_override_cursor = TRUE;
gimp_cursor_set (shell->canvas,
GIMP_GUI_CONFIG (shell->gdisp->gimage->gimp->config)->cursor_format,
shell->cursor_format,
cursor_type,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
......@@ -181,12 +181,13 @@ gimp_display_shell_clear_cursor (GimpDisplayShell *shell)
static void
gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
GdkCursorType cursor_type,
GimpCursorType cursor_type,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier,
gboolean always_install)
{
GimpDisplayConfig *config;
GimpCursorFormat cursor_format;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
......@@ -212,17 +213,20 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
}
}
if (shell->current_cursor != cursor_type ||
shell->tool_cursor != tool_cursor ||
shell->cursor_modifier != modifier ||
cursor_format = GIMP_GUI_CONFIG (config)->cursor_format;
if (shell->cursor_format != cursor_format ||
shell->current_cursor != cursor_type ||
shell->tool_cursor != tool_cursor ||
shell->cursor_modifier != modifier ||
always_install)
{
shell->cursor_format = cursor_format;
shell->current_cursor = cursor_type;
shell->tool_cursor = tool_cursor;
shell->cursor_modifier = modifier;
gimp_cursor_set (shell->canvas,
GIMP_GUI_CONFIG (config)->cursor_format,
gimp_cursor_set (shell->canvas, cursor_format,
cursor_type, tool_cursor, modifier);
}
}
......@@ -21,11 +21,11 @@
void gimp_display_shell_set_cursor (GimpDisplayShell *shell,
GdkCursorType cursor_type,
GimpCursorType cursor_type,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier);
void gimp_display_shell_set_override_cursor (GimpDisplayShell *shell,
GdkCursorType cursor_type);
GimpCursorType cursor_type);
void gimp_display_shell_unset_override_cursor (GimpDisplayShell *shell);
void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
......
......@@ -280,11 +280,12 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->icon_size = 32;
shell->icon_idle_id = 0;
shell->current_cursor = (GdkCursorType) -1;
shell->cursor_format = GIMP_CURSOR_FORMAT_BITMAP;
shell->current_cursor = (GimpCursorType) -1;
shell->tool_cursor = GIMP_TOOL_CURSOR_NONE;
shell->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE;
shell->override_cursor = (GdkCursorType) -1;
shell->override_cursor = (GimpCursorType) -1;
shell->using_override_cursor = FALSE;
shell->draw_cursor = FALSE;
......
......@@ -118,11 +118,12 @@ struct _GimpDisplayShell
gint icon_size; /* size of the icon pixmap */
guint icon_idle_id; /* ID of the idle-function */
GdkCursorType current_cursor; /* Currently installed main cursor */
GimpCursorFormat cursor_format; /* Currently used cursor format */
GimpCursorType current_cursor; /* Currently installed main cursor */
GimpToolCursorType tool_cursor; /* Current Tool cursor */
GimpCursorModifier cursor_modifier; /* Cursor modifier (plus, minus, ...) */
GdkCursorType override_cursor; /* Overriding cursor */
GimpCursorType override_cursor; /* Overriding cursor */
gboolean using_override_cursor; /* is the cursor overridden? */
gboolean draw_cursor; /* should we draw software cursor ? */
......
......@@ -224,7 +224,7 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpCloneOptions *options;
GdkCursorType ctype = GIMP_CURSOR_MOUSE;
GimpCursorType ctype = GIMP_CURSOR_MOUSE;
options = (GimpCloneOptions *) tool->tool_info->tool_options;
......
......@@ -261,7 +261,7 @@ gimp_color_tool_cursor_update (GimpTool *tool,
if (color_tool->enabled)
{
GdkCursorType cursor = GIMP_CURSOR_BAD;
GimpCursorType cursor = GIMP_CURSOR_BAD;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
if (coords->x > 0 && coords->x < gdisp->gimage->width &&
......
......@@ -754,10 +754,10 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpCropTool *crop = GIMP_CROP_TOOL (tool);
GimpCropTool *crop = GIMP_CROP_TOOL (tool);
GimpCropOptions *options;
GdkCursorType ctype = GIMP_CURSOR_CROSSHAIR_SMALL;
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
GimpCursorType cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
options = GIMP_CROP_OPTIONS (tool->tool_info->tool_options);
......@@ -766,12 +766,12 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
switch (crop->function)
{
case MOVING:
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
case RESIZING_LEFT:
case RESIZING_RIGHT:
cmodifier = GIMP_CURSOR_MODIFIER_RESIZE;
modifier = GIMP_CURSOR_MODIFIER_RESIZE;
break;
default:
......@@ -779,13 +779,13 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
}
}
gimp_tool_control_set_cursor (tool->control, ctype);
gimp_tool_control_set_cursor (tool->control, cursor);
gimp_tool_control_set_tool_cursor (tool->control,
options->crop_mode ==
GIMP_CROP_MODE_CROP ?
GIMP_TOOL_CURSOR_CROP :
GIMP_TOOL_CURSOR_RESIZE);
gimp_tool_control_set_cursor_modifier (tool->control, cmodifier);
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
}
......
......@@ -896,9 +896,9 @@ curves_graph_events (GtkWidget *widget,
GdkEvent *event,
GimpCurvesTool *tool)
{
static GdkCursorType cursor_type = GDK_TOP_LEFT_ARROW;
static GimpCursorType cursor_type = GDK_TOP_LEFT_ARROW;
GdkCursorType new_cursor = GDK_X_CURSOR;
GimpCursorType new_cursor = GDK_X_CURSOR;
GdkEventButton *bevent;
GdkEventMotion *mevent;
gint i;
......
......@@ -1005,8 +1005,8 @@ gimp_iscissors_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
GdkCursorType cursor = GIMP_CURSOR_MOUSE;
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
GimpCursorType cursor = GIMP_CURSOR_MOUSE;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
switch (iscissors->op)
{
......@@ -1014,10 +1014,10 @@ gimp_iscissors_tool_cursor_update (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
return;
case ISCISSORS_OP_MOVE_POINT:
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
case ISCISSORS_OP_ADD_POINT:
cmodifier = GIMP_CURSOR_MODIFIER_PLUS;
modifier = GIMP_CURSOR_MODIFIER_PLUS;
break;
case ISCISSORS_OP_IMPOSSIBLE:
cursor = GIMP_CURSOR_BAD;
......@@ -1027,7 +1027,7 @@ gimp_iscissors_tool_cursor_update (GimpTool *tool,
}
gimp_tool_set_cursor (tool, gdisp,
cursor, GIMP_TOOL_CURSOR_ISCISSORS, cmodifier);
cursor, GIMP_TOOL_CURSOR_ISCISSORS, modifier);
}
......
......@@ -508,8 +508,8 @@ gimp_measure_tool_cursor_update (GimpTool *tool,
{
GimpMeasureTool *mtool = GIMP_MEASURE_TOOL (tool);
gboolean in_handle = FALSE;
GdkCursorType ctype = GIMP_CURSOR_CROSSHAIR_SMALL;
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
GimpCursorType cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
gint i;
if (gimp_tool_control_is_active (tool->control) && tool->gdisp == gdisp)
......@@ -531,36 +531,36 @@ gimp_measure_tool_cursor_update (GimpTool *tool,
if (state & GDK_CONTROL_MASK)
{
if (state & GDK_MOD1_MASK)
ctype = GDK_BOTTOM_RIGHT_CORNER;
cursor = GDK_BOTTOM_RIGHT_CORNER;
else
ctype = GDK_BOTTOM_SIDE;
cursor = GDK_BOTTOM_SIDE;
break;
}
if (state & GDK_MOD1_MASK)
{
ctype = GDK_RIGHT_SIDE;
cursor = GDK_RIGHT_SIDE;
break;
}
if (state & GDK_SHIFT_MASK)
cmodifier = GIMP_CURSOR_MODIFIER_PLUS;
modifier = GIMP_CURSOR_MODIFIER_PLUS;
else
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
if (i == 0 && mtool->num_points == 3 &&
cmodifier == GIMP_CURSOR_MODIFIER_PLUS)
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
modifier == GIMP_CURSOR_MODIFIER_PLUS)
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
}
}
if (! in_handle && mtool->num_points > 1 && state & GDK_MOD1_MASK)
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
}
gimp_tool_control_set_cursor (tool->control, ctype);
gimp_tool_control_set_cursor_modifier (tool->control, cmodifier);
gimp_tool_control_set_cursor (tool->control, cursor);
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
}
......
......@@ -586,7 +586,7 @@ gimp_move_tool_cursor_update (GimpTool *tool,
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
GimpMoveOptions *options = GIMP_MOVE_OPTIONS (tool->tool_info->tool_options);
GdkCursorType cursor = GIMP_CURSOR_BAD;
GimpCursorType cursor = GIMP_CURSOR_BAD;
GimpToolCursorType tool_cursor = GIMP_TOOL_CURSOR_MOVE;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
......
......@@ -224,7 +224,7 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpCloneOptions *options;
GdkCursorType ctype = GIMP_CURSOR_MOUSE;
GimpCursorType ctype = GIMP_CURSOR_MOUSE;
options = (GimpCloneOptions *) tool->tool_info->tool_options;
......
......@@ -587,7 +587,7 @@ gimp_tool_pop_status (GimpTool *tool)
void
gimp_tool_set_cursor (GimpTool *tool,
GimpDisplay *gdisp,
GdkCursorType cursor,
GimpCursorType cursor,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier)
{
......
......@@ -156,7 +156,7 @@ void gimp_tool_pop_status (GimpTool *tool);
void gimp_tool_set_cursor (GimpTool *tool,
GimpDisplay *gdisp,
GdkCursorType cursor,
GimpCursorType cursor,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier);
......
......@@ -210,7 +210,7 @@ gimp_tool_control_set_preserve (GimpToolControl *control,
void
gimp_tool_control_set_cursor (GimpToolControl *control,
GdkCursorType cursor)
GimpCursorType cursor)
{
g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
......@@ -237,7 +237,7 @@ gimp_tool_control_set_cursor_modifier (GimpToolControl *control,
void
gimp_tool_control_set_toggle_cursor (GimpToolControl *control,
GdkCursorType cursor)
GimpCursorType cursor)
{
g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
......@@ -335,7 +335,7 @@ gimp_tool_control_is_toggled (GimpToolControl *control)
return control->toggled;
}
GdkCursorType
GimpCursorType
gimp_tool_control_get_cursor (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
......@@ -343,7 +343,7 @@ gimp_tool_control_get_cursor (GimpToolControl *control)
return control->cursor;
}
GdkCursorType
GimpCursorType
gimp_tool_control_get_toggle_cursor (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
......
......@@ -53,11 +53,11 @@ struct _GimpToolControl
* active drawable */
GimpMotionMode motion_mode; /* how to process motion events before *
* they are forwarded to the tool */
GdkCursorType cursor;
GimpCursorType cursor;
GimpToolCursorType tool_cursor;
GimpCursorModifier cursor_modifier;
GdkCursorType toggle_cursor;
GimpCursorType toggle_cursor;
GimpToolCursorType toggle_tool_cursor;
GimpCursorModifier toggle_cursor_modifier;
......@@ -115,10 +115,10 @@ void gimp_tool_control_snap_offsets (GimpToolControl
gint *width,
gint *height);
GdkCursorType gimp_tool_control_get_cursor (GimpToolControl *control);
GimpCursorType gimp_tool_control_get_cursor (GimpToolControl *control);
void gimp_tool_control_set_cursor (GimpToolControl *control,
GdkCursorType cursor);
GimpCursorType cursor);
GimpToolCursorType gimp_tool_control_get_tool_cursor (GimpToolControl *control);
void gimp_tool_control_set_tool_cursor (GimpToolControl *control,
......@@ -127,10 +127,10 @@ GimpCursorModifier gimp_tool_control_get_cursor_modifier (GimpToolControl
void gimp_tool_control_set_cursor_modifier (GimpToolControl *control,
GimpCursorModifier cmodifier);
GdkCursorType gimp_tool_control_get_toggle_cursor (GimpToolControl *control);
GimpCursorType gimp_tool_control_get_toggle_cursor (GimpToolControl *control);
void gimp_tool_control_set_toggle_cursor (GimpToolControl *control,
GdkCursorType cursor);
GimpCursorType cursor);
GimpToolCursorType gimp_tool_control_get_toggle_tool_cursor (GimpToolControl *control);
void gimp_tool_control_set_toggle_tool_cursor (GimpToolControl *control,
......
......@@ -638,8 +638,8 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
if (tr_tool->use_grid)
{
GimpChannel *selection = gimp_image_get_mask (gdisp->gimage);
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
GimpCursorType cursor = GDK_TOP_LEFT_ARROW;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
switch (options->type)
{
......@@ -652,14 +652,14 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
if (GIMP_IS_LAYER (drawable) &&
gimp_layer_get_mask (GIMP_LAYER (drawable)))
{
ctype = GIMP_CURSOR_BAD;
cursor = GIMP_CURSOR_BAD;
}
else if (gimp_display_coords_in_active_drawable (gdisp, coords))
{
if (gimp_channel_is_empty (selection) ||
gimp_channel_value (selection, coords->x, coords->y))
{
ctype = GIMP_CURSOR_MOUSE;
cursor = GIMP_CURSOR_MOUSE;
}
}
}
......@@ -670,25 +670,25 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
if (gimp_channel_is_empty (selection) ||
gimp_channel_value (selection, coords->x, coords->y))
{
ctype = GIMP_CURSOR_MOUSE;
cursor = GIMP_CURSOR_MOUSE;
}
break;
case GIMP_TRANSFORM_TYPE_PATH:
if (gimp_image_get_active_vectors (gdisp->gimage))
ctype = GIMP_CURSOR_MOUSE;
cursor = GIMP_CURSOR_MOUSE;
else
ctype = GIMP_CURSOR_BAD;
cursor = GIMP_CURSOR_BAD;
break;
}
if (tr_tool->use_center && tr_tool->function == TRANSFORM_HANDLE_CENTER)
{
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
}
gimp_tool_control_set_cursor (tool->control, ctype);
gimp_tool_control_set_cursor_modifier (tool->control, cmodifier);
gimp_tool_control_set_cursor (tool->control, cursor);
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
}
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment