Commit 7e922125 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

transparently handle cursor vs. toggle cursor in the cursor accessor

2005-07-30  Sven Neumann  <sven@gimp.org>

	* app/tools/gimptoolcontrol.[ch]: transparently handle cursor
	vs. toggle cursor in the cursor accessor functions.

	* app/tools/gimpconvolvetool.c
	* app/tools/gimperasertool.c
	* app/tools/gimpmagnifytool.c
	* app/tools/gimptool.c: simplifies things here.

	* app/tools/gimpforegroundselecttool.c: set a toggle cursor and
	toggle the tool if a mask is set.
parent ee767fa6
2005-07-30 Sven Neumann <sven@gimp.org>
* app/tools/gimptoolcontrol.[ch]: transparently handle cursor
vs. toggle cursor in the cursor accessor functions.
* app/tools/gimpconvolvetool.c
* app/tools/gimperasertool.c
* app/tools/gimpmagnifytool.c
* app/tools/gimptool.c: simplifies things here.
* app/tools/gimpforegroundselecttool.c: set a toggle cursor and
toggle the tool if a mask is set.
2005-07-30 Sven Neumann <sven@gimp.org>
* app/tools/gimpforegroundselecttool.c: implement cursor_update().
......
......@@ -120,8 +120,6 @@ gimp_convolve_tool_init (GimpConvolveTool *convolve)
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_BLUR);
gimp_tool_control_set_toggle_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_BLUR);
gimp_tool_control_set_toggle_cursor_modifier (tool->control,
GIMP_CURSOR_MODIFIER_MINUS);
}
......
......@@ -120,8 +120,6 @@ gimp_eraser_tool_init (GimpEraserTool *eraser)
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_ERASER);
gimp_tool_control_set_toggle_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_ERASER);
gimp_tool_control_set_toggle_cursor_modifier (tool->control,
GIMP_CURSOR_MODIFIER_MINUS);
......
......@@ -180,8 +180,11 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
GimpTool *tool = GIMP_TOOL (fg_select);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
gimp_tool_control_set_toggle_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PAINTBRUSH);
fg_select->mask = NULL;
}
......@@ -420,6 +423,8 @@ gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
gimp_display_shell_set_overlay (GIMP_DISPLAY_SHELL (gdisp->shell),
GIMP_DRAWABLE (mask));
gimp_tool_control_set_toggle (GIMP_TOOL (fg_select)->control, mask != NULL);
}
static void
......
......@@ -168,11 +168,6 @@ gimp_magnify_tool_init (GimpMagnifyTool *magnify_tool)
GIMP_TOOL_CURSOR_ZOOM);
gimp_tool_control_set_cursor_modifier (tool->control,
GIMP_CURSOR_MODIFIER_PLUS);
gimp_tool_control_set_toggle_cursor (tool->control,
GIMP_CURSOR_ZOOM);
gimp_tool_control_set_toggle_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_ZOOM);
gimp_tool_control_set_toggle_cursor_modifier (tool->control,
GIMP_CURSOR_MODIFIER_MINUS);
}
......
......@@ -307,20 +307,10 @@ gimp_tool_real_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
if (gimp_tool_control_is_toggled (tool->control))
{
gimp_tool_set_cursor (tool, gdisp,
gimp_tool_control_get_toggle_cursor (tool->control),
gimp_tool_control_get_toggle_tool_cursor (tool->control),
gimp_tool_control_get_toggle_cursor_modifier (tool->control));
}
else
{
gimp_tool_set_cursor (tool, gdisp,
gimp_tool_control_get_cursor (tool->control),
gimp_tool_control_get_tool_cursor (tool->control),
gimp_tool_control_get_cursor_modifier (tool->control));
}
gimp_tool_set_cursor (tool, gdisp,
gimp_tool_control_get_cursor (tool->control),
gimp_tool_control_get_tool_cursor (tool->control),
gimp_tool_control_get_cursor_modifier (tool->control));
}
......
......@@ -96,14 +96,15 @@ gimp_tool_control_init (GimpToolControl *control)
control->tool_cursor = GIMP_TOOL_CURSOR_NONE;
control->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE;
control->toggle_cursor = GIMP_CURSOR_MOUSE;
control->toggle_tool_cursor = GIMP_TOOL_CURSOR_NONE;
control->toggle_cursor_modifier = GIMP_CURSOR_MODIFIER_NONE;
control->toggle_cursor = -1;
control->toggle_tool_cursor = -1;
control->toggle_cursor_modifier = -1;
control->action_value_1 = NULL;
control->action_value_2 = NULL;
control->action_value_3 = NULL;
control->action_value_4 = NULL;
control->action_object_1 = NULL;
control->action_object_2 = NULL;
}
......@@ -389,15 +390,10 @@ gimp_tool_control_get_cursor (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
return control->cursor;
}
if (control->toggled && control->toggle_cursor != -1)
return control->toggle_cursor;
GimpCursorType
gimp_tool_control_get_toggle_cursor (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
return control->toggle_cursor;
return control->cursor;
}
GimpToolCursorType
......@@ -405,15 +401,10 @@ gimp_tool_control_get_tool_cursor (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
return control->tool_cursor;
}
GimpToolCursorType
gimp_tool_control_get_toggle_tool_cursor (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
if (control->toggled && control->toggle_tool_cursor != -1)
return control->toggle_tool_cursor;
return control->toggle_tool_cursor;
return control->tool_cursor;
}
GimpCursorModifier
......@@ -421,15 +412,10 @@ gimp_tool_control_get_cursor_modifier (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
return control->cursor_modifier;
}
if (control->toggled && control->toggle_cursor_modifier != -1)
return control->toggle_cursor_modifier;
GimpCursorModifier
gimp_tool_control_get_toggle_cursor_modifier (GimpToolControl *control)
{
g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
return control->toggle_cursor_modifier;
return control->cursor_modifier;
}
void
......
......@@ -128,31 +128,25 @@ void gimp_tool_control_snap_offsets (GimpToolControl
gint *width,
gint *height);
GimpCursorType gimp_tool_control_get_cursor (GimpToolControl *control);
void gimp_tool_control_set_cursor (GimpToolControl *control,
GimpCursorType cursor);
GimpToolCursorType gimp_tool_control_get_tool_cursor (GimpToolControl *control);
void gimp_tool_control_set_tool_cursor (GimpToolControl *control,
GimpToolCursorType cursor);
GimpCursorModifier gimp_tool_control_get_cursor_modifier (GimpToolControl *control);
void gimp_tool_control_set_cursor_modifier (GimpToolControl *control,
GimpCursorModifier cmodifier);
GimpCursorType gimp_tool_control_get_toggle_cursor (GimpToolControl *control);
void gimp_tool_control_set_toggle_cursor (GimpToolControl *control,
GimpCursorType cursor);
GimpToolCursorType gimp_tool_control_get_toggle_tool_cursor (GimpToolControl *control);
void gimp_tool_control_set_toggle_tool_cursor (GimpToolControl *control,
GimpToolCursorType cursor);
GimpCursorModifier gimp_tool_control_get_toggle_cursor_modifier (GimpToolControl *control);
void gimp_tool_control_set_toggle_cursor_modifier (GimpToolControl *control,
GimpCursorModifier cmodifier);
GimpCursorType gimp_tool_control_get_cursor (GimpToolControl *control);
GimpToolCursorType gimp_tool_control_get_tool_cursor (GimpToolControl *control);
GimpCursorModifier gimp_tool_control_get_cursor_modifier (GimpToolControl *control);
void gimp_tool_control_set_action_value_1 (GimpToolControl *control,
const gchar *action_desc);
const gchar * gimp_tool_control_get_action_value_1 (GimpToolControl *control);
......
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