[gimp] Issue #6843: "Canvas Size" dialog takes too much vertical space.



commit ef87f34ba4269334f0960f90d72683aab18b20c3
Author: Jehan <jehan girinstud io>
Date:   Sun Aug 22 18:04:39 2021 +0200

    Issue #6843: "Canvas Size" dialog takes too much vertical space.
    
    Since the recent changes to add template ability, there are just too
    many widgets stacked up vertically. Let's use a little better the
    horizontal space.
    
    To do this, I moved the preview on the right side of the "Canvas Size"
    and "Offset" number fields, and the "Center" button just below it.

 app/dialogs/resize-dialog.c | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)
---
diff --git a/app/dialogs/resize-dialog.c b/app/dialogs/resize-dialog.c
index 48eafda839..ef9cb6c475 100644
--- a/app/dialogs/resize-dialog.c
+++ b/app/dialogs/resize-dialog.c
@@ -134,6 +134,9 @@ resize_dialog_new (GimpViewable       *viewable,
   GtkWidget     *dialog;
   GtkWidget     *main_vbox;
   GtkWidget     *vbox;
+  GtkWidget     *center_hbox;
+  GtkWidget     *center_left_vbox;
+  GtkWidget     *center_right_vbox;
   GtkWidget     *frame;
   GtkWidget     *button;
   GtkWidget     *spinbutton;
@@ -335,9 +338,26 @@ resize_dialog_new (GimpViewable       *viewable,
                     G_CALLBACK (ppi_select_toggled),
                     private);
 
+  /* For space gain, organize the main widgets in both vertical and
+   * horizontal layout.
+   * The size and offset fields are on the center left, while the
+   * preview and the "Center" button are on center right.
+   */
+  center_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+  gtk_box_pack_start (GTK_BOX (main_vbox), center_hbox, FALSE, FALSE, 0);
+  gtk_widget_show (center_hbox);
+
+  center_left_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
+  gtk_box_pack_start (GTK_BOX (center_hbox), center_left_vbox, FALSE, FALSE, 0);
+  gtk_widget_show (center_left_vbox);
+
+  center_right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+  gtk_box_pack_start (GTK_BOX (center_hbox), center_right_vbox, FALSE, FALSE, 0);
+  gtk_widget_show (center_right_vbox);
+
   /* size select frame */
   frame = gimp_frame_new (size_title);
-  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (center_left_vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
   /* size box */
@@ -355,7 +375,7 @@ resize_dialog_new (GimpViewable       *viewable,
 
   /* offset frame */
   frame = gimp_frame_new (_("Offset"));
-  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (center_left_vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
@@ -395,18 +415,10 @@ resize_dialog_new (GimpViewable       *viewable,
                     G_CALLBACK (offset_update),
                     private);
 
-  button = gtk_button_new_with_mnemonic (_("C_enter"));
-  gtk_grid_attach (GTK_GRID (entry), button, 4, 1, 1, 1);
-  gtk_widget_show (button);
-
-  g_signal_connect (button, "clicked",
-                    G_CALLBACK (offset_center_clicked),
-                    private);
-
   frame = gtk_frame_new (NULL);
   gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (center_right_vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
   private->area = gimp_offset_area_new (width, height);
@@ -428,6 +440,15 @@ resize_dialog_new (GimpViewable       *viewable,
                     G_CALLBACK (size_notify),
                     private);
 
+  /* Button to center the image on canvas just below the preview. */
+  button = gtk_button_new_with_mnemonic (_("C_enter"));
+  gtk_box_pack_start (GTK_BOX (center_right_vbox), button, FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (offset_center_clicked),
+                    private);
+
   frame = gimp_frame_new (layers_title);
   gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);


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