[gimp] app: add unified interaction mode to the 3D Transform tool
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add unified interaction mode to the 3D Transform tool
- Date: Fri, 10 Jan 2020 21:21:51 +0000 (UTC)
commit 30132fc2da24979d67ca6e6d59eddea9d224131e
Author: Ell <ell_se yahoo com>
Date: Fri Jan 10 23:10:47 2020 +0200
app: add unified interaction mode to the 3D Transform tool
Add a "Unified interaction" option to the 3D Transform tool, and a
corresponding "unified" property to GimpToolTransform3DGrid. When
active, all three interaction modes of the grid (camera, move, and
rotate) are available simultaneously, regardless of the active
dialog page. In this mode, the inner and outer regions of the item
are used for moving and rotation, respectively, and the vanishing-
point is controlled through through a handle.
app/display/gimptooltransform3dgrid.c | 77 +++++++++++++++++++++++------------
app/tools/gimptransform3doptions.c | 18 ++++++++
app/tools/gimptransform3doptions.h | 2 +
app/tools/gimptransform3dtool.c | 1 +
4 files changed, 72 insertions(+), 26 deletions(-)
---
diff --git a/app/display/gimptooltransform3dgrid.c b/app/display/gimptooltransform3dgrid.c
index 9e3dca7796..2b030f2030 100644
--- a/app/display/gimptooltransform3dgrid.c
+++ b/app/display/gimptooltransform3dgrid.c
@@ -48,6 +48,7 @@ enum
{
PROP_0,
PROP_MODE,
+ PROP_UNIFIED,
PROP_CONSTRAIN_AXIS,
PROP_Z_AXIS,
PROP_LOCAL_FRAME,
@@ -76,6 +77,7 @@ typedef enum
struct _GimpToolTransform3DGridPrivate
{
GimpTransform3DMode mode;
+ gboolean unified;
gboolean constrain_axis;
gboolean z_axis;
@@ -150,8 +152,7 @@ static gboolean gimp_tool_transform_3d_grid_get_cursor (GimpToolW
GimpToolCursorType *tool_cursor,
GimpCursorModifier *modifier);
-static void gimp_tool_transform_3d_grid_set_mode (GimpToolTransform3DGrid *grid,
- GimpTransform3DMode mode);
+static void gimp_tool_transform_3d_grid_update_mode (GimpToolTransform3DGrid *grid);
static void gimp_tool_transform_3d_grid_reset_motion (GimpToolTransform3DGrid *grid);
static gboolean gimp_tool_transform_3d_grid_constrain (GimpToolTransform3DGrid *grid,
gdouble x,
@@ -202,6 +203,13 @@ gimp_tool_transform_3d_grid_class_init (GimpToolTransform3DGridClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class, PROP_UNIFIED,
+ g_param_spec_boolean ("unified",
+ NULL, NULL,
+ FALSE,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
g_object_class_install_property (object_class, PROP_CONSTRAIN_AXIS,
g_param_spec_boolean ("constrain-axis",
NULL, NULL,
@@ -368,7 +376,13 @@ gimp_tool_transform_3d_grid_set_property (GObject *object,
switch (property_id)
{
case PROP_MODE:
- gimp_tool_transform_3d_grid_set_mode (grid, g_value_get_enum (value));
+ priv->mode = g_value_get_enum (value);
+ gimp_tool_transform_3d_grid_update_mode (grid);
+ break;
+
+ case PROP_UNIFIED:
+ priv->unified = g_value_get_boolean (value);
+ gimp_tool_transform_3d_grid_update_mode (grid);
break;
case PROP_CONSTRAIN_AXIS:
@@ -453,6 +467,9 @@ gimp_tool_transform_3d_grid_get_property (GObject *object,
case PROP_MODE:
g_value_set_enum (value, priv->mode);
break;
+ case PROP_UNIFIED:
+ g_value_set_boolean (value, priv->unified);
+ break;
case PROP_CONSTRAIN_AXIS:
g_value_set_boolean (value, priv->constrain_axis);
@@ -659,38 +676,46 @@ gimp_tool_transform_3d_grid_get_cursor (GimpToolWidget *widget,
}
static void
-gimp_tool_transform_3d_grid_set_mode (GimpToolTransform3DGrid *grid,
- GimpTransform3DMode mode)
+gimp_tool_transform_3d_grid_update_mode (GimpToolTransform3DGrid *grid)
{
GimpToolTransform3DGridPrivate *priv = grid->priv;
- priv->mode = mode;
-
- switch (mode)
+ if (priv->unified)
{
- case GIMP_TRANSFORM_3D_MODE_CAMERA:
g_object_set (grid,
- "inside-function", GIMP_TRANSFORM_FUNCTION_NONE,
- "outside-function", GIMP_TRANSFORM_FUNCTION_NONE,
+ "inside-function", GIMP_TRANSFORM_FUNCTION_MOVE,
+ "outside-function", GIMP_TRANSFORM_FUNCTION_ROTATE,
"use-pivot-handle", TRUE,
NULL);
- break;
+ }
+ else
+ {
+ switch (priv->mode)
+ {
+ case GIMP_TRANSFORM_3D_MODE_CAMERA:
+ g_object_set (grid,
+ "inside-function", GIMP_TRANSFORM_FUNCTION_NONE,
+ "outside-function", GIMP_TRANSFORM_FUNCTION_NONE,
+ "use-pivot-handle", TRUE,
+ NULL);
+ break;
- case GIMP_TRANSFORM_3D_MODE_MOVE:
- g_object_set (grid,
- "inside-function", GIMP_TRANSFORM_FUNCTION_MOVE,
- "outside-function", GIMP_TRANSFORM_FUNCTION_MOVE,
- "use-pivot-handle", FALSE,
- NULL);
- break;
+ case GIMP_TRANSFORM_3D_MODE_MOVE:
+ g_object_set (grid,
+ "inside-function", GIMP_TRANSFORM_FUNCTION_MOVE,
+ "outside-function", GIMP_TRANSFORM_FUNCTION_MOVE,
+ "use-pivot-handle", FALSE,
+ NULL);
+ break;
- case GIMP_TRANSFORM_3D_MODE_ROTATE:
- g_object_set (grid,
- "inside-function", GIMP_TRANSFORM_FUNCTION_ROTATE,
- "outside-function", GIMP_TRANSFORM_FUNCTION_ROTATE,
- "use-pivot-handle", FALSE,
- NULL);
- break;
+ case GIMP_TRANSFORM_3D_MODE_ROTATE:
+ g_object_set (grid,
+ "inside-function", GIMP_TRANSFORM_FUNCTION_ROTATE,
+ "outside-function", GIMP_TRANSFORM_FUNCTION_ROTATE,
+ "use-pivot-handle", FALSE,
+ NULL);
+ break;
+ }
}
}
diff --git a/app/tools/gimptransform3doptions.c b/app/tools/gimptransform3doptions.c
index cec7f1b66a..a4baf1d53e 100644
--- a/app/tools/gimptransform3doptions.c
+++ b/app/tools/gimptransform3doptions.c
@@ -41,6 +41,7 @@ enum
{
PROP_0,
PROP_MODE,
+ PROP_UNIFIED,
PROP_CONSTRAIN_AXIS,
PROP_Z_AXIS,
PROP_LOCAL_FRAME
@@ -79,6 +80,13 @@ gimp_transform_3d_options_class_init (GimpTransform3DOptionsClass *klass)
GIMP_TRANSFORM_3D_MODE_CAMERA,
GIMP_PARAM_STATIC_STRINGS);
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_UNIFIED,
+ "unified",
+ _("Unified interaction"),
+ _("Combine all interaction modes"),
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_CONSTRAIN_AXIS,
"constrain-axis",
NULL,
@@ -119,6 +127,9 @@ gimp_transform_3d_options_set_property (GObject *object,
case PROP_MODE:
options->mode = g_value_get_enum (value);
break;
+ case PROP_UNIFIED:
+ options->unified = g_value_get_boolean (value);
+ break;
case PROP_CONSTRAIN_AXIS:
options->constrain_axis = g_value_get_boolean (value);
@@ -149,6 +160,9 @@ gimp_transform_3d_options_get_property (GObject *object,
case PROP_MODE:
g_value_set_enum (value, options->mode);
break;
+ case PROP_UNIFIED:
+ g_value_set_boolean (value, options->unified);
+ break;
case PROP_CONSTRAIN_AXIS:
g_value_set_boolean (value, options->constrain_axis);
@@ -176,6 +190,10 @@ gimp_transform_3d_options_gui (GimpToolOptions *tool_options)
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType constrain_mask = gimp_get_constrain_behavior_mask ();
+ button = gimp_prop_check_button_new (config, "unified", NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
label = g_strdup_printf (_("Constrain axis (%s)"),
gimp_get_mod_string (extend_mask));
diff --git a/app/tools/gimptransform3doptions.h b/app/tools/gimptransform3doptions.h
index b5aa038490..d0fd3e0bef 100644
--- a/app/tools/gimptransform3doptions.h
+++ b/app/tools/gimptransform3doptions.h
@@ -38,6 +38,8 @@ struct _GimpTransform3DOptions
GimpTransformGridOptions parent_instance;
GimpTransform3DMode mode;
+ gboolean unified;
+
gboolean constrain_axis;
gboolean z_axis;
gboolean local_frame;
diff --git a/app/tools/gimptransform3dtool.c b/app/tools/gimptransform3dtool.c
index 3f3fc83cd8..1f01ee2b5c 100644
--- a/app/tools/gimptransform3dtool.c
+++ b/app/tools/gimptransform3dtool.c
@@ -665,6 +665,7 @@ gimp_transform_3d_tool_get_widget (GimpTransformGridTool *tg_tool)
static const gchar *bound_properties[] =
{
"mode",
+ "unified",
"constrain-axis",
"z-axis",
"local-frame",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]