[gimp] app: change GEGL op GUI generation so widgets can expand vertically



commit 7529fd987c033f21872dc57797e93c7d40b6ffc2
Author: Michael Natterer <mitch gimp org>
Date:   Sat Mar 26 20:28:24 2016 +0100

    app: change GEGL op GUI generation so widgets can expand vertically
    
    Currently we only expand scrolled windows, which are used for
    multiline text properties' GtkTextViews.

 app/tools/gimpoperationtool.c          |    4 +-
 app/widgets/gimppropgui-constructors.c |   45 ++++++++++++++++++++++++-------
 2 files changed, 37 insertions(+), 12 deletions(-)
---
diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c
index 3012595..ff286ff 100644
--- a/app/tools/gimpoperationtool.c
+++ b/app/tools/gimpoperationtool.c
@@ -286,7 +286,7 @@ gimp_operation_tool_dialog (GimpImageMapTool *im_tool)
   /*  The options vbox  */
   tool->options_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
   gtk_box_pack_start (GTK_BOX (main_vbox), tool->options_box,
-                      FALSE, FALSE, 0);
+                      TRUE, TRUE, 0);
   gtk_widget_show (tool->options_box);
 
   for (list = tool->aux_inputs; list; list = g_list_next (list))
@@ -734,7 +734,7 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
       if (tool->options_box)
         {
           gtk_box_pack_start (GTK_BOX (tool->options_box), tool->options_gui,
-                              FALSE, FALSE, 0);
+                              TRUE, TRUE, 0);
           gtk_widget_show (tool->options_gui);
         }
     }
diff --git a/app/widgets/gimppropgui-constructors.c b/app/widgets/gimppropgui-constructors.c
index bd2116e..ee6afe0 100644
--- a/app/widgets/gimppropgui-constructors.c
+++ b/app/widgets/gimppropgui-constructors.c
@@ -177,33 +177,58 @@ _gimp_prop_gui_new_generic (GObject              *config,
         {
           GtkWidget   *widget;
           const gchar *label;
+          gboolean     expand = FALSE;
 
           widget = gimp_prop_widget_new_from_pspec (config, pspec, context,
                                                     create_picker_func,
                                                     picker_creator,
                                                     &label);
 
+          if (GTK_IS_SCROLLED_WINDOW (widget))
+            expand = TRUE;
+
           if (widget && label)
             {
-              GtkWidget *hbox;
               GtkWidget *l;
 
-              hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
-              gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
-              gtk_widget_show (hbox);
-
               l = gtk_label_new_with_mnemonic (label);
               gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
-              gtk_size_group_add_widget (label_group, l);
-              gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0);
               gtk_widget_show (l);
 
-              gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
-              gtk_widget_show (widget);
+              if (GTK_IS_SCROLLED_WINDOW (widget))
+                {
+                  GtkWidget *frame;
+
+                  /* don't set as frame title, it should not be bold */
+                  gtk_box_pack_start (GTK_BOX (main_vbox), l, FALSE, FALSE, 0);
+
+                  frame = gimp_frame_new (NULL);
+                  gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
+                  gtk_widget_show (frame);
+
+                  gtk_container_add (GTK_CONTAINER (frame), widget);
+                  gtk_widget_show (widget);
+                }
+              else
+                {
+                  GtkWidget *hbox;
+
+                  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+                  gtk_box_pack_start (GTK_BOX (main_vbox), hbox,
+                                      expand, expand, 0);
+                  gtk_widget_show (hbox);
+
+                  gtk_size_group_add_widget (label_group, l);
+                  gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0);
+
+                  gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+                  gtk_widget_show (widget);
+                }
             }
           else if (widget)
             {
-              gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0);
+              gtk_box_pack_start (GTK_BOX (main_vbox), widget,
+                                  expand, expand, 0);
               gtk_widget_show (widget);
             }
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]