Skip to content

Commit

Permalink
Add zoom ratio display to OSD in fullscreen mode.
Browse files Browse the repository at this point in the history
It appears as [%zoom%] in fullscreen info string.
It is now displayed by default.
  • Loading branch information
Laurent Monin committed Apr 18, 2008
1 parent f595a30 commit 2167314
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/fullscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/image-overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion src/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -1578,7 +1581,7 @@ gchar *image_zoom_get_as_text(ImageWindow *imd)
{
r = 1.0 / scale;
}
approx = " ~";
approx = "~";
}

if (rint(l) != l) pl = 1;
Expand Down
6 changes: 6 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2167314

Please sign in to comment.