Re: Customizable fullscreen overlay (also Exif in fullscreen)
Timo Horstschäfer <[email protected]> Wed, 19 Sep 2007 14:54:32 +0200
| Newsgroups | gmane.comp.gnome.apps.gqview.devel |
|---|---|
| Message-ID | <[email protected]> |
--Boundary-00=_IwR8GcqXMmEhZ9b
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
I found it annoying that you have to enable the osd in fullscreen mode
everytime GQview is started.
With the updated patch the visibility of the fullscreen osd is stored in the
config file.
Could the custom overlay patch be included in the CVS code?
--Boundary-00=_IwR8GcqXMmEhZ9b
Content-Type: text/x-diff;
charset="utf-8";
name="custom-overlay2.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="custom-overlay2.patch"
Index: src/globals.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/gqview/gqview/src/globals.c,v
retrieving revision 1.6
diff -u -r1.6 globals.c
=2D-- src/globals.c 25 Nov 2006 03:00:32 -0000 1.6
+++ src/globals.c 19 Sep 2007 12:40:01 -0000
@@ -97,6 +97,8 @@
gint fullscreen_clean_flip =3D FALSE;
gint fullscreen_disable_saver =3D TRUE;
gint fullscreen_above =3D FALSE;
+gint show_fullscreen_info =3D TRUE;
+gchar *fullscreen_info =3D NULL;
=20
gint dupe_custom_threshold =3D 99;
=20
Index: src/gqview.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/gqview/gqview/src/gqview.h,v
retrieving revision 1.8
diff -u -r1.8 gqview.h
=2D-- src/gqview.h 25 Nov 2006 03:00:32 -0000 1.8
+++ src/gqview.h 19 Sep 2007 12:40:01 -0000
@@ -161,6 +161,8 @@
extern gint fullscreen_clean_flip;
extern gint fullscreen_disable_saver;
extern gint fullscreen_above;
+extern gint show_fullscreen_info;
+extern gchar *fullscreen_info;
=20
extern gint dupe_custom_threshold;
=20
Index: src/main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/gqview/gqview/src/main.c,v
retrieving revision 1.10
diff -u -r1.10 main.c
=2D-- src/main.c 25 Nov 2006 03:00:32 -0000 1.10
+++ src/main.c 19 Sep 2007 12:40:01 -0000
@@ -34,6 +34,7 @@
#include "ui_fileops.h"
#include "ui_tabcomp.h"
#include "ui_utildlg.h"
+#include "image-overlay.h"
=20
#include <gdk/gdkkeysyms.h> /* for keyboard values */
=20
@@ -1133,6 +1134,8 @@
color_profile_input_file[i] =3D NULL;
color_profile_input_name[i] =3D NULL;
}
+
+ fullscreen_info =3D g_strdup("%collection%(%number%/%total%) <b>%name%</b=
>\n%res%|%date%|%size%\n%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFoc=
alLength%|%fExposureBias%\n%fCamera%|%fFlash%");
}
=20
static void exit_gqview_final(void)
@@ -1153,6 +1156,7 @@
layout_geometry_get(NULL, &main_window_x, &main_window_y,
&main_window_w, &main_window_h);
}
+ show_fullscreen_info =3D image_osd_get(lw->image, NULL, NULL);
}
=20
layout_geometry_get_dividers(NULL, &window_hdivider_pos, &window_vdivider=
_pos);
@@ -1270,6 +1274,7 @@
setup_default_options();
load_options();
=20
+
parse_command_line(argc, argv, &cmd_path, &cmd_file, &cmd_list, &collecti=
on_list, &geometry);
=20
gtk_init (&argc, &argv);
@@ -1416,6 +1421,7 @@
collection_get_first(first_collection));
}
}
+ image_osd_set(lw->image, FALSE, show_fullscreen_info);
=20
g_free(geometry);
g_free(cmd_path);
Index: src/rcfile.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/gqview/gqview/src/rcfile.c,v
retrieving revision 1.7
diff -u -r1.7 rcfile.c
=2D-- src/rcfile.c 25 Nov 2006 03:00:33 -0000 1.7
+++ src/rcfile.c 19 Sep 2007 12:40:01 -0000
@@ -65,18 +65,29 @@
=20
static void write_char_option(FILE *f, gchar *label, gchar *text)
{
=2D if (text)
=2D fprintf(f,"%s: \"%s\"\n", label, text);
+ gchar *e;
+ if (text)=09
+ {
+ e =3D g_strescape(text, "");
+ fprintf(f,"%s: \"%s\"\n", label, e);
+ g_free(e);
+ }
else
fprintf(f,"%s: \n", label);
}
=20
static gchar *read_char_option(FILE *f, gchar *option, gchar *label, gchar=
*value, gchar *text)
{
+ gchar *e;
if (strcasecmp(option, label) =3D=3D 0)
{
g_free(text);
=2D text =3D quoted_value(value);
+ e =3D quoted_value(value);
+ if (e)
+ {
+ text =3D g_strcompress(e);
+ g_free(e);
+ }
}
return text;
}
@@ -289,6 +300,8 @@
write_bool_option(f, "fullscreen_clean_flip", fullscreen_clean_flip);
write_bool_option(f, "fullscreen_disable_saver", fullscreen_disable_saver=
);
write_bool_option(f, "fullscreen_above", fullscreen_above);
+ write_bool_option(f, "show_fullscreen_info", show_fullscreen_info);
+ write_char_option(f, "fullscreen_info", fullscreen_info);
=20
write_int_option(f, "custom_similarity_threshold", dupe_custom_threshold);
=20
@@ -556,6 +569,10 @@
"fullscreen_disable_saver", value, fullscreen_disable_saver);
fullscreen_above =3D read_bool_option(f, option,
"fullscreen_above", value, fullscreen_above);
+ show_fullscreen_info =3D read_bool_option(f, option,
+ "show_fullscreen_info", value, show_fullscreen_info);
+ fullscreen_info =3D read_char_option(f, option,
+ "fullscreen_info", value_all, fullscreen_info);
=20
dupe_custom_threshold =3D read_int_option(f, option,
"custom_similarity_threshold", value, dupe_custom_threshold);
Index: src/image-overlay.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/gqview/gqview/src/image-overlay.c,v
retrieving revision 1.5
diff -u -r1.5 image-overlay.c
=2D-- src/image-overlay.c 2 Dec 2006 21:57:12 -0000 1.5
+++ src/image-overlay.c 19 Sep 2007 12:40:01 -0000
@@ -19,6 +19,7 @@
#include "layout.h"
#include "pixbuf-renderer.h"
#include "pixbuf_util.h"
+#include "exif.h"
=20
=20
/*
@@ -75,6 +76,77 @@
=20
static void image_osd_timer_schedule(OverlayStateData *osd);
=20
+static gchar* image_osd_mkinfo(const gchar *str, ImageWindow *imd, GHashTa=
ble *vars)
+{
+ gchar delim =3D '%', imp =3D '|', sep[] =3D " - ";
+ gchar *start, *end;
+ gint pos, prev;
+ gint last;
+ gchar *name, *data;
+ GString *new =3D g_string_new(str);
+ gchar *ret;
+ ExifData *exif;
+
+ exif =3D exif_read(imd->image_path, FALSE);
+ prev =3D 0;
+ last =3D FALSE;
+
+ while (TRUE)
+ {
+ start =3D strchr(new->str, delim);
+ if (!start)
+ break;
+ end =3D strchr(start+1, delim);
+ if (!end)
+ break;
+
+ name =3D g_strndup(start+1, end-start-1);
+ pos =3D start-new->str;
+
+ data =3D g_strdup(g_hash_table_lookup(vars, name));
+ if (!data && exif)
+ data =3D exif_get_data_as_text(exif, name);
+
+ g_string_erase(new, pos, end-start+1);
+ if (data)
+ g_string_insert(new, pos, data);
+ if (pos-prev =3D=3D 2 && new->str[pos-1] =3D=3D imp)
+ {
+ g_string_erase(new, --pos, 1);
+ if (last && data)
+ {
+ g_string_insert(new, pos, sep);
+ pos +=3D strlen(sep);
+ }
+ }
+
+ prev =3D data ? pos+strlen(data)-1 : pos-1;
+ last =3D data ? TRUE : last;
+ g_free(name);
+ g_free(data);
+ }
+=09
+ /* search and destroy empty lines */
+ end =3D new->str;
+ while (start =3D strchr(end, '\n'))
+ {
+ end =3D start;
+ while (*++(end) =3D=3D '\n')
+ ;
+ g_string_erase(new, start-new->str, end-start-1);
+ }
+ =09
+
+ g_strchomp(new->str);
+
+ ret =3D new->str;
+ g_string_free(new, FALSE);
+
+ return ret;
+}
+=09
+
+
=20
static GdkPixbuf *image_osd_info_render(ImageWindow *imd)
{
@@ -86,9 +158,13 @@
gchar *text;
gchar *size;
gint n, t;
+ gint w, h;
CollectionData *cd;
CollectInfo *info;
gchar *ct;
+ GHashTable *vars;
+
+ vars =3D g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
=20
name =3D image_get_name(imd);
if (name)
@@ -147,20 +223,10 @@
}
=20
size =3D text_from_size_abrev(imd->size);
=2D if (!name_escaped)
=2D {
=2D text =3D g_strdup_printf(_("Untitled"));
=2D }
=2D else if (imd->unknown)
=2D {
=2D text =3D g_strdup_printf("%s(%d/%d) <b>%s</b>\n%s - %s", ct,
=2D n, t, name_escaped,
=2D text_from_time(imd->mtime), size);
=2D }
=2D else
=2D {
=2D gint w, h;
=20
+
+ if (!imd->unknown)
+ {
if (imd->delay_flip &&
imd->il && imd->il->pixbuf &&
image_get_pixbuf(imd) !=3D imd->il->pixbuf)
@@ -172,15 +238,30 @@
{
pixbuf_renderer_get_image_size(PIXBUF_RENDERER(imd->pr), &w, &h);
}
+ g_hash_table_insert(vars, "width", g_strdup_printf("%d", w));
+ g_hash_table_insert(vars, "height", g_strdup_printf("%d", h));
+ g_hash_table_insert(vars, "res", g_strdup_printf("%d =C3=97 %d", w, h));
+ }
+
+ g_hash_table_insert(vars, "collection", g_strdup(ct));
+ g_hash_table_insert(vars, "number", g_strdup_printf("%d", n));
+ g_hash_table_insert(vars, "total", g_strdup_printf("%d", t));
+ 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));
=20
=2D text =3D g_strdup_printf("%s(%d/%d) <b>%s</b>\n%d x %d - %s - %s", ct,
=2D n, t, name_escaped,
=2D w, h,
=2D text_from_time(imd->mtime), size);
+ if (!name_escaped)
+ {
+ text =3D g_strdup_printf(_("Untitled"));
+ }
+ else
+ {
+ text =3D image_osd_mkinfo(fullscreen_info, imd, vars);
}
g_free(size);
g_free(ct);
g_free(name_escaped);
+ g_hash_table_destroy(vars);
=20
layout =3D gtk_widget_create_pango_layout(imd->pr, NULL);
pango_layout_set_markup(layout, text, -1);
@@ -192,16 +273,16 @@
height +=3D 10;
=20
pixbuf =3D gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
=2D pixbuf_set_rect_fill(pixbuf, 3, 3, width-6, height-6, 240, 240, 240, 21=
0);
=2D pixbuf_set_rect(pixbuf, 0, 0, width, height, 240, 240, 240, 80, 1, 1, 1=
, 1);
=2D pixbuf_set_rect(pixbuf, 1, 1, width-2, height-2, 240, 240, 240, 130, 1,=
1, 1, 1);
=2D pixbuf_set_rect(pixbuf, 2, 2, width-4, height-4, 240, 240, 240, 180, 1,=
1, 1, 1);
+ pixbuf_set_rect_fill(pixbuf, 3, 3, width-6, height-6, 0, 0, 0, 120);
+ pixbuf_set_rect(pixbuf, 0, 0, width, height, 0, 0, 0, 30, 1, 1, 1, 1);
+ pixbuf_set_rect(pixbuf, 1, 1, width-2, height-2, 0, 0, 0, 60, 1, 1, 1, 1);
+ pixbuf_set_rect(pixbuf, 2, 2, width-4, height-4, 0, 0, 0, 90, 1, 1, 1, 1);
pixbuf_pixel_set(pixbuf, 0, 0, 0, 0, 0, 0);
pixbuf_pixel_set(pixbuf, width - 1, 0, 0, 0, 0, 0);
pixbuf_pixel_set(pixbuf, 0, height - 1, 0, 0, 0, 0);
pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0);
=20
=2D pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255);
+ pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 255, 255, 255, 255);
=20
g_object_unref(G_OBJECT(layout));
=20
--Boundary-00=_IwR8GcqXMmEhZ9b
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--Boundary-00=_IwR8GcqXMmEhZ9b
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Gqview-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gqview-devel
--Boundary-00=_IwR8GcqXMmEhZ9b--