Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
authorJohn Ellis <johne@verizon.net>
Sat, 2 Dec 2006 21:57:12 +0000 (21:57 +0000)
committerJohn Ellis <johne@verizon.net>
Sat, 2 Dec 2006 21:57:12 +0000 (21:57 +0000)
        * 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.

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

index 9b1a157..0e48e05 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/TODO b/TODO
index ffb8b1c..0179061 100644 (file)
--- a/TODO
+++ b/TODO
@@ -140,6 +140,9 @@ d> fix printing of transparent images to not use black for transparency (white o
    > 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?:
 ----------------------------------------------
 
index f791727..eb12fc4 100644 (file)
@@ -48,19 +48,21 @@ struct _OverlayStateData {
 
 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 @@ static GdkPixbuf *image_osd_icon_pixbuf(ImageOSDFlag flag)
        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)
                {
-               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 = pixbuf_inline(osd_icons[flag].key);
+               }
+
+       if (!icon)
+               {
+               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 @@ static gint image_osd_update_cb(gpointer data)
 
                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 @@ static gint image_osd_update_cb(gpointer data)
                        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)
index 12fbd25..e345115 100644 (file)
@@ -19,6 +19,7 @@ typedef enum {
        IMAGE_OSD_COLOR,
        IMAGE_OSD_FIRST,
        IMAGE_OSD_LAST,
+       IMAGE_OSD_ICON,
        IMAGE_OSD_COUNT
 } ImageOSDFlag;
 
index 8e3c6d3..74297aa 100644 (file)
@@ -264,6 +264,8 @@ static void image_alter_real(ImageWindow *imd, AlterType type, gint clamp)
                                                    (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 @@ static void image_post_process(ImageWindow *imd, gint clamp)
                                        break;
                                }
 
-                       if (rotate) image_state_set(imd, IMAGE_STATE_COLOR_ADJ);
+                       if (rotate) image_state_set(imd, IMAGE_STATE_ROTATE_AUTO);
                        }
                }
 
index e200a25..677db01 100644 (file)
@@ -688,15 +688,13 @@ static void view_fullscreen_stop_func(FullScreenData *fs, gpointer data)
 
 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 @@ static void view_fullscreen_toggle(ViewWindow *vw, gint force_off)
 
                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 @@ static void view_overlay_toggle(ViewWindow *vw)
        if (!image_osd_get(imd, NULL, NULL))
                {
                image_osd_set(imd, TRUE, TRUE);
+               image_osd_icon(imd, IMAGE_OSD_ICON, -1);
                }
        else
                {
index 4235393..e4ee7d8 100644 (file)
@@ -1832,8 +1832,6 @@ LayoutWindow *layout_new_with_geometry(const gchar *path, gint popped, gint hidd
        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,
index 9edbb55..993cd1a 100644 (file)
@@ -43,18 +43,22 @@ static void layout_image_set_buttons(LayoutWindow *lw);
  *----------------------------------------------------------------------------
  */
 
-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 @@ static gint layout_image_full_screen_key_press_cb(GtkWidget *widget, GdkEventKey
                                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 @@ void layout_image_full_screen_start(LayoutWindow *lw)
        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 @@ void layout_image_full_screen_stop(LayoutWindow *lw)
        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 @@ void layout_image_next(LayoutWindow *lw)
        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 @@ void layout_image_next(LayoutWindow *lw)
                        {
                        layout_image_set_index(lw, current + 1);
                        }
+               else
+                       {
+                       image_osd_icon(lw->image, IMAGE_OSD_LAST, -1);
+                       }
                }
        else
                {
@@ -1229,7 +1252,14 @@ void layout_image_prev(LayoutWindow *lw)
        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 @@ void layout_image_prev(LayoutWindow *lw)
                        {
                        layout_image_set_index(lw, current - 1);
                        }
+               else
+                       {
+                       image_osd_icon(lw->image, IMAGE_OSD_FIRST, -1);
+                       }
                }
        else
                {
index 8c37140..09d18e7 100644 (file)
@@ -68,6 +68,7 @@ gint layout_image_slideshow_pause_toggle(LayoutWindow *lw);
 gint layout_image_slideshow_paused(LayoutWindow *lw);
 
 
+void layout_image_overlay_toggle(LayoutWindow *lw);
 void layout_image_overlay_update(LayoutWindow *lw);
 
 
index ebddb1e..6adbc2b 100644 (file)
@@ -255,6 +255,9 @@ static gint layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer
                        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;
index 9a3075b..b05b45f 100644 (file)
@@ -398,7 +398,6 @@ struct _LayoutWindow
        /* full screen */
 
        FullScreenData *full_screen;
-       gint full_screen_overlay_on;
 
        /* dividers */