Made it possible to constrain movement with the Move Tool in 45 degree
2008-01-15 Martin Nordholts <martinn@svn.gnome.org> * app/tools/gimpeditselectiontool.[ch]: Made it possible to constrain movement with the Move Tool in 45 degree angles by holding Ctrl when a move has been initiated. This fixes the essential part of bug #78730. svn path=/trunk/; revision=24622
This commit is contained in:

committed by
Martin Nordholts

parent
572115701f
commit
9934221a07
@ -1,3 +1,10 @@
|
|||||||
|
2008-01-15 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
|
* app/tools/gimpeditselectiontool.[ch]: Made it possible to
|
||||||
|
constrain movement with the Move Tool in 45 degree angles by
|
||||||
|
holding Ctrl when a move has been initiated. This fixes the
|
||||||
|
essential part of bug #78730.
|
||||||
|
|
||||||
2008-01-15 Michael Natterer <mitch@gimp.org>
|
2008-01-15 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/gegl/gimpoperationcolorize.[ch]
|
* app/gegl/gimpoperationcolorize.[ch]
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include "gimpeditselectiontool.h"
|
#include "gimpeditselectiontool.h"
|
||||||
#include "gimptoolcontrol.h"
|
#include "gimptoolcontrol.h"
|
||||||
#include "tool_manager.h"
|
#include "tool_manager.h"
|
||||||
|
#include "tools-utils.h"
|
||||||
|
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
@ -62,20 +63,30 @@
|
|||||||
#define EDIT_SELECT_SCROLL_LOCK FALSE
|
#define EDIT_SELECT_SCROLL_LOCK FALSE
|
||||||
#define ARROW_VELOCITY 25
|
#define ARROW_VELOCITY 25
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of evenly distributed lines onto which moving will be
|
||||||
|
* constrained when movement constraint is active.
|
||||||
|
*/
|
||||||
|
#define N_SNAP_LINES 4
|
||||||
|
|
||||||
static void gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|
||||||
GimpCoords *coords,
|
|
||||||
guint32 time,
|
|
||||||
GdkModifierType state,
|
|
||||||
GimpButtonReleaseType release_type,
|
|
||||||
GimpDisplay *display);
|
|
||||||
static void gimp_edit_selection_tool_motion (GimpTool *tool,
|
|
||||||
GimpCoords *coords,
|
|
||||||
guint32 time,
|
|
||||||
GdkModifierType state,
|
|
||||||
GimpDisplay *display);
|
|
||||||
|
|
||||||
static void gimp_edit_selection_tool_draw (GimpDrawTool *tool);
|
static void gimp_edit_selection_tool_button_release (GimpTool *tool,
|
||||||
|
GimpCoords *coords,
|
||||||
|
guint32 time,
|
||||||
|
GdkModifierType state,
|
||||||
|
GimpButtonReleaseType release_type,
|
||||||
|
GimpDisplay *display);
|
||||||
|
static void gimp_edit_selection_tool_motion (GimpTool *tool,
|
||||||
|
GimpCoords *coords,
|
||||||
|
guint32 time,
|
||||||
|
GdkModifierType state,
|
||||||
|
GimpDisplay *display);
|
||||||
|
static void gimp_edit_selection_tool_active_modifier_key (GimpTool *tool,
|
||||||
|
GdkModifierType key,
|
||||||
|
gboolean press,
|
||||||
|
GdkModifierType state,
|
||||||
|
GimpDisplay *display);
|
||||||
|
static void gimp_edit_selection_tool_draw (GimpDrawTool *tool);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpEditSelectionTool, gimp_edit_selection_tool,
|
G_DEFINE_TYPE (GimpEditSelectionTool, gimp_edit_selection_tool,
|
||||||
@ -87,13 +98,14 @@ G_DEFINE_TYPE (GimpEditSelectionTool, gimp_edit_selection_tool,
|
|||||||
static void
|
static void
|
||||||
gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *klass)
|
gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *klass)
|
||||||
{
|
{
|
||||||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||||
GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass);
|
GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass);
|
||||||
|
|
||||||
tool_class->button_release = gimp_edit_selection_tool_button_release;
|
tool_class->button_release = gimp_edit_selection_tool_button_release;
|
||||||
tool_class->motion = gimp_edit_selection_tool_motion;
|
tool_class->motion = gimp_edit_selection_tool_motion;
|
||||||
|
tool_class->active_modifier_key = gimp_edit_selection_tool_active_modifier_key;
|
||||||
|
|
||||||
draw_class->draw = gimp_edit_selection_tool_draw;
|
draw_class->draw = gimp_edit_selection_tool_draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -111,6 +123,8 @@ gimp_edit_selection_tool_init (GimpEditSelectionTool *edit_selection_tool)
|
|||||||
edit_selection_tool->cumly = 0;
|
edit_selection_tool->cumly = 0;
|
||||||
|
|
||||||
edit_selection_tool->first_move = TRUE;
|
edit_selection_tool->first_move = TRUE;
|
||||||
|
|
||||||
|
edit_selection_tool->constrain = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -207,6 +221,12 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
|||||||
edit_select->x = edit_select->origx = coords->x - off_x;
|
edit_select->x = edit_select->origx = coords->x - off_x;
|
||||||
edit_select->y = edit_select->origy = coords->y - off_y;
|
edit_select->y = edit_select->origy = coords->y - off_y;
|
||||||
|
|
||||||
|
/* Remember starting point for use in constrained movement */
|
||||||
|
edit_select->start_x = coords->x;
|
||||||
|
edit_select->start_y = coords->y;
|
||||||
|
|
||||||
|
edit_select->constrain = FALSE;
|
||||||
|
|
||||||
switch (edit_select->edit_mode)
|
switch (edit_select->edit_mode)
|
||||||
{
|
{
|
||||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||||
@ -542,6 +562,13 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
|
|||||||
|
|
||||||
gimp_item_offsets (active_item, &off_x, &off_y);
|
gimp_item_offsets (active_item, &off_x, &off_y);
|
||||||
|
|
||||||
|
if (edit_select->constrain)
|
||||||
|
{
|
||||||
|
gimp_tool_motion_constrain (edit_select->start_x, edit_select->start_y,
|
||||||
|
&coords->x, &coords->y,
|
||||||
|
N_SNAP_LINES);
|
||||||
|
}
|
||||||
|
|
||||||
motion_x = coords->x - off_x;
|
motion_x = coords->x - off_x;
|
||||||
motion_y = coords->y - off_y;
|
motion_y = coords->y - off_y;
|
||||||
|
|
||||||
@ -676,6 +703,18 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
|
|||||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_edit_selection_tool_active_modifier_key (GimpTool *tool,
|
||||||
|
GdkModifierType key,
|
||||||
|
gboolean press,
|
||||||
|
GdkModifierType state,
|
||||||
|
GimpDisplay *display)
|
||||||
|
{
|
||||||
|
GimpEditSelectionTool *edit_select = GIMP_EDIT_SELECTION_TOOL (tool);
|
||||||
|
|
||||||
|
edit_select->constrain = state & GDK_CONTROL_MASK ? TRUE : FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,9 @@ struct _GimpEditSelectionTool
|
|||||||
gboolean first_move; /* Don't push undos after the first */
|
gboolean first_move; /* Don't push undos after the first */
|
||||||
|
|
||||||
gboolean propagate_release;
|
gboolean propagate_release;
|
||||||
|
|
||||||
|
gboolean constrain; /* Constrain the movement */
|
||||||
|
gdouble start_x, start_y;/* Coords when button was pressed */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpEditSelectionToolClass
|
struct _GimpEditSelectionToolClass
|
||||||
|
Reference in New Issue
Block a user