changeset 481:67a612985686

Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
author zas_
date Tue, 22 Apr 2008 08:53:07 +0000
parents 805c3258d228
children 75b7154e6435
files src/image-overlay.c src/image-overlay.h src/img-view.c src/layout_image.c
diffstat 4 files changed, 32 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/image-overlay.c	Tue Apr 22 08:34:30 2008 +0000
+++ b/src/image-overlay.c	Tue Apr 22 08:53:07 2008 +0000
@@ -77,6 +77,9 @@
 
 #define HISTOGRAM_HEIGHT 140
 
+static void image_osd_timer_schedule(OverlayStateData *osd);
+
+
 void set_default_image_overlay_template_string(ConfOptions *options)
 {
 	if (options->image_overlay.common.template_string) g_free(options->image_overlay.common.template_string);
@@ -114,9 +117,28 @@
 		histogram_set_mode(imd->histogram, !histogram_get_mode(imd->histogram));
 }
 
-
-
-static void image_osd_timer_schedule(OverlayStateData *osd);
+void image_osd_toggle(ImageWindow *imd)
+{
+	if (image_osd_get(imd, NULL, NULL))
+		{
+		if (image_osd_histogram_onoff_status(imd))
+			{
+			image_osd_histogram_onoff_toggle(imd, 0);
+			image_osd_update(imd);
+			}
+		else
+			{
+			image_osd_set(imd, FALSE, FALSE);
+			}
+		}
+	else
+		{
+		image_osd_set(imd, TRUE, TRUE);
+		image_osd_icon(imd, IMAGE_OSD_ICON, -1);
+		image_osd_histogram_onoff_toggle(imd, 1);
+		image_osd_update(imd);
+		}
+}
 
 static gchar *image_osd_mkinfo(const gchar *str, ImageWindow *imd, GHashTable *vars)
 {
--- a/src/image-overlay.h	Tue Apr 22 08:34:30 2008 +0000
+++ b/src/image-overlay.h	Tue Apr 22 08:53:07 2008 +0000
@@ -38,4 +38,7 @@
 void image_osd_histogram_chan_toggle(ImageWindow *);
 void image_osd_histogram_log_toggle(ImageWindow *);
 
+void image_osd_toggle(ImageWindow *imd);
+
+
 #endif
--- a/src/img-view.c	Tue Apr 22 08:34:30 2008 +0000
+++ b/src/img-view.c	Tue Apr 22 08:53:07 2008 +0000
@@ -725,16 +725,8 @@
 	ImageWindow *imd;
 
 	imd = view_window_active_image(vw);
-
-	if (!image_osd_get(imd, NULL, NULL))
-		{
-		image_osd_set(imd, TRUE, TRUE);
-		image_osd_icon(imd, IMAGE_OSD_ICON, -1);
-		}
-	else
-		{
-		image_osd_set(imd, FALSE, FALSE);
-		}
+	
+	image_osd_toggle(imd);
 }
 
 static void view_slideshow_next(ViewWindow *vw)
--- a/src/layout_image.c	Tue Apr 22 08:34:30 2008 +0000
+++ b/src/layout_image.c	Tue Apr 22 08:53:07 2008 +0000
@@ -46,15 +46,8 @@
 
 void layout_image_overlay_toggle(LayoutWindow *lw)
 {
-	if (image_osd_get(lw->image, NULL, NULL))
-		{
-		image_osd_set(lw->image, FALSE, FALSE);
-		}
-	else
-		{
-		image_osd_set(lw->image, (lw->full_screen != NULL), TRUE);
-		image_osd_icon(lw->image, IMAGE_OSD_ICON, -1);
-		}
+	if (!lw) return;
+	image_osd_toggle(lw->image);
 }
 
 void layout_image_overlay_update(LayoutWindow *lw)