mirror of https://github.com/GNOME/gimp.git
app: Add option to re-enable previous drag-to-zoom behavior
Adds a new configuration option "drag-zoom-mode" to choose whether to zoom by distance of movement (newly added) or by duration of movement (previous behavior) when zooming via dragging the mouse, defaulting to distance. This option can be found in the preferences dialog as: Image Windows -> Zoom & Resize Behavior -> Drag-to-zoom behavior
This commit is contained in:
parent
8b1025919f
commit
505a78e715
|
@ -107,6 +107,15 @@ typedef enum
|
|||
GIMP_POSITION_RIGHT /*< desc="Right" >*/
|
||||
} GimpPosition;
|
||||
|
||||
#define GIMP_TYPE_DRAG_ZOOM_MODE (gimp_drag_zoom_mode_get_type ())
|
||||
|
||||
GType gimp_drag_zoom_mode_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PROP_DRAG_ZOOM_MODE_DISTANCE, /*< desc="By distance" >*/
|
||||
PROP_DRAG_ZOOM_MODE_DURATION, /*< desc="By duration" >*/
|
||||
} GimpDragZoomMode;
|
||||
|
||||
#define GIMP_TYPE_SPACE_BAR_ACTION (gimp_space_bar_action_get_type ())
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ enum
|
|||
PROP_DEFAULT_SHOW_ALL,
|
||||
PROP_DEFAULT_DOT_FOR_DOT,
|
||||
PROP_INITIAL_ZOOM_TO_FIT,
|
||||
PROP_DRAG_ZOOM_MODE,
|
||||
PROP_CURSOR_MODE,
|
||||
PROP_CURSOR_UPDATING,
|
||||
PROP_SHOW_BRUSH_OUTLINE,
|
||||
|
@ -181,6 +182,14 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
|||
TRUE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_DRAG_ZOOM_MODE,
|
||||
"drag-zoom-mode",
|
||||
"Drag-to-zoom behavior",
|
||||
DRAG_ZOOM_MODE_BLURB,
|
||||
GIMP_TYPE_DRAG_ZOOM_MODE,
|
||||
PROP_DRAG_ZOOM_MODE_DISTANCE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_CURSOR_MODE,
|
||||
"cursor-mode",
|
||||
"Cursor mode",
|
||||
|
@ -426,6 +435,9 @@ gimp_display_config_set_property (GObject *object,
|
|||
case PROP_INITIAL_ZOOM_TO_FIT:
|
||||
display_config->initial_zoom_to_fit = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_DRAG_ZOOM_MODE:
|
||||
display_config->drag_zoom_mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_CURSOR_MODE:
|
||||
display_config->cursor_mode = g_value_get_enum (value);
|
||||
break;
|
||||
|
@ -538,6 +550,9 @@ gimp_display_config_get_property (GObject *object,
|
|||
case PROP_INITIAL_ZOOM_TO_FIT:
|
||||
g_value_set_boolean (value, display_config->initial_zoom_to_fit);
|
||||
break;
|
||||
case PROP_DRAG_ZOOM_MODE:
|
||||
g_value_set_enum (value, display_config->drag_zoom_mode);
|
||||
break;
|
||||
case PROP_CURSOR_MODE:
|
||||
g_value_set_enum (value, display_config->cursor_mode);
|
||||
break;
|
||||
|
|
|
@ -50,6 +50,7 @@ struct _GimpDisplayConfig
|
|||
gboolean default_show_all;
|
||||
gboolean default_dot_for_dot;
|
||||
gboolean initial_zoom_to_fit;
|
||||
GimpDragZoomMode drag_zoom_mode;
|
||||
GimpCursorMode cursor_mode;
|
||||
gboolean cursor_updating;
|
||||
gboolean show_brush_outline;
|
||||
|
|
|
@ -257,6 +257,10 @@ _("Sets the preferred pen and touch input API.")
|
|||
_("When enabled, this will ensure that the full image is visible after a " \
|
||||
"file is opened, otherwise it will be displayed with a scale of 1:1.")
|
||||
|
||||
#define DRAG_ZOOM_MODE_BLURB \
|
||||
_("Whether to zoom based on distance moved or time spent moving, when " \
|
||||
"zooming via dragging the mouse.")
|
||||
|
||||
#define INTERPOLATION_TYPE_BLURB \
|
||||
_("Sets the level of interpolation used for scaling and other " \
|
||||
"transformations.")
|
||||
|
|
|
@ -2933,6 +2933,12 @@ prefs_dialog_new (Gimp *gimp,
|
|||
_("Initial zoom _ratio:"),
|
||||
GTK_GRID (grid), 0, size_group);
|
||||
|
||||
grid = prefs_grid_new (GTK_CONTAINER (vbox2));
|
||||
|
||||
prefs_enum_combo_box_add (object, "drag-zoom-mode", 0, 0,
|
||||
_("Dra_g-to-zoom behavior:"),
|
||||
GTK_GRID (grid), 0, size_group);
|
||||
|
||||
/* Space Bar */
|
||||
vbox2 = prefs_frame_new (_("Space Bar"),
|
||||
GTK_CONTAINER (vbox), FALSE);
|
||||
|
|
|
@ -811,12 +811,32 @@ gimp_display_shell_scale_drag (GimpDisplayShell *shell,
|
|||
|
||||
if (delta_y != 0.0)
|
||||
{
|
||||
GimpDisplayConfig *config = shell->display->config;
|
||||
|
||||
gimp_display_shell_push_zoom_focus_pointer_pos (shell, start_x, start_y);
|
||||
|
||||
gimp_display_shell_scale (shell,
|
||||
GIMP_ZOOM_TO,
|
||||
scale * exp (0.01 * delta_y),
|
||||
GIMP_ZOOM_FOCUS_POINTER);
|
||||
if (config->drag_zoom_mode == PROP_DRAG_ZOOM_MODE_DISTANCE)
|
||||
{
|
||||
gimp_display_shell_scale (shell,
|
||||
GIMP_ZOOM_TO,
|
||||
scale * exp (0.01 * delta_y),
|
||||
GIMP_ZOOM_FOCUS_POINTER);
|
||||
}
|
||||
else if (delta_y > 0.0) /* drag_zoom_mode == PROP_DRAG_ZOOM_MODE_DURATION */
|
||||
{
|
||||
gimp_display_shell_scale (shell,
|
||||
GIMP_ZOOM_TO,
|
||||
scale * 1.1,
|
||||
GIMP_ZOOM_FOCUS_POINTER);
|
||||
}
|
||||
else /* delta_y < 0.0 */
|
||||
{
|
||||
gimp_display_shell_scale (shell,
|
||||
GIMP_ZOOM_TO,
|
||||
scale * 0.9,
|
||||
GIMP_ZOOM_FOCUS_POINTER);
|
||||
}
|
||||
|
||||
|
||||
if (shell->zoom_focus_point)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue