changeset 122:e2a8b7f2165b

Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net> * image-overlay.[ch]: More work on osd icons. * image.c: Use correct flag when setting auto rotation state, and set the state again after the rotation so that osd can update. * img-view.c: Show osd icon when overlay is enabled. * layout.c, layout_image.[ch]: Enable overlay regardless of the full screen state, only difference now is that image description text is only shown when in full screen but icons will always appear. * layout_util.c: Make I key toggle overlay from windowed mode too. * typedefs.h (LayoutWindow): Remove no longer used full_screen_overlay_on.
author gqview
date Sat, 02 Dec 2006 21:57:12 +0000
parents 045ac4c27e62
children 3602a4aa7c71
files ChangeLog TODO src/image-overlay.c src/image-overlay.h src/image.c src/img-view.c src/layout.c src/layout_image.c src/layout_image.h src/layout_util.c src/typedefs.h
diffstat 11 files changed, 148 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Dec 01 19:41:45 2006 +0000
+++ b/ChangeLog	Sat Dec 02 21:57:12 2006 +0000
@@ -1,3 +1,16 @@
+Sat Dec  2 16:44:48 2006  John Ellis  <johne@verizon.net>
+
+	* image-overlay.[ch]: More work on osd icons.
+	* image.c: Use correct flag when setting auto rotation state, and set
+	the state again after the rotation so that osd can update.
+	* img-view.c: Show osd icon when overlay is enabled.
+	* layout.c, layout_image.[ch]: Enable overlay regardless of the
+	full screen state, only difference now is that image description text
+	is only shown when in full screen but icons will always appear.
+	* layout_util.c: Make I key toggle overlay from windowed mode too.
+	* typedefs.h (LayoutWindow): Remove no longer used 
+	full_screen_overlay_on.
+
 Fri Dec  1 14:27:55 2006  John Ellis  <johne@verizon.net>
 
 	* print.c (print_job_ps_page_image): Use a white mask when printing
--- a/TODO	Fri Dec 01 19:41:45 2006 +0000
+++ b/TODO	Sat Dec 02 21:57:12 2006 +0000
@@ -140,6 +140,9 @@
    > collection window
    > search window
 
+ > make wallpaper setting have a dialog to allow choosing tile, scale, center and then
+   also choose desktop environment (or detect it somehow?)
+
 Wishlist?:
 ----------------------------------------------
 
--- a/src/image-overlay.c	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/image-overlay.c	Sat Dec 02 21:57:12 2006 +0000
@@ -48,19 +48,21 @@
 
 typedef struct _OSDIcon OSDIcon;
 struct _OSDIcon {
-	gint x;
+	gint reset;	/* reset on new image */
+	gint x;		/* x, y offset */
 	gint y;
-	gchar *key;
+	gchar *key;	/* inline pixbuf */
 };
 
 static OSDIcon osd_icons[] = {
-	{ 0, -10, PIXBUF_INLINE_ICON },
-	{ -10, -10, "IMAGE_OSD_ROTATE_USER" },
-	{ -10, -10, "IMAGE_OSD_ROTATE_AUTO" },
-	{ -40, -10, "IMAGE_OSD_COLOR" },
-	{ -70, -10, "IMAGE_OSD_FIRST" },
-	{ -70, -10, "IMAGE_OSD_LAST" },
-	{ 0, 0, NULL }
+	{  TRUE,   0,   0, NULL },			/* none */
+	{  TRUE, -10, -10, NULL },			/* auto rotated */
+	{  TRUE, -10, -10, NULL },			/* user rotated */
+	{  TRUE, -40, -10, NULL },			/* color embedded */
+	{  TRUE, -70, -10, NULL },			/* first image */
+	{  TRUE, -70, -10, NULL },			/* last image */
+	{ FALSE, -70, -10, NULL },			/* osd enabled */
+	{ FALSE, 0, 0, NULL }
 };
 
 #define OSD_DATA "overlay-data"
@@ -214,30 +216,52 @@
 	if (!icons) icons = g_new0(GdkPixbuf *, IMAGE_OSD_COUNT);
 	if (icons[flag]) return icons[flag];
 
-	icon = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 24, 24);
-	pixbuf_set_rect_fill(icon, 1, 1, 22, 22, 255, 255, 255, 200);
-	pixbuf_set_rect(icon, 0, 0, 24, 24, 0, 0, 0, 128, 1, 1, 1, 1);
-	switch (flag)
+	if (osd_icons[flag].key)
+		{
+		icon = pixbuf_inline(osd_icons[flag].key);
+		}
+
+	if (!icon)
 		{
-		case IMAGE_OSD_COLOR:
-			pixbuf_set_rect_fill(icon, 3, 3, 18, 6, 200, 0, 0, 255);
-			pixbuf_set_rect_fill(icon, 3, 9, 18, 6, 0, 200, 0, 255);
-			pixbuf_set_rect_fill(icon, 3, 15, 18, 6, 0, 0, 200, 255);
-			break;
-		case IMAGE_OSD_FIRST:
-			pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 3, 0);
-			pixbuf_draw_triangle(icon, 6, 5, 12, 6,
-					     12, 5, 18, 11, 6, 11,
-					     0, 0, 0, 255);
-			break;
-		case IMAGE_OSD_LAST:
-			pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 0, 3);
-			pixbuf_draw_triangle(icon, 6, 12, 12, 6,
-					     12, 18, 6, 12, 18, 12,
-					     0, 0, 0, 255);
-			break;
-		default:
-			break;
+		icon = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 24, 24);
+		pixbuf_set_rect_fill(icon, 1, 1, 22, 22, 255, 255, 255, 200);
+		pixbuf_set_rect(icon, 0, 0, 24, 24, 0, 0, 0, 128, 1, 1, 1, 1);
+		switch (flag)
+			{
+			case IMAGE_OSD_ROTATE_AUTO:
+				pixbuf_set_rect(icon, 3, 8, 11, 12,
+						0, 0, 0, 255,
+						3, 0, 3, 0);
+				pixbuf_draw_triangle(icon, 14, 3, 6, 12,
+						     20, 9, 14, 15, 14, 3,
+						     0, 0, 0, 255);
+				break;
+			case IMAGE_OSD_ROTATE_USER:
+				break;
+			case IMAGE_OSD_COLOR:
+				pixbuf_set_rect_fill(icon, 3, 3, 18, 6, 200, 0, 0, 255);
+				pixbuf_set_rect_fill(icon, 3, 9, 18, 6, 0, 200, 0, 255);
+				pixbuf_set_rect_fill(icon, 3, 15, 18, 6, 0, 0, 200, 255);
+				break;
+			case IMAGE_OSD_FIRST:
+				pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 3, 0);
+				pixbuf_draw_triangle(icon, 6, 5, 12, 6,
+						     12, 5, 18, 11, 6, 11,
+						     0, 0, 0, 255);
+				break;
+			case IMAGE_OSD_LAST:
+				pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 0, 3);
+				pixbuf_draw_triangle(icon, 6, 12, 12, 6,
+						     12, 18, 6, 12, 18, 12,
+						     0, 0, 0, 255);
+				break;
+			case IMAGE_OSD_ICON:
+				pixbuf_set_rect_fill(icon, 11, 3, 3, 12, 0, 0, 0, 255);
+				pixbuf_set_rect_fill(icon, 11, 17, 3, 3, 0, 0, 0, 255);
+				break;
+			default:
+				break;
+			}
 		}
 
 	icons[flag] = icon;
@@ -306,7 +330,10 @@
 
 		if (osd->changed_states & IMAGE_STATE_IMAGE)
 			{
-			for (i = 0; i < IMAGE_OSD_COUNT; i++) osd->icon_time[i] = 0;
+			for (i = 0; i < IMAGE_OSD_COUNT; i++)
+				{
+				if (osd_icons[i].reset)	osd->icon_time[i] = 0;
+				}
 			}
 
 		if (osd->changed_states & IMAGE_STATE_COLOR_ADJ)
@@ -315,6 +342,20 @@
 			image_osd_timer_schedule(osd);
 			}
 
+		if (osd->changed_states & IMAGE_STATE_ROTATE_AUTO)
+			{
+			gint n = 0;
+
+			if (osd->imd->state & IMAGE_STATE_ROTATE_AUTO)
+				{
+				n = 1;
+				if (!osd->imd->cm) n += IMAGE_OSD_DEFAULT_DURATION;
+				}
+
+			osd->icon_time[IMAGE_OSD_ROTATE_AUTO] = n;
+			image_osd_timer_schedule(osd);
+			}
+
 		for (i = 0; i < IMAGE_OSD_COUNT; i++)
 			{
 			if (osd->icon_time[i] > 0)
--- a/src/image-overlay.h	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/image-overlay.h	Sat Dec 02 21:57:12 2006 +0000
@@ -19,6 +19,7 @@
 	IMAGE_OSD_COLOR,
 	IMAGE_OSD_FIRST,
 	IMAGE_OSD_LAST,
+	IMAGE_OSD_ICON,
 	IMAGE_OSD_COUNT
 } ImageOSDFlag;
 
--- a/src/image.c	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/image.c	Sat Dec 02 21:57:12 2006 +0000
@@ -264,6 +264,8 @@
 						    (gint)((gdouble)y / pr->scale),
 						    0.50, 0.50);
 		}
+
+	if (exif_rotate) image_state_set(imd, IMAGE_STATE_ROTATE_AUTO);
 }
 
 static void image_post_process_alter(ImageWindow *imd, gint clamp)
@@ -460,7 +462,7 @@
 					break;
 				}
 
-			if (rotate) image_state_set(imd, IMAGE_STATE_COLOR_ADJ);
+			if (rotate) image_state_set(imd, IMAGE_STATE_ROTATE_AUTO);
 			}
 		}
 
--- a/src/img-view.c	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/img-view.c	Sat Dec 02 21:57:12 2006 +0000
@@ -688,15 +688,13 @@
 
 static void view_fullscreen_toggle(ViewWindow *vw, gint force_off)
 {
-	gint info, status;
-
 	if (force_off && !vw->fs) return;
 
 	if (vw->fs)
 		{
-		if (image_osd_get(vw->fs->imd, &info, &status))
+		if (image_osd_get(vw->fs->imd, NULL, NULL))
 			{
-			image_osd_set(vw->imd, info, status);
+			image_osd_set(vw->imd, TRUE, TRUE);
 			}
 
 		fullscreen_stop(vw->fs);
@@ -711,10 +709,10 @@
 
 		if (vw->ss) vw->ss->imd = vw->fs->imd;
 
-		if (image_osd_get(vw->imd, &info, &status))
+		if (image_osd_get(vw->imd, NULL, NULL))
 			{
 			image_osd_set(vw->imd, FALSE, FALSE);
-			image_osd_set(vw->fs->imd, info, status);
+			image_osd_set(vw->fs->imd, TRUE, TRUE);
 			}
 		}
 }
@@ -728,6 +726,7 @@
 	if (!image_osd_get(imd, NULL, NULL))
 		{
 		image_osd_set(imd, TRUE, TRUE);
+		image_osd_icon(imd, IMAGE_OSD_ICON, -1);
 		}
 	else
 		{
--- a/src/layout.c	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/layout.c	Sat Dec 02 21:57:12 2006 +0000
@@ -1832,8 +1832,6 @@
 	lw->bar_exif_size = -1;
 	lw->bar_exif_advanced = FALSE;
 
-	lw->full_screen_overlay_on = FALSE;
-
 	/* default layout */
 
 	layout_config_parse(layout_style, layout_order,
--- a/src/layout_image.c	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/layout_image.c	Sat Dec 02 21:57:12 2006 +0000
@@ -43,18 +43,22 @@
  *----------------------------------------------------------------------------
  */
 
-static void layout_image_overlay_set(LayoutWindow *lw, gint enable)
+void layout_image_overlay_toggle(LayoutWindow *lw)
 {
-	lw->full_screen_overlay_on = enable;
-
-	if (!lw->full_screen) return;
-
-	image_osd_set(lw->image, enable, enable);
+	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);
+		}
 }
 
 void layout_image_overlay_update(LayoutWindow *lw)
 {
-	if (!lw || !lw->full_screen) return;
+	if (!lw) return;
 
 	image_osd_update(lw->image);
 }
