mirror of https://github.com/GNOME/gimp.git
app/config/gimpdisplayconfig.[ch] app/config/gimprc-blurbs.h added new
2006-09-08 Sven Neumann <sven@gimp.org> * app/config/gimpdisplayconfig.[ch] * app/config/gimprc-blurbs.h * app/display/display-enums.[ch]: added new gimprc option "space-bar-action" and default to "pan". Will add a GUI for this later. * app/display/gimpdisplayshell-callbacks.c: respect the new option and either pan the display or push the move tool. Fixes bug #349903.
This commit is contained in:
parent
2426755ba9
commit
d01cef075b
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2006-09-08 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/config/gimpdisplayconfig.[ch]
|
||||
* app/config/gimprc-blurbs.h
|
||||
* app/display/display-enums.[ch]: added new gimprc option
|
||||
"space-bar-action" and default to "pan". Will add a GUI for this later.
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c: respect the new option
|
||||
and either pan the display or push the move tool. Fixes bug #349903.
|
||||
|
||||
2006-09-08 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimp.[ch]: added function gimp_get_tool_info().
|
||||
|
|
|
@ -65,7 +65,8 @@ enum
|
|||
PROP_NAV_PREVIEW_SIZE,
|
||||
PROP_DEFAULT_VIEW,
|
||||
PROP_DEFAULT_FULLSCREEN_VIEW,
|
||||
PROP_ACTIVATE_ON_FOCUS
|
||||
PROP_ACTIVATE_ON_FOCUS,
|
||||
PROP_SPACE_BAR_ACTION
|
||||
};
|
||||
|
||||
|
||||
|
@ -198,7 +199,6 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
|||
GIMP_TYPE_VIEW_SIZE,
|
||||
GIMP_VIEW_SIZE_MEDIUM,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_VIEW,
|
||||
"default-view",
|
||||
DEFAULT_VIEW_BLURB,
|
||||
|
@ -216,6 +216,12 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
|||
ACTIVATE_ON_FOCUS_BLURB,
|
||||
DEFAULT_ACTIVATE_ON_FOCUS,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SPACE_BAR_ACTION,
|
||||
"space-bar-action",
|
||||
SPACE_BAR_ACTION_BLURB,
|
||||
GIMP_TYPE_SPACE_BAR_ACTION,
|
||||
GIMP_SPACE_BAR_ACTION_PAN,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -339,6 +345,9 @@ gimp_display_config_set_property (GObject *object,
|
|||
case PROP_ACTIVATE_ON_FOCUS:
|
||||
display_config->activate_on_focus = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SPACE_BAR_ACTION:
|
||||
display_config->space_bar_action = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
@ -425,6 +434,9 @@ gimp_display_config_get_property (GObject *object,
|
|||
case PROP_ACTIVATE_ON_FOCUS:
|
||||
g_value_set_boolean (value, display_config->activate_on_focus);
|
||||
break;
|
||||
case PROP_SPACE_BAR_ACTION:
|
||||
g_value_set_enum (value, display_config->space_bar_action);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
|
|
@ -67,6 +67,7 @@ struct _GimpDisplayConfig
|
|||
GimpDisplayOptions *default_view;
|
||||
GimpDisplayOptions *default_fullscreen_view;
|
||||
gboolean activate_on_focus;
|
||||
GimpSpaceBarAction space_bar_action;
|
||||
};
|
||||
|
||||
struct _GimpDisplayConfigClass
|
||||
|
|
|
@ -330,6 +330,9 @@ N_("Enable displaying a handy GIMP tip on startup.")
|
|||
#define SHOW_TOOLTIPS_BLURB \
|
||||
N_("Show a tooltip when the pointer hovers over an item.")
|
||||
|
||||
#define SPACE_BAR_ACTION_BLURB \
|
||||
N_("What to do when the space bar is pressed in the image window.")
|
||||
|
||||
#define SWAP_PATH_BLURB \
|
||||
N_("Sets the swap file location. GIMP uses a tile based memory allocation " \
|
||||
"scheme. The swap file is used to quickly and easily swap tiles out to " \
|
||||
|
|
|
@ -70,6 +70,36 @@ gimp_canvas_padding_mode_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_space_bar_action_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_SPACE_BAR_ACTION_NONE, "GIMP_SPACE_BAR_ACTION_NONE", "none" },
|
||||
{ GIMP_SPACE_BAR_ACTION_PAN, "GIMP_SPACE_BAR_ACTION_PAN", "pan" },
|
||||
{ GIMP_SPACE_BAR_ACTION_MOVE, "GIMP_SPACE_BAR_ACTION_MOVE", "move" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_SPACE_BAR_ACTION_NONE, N_("None"), NULL },
|
||||
{ GIMP_SPACE_BAR_ACTION_PAN, N_("Pan"), NULL },
|
||||
{ GIMP_SPACE_BAR_ACTION_MOVE, N_("Move"), NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
{
|
||||
type = g_enum_register_static ("GimpSpaceBarAction", values);
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/* Generated data ends here */
|
||||
|
||||
|
|
|
@ -46,4 +46,16 @@ typedef enum
|
|||
} GimpCanvasPaddingMode;
|
||||
|
||||
|
||||
#define GIMP_TYPE_SPACE_BAR_ACTION (gimp_space_bar_action_get_type ())
|
||||
|
||||
GType gimp_space_bar_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_SPACE_BAR_ACTION_NONE, /*< desc="None" >*/
|
||||
GIMP_SPACE_BAR_ACTION_PAN, /*< desc="Pan" >*/
|
||||
GIMP_SPACE_BAR_ACTION_MOVE /*< desc="Move" >*/
|
||||
} GimpSpaceBarAction;
|
||||
|
||||
|
||||
#endif /* __DISPLAY_ENUMS_H__ */
|
||||
|
|
|
@ -77,9 +77,6 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
/* #define DEBUG_MOVE_PUSH 1 */
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_display_shell_vscrollbar_update (GtkAdjustment *adjustment,
|
||||
|
@ -455,73 +452,102 @@ gimp_display_shell_space_pressed (GimpDisplayShell *shell,
|
|||
GdkModifierType state,
|
||||
guint32 time)
|
||||
{
|
||||
if (! shell->space_pressed)
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
|
||||
if (shell->space_pressed)
|
||||
return;
|
||||
|
||||
switch (GIMP_DISPLAY_CONFIG (gimp->config)->space_bar_action)
|
||||
{
|
||||
GimpDisplay *display = shell->display;
|
||||
Gimp *gimp = display->image->gimp;
|
||||
GimpTool *active_tool = tool_manager_get_active (gimp);
|
||||
case GIMP_SPACE_BAR_ACTION_NONE:
|
||||
break;
|
||||
|
||||
if (active_tool && ! GIMP_IS_MOVE_TOOL (active_tool))
|
||||
{
|
||||
GimpToolInfo *move_tool_info;
|
||||
case GIMP_SPACE_BAR_ACTION_PAN:
|
||||
{
|
||||
gint x, y;
|
||||
|
||||
move_tool_info = gimp_get_tool_info (gimp, "gimp-move-tool");
|
||||
gdk_window_get_pointer (GTK_WIDGET (shell)->window, &x, &y, NULL);
|
||||
|
||||
if (GIMP_IS_TOOL_INFO (move_tool_info))
|
||||
{
|
||||
#ifdef DEBUG_MOVE_PUSH
|
||||
g_printerr ("%s: pushing move tool\n", G_STRFUNC);
|
||||
#endif
|
||||
shell->scrolling = TRUE;
|
||||
|
||||
shell->space_shaded_tool =
|
||||
gimp_object_get_name (GIMP_OBJECT (active_tool->tool_info));
|
||||
shell->scroll_start_x = x + shell->offset_x;
|
||||
shell->scroll_start_y = y + shell->offset_y;
|
||||
|
||||
gdk_keyboard_grab (shell->canvas->window, FALSE, time);
|
||||
gimp_display_shell_set_override_cursor (shell, GDK_FLEUR);
|
||||
|
||||
gimp_context_set_tool (gimp_get_user_context (gimp),
|
||||
move_tool_info);
|
||||
gtk_grab_add (shell->canvas);
|
||||
|
||||
tool_manager_focus_display_active (gimp, display);
|
||||
tool_manager_modifier_state_active (gimp, state, display);
|
||||
shell->space_pressed = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
shell->space_pressed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
case GIMP_SPACE_BAR_ACTION_MOVE:
|
||||
{
|
||||
GimpTool *active_tool = tool_manager_get_active (gimp);
|
||||
|
||||
if (active_tool && ! GIMP_IS_MOVE_TOOL (active_tool))
|
||||
{
|
||||
shell->space_shaded_tool =
|
||||
gimp_object_get_name (GIMP_OBJECT (active_tool->tool_info));
|
||||
|
||||
gimp_context_set_tool (gimp_get_user_context (gimp),
|
||||
gimp_get_tool_info (gimp, "gimp-move-tool"));
|
||||
|
||||
tool_manager_focus_display_active (gimp, shell->display);
|
||||
tool_manager_modifier_state_active (gimp, state, shell->display);
|
||||
|
||||
gdk_keyboard_grab (shell->canvas->window, FALSE, time);
|
||||
|
||||
shell->space_pressed = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gimp_display_shell_space_released (GimpDisplayShell *shell,
|
||||
GdkModifierType state,
|
||||
guint32 time)
|
||||
{
|
||||
if (shell->space_pressed)
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
|
||||
if (! shell->space_pressed)
|
||||
return;
|
||||
|
||||
switch (GIMP_DISPLAY_CONFIG (gimp->config)->space_bar_action)
|
||||
{
|
||||
GimpDisplay *display = shell->display;
|
||||
Gimp *gimp = display->image->gimp;
|
||||
case GIMP_SPACE_BAR_ACTION_NONE:
|
||||
return;
|
||||
|
||||
#ifdef DEBUG_MOVE_PUSH
|
||||
g_printerr ("%s: popping move tool\n", G_STRFUNC);
|
||||
#endif
|
||||
case GIMP_SPACE_BAR_ACTION_PAN:
|
||||
shell->scrolling = FALSE;
|
||||
shell->scroll_start_x = 0;
|
||||
shell->scroll_start_y = 0;
|
||||
|
||||
gimp_display_shell_unset_override_cursor (shell);
|
||||
|
||||
gtk_grab_remove (shell->canvas);
|
||||
|
||||
shell->space_pressed = FALSE;
|
||||
return;
|
||||
|
||||
case GIMP_SPACE_BAR_ACTION_MOVE:
|
||||
gimp_context_set_tool (gimp_get_user_context (gimp),
|
||||
gimp_get_tool_info (gimp,
|
||||
shell->space_shaded_tool));
|
||||
shell->space_shaded_tool = NULL;
|
||||
|
||||
tool_manager_focus_display_active (gimp, display);
|
||||
tool_manager_modifier_state_active (gimp, state, display);
|
||||
|
||||
shell->space_pressed = FALSE;
|
||||
tool_manager_focus_display_active (gimp, shell->display);
|
||||
tool_manager_modifier_state_active (gimp, state, shell->display);
|
||||
|
||||
gdk_display_keyboard_ungrab (gtk_widget_get_display (shell->canvas),
|
||||
time);
|
||||
|
||||
shell->space_pressed = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
gboolean
|
||||
gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
GdkEvent *event,
|
||||
|
@ -536,8 +562,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
GimpCoords image_coords;
|
||||
GdkModifierType state;
|
||||
guint32 time;
|
||||
gboolean return_val = FALSE;
|
||||
gboolean update_sw_cursor = FALSE;
|
||||
gboolean return_val = FALSE;
|
||||
gboolean update_sw_cursor = FALSE;
|
||||
|
||||
g_return_val_if_fail (GTK_WIDGET_REALIZED (canvas), FALSE);
|
||||
|
||||
|
@ -751,7 +777,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
}
|
||||
|
||||
/* ignore new mouse events */
|
||||
if (gimp->busy)
|
||||
if (gimp->busy || shell->scrolling)
|
||||
return TRUE;
|
||||
|
||||
active_tool = tool_manager_get_active (gimp);
|
||||
|
@ -775,7 +801,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
if (gimp_devices_get_current (gimp) ==
|
||||
gdk_display_get_core_pointer (gdk_display))
|
||||
{
|
||||
event_mask |= (GDK_POINTER_MOTION_HINT_MASK);
|
||||
event_mask |= GDK_POINTER_MOTION_HINT_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -812,8 +838,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
if (initialized)
|
||||
{
|
||||
tool_manager_button_press_active (gimp,
|
||||
&image_coords, time, state,
|
||||
display);
|
||||
&image_coords,
|
||||
time, state, display);
|
||||
|
||||
shell->last_motion_time = bevent->time;
|
||||
}
|
||||
|
@ -1089,7 +1115,15 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
gimp_display_shell_check_device_cursor (shell);
|
||||
}
|
||||
|
||||
if (state & GDK_BUTTON1_MASK)
|
||||
if (shell->scrolling)
|
||||
{
|
||||
gimp_display_shell_scroll (shell,
|
||||
(shell->scroll_start_x - mevent->x -
|
||||
shell->offset_x),
|
||||
(shell->scroll_start_y - mevent->y -
|
||||
shell->offset_y));
|
||||
}
|
||||
else if (state & GDK_BUTTON1_MASK)
|
||||
{
|
||||
if (active_tool &&
|
||||
gimp_tool_control_is_active (active_tool->control) &&
|
||||
|
@ -1167,17 +1201,6 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
shell->last_motion_time = mevent->time;
|
||||
}
|
||||
}
|
||||
else if (state & GDK_BUTTON2_MASK)
|
||||
{
|
||||
if (shell->scrolling)
|
||||
{
|
||||
gimp_display_shell_scroll (shell,
|
||||
(shell->scroll_start_x - mevent->x -
|
||||
shell->offset_x),
|
||||
(shell->scroll_start_y - mevent->y -
|
||||
shell->offset_y));
|
||||
}
|
||||
}
|
||||
|
||||
if (! (state &
|
||||
(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)))
|
||||
|
|
Loading…
Reference in New Issue