added "GimpVectorMode saved_mode" to the GimpVectorTool struct.

2003-09-17  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpvectortool.[ch]: added "GimpVectorMode saved_mode"
	to the GimpVectorTool struct.

	(gimp_vector_tool_modifier_key): use it to correctly keep track of
	the modifier state.

	* app/tools/gimpselectiontool.c (gimp_selection_tool_modifier_key):
	moved variable to local scope.
This commit is contained in:
Michael Natterer
2003-09-17 11:16:55 +00:00
committed by Michael Natterer
parent 2b47b79bb7
commit 69e11c9af2
4 changed files with 59 additions and 20 deletions

View File

@ -1,3 +1,14 @@
2003-09-17 Michael Natterer <mitch@gimp.org>
* app/tools/gimpvectortool.[ch]: added "GimpVectorMode saved_mode"
to the GimpVectorTool struct.
(gimp_vector_tool_modifier_key): use it to correctly keep track of
the modifier state.
* app/tools/gimpselectiontool.c (gimp_selection_tool_modifier_key):
moved variable to local scope.
2003-09-17 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-path.c (gimp_config_path_expand): fixed

View File

@ -121,15 +121,16 @@ gimp_selection_tool_modifier_key (GimpTool *tool,
{
GimpSelectionTool *selection_tool;
GimpSelectionOptions *options;
SelectOps button_op;
selection_tool = GIMP_SELECTION_TOOL (tool);
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
button_op = options->operation;
if (key == GDK_SHIFT_MASK || key == GDK_CONTROL_MASK)
{
SelectOps button_op;
button_op = options->operation;
if (press)
{
if (key == (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)))

View File

@ -215,6 +215,8 @@ gimp_vector_tool_init (GimpVectorTool *vector_tool)
vector_tool->sel_count = 0;
vector_tool->sel_anchor = NULL;
vector_tool->sel_stroke = NULL;
vector_tool->saved_mode = GIMP_VECTOR_MODE_CREATE;
}
@ -672,30 +674,53 @@ gimp_vector_tool_modifier_key (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpVectorTool *vector_tool;
GimpVectorOptions *options;
options = GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options);
vector_tool = GIMP_VECTOR_TOOL (tool);
options = GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options);
if (key == TOGGLE_MASK)
return;
if (state & MOVE_MASK)
if (key == INSDEL_MASK || key == MOVE_MASK)
{
g_object_set (options,
"vectors-edit-mode", GIMP_VECTOR_MODE_MOVE,
NULL);
}
else if (state & INSDEL_MASK)
{
g_object_set (options,
"vectors-edit-mode", GIMP_VECTOR_MODE_ADJUST,
NULL);
}
else
{
g_object_set (options,
"vectors-edit-mode", GIMP_VECTOR_MODE_CREATE,
NULL);
GimpVectorMode button_mode;
button_mode = options->edit_mode;
if (press)
{
if (key == (state & (INSDEL_MASK | MOVE_MASK)))
{
/* first modifier pressed */
vector_tool->saved_mode = options->edit_mode;
}
}
else
{
if (! (state & (INSDEL_MASK | MOVE_MASK)))
{
/* last modifier released */
button_mode = vector_tool->saved_mode;
}
}
if (state & INSDEL_MASK)
{
button_mode = GIMP_VECTOR_MODE_ADJUST;
}
else if (state & MOVE_MASK)
{
button_mode = GIMP_VECTOR_MODE_MOVE;
}
if (button_mode != options->edit_mode)
{
g_object_set (options, "vectors-edit-mode", button_mode, NULL);
}
}
}

View File

@ -82,6 +82,8 @@ struct _GimpVectorTool
GimpAnchor *sel_anchor; /* currently selected anchor, NULL */
/* if multiple anchors are selected */
GimpStroke *sel_stroke; /* selected stroke */
GimpVectorMode saved_mode; /* used by modifier_key() */
};
struct _GimpVectorToolClass