[gimp/gimp-2-10] Issue #1560 - invisible canvas flip/rotation buttons...



commit a33b9e96d792591209206f00dd0da4774047e1d8
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 4 15:13:23 2018 +0200

    Issue #1560 - invisible canvas flip/rotation buttons...
    
    ...at the bottom of image window
    
    Need to show/hide the event box, not just the labels/icons inside.
    
    (cherry picked from commit 1806b66c5ac4804e73dbee957f7af6ce2db634c7)

 app/display/gimpstatusbar.c | 91 ++++++++++++++++++++++++++-------------------
 app/display/gimpstatusbar.h |  1 +
 2 files changed, 54 insertions(+), 38 deletions(-)
---
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index 49684d2b79..a8f2c44f68 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -193,7 +193,7 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
   GtkWidget     *hbox;
   GtkWidget     *hbox2;
   GtkWidget     *image;
-  GtkWidget     *widget;
+  GtkWidget     *label;
   GimpUnitStore *store;
   GList         *children;
 
@@ -259,38 +259,47 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
                     statusbar);
 
   /* Shell transform status */
-  widget = gtk_event_box_new ();
-  gtk_widget_add_events (widget, GDK_BUTTON_PRESS_MASK);
+  statusbar->rotate_widget = gtk_event_box_new ();
+  gtk_box_pack_start (GTK_BOX (hbox), statusbar->rotate_widget,
+                      FALSE, FALSE, 1);
+  gtk_widget_show (statusbar->rotate_widget);
+
   statusbar->rotate_label = gtk_label_new (NULL);
-  g_signal_connect (widget, "button-press-event",
+  gtk_container_add (GTK_CONTAINER (statusbar->rotate_widget),
+                     statusbar->rotate_label);
+  gtk_widget_show (statusbar->rotate_label);
+
+  g_signal_connect (statusbar->rotate_widget, "button-press-event",
                     G_CALLBACK (gimp_statusbar_rotate_pressed),
                     statusbar);
-  gtk_container_add (GTK_CONTAINER (widget), statusbar->rotate_label);
-  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 1);
-  gtk_widget_show (statusbar->rotate_label);
-  gtk_widget_show (widget);
-
-  widget = gtk_event_box_new ();
-  statusbar->horizontal_flip_icon = gtk_image_new_from_icon_name ("gimp-flip-horizontal",
-                                                                  GTK_ICON_SIZE_MENU);
-  gtk_container_add (GTK_CONTAINER (widget), statusbar->horizontal_flip_icon);
-  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 1);
-  g_signal_connect (widget, "button-press-event",
+
+  statusbar->horizontal_flip_icon = gtk_event_box_new ();
+  gtk_box_pack_start (GTK_BOX (hbox), statusbar->horizontal_flip_icon,
+                      FALSE, FALSE, 1);
+  gtk_widget_show (statusbar->horizontal_flip_icon);
+
+  image = gtk_image_new_from_icon_name ("gimp-flip-horizontal",
+                                        GTK_ICON_SIZE_MENU);
+  gtk_container_add (GTK_CONTAINER (statusbar->horizontal_flip_icon), image);
+  gtk_widget_show (image);
+
+  g_signal_connect (statusbar->horizontal_flip_icon, "button-press-event",
                     G_CALLBACK (gimp_statusbar_horiz_flip_pressed),
                     statusbar);
-  gtk_widget_show (statusbar->horizontal_flip_icon);
-  gtk_widget_show (widget);
-
-  widget = gtk_event_box_new ();
-  statusbar->vertical_flip_icon = gtk_image_new_from_icon_name ("gimp-flip-vertical",
-                                                                GTK_ICON_SIZE_MENU);
-  gtk_container_add (GTK_CONTAINER (widget), statusbar->vertical_flip_icon);
-  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 1);
-  g_signal_connect (widget, "button-press-event",
+
+  statusbar->vertical_flip_icon = gtk_event_box_new ();
+  gtk_box_pack_start (GTK_BOX (hbox), statusbar->vertical_flip_icon,
+                      FALSE, FALSE, 1);
+  gtk_widget_show (statusbar->vertical_flip_icon);
+
+  image = gtk_image_new_from_icon_name ("gimp-flip-vertical",
+                                        GTK_ICON_SIZE_MENU);
+  gtk_container_add (GTK_CONTAINER (statusbar->vertical_flip_icon), image);
+  gtk_widget_show (image);
+
+  g_signal_connect (statusbar->vertical_flip_icon, "button-press-event",
                     G_CALLBACK (gimp_statusbar_vert_flip_pressed),
                     statusbar);
-  gtk_widget_show (statusbar->vertical_flip_icon);
-  gtk_widget_show (widget);
 
   /*  put the label back into the message area  */
   gtk_box_pack_start (GTK_BOX (hbox), statusbar->label, TRUE, TRUE, 1);
@@ -330,9 +339,9 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
   gtk_box_pack_start (GTK_BOX (hbox2), image, FALSE, FALSE, 2);
   gtk_widget_show (image);
 
-  widget = gtk_label_new ("Cancel");
-  gtk_box_pack_start (GTK_BOX (hbox2), widget, FALSE, FALSE, 2);
-  gtk_widget_show (widget);
+  label = gtk_label_new ("Cancel");
+  gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 2);
+  gtk_widget_show (label);
 
   g_signal_connect (statusbar->cancel_button, "clicked",
                     G_CALLBACK (gimp_statusbar_progress_canceled),
@@ -845,7 +854,7 @@ gimp_statusbar_empty (GimpStatusbar *statusbar)
   gtk_widget_hide (statusbar->cursor_label);
   gtk_widget_hide (statusbar->unit_combo);
   gtk_widget_hide (statusbar->scale_combo);
-  gtk_widget_hide (statusbar->rotate_label);
+  gtk_widget_hide (statusbar->rotate_widget);
   gtk_widget_hide (statusbar->horizontal_flip_icon);
   gtk_widget_hide (statusbar->vertical_flip_icon);
 }
