[gimp] Bug 764630 - Preview curtain: can there be a switch "left/right"...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 764630 - Preview curtain: can there be a switch "left/right"...
- Date: Thu, 14 Apr 2016 01:38:10 +0000 (UTC)
commit 8f8da223895a0aa895129c075c25f0ed952ecfac
Author: Michael Natterer <mitch gimp org>
Date: Thu Apr 14 02:33:45 2016 +0100
Bug 764630 - Preview curtain: can there be a switch "left/right"...
...for the preview?
Change to allow for split previews in all 4 directions. Remove the
direction controls from the filter dialog, and instead implement
shift- and control-clicking on the split guide to switch
original/filtered sides, or orientation.
app/core/gimpimagemap.c | 115 +++++++++++++--------
app/core/gimpimagemap.h | 4 +-
app/tools/gimpimagemapoptions.c | 40 ++++----
app/tools/gimpimagemapoptions.h | 4 +-
app/tools/gimpimagemaptool.c | 220 +++++++++++++++++++++++++++++++-------
5 files changed, 276 insertions(+), 107 deletions(-)
---
diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c
index 5996284..23c97bf 100644
--- a/app/core/gimpimagemap.c
+++ b/app/core/gimpimagemap.c
@@ -64,8 +64,8 @@ struct _GimpImageMap
GimpImageMapRegion region;
gboolean preview_enabled;
- GimpOrientationType preview_orientation;
- gdouble preview_percent;
+ GimpAlignmentType preview_alignment;
+ gdouble preview_position;
gdouble opacity;
GimpLayerModeEffects paint_mode;
gboolean gamma_hack;
@@ -87,8 +87,8 @@ static void gimp_image_map_finalize (GObject *object);
static void gimp_image_map_sync_region (GimpImageMap *image_map);
static void gimp_image_map_sync_preview (GimpImageMap *image_map,
gboolean old_enabled,
- GimpOrientationType old_orientation,
- gdouble old_percent);
+ GimpAlignmentType old_alignment,
+ gdouble old_position);
static void gimp_image_map_sync_mode (GimpImageMap *image_map);
static void gimp_image_map_sync_affect (GimpImageMap *image_map);
static void gimp_image_map_sync_gamma_hack (GimpImageMap *image_map);
@@ -133,11 +133,11 @@ gimp_image_map_class_init (GimpImageMapClass *klass)
static void
gimp_image_map_init (GimpImageMap *image_map)
{
- image_map->region = GIMP_IMAGE_MAP_REGION_SELECTION;
- image_map->preview_orientation = GIMP_ORIENTATION_HORIZONTAL;
- image_map->preview_percent = 1.0;
- image_map->opacity = GIMP_OPACITY_OPAQUE;
- image_map->paint_mode = GIMP_REPLACE_MODE;
+ image_map->region = GIMP_IMAGE_MAP_REGION_SELECTION;
+ image_map->preview_alignment = GIMP_ALIGN_LEFT;
+ image_map->preview_position = 1.0;
+ image_map->opacity = GIMP_OPACITY_OPAQUE;
+ image_map->paint_mode = GIMP_REPLACE_MODE;
}
static void
@@ -241,27 +241,31 @@ gimp_image_map_set_region (GimpImageMap *image_map,
void
gimp_image_map_set_preview (GimpImageMap *image_map,
gboolean enabled,
- GimpOrientationType orientation,
- gdouble percent)
+ GimpAlignmentType alignment,
+ gdouble position)
{
g_return_if_fail (GIMP_IS_IMAGE_MAP (image_map));
+ g_return_if_fail (alignment == GIMP_ALIGN_LEFT ||
+ alignment == GIMP_ALIGN_RIGHT ||
+ alignment == GIMP_ALIGN_TOP ||
+ alignment == GIMP_ALIGN_BOTTOM);
- percent = CLAMP (percent, 0.0, 1.0);
+ position = CLAMP (position, 0.0, 1.0);
- if (enabled != image_map->preview_enabled ||
- orientation != image_map->preview_orientation ||
- percent != image_map->preview_percent)
+ if (enabled != image_map->preview_enabled ||
+ alignment != image_map->preview_alignment ||
+ position != image_map->preview_position)
{
- gboolean old_enabled = image_map->preview_enabled;
- GimpOrientationType old_orientation = image_map->preview_orientation;
- gdouble old_percent = image_map->preview_percent;
+ gboolean old_enabled = image_map->preview_enabled;
+ GimpAlignmentType old_alignment = image_map->preview_alignment;
+ gdouble old_position = image_map->preview_position;
- image_map->preview_enabled = enabled;
- image_map->preview_orientation = orientation;
- image_map->preview_percent = percent;
+ image_map->preview_enabled = enabled;
+ image_map->preview_alignment = alignment;
+ image_map->preview_position = position;
gimp_image_map_sync_preview (image_map,
- old_enabled, old_orientation, old_percent);
+ old_enabled, old_alignment, old_position);
}
}
@@ -383,8 +387,8 @@ gimp_image_map_apply (GimpImageMap *image_map,
gimp_image_map_sync_region (image_map);
gimp_image_map_sync_preview (image_map,
image_map->preview_enabled,
- image_map->preview_orientation,
- image_map->preview_percent);
+ image_map->preview_alignment,
+ image_map->preview_position);
gimp_image_map_sync_mode (image_map);
gimp_image_map_sync_gamma_hack (image_map);
@@ -518,31 +522,56 @@ gimp_image_map_sync_region (GimpImageMap *image_map)
}
static void
-gimp_image_map_get_preview_rect (GimpImageMap *image_map,
- gboolean enabled,
- GimpOrientationType orientation,
- gdouble percent,
- GeglRectangle *rect)
+gimp_image_map_get_preview_rect (GimpImageMap *image_map,
+ gboolean enabled,
+ GimpAlignmentType alignment,
+ gdouble position,
+ GeglRectangle *rect)
{
+ gint width;
+ gint height;
+
rect->x = 0;
rect->y = 0;
rect->width = gimp_item_get_width (GIMP_ITEM (image_map->drawable));
rect->height = gimp_item_get_height (GIMP_ITEM (image_map->drawable));
+ width = rect->width;
+ height = rect->height;
+
if (enabled)
{
- if (orientation == GIMP_ORIENTATION_HORIZONTAL)
- rect->width *= percent;
- else
- rect->height *= percent;
+ switch (alignment)
+ {
+ case GIMP_ALIGN_LEFT:
+ rect->width *= position;
+ break;
+
+ case GIMP_ALIGN_RIGHT:
+ rect->width *= (1.0 - position);
+ rect->x = width - rect->width;
+ break;
+
+ case GIMP_ALIGN_TOP:
+ rect->height *= position;
+ break;
+
+ case GIMP_ALIGN_BOTTOM:
+ rect->height *= (1.0 - position);
+ rect->y = height - rect->height;
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
}
}
static void
-gimp_image_map_sync_preview (GimpImageMap *image_map,
- gboolean old_enabled,
- GimpOrientationType old_orientation,
- gdouble old_percent)
+gimp_image_map_sync_preview (GimpImageMap *image_map,
+ gboolean old_enabled,
+ GimpAlignmentType old_alignment,
+ gdouble old_position)
{
if (image_map->applicator)
{
@@ -551,21 +580,23 @@ gimp_image_map_sync_preview (GimpImageMap *image_map,
gimp_image_map_get_preview_rect (image_map,
old_enabled,
- old_orientation,
- old_percent,
+ old_alignment,
+ old_position,
&old_rect);
gimp_image_map_get_preview_rect (image_map,
image_map->preview_enabled,
- image_map->preview_orientation,
- image_map->preview_percent,
+ image_map->preview_alignment,
+ image_map->preview_position,
&new_rect);
gimp_applicator_set_preview (image_map->applicator,
image_map->preview_enabled,
&new_rect);
- if (old_rect.width != new_rect.width ||
+ if (old_rect.x != new_rect.x ||
+ old_rect.y != new_rect.y ||
+ old_rect.width != new_rect.width ||
old_rect.height != new_rect.height)
{
cairo_region_t *region;
diff --git a/app/core/gimpimagemap.h b/app/core/gimpimagemap.h
index 77390fb..7b4441d 100644
--- a/app/core/gimpimagemap.h
+++ b/app/core/gimpimagemap.h
@@ -58,8 +58,8 @@ void gimp_image_map_set_region (GimpImageMap *image_map,
GimpImageMapRegion region);
void gimp_image_map_set_preview (GimpImageMap *image_map,
gboolean enabled,
- GimpOrientationType orientation,
- gdouble percent_visible);
+ GimpAlignmentType alignment,
+ gdouble split_position);
void gimp_image_map_set_mode (GimpImageMap *image_map,
gdouble opacity,
GimpLayerModeEffects paint_mode);
diff --git a/app/tools/gimpimagemapoptions.c b/app/tools/gimpimagemapoptions.c
index 5503497..225c6fd 100644
--- a/app/tools/gimpimagemapoptions.c
+++ b/app/tools/gimpimagemapoptions.c
@@ -34,8 +34,8 @@ enum
PROP_0,
PROP_PREVIEW,
PROP_PREVIEW_SPLIT,
- PROP_PREVIEW_PERCENT,
- PROP_PREVIEW_ORIENTATION,
+ PROP_PREVIEW_ALIGNMENT,
+ PROP_PREVIEW_POSITION,
PROP_REGION,
PROP_SETTINGS
};
@@ -82,21 +82,21 @@ gimp_image_map_options_class_init (GimpImageMapOptionsClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
- g_object_class_install_property (object_class, PROP_PREVIEW_PERCENT,
- g_param_spec_double ("preview-percent",
+ g_object_class_install_property (object_class, PROP_PREVIEW_ALIGNMENT,
+ g_param_spec_enum ("preview-alignment",
+ NULL, NULL,
+ GIMP_TYPE_ALIGNMENT_TYPE,
+ GIMP_ALIGN_LEFT,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_PREVIEW_POSITION,
+ g_param_spec_double ("preview-position",
NULL, NULL,
0.0, 1.0, 0.5,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
- g_object_class_install_property (object_class, PROP_PREVIEW_ORIENTATION,
- g_param_spec_enum ("preview-orientation",
- NULL, NULL,
- GIMP_TYPE_ORIENTATION_TYPE,
- GIMP_ORIENTATION_HORIZONTAL,
- GIMP_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
g_object_class_install_property (object_class, PROP_REGION,
g_param_spec_enum ("region",
NULL, NULL,
@@ -150,12 +150,12 @@ gimp_image_map_options_set_property (GObject *object,
options->preview_split = g_value_get_boolean (value);
break;
- case PROP_PREVIEW_PERCENT:
- options->preview_percent = g_value_get_double (value);
+ case PROP_PREVIEW_ALIGNMENT:
+ options->preview_alignment = g_value_get_enum (value);
break;
- case PROP_PREVIEW_ORIENTATION:
- options->preview_orientation = g_value_get_enum (value);
+ case PROP_PREVIEW_POSITION:
+ options->preview_position = g_value_get_double (value);
break;
case PROP_REGION:
@@ -192,12 +192,12 @@ gimp_image_map_options_get_property (GObject *object,
g_value_set_boolean (value, options->preview_split);
break;
- case PROP_PREVIEW_PERCENT:
- g_value_set_double (value, options->preview_percent);
+ case PROP_PREVIEW_ALIGNMENT:
+ g_value_set_enum (value, options->preview_alignment);
break;
- case PROP_PREVIEW_ORIENTATION:
- g_value_set_enum (value, options->preview_orientation);
+ case PROP_PREVIEW_POSITION:
+ g_value_set_double (value, options->preview_position);
break;
case PROP_REGION:
diff --git a/app/tools/gimpimagemapoptions.h b/app/tools/gimpimagemapoptions.h
index 9913d06..599a78d 100644
--- a/app/tools/gimpimagemapoptions.h
+++ b/app/tools/gimpimagemapoptions.h
@@ -38,8 +38,8 @@ struct _GimpImageMapOptions
gboolean preview;
gboolean preview_split;
- gdouble preview_percent;
- GimpOrientationType preview_orientation;
+ GimpAlignmentType preview_alignment;
+ gdouble preview_position;
GimpImageMapRegion region;
GFile *settings;
};
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index 5f2c790..961878f 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -62,6 +62,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
+#include "display/gimpdisplayshell-transform.h"
#include "display/gimptoolgui.h"
#include "gimpcoloroptions.h"
@@ -94,6 +95,11 @@ static void gimp_image_map_tool_button_press (GimpTool *tool,
static gboolean gimp_image_map_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display);
+static void gimp_image_map_tool_oper_update (GimpTool *tool,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ gboolean proximity,
+ GimpDisplay *display);
static void gimp_image_map_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
@@ -170,6 +176,7 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass)
tool_class->control = gimp_image_map_tool_control;
tool_class->button_press = gimp_image_map_tool_button_press;
tool_class->key_press = gimp_image_map_tool_key_press;
+ tool_class->oper_update = gimp_image_map_tool_oper_update;
tool_class->cursor_update = gimp_image_map_tool_cursor_update;
tool_class->options_notify = gimp_image_map_tool_options_notify;
@@ -340,7 +347,6 @@ gimp_image_map_tool_initialize (GimpTool *tool,
GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool);
GtkWidget *vbox;
GtkWidget *hbox;
- GtkWidget *icon_box;
GtkWidget *toggle;
gchar *operation_name;
@@ -438,18 +444,6 @@ gimp_image_map_tool_initialize (GimpTool *tool,
toggle, "sensitive",
G_BINDING_SYNC_CREATE);
- icon_box = gimp_prop_enum_icon_box_new (G_OBJECT (tool_info->tool_options),
- "preview-orientation",
- "gimp-flip",
- GIMP_ORIENTATION_HORIZONTAL,
- GIMP_ORIENTATION_VERTICAL);
- gtk_box_pack_start (GTK_BOX (hbox), icon_box, FALSE, FALSE, 0);
- gtk_widget_show (icon_box);
-
- g_object_bind_property (G_OBJECT (tool_info->tool_options), "preview",
- icon_box, "sensitive",
- G_BINDING_SYNC_CREATE);
-
/* The area combo */
gegl_node_get (im_tool->operation,
"operation", &operation_name,
@@ -532,14 +526,69 @@ gimp_image_map_tool_button_press (GimpTool *tool,
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
- GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
+ GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
+ GimpImageMapOptions *options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (tool);
if (gimp_image_map_tool_on_guide (im_tool, coords, display))
{
gimp_tool_control_halt (tool->control);
- gimp_guide_tool_start_edit (tool, display,
- im_tool->percent_guide);
+ if (state & gimp_get_extend_selection_mask ())
+ {
+ GimpAlignmentType alignment;
+
+ /* switch side */
+ switch (options->preview_alignment)
+ {
+ case GIMP_ALIGN_LEFT: alignment = GIMP_ALIGN_RIGHT; break;
+ case GIMP_ALIGN_RIGHT: alignment = GIMP_ALIGN_LEFT; break;
+ case GIMP_ALIGN_TOP: alignment = GIMP_ALIGN_BOTTOM; break;
+ case GIMP_ALIGN_BOTTOM: alignment = GIMP_ALIGN_TOP; break;
+ default:
+ g_return_if_reached ();
+ }
+
+ g_object_set (options, "preview-alignment", alignment, NULL);
+ }
+ else if (state & gimp_get_toggle_behavior_mask ())
+ {
+ GimpItem *item = GIMP_ITEM (im_tool->drawable);
+ GimpAlignmentType alignment;
+ gdouble position;
+
+ /* switch orientation */
+ switch (options->preview_alignment)
+ {
+ case GIMP_ALIGN_LEFT: alignment = GIMP_ALIGN_TOP; break;
+ case GIMP_ALIGN_RIGHT: alignment = GIMP_ALIGN_BOTTOM; break;
+ case GIMP_ALIGN_TOP: alignment = GIMP_ALIGN_LEFT; break;
+ case GIMP_ALIGN_BOTTOM: alignment = GIMP_ALIGN_RIGHT; break;
+ default:
+ g_return_if_reached ();
+ }
+
+ if (alignment == GIMP_ALIGN_LEFT ||
+ alignment == GIMP_ALIGN_RIGHT)
+ {
+ position = ((coords->x - gimp_item_get_offset_x (item)) /
+ gimp_item_get_width (item));
+ }
+ else
+ {
+ position = ((coords->y - gimp_item_get_offset_y (item)) /
+ gimp_item_get_height (item));
+ }
+
+ g_object_set (options,
+ "preview-alignment", alignment,
+ "preview-position", CLAMP (position, 0.0, 1.0),
+ NULL);
+ }
+ else
+ {
+ gimp_guide_tool_start_edit (tool, display,
+ im_tool->percent_guide);
+ }
}
}
}
@@ -581,6 +630,53 @@ gimp_image_map_tool_key_press (GimpTool *tool,
}
static void
+gimp_image_map_tool_oper_update (GimpTool *tool,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ gboolean proximity,
+ GimpDisplay *display)
+{
+ GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
+ display);
+
+ if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
+ {
+ GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
+
+ gimp_tool_pop_status (tool, display);
+
+ if (gimp_image_map_tool_on_guide (im_tool, coords, display))
+ {
+ GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
+ GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
+ gchar *status = NULL;
+
+ if (state & extend_mask)
+ {
+ status = g_strdup (_("Click to switch the original and filtered sides"));
+ }
+ else if (state & toggle_mask)
+ {
+ status = g_strdup (_("Click to switch between vertical and horizontal"));
+ }
+ else
+ {
+ status = gimp_suggest_modifiers (_("Click to move the split guide"),
+ (extend_mask | toggle_mask) & ~state,
+ _("%s: switch original and filtered"),
+ _("%s: switch horizontal and vertical"),
+ NULL);
+ }
+
+ if (proximity)
+ gimp_tool_push_status (tool, display, "%s", status);
+
+ g_free (status);
+ }
+ }
+}
+
+static void
gimp_image_map_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
@@ -640,34 +736,73 @@ gimp_image_map_tool_options_notify (GimpTool *tool,
else if (! strcmp (pspec->name, "preview-split") &&
im_tool->image_map)
{
+ if (im_options->preview_split)
+ {
+ GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
+ GimpItem *item = GIMP_ITEM (im_tool->drawable);
+ gint x, y, width, height;
+
+ gimp_display_shell_untransform_viewport (shell,
+ &x, &y, &width, &height);
+
+ if (gimp_rectangle_intersect (gimp_item_get_offset_x (item),
+ gimp_item_get_offset_y (item),
+ gimp_item_get_width (item),
+ gimp_item_get_height (item),
+ x, y, width, height,
+ &x, &y, &width, &height))
+ {
+ gdouble position;
+
+ if (im_options->preview_alignment == GIMP_ALIGN_LEFT ||
+ im_options->preview_alignment == GIMP_ALIGN_RIGHT)
+ {
+ position = ((gdouble) ((x + width / 2) -
+ gimp_item_get_offset_x (item)) /
+ (gdouble) gimp_item_get_width (item));
+ }
+ else
+ {
+ position = ((gdouble) ((y + height / 2) -
+ gimp_item_get_offset_y (item)) /
+ (gdouble) gimp_item_get_height (item));
+ }
+
+ g_object_set (options,
+ "preview-position", CLAMP (position, 0.0, 1.0),
+ NULL);
+
+ }
+ }
+
gimp_image_map_set_preview (im_tool->image_map,
im_options->preview_split,
- im_options->preview_orientation,
- im_options->preview_percent);
+ im_options->preview_alignment,
+ im_options->preview_position);
if (im_options->preview_split)
gimp_image_map_tool_add_guide (im_tool);
else
gimp_image_map_tool_remove_guide (im_tool);
}
- else if (! strcmp (pspec->name, "preview-percent") &&
+ else if (! strcmp (pspec->name, "preview-alignment") &&
im_tool->image_map)
{
gimp_image_map_set_preview (im_tool->image_map,
im_options->preview_split,
- im_options->preview_orientation,
- im_options->preview_percent);
+ im_options->preview_alignment,
+ im_options->preview_position);
if (im_options->preview_split)
gimp_image_map_tool_move_guide (im_tool);
}
- else if (! strcmp (pspec->name, "preview-orientation") &&
+ else if (! strcmp (pspec->name, "preview-position") &&
im_tool->image_map)
{
gimp_image_map_set_preview (im_tool->image_map,
im_options->preview_split,
- im_options->preview_orientation,
- im_options->preview_percent);
+ im_options->preview_alignment,
+ im_options->preview_position);
if (im_options->preview_split)
gimp_image_map_tool_move_guide (im_tool);
@@ -907,13 +1042,14 @@ gimp_image_map_tool_add_guide (GimpImageMapTool *im_tool)
item = GIMP_ITEM (im_tool->drawable);
image = gimp_item_get_image (item);
- if (options->preview_orientation == GIMP_ORIENTATION_HORIZONTAL)
+ if (options->preview_alignment == GIMP_ALIGN_LEFT ||
+ options->preview_alignment == GIMP_ALIGN_RIGHT)
{
orientation = GIMP_ORIENTATION_VERTICAL;
position = (gimp_item_get_offset_x (item) +
gimp_item_get_width (item) *
- options->preview_percent);
+ options->preview_position);
}
else
{
@@ -921,7 +1057,7 @@ gimp_image_map_tool_add_guide (GimpImageMapTool *im_tool)
position = (gimp_item_get_offset_y (item) +
gimp_item_get_height (item) *
- options->preview_percent);
+ options->preview_position);
}
im_tool->percent_guide = gimp_guide_custom_new (orientation,
@@ -964,13 +1100,14 @@ gimp_image_map_tool_move_guide (GimpImageMapTool *im_tool)
item = GIMP_ITEM (im_tool->drawable);
- if (options->preview_orientation == GIMP_ORIENTATION_HORIZONTAL)
+ if (options->preview_alignment == GIMP_ALIGN_LEFT ||
+ options->preview_alignment == GIMP_ALIGN_RIGHT)
{
orientation = GIMP_ORIENTATION_VERTICAL;
position = (gimp_item_get_offset_x (item) +
gimp_item_get_width (item) *
- options->preview_percent);
+ options->preview_position);
}
else
{
@@ -978,7 +1115,7 @@ gimp_image_map_tool_move_guide (GimpImageMapTool *im_tool)
position = (gimp_item_get_offset_y (item) +
gimp_item_get_height (item) *
- options->preview_percent);
+ options->preview_position);
}
if (orientation != gimp_guide_get_orientation (im_tool->percent_guide) ||
@@ -1051,23 +1188,24 @@ gimp_image_map_tool_guide_moved (GimpGuide *guide,
{
GimpImageMapOptions *options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (im_tool);
GimpItem *item = GIMP_ITEM (im_tool->drawable);
- gdouble percent;
+ gdouble position;
- if (options->preview_orientation == GIMP_ORIENTATION_HORIZONTAL)
+ if (options->preview_alignment == GIMP_ALIGN_LEFT ||
+ options->preview_alignment == GIMP_ALIGN_RIGHT)
{
- percent = ((gdouble) (gimp_guide_get_position (guide) -
- gimp_item_get_offset_x (item)) /
- (gdouble) gimp_item_get_width (item));
+ position = ((gdouble) (gimp_guide_get_position (guide) -
+ gimp_item_get_offset_x (item)) /
+ (gdouble) gimp_item_get_width (item));
}
else
{
- percent = ((gdouble) (gimp_guide_get_position (guide) -
- gimp_item_get_offset_y (item)) /
- (gdouble) gimp_item_get_height (item));
+ position = ((gdouble) (gimp_guide_get_position (guide) -
+ gimp_item_get_offset_y (item)) /
+ (gdouble) gimp_item_get_height (item));
}
g_object_set (options,
- "preview-percent", CLAMP (percent, 0.0, 1.0),
+ "preview-position", CLAMP (position, 0.0, 1.0),
NULL);
}
@@ -1229,8 +1367,8 @@ gimp_image_map_tool_get_operation (GimpImageMapTool *im_tool)
g_free (operation_name);
g_object_set (GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (im_tool),
- "preview-split", FALSE,
- "preview-percent", 0.5,
+ "preview-split", FALSE,
+ "preview-position", 0.5,
NULL);
if (im_tool->config)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]