Implemented this function to support rotating with arrow keys. See bug
2008-05-31 Martin Nordholts <martinn@svn.gnome.org> * app/tools/gimprotatetool.c (gimp_rotate_tool_key_press): Implemented this function to support rotating with arrow keys. See bug #387779. svn path=/trunk/; revision=25873
This commit is contained in:
committed by
Martin Nordholts
parent
a3626edd9f
commit
c827f0cd84
@ -1,3 +1,9 @@
|
||||
2008-05-31 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/tools/gimprotatetool.c (gimp_rotate_tool_key_press):
|
||||
Implemented this function to support rotating with arrow keys. See
|
||||
bug #387779.
|
||||
|
||||
2008-05-30 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
Made moving the selection mask in the varoius ways automatically
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
@ -55,19 +56,21 @@
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_rotate_tool_dialog (GimpTransformTool *tr_tool);
|
||||
static void gimp_rotate_tool_dialog_update (GimpTransformTool *tr_tool);
|
||||
static void gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
|
||||
GimpDisplay *display);
|
||||
static void gimp_rotate_tool_motion (GimpTransformTool *tr_tool,
|
||||
GimpDisplay *display);
|
||||
static void gimp_rotate_tool_recalc (GimpTransformTool *tr_tool,
|
||||
GimpDisplay *display);
|
||||
|
||||
static void rotate_angle_changed (GtkAdjustment *adj,
|
||||
GimpTransformTool *tr_tool);
|
||||
static void rotate_center_changed (GtkWidget *entry,
|
||||
GimpTransformTool *tr_tool);
|
||||
static gboolean gimp_rotate_tool_key_press (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GimpDisplay *display);
|
||||
static void gimp_rotate_tool_dialog (GimpTransformTool *tr_tool);
|
||||
static void gimp_rotate_tool_dialog_update (GimpTransformTool *tr_tool);
|
||||
static void gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
|
||||
GimpDisplay *display);
|
||||
static void gimp_rotate_tool_motion (GimpTransformTool *tr_tool,
|
||||
GimpDisplay *display);
|
||||
static void gimp_rotate_tool_recalc (GimpTransformTool *tr_tool,
|
||||
GimpDisplay *display);
|
||||
static void rotate_angle_changed (GtkAdjustment *adj,
|
||||
GimpTransformTool *tr_tool);
|
||||
static void rotate_center_changed (GtkWidget *entry,
|
||||
GimpTransformTool *tr_tool);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpRotateTool, gimp_rotate_tool, GIMP_TYPE_TRANSFORM_TOOL)
|
||||
@ -95,8 +98,11 @@ gimp_rotate_tool_register (GimpToolRegisterCallback callback,
|
||||
static void
|
||||
gimp_rotate_tool_class_init (GimpRotateToolClass *klass)
|
||||
{
|
||||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||
GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass);
|
||||
|
||||
tool_class->key_press = gimp_rotate_tool_key_press;
|
||||
|
||||
trans_class->dialog = gimp_rotate_tool_dialog;
|
||||
trans_class->dialog_update = gimp_rotate_tool_dialog_update;
|
||||
trans_class->prepare = gimp_rotate_tool_prepare;
|
||||
@ -119,6 +125,56 @@ gimp_rotate_tool_init (GimpRotateTool *rotate_tool)
|
||||
tr_tool->use_center = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_rotate_tool_key_press (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
GimpRotateTool *rotate = GIMP_ROTATE_TOOL (tool);
|
||||
gboolean handled_key = FALSE;
|
||||
GtkSpinButton *angle_spin = GTK_SPIN_BUTTON (rotate->angle_spin_button);
|
||||
|
||||
if (display == draw_tool->display)
|
||||
{
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
case GDK_Up:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_FORWARD, 0.0);
|
||||
break;
|
||||
|
||||
case GDK_Down:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_BACKWARD, 0.0);
|
||||
break;
|
||||
|
||||
case GDK_Left:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_FORWARD, 0.0);
|
||||
break;
|
||||
|
||||
case GDK_Right:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_BACKWARD, 0.0);
|
||||
break;
|
||||
|
||||
default:
|
||||
handled_key = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! handled_key)
|
||||
{
|
||||
handled_key = GIMP_TOOL_CLASS (parent_class)->key_press (tool,
|
||||
kevent,
|
||||
display);
|
||||
}
|
||||
|
||||
return handled_key;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rotate_tool_dialog (GimpTransformTool *tr_tool)
|
||||
{
|
||||
@ -143,6 +199,7 @@ gimp_rotate_tool_dialog (GimpTransformTool *tr_tool)
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (button), SB_WIDTH);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("_Angle:"),
|
||||
0.0, 0.5, button, 1, TRUE);
|
||||
rotate->angle_spin_button = button;
|
||||
|
||||
g_signal_connect (rotate->angle_adj, "value-changed",
|
||||
G_CALLBACK (rotate_angle_changed),
|
||||
|
||||
@ -39,6 +39,7 @@ struct _GimpRotateTool
|
||||
GimpTransformTool parent_instance;
|
||||
|
||||
GtkObject *angle_adj;
|
||||
GtkWidget *angle_spin_button;
|
||||
GtkWidget *sizeentry;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user