@@ -858,7 +867,7 @@ gimp_statusbar_fill (GimpStatusbar *statusbar)
   gtk_widget_show (statusbar->cursor_label);
   gtk_widget_show (statusbar->unit_combo);
   gtk_widget_show (statusbar->scale_combo);
-  gtk_widget_show (statusbar->rotate_label);
+  gtk_widget_show (statusbar->rotate_widget);
   gimp_statusbar_shell_rotated (statusbar->shell, statusbar);
 }
 
@@ -1439,22 +1448,28 @@ static void
 gimp_statusbar_shell_rotated (GimpDisplayShell *shell,
                               GimpStatusbar    *statusbar)
 {
-  gchar *text = NULL;
-
   if (shell->rotate_angle != 0.0)
     {
       /* Degree symbol U+00B0. There are no spaces between the value and the
-       * unit for angular rotation. */
-      text = g_strdup_printf (" %.2f\xC2\xB0", shell->rotate_angle);
+       * unit for angular rotation.
+       */
+      gchar *text = g_strdup_printf (" %.2f\xC2\xB0", shell->rotate_angle);
+
+      gtk_label_set_text (GTK_LABEL (statusbar->rotate_label), text);
+      g_free (text);
+
+      gtk_widget_show (statusbar->rotate_widget);
+    }
+  else
+    {
+      gtk_widget_hide (statusbar->rotate_widget);
     }
-  gtk_label_set_text (GTK_LABEL (statusbar->rotate_label), text);
-  if (text)
-    g_free (text);
 
   if (shell->flip_horizontally)
     gtk_widget_show (statusbar->horizontal_flip_icon);
   else
     gtk_widget_hide (statusbar->horizontal_flip_icon);
+
   if (shell->flip_vertically)
     gtk_widget_show (statusbar->vertical_flip_icon);
   else
diff --git a/app/display/gimpstatusbar.h b/app/display/gimpstatusbar.h
index 4e7a8079a7..8721551b94 100644
--- a/app/display/gimpstatusbar.h
+++ b/app/display/gimpstatusbar.h
@@ -58,6 +58,7 @@ struct _GimpStatusbar
   GtkWidget           *cursor_label;
   GtkWidget           *unit_combo;
   GtkWidget           *scale_combo;
+  GtkWidget           *rotate_widget;
   GtkWidget           *rotate_label;
   GtkWidget           *horizontal_flip_icon;
   GtkWidget           *vertical_flip_icon;


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