changeset 415:4f7362028062

Add zoom ratio display to OSD in fullscreen mode. It appears as [%zoom%] in fullscreen info string. It is now displayed by default.
author zas_
date Fri, 18 Apr 2008 23:09:03 +0000
parents 49c1cbe058ae
children 054a26ac407f
files src/fullscreen.c src/image-overlay.c src/image.c src/main.h src/typedefs.h
diffstat 5 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/fullscreen.c	Fri Apr 18 22:31:58 2008 +0000
+++ b/src/fullscreen.c	Fri Apr 18 23:09:03 2008 +0000
@@ -35,10 +35,7 @@
 void set_default_fullscreen_info(ConfOptions *options)
 {
 	if (options->fullscreen.info) g_free(options->fullscreen.info);
-	options->fullscreen.info = g_strdup("%collection%(%number%/%total%) <b>%name%</b>\n"
-				   "%res%|%date%|%size%\n"
-				   "%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n"
-				   "%fCamera%|%fFlash%");
+	options->fullscreen.info = g_strdup(DEFAULT_OVERLAY_INFO);
 }
 
 static void clear_mouse_cursor(GtkWidget *widget, gint state)
--- a/src/image-overlay.c	Fri Apr 18 22:31:58 2008 +0000
+++ b/src/image-overlay.c	Fri Apr 18 23:09:03 2008 +0000
@@ -171,6 +171,7 @@
 
 		pos = start-new->str;
 		data = g_strdup(g_hash_table_lookup(vars, name));
+		if (data && strcmp(name, "zoom") == 0) imd->overlay_show_zoom = TRUE;
 		if (!data && exif)
 			data = exif_get_data_as_text(exif, name);
 		if (data && *data && limit > 0 && strlen(data) > limit + 3)
@@ -326,7 +327,8 @@
  	g_hash_table_insert(vars, "name", g_strdup(name_escaped));
  	g_hash_table_insert(vars, "date", g_strdup(text_from_time(imd->mtime)));
  	g_hash_table_insert(vars, "size", g_strdup(size));
-  
+	g_hash_table_insert(vars, "zoom", image_zoom_get_as_text(imd));
+
  	if (!name_escaped)
  		{
  		text = g_strdup_printf(_("Untitled"));
@@ -518,6 +520,8 @@
 {
 	OverlayStateData *osd = data;
 
+	osd->imd->overlay_show_zoom = FALSE;
+
 	if (osd->show_info)
 		{
 		if (osd->changed_states & IMAGE_STATE_IMAGE)
--- a/src/image.c	Fri Apr 18 22:31:58 2008 +0000
+++ b/src/image.c	Fri Apr 18 23:09:03 2008 +0000
@@ -18,6 +18,7 @@
 #include "collect.h"
 #include "color-man.h"
 #include "exif.h"
+#include "image-overlay.h"
 #include "layout.h"
 #include "layout_image.h"
 #include "pixbuf-renderer.h"
@@ -109,6 +110,8 @@
 	ImageWindow *imd = data;
 
 	if (imd->title_show_zoom) image_update_title(imd);
+	if (imd->overlay_show_zoom) image_osd_update(imd);
+
 	image_update_util(imd);
 }
 
@@ -1578,7 +1581,7 @@
 			{
 			r = 1.0 / scale;
 			}
-		approx = " ~";
+		approx = "~";
 		}
 
 	if (rint(l) != l) pl = 1;
--- a/src/main.h	Fri Apr 18 22:31:58 2008 +0000
+++ b/src/main.h	Fri Apr 18 23:09:03 2008 +0000
@@ -100,6 +100,12 @@
 #define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_MIN 		1
 #define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_MAX		16
 
+
+#define DEFAULT_OVERLAY_INFO 	"%collection%(%number%/%total%) [%zoom%] <b>%name%</b>\n" \
+			   	"%res%|%date%|%size%\n" \
+				"%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n" \
+				"%fCamera%|%fFlash%" \
+
 #if 1 /* set to 0 to disable debugging code and related options */
 # ifndef DEBUG
 # define DEBUG 1
--- a/src/typedefs.h	Fri Apr 18 22:31:58 2008 +0000
+++ b/src/typedefs.h	Fri Apr 18 23:09:03 2008 +0000
@@ -383,6 +383,8 @@
 	gint delay_flip;
 	gint orientation;
 	gint desaturate;
+
+	gint overlay_show_zoom; /* set to true if overlay is showing zoom ratio */
 };
 
 #define FILEDATA_MARKS_SIZE 6