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 1806b66c5a)
This commit is contained in:
Michael Natterer
2018-06-04 15:13:23 +02:00
parent 226367d6cb
commit a33b9e96d7
2 changed files with 52 additions and 36 deletions

View File

@ -193,7 +193,7 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *hbox2; GtkWidget *hbox2;
GtkWidget *image; GtkWidget *image;
GtkWidget *widget; GtkWidget *label;
GimpUnitStore *store; GimpUnitStore *store;
GList *children; GList *children;
@ -259,38 +259,47 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
statusbar); statusbar);
/* Shell transform status */ /* Shell transform status */
widget = gtk_event_box_new (); statusbar->rotate_widget = gtk_event_box_new ();
gtk_widget_add_events (widget, GDK_BUTTON_PRESS_MASK); 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); 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), G_CALLBACK (gimp_statusbar_rotate_pressed),
statusbar); 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_event_box_new ();
statusbar->horizontal_flip_icon = gtk_image_new_from_icon_name ("gimp-flip-horizontal", gtk_box_pack_start (GTK_BOX (hbox), statusbar->horizontal_flip_icon,
GTK_ICON_SIZE_MENU); FALSE, FALSE, 1);
gtk_container_add (GTK_CONTAINER (widget), statusbar->horizontal_flip_icon); gtk_widget_show (statusbar->horizontal_flip_icon);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 1);
g_signal_connect (widget, "button-press-event", 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), G_CALLBACK (gimp_statusbar_horiz_flip_pressed),
statusbar); statusbar);
gtk_widget_show (statusbar->horizontal_flip_icon);
gtk_widget_show (widget);
widget = gtk_event_box_new (); statusbar->vertical_flip_icon = gtk_event_box_new ();
statusbar->vertical_flip_icon = gtk_image_new_from_icon_name ("gimp-flip-vertical", gtk_box_pack_start (GTK_BOX (hbox), statusbar->vertical_flip_icon,
GTK_ICON_SIZE_MENU); FALSE, FALSE, 1);
gtk_container_add (GTK_CONTAINER (widget), statusbar->vertical_flip_icon); gtk_widget_show (statusbar->vertical_flip_icon);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 1);
g_signal_connect (widget, "button-press-event", 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), G_CALLBACK (gimp_statusbar_vert_flip_pressed),
statusbar); statusbar);
gtk_widget_show (statusbar->vertical_flip_icon);
gtk_widget_show (widget);
/* put the label back into the message area */ /* put the label back into the message area */
gtk_box_pack_start (GTK_BOX (hbox), statusbar->label, TRUE, TRUE, 1); 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_box_pack_start (GTK_BOX (hbox2), image, FALSE, FALSE, 2);
gtk_widget_show (image); gtk_widget_show (image);
widget = gtk_label_new ("Cancel"); label = gtk_label_new ("Cancel");
gtk_box_pack_start (GTK_BOX (hbox2), widget, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 2);
gtk_widget_show (widget); gtk_widget_show (label);
g_signal_connect (statusbar->cancel_button, "clicked", g_signal_connect (statusbar->cancel_button, "clicked",
G_CALLBACK (gimp_statusbar_progress_canceled), 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->cursor_label);
gtk_widget_hide (statusbar->unit_combo); gtk_widget_hide (statusbar->unit_combo);
gtk_widget_hide (statusbar->scale_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->horizontal_flip_icon);
gtk_widget_hide (statusbar->vertical_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->cursor_label);
gtk_widget_show (statusbar->unit_combo); gtk_widget_show (statusbar->unit_combo);
gtk_widget_show (statusbar->scale_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); gimp_statusbar_shell_rotated (statusbar->shell, statusbar);
} }
@ -1439,22 +1448,28 @@ static void
gimp_statusbar_shell_rotated (GimpDisplayShell *shell, gimp_statusbar_shell_rotated (GimpDisplayShell *shell,
GimpStatusbar *statusbar) GimpStatusbar *statusbar)
{ {
gchar *text = NULL;
if (shell->rotate_angle != 0.0) if (shell->rotate_angle != 0.0)
{ {
/* Degree symbol U+00B0. There are no spaces between the value and the /* Degree symbol U+00B0. There are no spaces between the value and the
* unit for angular rotation. */ * unit for angular rotation.
text = g_strdup_printf (" %.2f\xC2\xB0", shell->rotate_angle); */
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) if (shell->flip_horizontally)
gtk_widget_show (statusbar->horizontal_flip_icon); gtk_widget_show (statusbar->horizontal_flip_icon);
else else
gtk_widget_hide (statusbar->horizontal_flip_icon); gtk_widget_hide (statusbar->horizontal_flip_icon);
if (shell->flip_vertically) if (shell->flip_vertically)
gtk_widget_show (statusbar->vertical_flip_icon); gtk_widget_show (statusbar->vertical_flip_icon);
else else

View File

@ -58,6 +58,7 @@ struct _GimpStatusbar
GtkWidget *cursor_label; GtkWidget *cursor_label;
GtkWidget *unit_combo; GtkWidget *unit_combo;
GtkWidget *scale_combo; GtkWidget *scale_combo;
GtkWidget *rotate_widget;
GtkWidget *rotate_label; GtkWidget *rotate_label;
GtkWidget *horizontal_flip_icon; GtkWidget *horizontal_flip_icon;
GtkWidget *vertical_flip_icon; GtkWidget *vertical_flip_icon;