Add zoom ratio display to OSD in fullscreen mode.
authorLaurent Monin <geeqie@norz.org>
Fri, 18 Apr 2008 23:09:03 +0000 (23:09 +0000)
committerLaurent Monin <geeqie@norz.org>
Fri, 18 Apr 2008 23:09:03 +0000 (23:09 +0000)
It appears as [%zoom%] in fullscreen info string.
It is now displayed by default.

src/fullscreen.c
src/image-overlay.c
src/image.c
src/main.h
src/typedefs.h

index 63cedc9..a44537b 100644 (file)
@@ -35,10 +35,7 @@ enum {
 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)
index 7c0fc46..2d54cda 100644 (file)
@@ -171,6 +171,7 @@ static gchar *image_osd_mkinfo(const gchar *str, ImageWindow *imd, GHashTable *v
 
                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 @@ static GdkPixbuf *image_osd_info_render(ImageWindow *imd)
        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 @@ static gint image_osd_update_cb(gpointer data)
 {
        OverlayStateData *osd = data;
 
+       osd->imd->overlay_show_zoom = FALSE;
+
        if (osd->show_info)
                {
                if (osd->changed_states & IMAGE_STATE_IMAGE)
index 7de54ab..f029a21 100644 (file)
@@ -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 @@ static void image_zoom_cb(PixbufRenderer *pr, gdouble zoom, gpointer data)
        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 @@ gchar *image_zoom_get_as_text(ImageWindow *imd)
                        {
                        r = 1.0 / scale;
                        }
-               approx = " ~";
+               approx = "~";
                }
 
        if (rint(l) != l) pl = 1;
index d457815..f8b388b 100644 (file)
 #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
index 55830a7..57a6f86 100644 (file)
@@ -383,6 +383,8 @@ struct _ImageWindow
        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