Mercurial > geeqie
changeset 614:b2898f04c82e
image_osd_get() and image_osd_set() now uses flags.
author | zas_ |
---|---|
date | Fri, 09 May 2008 09:58:46 +0000 |
parents | d06f422a6673 |
children | cddccc89d93b |
files | src/image-overlay.c src/image-overlay.h src/img-view.c src/layout_image.c src/main.c |
diffstat | 5 files changed, 39 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/src/image-overlay.c Fri May 09 09:34:38 2008 +0000 +++ b/src/image-overlay.c Fri May 09 09:58:46 2008 +0000 @@ -30,13 +30,13 @@ *---------------------------------------------------------------------------- */ + typedef struct _OverlayStateData OverlayStateData; struct _OverlayStateData { ImageWindow *imd; ImageState changed_states; - gint show_info; - gint show_status; + OsdShowFlags show; gint ovl_info; @@ -123,9 +123,9 @@ void image_osd_toggle(ImageWindow *imd) { - gint info; + OsdShowFlags show; - if (image_osd_get(imd, &info, NULL) && info) + if (image_osd_get(imd, &show) && show & OSD_SHOW_INFO) { if (image_osd_histogram_onoff_status(imd)) { @@ -134,12 +134,12 @@ } else { - image_osd_set(imd, FALSE, FALSE); + image_osd_set(imd, OSD_SHOW_NOTHING); } } else { - image_osd_set(imd, TRUE, TRUE); + image_osd_set(imd, OSD_SHOW_INFO | OSD_SHOW_STATUS); image_osd_icon(imd, IMAGE_OSD_ICON, -1); image_osd_histogram_onoff_toggle(imd, 1); image_osd_update(imd); @@ -552,7 +552,7 @@ osd->imd->overlay_show_zoom = FALSE; - if (osd->show_info) + if (osd->show & OSD_SHOW_INFO) { if (osd->changed_states & IMAGE_STATE_IMAGE) { @@ -588,7 +588,7 @@ } } - if (osd->show_status) + if (osd->show & OSD_SHOW_STATUS) { gint i; @@ -763,7 +763,7 @@ image_osd_free(osd); } -static void image_osd_enable(ImageWindow *imd, gint info, gint status) +static void image_osd_enable(ImageWindow *imd, OsdShowFlags show) { OverlayStateData *osd; @@ -782,30 +782,26 @@ image_set_state_func(osd->imd, image_osd_state_cb, osd); } - if (osd->show_info != info || - osd->show_status != status) - { - osd->show_info = info; - osd->show_status = status; + if (show != osd->show) + image_osd_update_schedule(osd, TRUE); - image_osd_update_schedule(osd, TRUE); - } + osd->show = show; } -void image_osd_set(ImageWindow *imd, gint info, gint status) +void image_osd_set(ImageWindow *imd, OsdShowFlags show) { if (!imd) return; - if (!info && !status) + if (show == OSD_SHOW_NOTHING) { image_osd_remove(imd); return; } - image_osd_enable(imd, info, status); + image_osd_enable(imd, show); } -gint image_osd_get(ImageWindow *imd, gint *info, gint *status) +gint image_osd_get(ImageWindow *imd, OsdShowFlags *show) { OverlayStateData *osd; @@ -814,8 +810,7 @@ osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA"); if (!osd) return FALSE; - if (info) *info = osd->show_info; - if (status) *status = osd->show_status; + if (show) *show = osd->show; return TRUE; }
--- a/src/image-overlay.h Fri May 09 09:34:38 2008 +0000 +++ b/src/image-overlay.h Fri May 09 09:58:46 2008 +0000 @@ -24,10 +24,17 @@ IMAGE_OSD_COUNT } ImageOSDFlag; +typedef enum { + OSD_SHOW_NOTHING = 0, + OSD_SHOW_INFO = 1 << 0, + OSD_SHOW_STATUS = 1 << 1, + OSD_SHOW_HISTOGRAM = 1 << 2 +} OsdShowFlags; + void set_default_image_overlay_template_string(ConfOptions *options); -void image_osd_set(ImageWindow *imd, gint info, gint status); -gint image_osd_get(ImageWindow *imd, gint *info, gint *status); +void image_osd_set(ImageWindow *imd, OsdShowFlags show); +gint image_osd_get(ImageWindow *imd, OsdShowFlags *show); void image_osd_update(ImageWindow *imd);
--- a/src/img-view.c Fri May 09 09:34:38 2008 +0000 +++ b/src/img-view.c Fri May 09 09:58:46 2008 +0000 @@ -695,9 +695,9 @@ if (vw->fs) { - if (image_osd_get(vw->fs->imd, NULL, NULL)) + if (image_osd_get(vw->fs->imd, NULL)) { - image_osd_set(vw->imd, TRUE, TRUE); + image_osd_set(vw->imd, OSD_SHOW_INFO | OSD_SHOW_STATUS); } fullscreen_stop(vw->fs); @@ -712,10 +712,10 @@ if (vw->ss) vw->ss->imd = vw->fs->imd; - if (image_osd_get(vw->imd, NULL, NULL)) + if (image_osd_get(vw->imd, NULL)) { - image_osd_set(vw->imd, FALSE, FALSE); - image_osd_set(vw->fs->imd, TRUE, TRUE); + image_osd_set(vw->imd, OSD_SHOW_NOTHING); + image_osd_set(vw->fs->imd, OSD_SHOW_INFO | OSD_SHOW_STATUS); } } }
--- a/src/layout_image.c Fri May 09 09:34:38 2008 +0000 +++ b/src/layout_image.c Fri May 09 09:58:46 2008 +0000 @@ -358,10 +358,10 @@ if (lw->tools) gtk_widget_set_sensitive(lw->tools, FALSE); #endif - if (image_osd_get(lw->full_screen->normal_imd, NULL, NULL)) + if (image_osd_get(lw->full_screen->normal_imd, NULL)) { - image_osd_set(lw->image, TRUE, TRUE); - image_osd_set(lw->full_screen->normal_imd, FALSE, FALSE); + image_osd_set(lw->image, OSD_SHOW_INFO | OSD_SHOW_STATUS); + image_osd_set(lw->full_screen->normal_imd, OSD_SHOW_NOTHING); } } @@ -370,9 +370,9 @@ if (!layout_valid(&lw)) return; if (!lw->full_screen) return; - if (image_osd_get(lw->image, NULL, NULL)) + if (image_osd_get(lw->image, NULL)) { - image_osd_set(lw->full_screen->normal_imd, FALSE, TRUE); + image_osd_set(lw->full_screen->normal_imd, OSD_SHOW_STATUS); } fullscreen_stop(lw->full_screen);
--- a/src/main.c Fri May 09 09:34:38 2008 +0000 +++ b/src/main.c Fri May 09 09:58:46 2008 +0000 @@ -1208,7 +1208,7 @@ layout_geometry_get(NULL, &options->layout.main_window.x, &options->layout.main_window.y, &options->layout.main_window.w, &options->layout.main_window.h); } - options->image_overlay.common.enabled = image_osd_get(lw->image, NULL, NULL); + options->image_overlay.common.enabled = image_osd_get(lw->image, NULL); } layout_geometry_get_dividers(NULL, &options->layout.main_window.hdivider_pos, &options->layout.main_window.vdivider_pos); @@ -1479,7 +1479,8 @@ collection_get_first(first_collection)); } } - image_osd_set(lw->image, FALSE, (options->image_overlay.common.show_at_startup || options->image_overlay.common.enabled)); + + image_osd_set(lw->image, (options->image_overlay.common.show_at_startup || options->image_overlay.common.enabled) ? OSD_SHOW_INFO : OSD_SHOW_NOTHING); g_free(geometry); g_free(cmd_path);