@@ -307,7 +311,7 @@
 				layout_image_full_screen_menu_popup(lw);
 				break;
 			case 'I': case 'i':
-				layout_image_overlay_set(lw, !(lw->full_screen_overlay_on));
+				layout_image_overlay_toggle(lw);
 				break;
 			default:
 				stop_signal = FALSE;
@@ -360,7 +364,11 @@
 	if (lw->tools) gtk_widget_set_sensitive(lw->tools, FALSE);
 #endif
 
-	layout_image_overlay_set(lw, lw->full_screen_overlay_on);
+	if (image_osd_get(lw->full_screen->normal_imd, NULL, NULL))
+		{
+		image_osd_set(lw->image, TRUE, TRUE);
+		image_osd_set(lw->full_screen->normal_imd, FALSE, FALSE);
+		}
 }
 
 void layout_image_full_screen_stop(LayoutWindow *lw)
@@ -368,6 +376,10 @@
 	if (!layout_valid(&lw)) return;
 	if (!lw->full_screen) return;
 
+	if (image_osd_get(lw->image, NULL, NULL))
+		{
+		image_osd_set(lw->full_screen->normal_imd, FALSE, TRUE);
+		}
 	fullscreen_stop(lw->full_screen);
 
 #if 0
@@ -1191,7 +1203,14 @@
 	if (cd && info)
 		{
 		info = collection_next_by_info(cd, info);
-		if (info) layout_image_set_collection_real(lw, cd, info, TRUE);
+		if (info)
+			{
+			layout_image_set_collection_real(lw, cd, info, TRUE);
+			}
+		else
+			{
+			image_osd_icon(lw->image, IMAGE_OSD_LAST, -1);
+			}
 		return;
 		}
 
@@ -1203,6 +1222,10 @@
 			{
 			layout_image_set_index(lw, current + 1);
 			}
+		else
+			{
+			image_osd_icon(lw->image, IMAGE_OSD_LAST, -1);
+			}
 		}
 	else
 		{
@@ -1229,7 +1252,14 @@
 	if (cd && info)
 		{
 		info = collection_prev_by_info(cd, info);
-		if (info) layout_image_set_collection_real(lw, cd, info, FALSE);
+		if (info)
+			{
+			layout_image_set_collection_real(lw, cd, info, FALSE);
+			}
+		else
+			{
+			image_osd_icon(lw->image, IMAGE_OSD_FIRST, -1);
+			}
 		return;
 		}
 
@@ -1241,6 +1271,10 @@
 			{
 			layout_image_set_index(lw, current - 1);
 			}
+		else
+			{
+			image_osd_icon(lw->image, IMAGE_OSD_FIRST, -1);
+			}
 		}
 	else
 		{
--- a/src/layout_image.h	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/layout_image.h	Sat Dec 02 21:57:12 2006 +0000
@@ -68,6 +68,7 @@
 gint layout_image_slideshow_paused(LayoutWindow *lw);
 
 
+void layout_image_overlay_toggle(LayoutWindow *lw);
 void layout_image_overlay_update(LayoutWindow *lw);
 
 
--- a/src/layout_util.c	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/layout_util.c	Sat Dec 02 21:57:12 2006 +0000
@@ -255,6 +255,9 @@
 			case GDK_F11:
 				layout_image_full_screen_toggle(lw);
 				break;
+			case 'I': case 'i':
+				layout_image_overlay_toggle(lw);
+				break;
 			default:
 				stop_signal = FALSE;
 				break;
--- a/src/typedefs.h	Fri Dec 01 19:41:45 2006 +0000
+++ b/src/typedefs.h	Sat Dec 02 21:57:12 2006 +0000
@@ -398,7 +398,6 @@
 	/* full screen */
 
 	FullScreenData *full_screen;
-	gint full_screen_overlay_on;
 
 	/* dividers */