[gimp] libgimpwidgets: enable ratio expressions for size entries with two fields
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: enable ratio expressions for size entries with two fields
- Date: Wed, 4 Oct 2017 18:26:26 +0000 (UTC)
commit f2a80a093a9adc8864e43928e137d35d7cbb82b0
Author: Ell <ell_se yahoo com>
Date: Wed Oct 4 12:37:45 2017 -0400
libgimpwidgets: enable ratio expressions for size entries with two fields
When a size entry has exactly two fields, enable ratio expressions
in eevl. Set the reference value to the value of the field that is
not currently being evaluated, and invert the ratio when evaluating
the second field.
libgimpwidgets/gimpsizeentry.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/libgimpwidgets/gimpsizeentry.c b/libgimpwidgets/gimpsizeentry.c
index 9ac1030..1f82fee 100644
--- a/libgimpwidgets/gimpsizeentry.c
+++ b/libgimpwidgets/gimpsizeentry.c
@@ -1282,6 +1282,30 @@ gimp_size_entry_eevl_input_callback (GtkSpinButton *spinner,
options.unit_resolver_proc = gimp_size_entry_eevl_unit_resolver;
options.data = data;
+ /* enable ratio expressions when there are two fields */
+ if (gsef->gse->number_of_fields == 2)
+ {
+ GimpSizeEntryField *other_gsef;
+
+ options.ratio_expressions = TRUE;
+
+ if (gsef == gsef->gse->fields->data)
+ {
+ other_gsef = gsef->gse->fields->next->data;
+
+ options.ratio_invert = FALSE;
+ }
+ else
+ {
+ other_gsef = gsef->gse->fields->data;
+
+ options.ratio_invert = TRUE;
+ }
+
+ options.ratio_quantity.value = other_gsef->value;
+ options.ratio_quantity.dimension = 0;
+ }
+
success = gimp_eevl_evaluate (gtk_entry_get_text (GTK_ENTRY (spinner)),
&options,
&result,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]