[gimp] app: add functions to switch preview side and orientation to GimpFilterOptions
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add functions to switch preview side and orientation to GimpFilterOptions
- Date: Sat, 25 Mar 2017 13:59:20 +0000 (UTC)
commit f56df8d7dce2b930cca53cfbae5e0b32cd1a733a
Author: Michael Natterer <mitch gimp org>
Date: Sat Mar 25 14:50:19 2017 +0100
app: add functions to switch preview side and orientation to GimpFilterOptions
app/tools/gimpfilteroptions.c | 59 +++++++++++++++++++++++++++++++++++++++++
app/tools/gimpfilteroptions.h | 7 ++++-
2 files changed, 65 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimpfilteroptions.c b/app/tools/gimpfilteroptions.c
index ef6933a..95e025f 100644
--- a/app/tools/gimpfilteroptions.c
+++ b/app/tools/gimpfilteroptions.c
@@ -247,3 +247,62 @@ gimp_filter_options_get_property (GObject *object,
break;
}
}
+
+
+/* public functions */
+
+void
+gimp_filter_options_switch_preview_side (GimpFilterOptions *options)
+{
+ GimpAlignmentType alignment;
+
+ g_return_if_fail (GIMP_IS_FILTER_OPTIONS (options));
+
+ 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);
+}
+
+void
+gimp_filter_options_switch_preview_orientation (GimpFilterOptions *options,
+ gdouble position_x,
+ gdouble position_y)
+{
+ GimpAlignmentType alignment;
+ gdouble position;
+
+ g_return_if_fail (GIMP_IS_FILTER_OPTIONS (options));
+
+ 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 = position_x;
+ }
+ else
+ {
+ position = position_y;
+ }
+
+ g_object_set (options,
+ "preview-alignment", alignment,
+ "preview-position", CLAMP (position, 0.0, 1.0),
+ NULL);
+}
diff --git a/app/tools/gimpfilteroptions.h b/app/tools/gimpfilteroptions.h
index 758d646..e28f420 100644
--- a/app/tools/gimpfilteroptions.h
+++ b/app/tools/gimpfilteroptions.h
@@ -53,7 +53,12 @@ struct _GimpFilterOptionsClass
};
-GType gimp_filter_options_get_type (void) G_GNUC_CONST;
+GType gimp_filter_options_get_type (void) G_GNUC_CONST;
+
+void gimp_filter_options_switch_preview_side (GimpFilterOptions *options);
+void gimp_filter_options_switch_preview_orientation (GimpFilterOptions *options,
+ gdouble position_x,
+ gdouble position_y);
#endif /* __GIMP_FILTER_OPTIONS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]