[gimp] app: add boolean property "force-narrow-mode" to GimpToolRectangle
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add boolean property "force-narrow-mode" to GimpToolRectangle
- Date: Wed, 28 Jun 2017 12:24:51 +0000 (UTC)
commit a562860eed4885197086d46e44d4a7115eed266f
Author: Michael Natterer <mitch gimp org>
Date: Wed Jun 28 14:23:51 2017 +0200
app: add boolean property "force-narrow-mode" to GimpToolRectangle
which allows to force outside handles without resorting to hacks.
app/display/gimptoolrectangle.c | 33 +++++++++++++++++++++++++++++----
1 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/app/display/gimptoolrectangle.c b/app/display/gimptoolrectangle.c
index 21c4137..1826ee1 100644
--- a/app/display/gimptoolrectangle.c
+++ b/app/display/gimptoolrectangle.c
@@ -75,6 +75,7 @@ enum
PROP_CONSTRAINT,
PROP_PRECISION,
PROP_NARROW_MODE,
+ PROP_FORCE_NARROW_MODE,
PROP_DRAW_ELLIPSE,
PROP_ROUND_CORNERS,
PROP_CORNER_RADIUS,
@@ -205,6 +206,9 @@ struct _GimpToolRectanglePrivate
*/
gboolean narrow_mode;
+ /* This boolean allows to always set narrow mode */
+ gboolean force_narrow_mode;
+
/* Whether or not to draw an ellipse inside the rectangle */
gboolean draw_ellipse;
@@ -502,6 +506,13 @@ gimp_tool_rectangle_class_init (GimpToolRectangleClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class, PROP_FORCE_NARROW_MODE,
+ g_param_spec_boolean ("force-narrow-mode",
+ NULL, NULL,
+ FALSE,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
g_object_class_install_property (object_class, PROP_DRAW_ELLIPSE,
g_param_spec_boolean ("draw-ellipse",
NULL, NULL,
@@ -799,6 +810,9 @@ gimp_tool_rectangle_set_property (GObject *object,
case PROP_NARROW_MODE:
private->narrow_mode = g_value_get_boolean (value);
break;
+ case PROP_FORCE_NARROW_MODE:
+ private->force_narrow_mode = g_value_get_boolean (value);
+ break;
case PROP_DRAW_ELLIPSE:
private->draw_ellipse = g_value_get_boolean (value);
break;
@@ -898,6 +912,9 @@ gimp_tool_rectangle_get_property (GObject *object,
case PROP_NARROW_MODE:
g_value_set_boolean (value, private->narrow_mode);
break;
+ case PROP_FORCE_NARROW_MODE:
+ g_value_set_boolean (value, private->force_narrow_mode);
+ break;
case PROP_DRAW_ELLIPSE:
g_value_set_boolean (value, private->draw_ellipse);
break;
@@ -1346,8 +1363,13 @@ gimp_tool_rectangle_button_press (GimpToolWidget *widget,
private->x1 = private->x2 = snapped_x;
private->y1 = private->y2 = snapped_y;
- /* Created rectangles should not be started in narrow-mode */
- private->narrow_mode = FALSE;
+ /* Unless forced, created rectangles should not be started in
+ * narrow-mode
+ */
+ if (private->force_narrow_mode)
+ private->narrow_mode = TRUE;
+ else
+ private->narrow_mode = FALSE;
/* If the rectangle is being modified we want the center on
* fixed_center to be at the center of the currently existing
@@ -2008,8 +2030,11 @@ gimp_tool_rectangle_update_handle_sizes (GimpToolRectangle *rectangle)
&visible_rectangle_height);
/* Determine if we are in narrow-mode or not. */
- private->narrow_mode = (visible_rectangle_width < NARROW_MODE_THRESHOLD ||
- visible_rectangle_height < NARROW_MODE_THRESHOLD);
+ if (private->force_narrow_mode)
+ private->narrow_mode = TRUE;
+ else
+ private->narrow_mode = (visible_rectangle_width < NARROW_MODE_THRESHOLD ||
+ visible_rectangle_height < NARROW_MODE_THRESHOLD);
}
if (private->narrow_mode)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]