Mercurial > geeqie.yaz
changeset 1336:4179d41d1149
fixed overlay configuration
split overlay options between global and layout window
author | nadvornik |
---|---|
date | Sat, 28 Feb 2009 14:40:22 +0000 |
parents | 588d96cda850 |
children | 091ba3e6aedb |
files | src/image-overlay.c src/image-overlay.h src/layout.c src/layout_image.c src/options.c src/options.h src/preferences.c src/rcfile.c src/typedefs.h |
diffstat | 9 files changed, 85 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/src/image-overlay.c Sat Feb 28 12:50:39 2009 +0000 +++ b/src/image-overlay.c Sat Feb 28 14:40:22 2009 +0000 @@ -131,7 +131,6 @@ if (!osd || !osd->histogram) return; histogram_toggle_channel(osd->histogram); - options->image_overlay.common.histogram_channel = histogram_get_channel(osd->histogram); image_osd_update(imd); } @@ -142,7 +141,6 @@ if (!osd || !osd->histogram) return; histogram_toggle_mode(osd->histogram); - options->image_overlay.common.histogram_mode = histogram_get_mode(osd->histogram); image_osd_update(imd); } @@ -153,13 +151,12 @@ if (!imd) return; osd = image_get_osd_data(imd); - if (!osd) + if (osd->show == OSD_SHOW_NOTHING) { image_osd_set(imd, OSD_SHOW_INFO | OSD_SHOW_STATUS); return; } - - if (osd->show != OSD_SHOW_NOTHING) + else { if (osd->show & OSD_SHOW_HISTOGRAM) { @@ -548,7 +545,7 @@ osd_template_insert(vars, "res", NULL, OSDT_NONE); } - text = image_osd_mkinfo(options->image_overlay.common.template_string, imd, vars); + text = image_osd_mkinfo(options->image_overlay.template_string, imd, vars); g_hash_table_destroy(vars); } else { @@ -1011,9 +1008,11 @@ osd->timer_id = -1; osd->show = OSD_SHOW_NOTHING; osd->histogram = NULL; - osd->x = options->image_overlay.common.x; - osd->y = options->image_overlay.common.y; + osd->x = options->image_overlay.x; + osd->y = options->image_overlay.y; + osd->histogram = histogram_new(); + osd->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy", G_CALLBACK(image_osd_destroy_cb), osd); image_set_osd_data(imd, osd); @@ -1021,18 +1020,6 @@ image_set_state_func(osd->imd, image_osd_state_cb, osd); } - if (show & OSD_SHOW_HISTOGRAM) - { - osd->histogram = histogram_new(); - histogram_set_channel(osd->histogram, options->image_overlay.common.histogram_channel); - histogram_set_mode(osd->histogram, options->image_overlay.common.histogram_mode); - } - else if (osd->histogram) - { - histogram_free(osd->histogram); - osd->histogram = NULL; - } - if (show & OSD_SHOW_STATUS) image_osd_icon(imd, IMAGE_OSD_ICON, -1); @@ -1046,12 +1033,6 @@ { if (!imd) return; - if (show == OSD_SHOW_NOTHING) - { - image_osd_remove(imd); - return; - } - image_osd_enable(imd, show); } @@ -1062,6 +1043,26 @@ return osd ? osd->show : OSD_SHOW_NOTHING; } +Histogram *image_osd_get_histogram(ImageWindow *imd) +{ + OverlayStateData *osd = image_get_osd_data(imd); + + return osd ? osd->histogram : NULL; +} + +void image_osd_copy_status(ImageWindow *src, ImageWindow *dest) +{ + Histogram *h_src, *h_dest; + image_osd_set(dest, image_osd_get(src)); + + h_src = image_osd_get_histogram(src); + h_dest = image_osd_get_histogram(dest); + + h_dest->histogram_mode = h_src->histogram_mode; + h_dest->histogram_channel = h_src->histogram_channel; + +} + /* duration: 0 = hide 1 = show
--- a/src/image-overlay.h Sat Feb 28 12:50:39 2009 +0000 +++ b/src/image-overlay.h Sat Feb 28 14:40:22 2009 +0000 @@ -37,6 +37,10 @@ void image_osd_set(ImageWindow *imd, OsdShowFlags show); OsdShowFlags image_osd_get(ImageWindow *imd); +Histogram *image_osd_get_histogram(ImageWindow *imd); + +void image_osd_copy_status(ImageWindow *src, ImageWindow *dest); + void image_osd_update(ImageWindow *imd); void image_osd_icon(ImageWindow *imd, ImageOSDFlag flag, gint duration);
--- a/src/layout.c Sat Feb 28 12:50:39 2009 +0000 +++ b/src/layout.c Sat Feb 28 14:40:22 2009 +0000 @@ -1913,6 +1913,7 @@ void layout_sync_options_with_current_state(LayoutWindow *lw) { + Histogram *histogram; if (!layout_valid(&lw)) return; lw->options.main_window.maximized = window_maximized(lw->window); @@ -1929,6 +1930,12 @@ layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.y, &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos); + lw->options.image_overlay.state = image_osd_get(lw->image); + histogram = image_osd_get_histogram(lw->image); + + lw->options.image_overlay.histogram_channel = histogram->histogram_channel; + lw->options.image_overlay.histogram_mode = histogram->histogram_mode; + // if (options->startup.restore_path && options->startup.use_last_path) // { // g_free(options->startup.path); @@ -1995,6 +2002,7 @@ LayoutWindow *lw; GdkGeometry hint; GdkWindowHints hint_mask; + Histogram *histogram; lw = g_new0(LayoutWindow, 1); @@ -2115,7 +2123,11 @@ gtk_widget_show(lw->window); layout_tools_hide(lw, lw->options.tools_hidden); - image_osd_set(lw->image, options->image_overlay.common.state | (options->image_overlay.common.show_at_startup ? OSD_SHOW_INFO : OSD_SHOW_NOTHING)); + image_osd_set(lw->image, lw->options.image_overlay.state); + histogram = image_osd_get_histogram(lw->image); + + histogram->histogram_channel = lw->options.image_overlay.histogram_channel; + histogram->histogram_mode = lw->options.image_overlay.histogram_mode; layout_window_list = g_list_append(layout_window_list, lw); @@ -2137,8 +2149,6 @@ WRITE_SEPARATOR(); WRITE_BOOL(*layout, save_window_positions); - WRITE_SEPARATOR(); - WRITE_INT(*layout, main_window.x); WRITE_INT(*layout, main_window.y); WRITE_INT(*layout, main_window.w); @@ -2165,6 +2175,10 @@ WRITE_SEPARATOR(); WRITE_BOOL(*layout, toolbar_hidden); + + WRITE_UINT(*layout, image_overlay.state); + WRITE_INT(*layout, image_overlay.histogram_channel); + WRITE_INT(*layout, image_overlay.histogram_mode); } @@ -2229,6 +2243,10 @@ if (READ_BOOL(*layout, tools_restore_state)) continue; if (READ_BOOL(*layout, toolbar_hidden)) continue; + if (READ_UINT(*layout, image_overlay.state)) continue; + if (READ_INT(*layout, image_overlay.histogram_channel)) continue; + if (READ_INT(*layout, image_overlay.histogram_mode)) continue; + DEBUG_1("unknown attribute %s = %s", option, value); }
--- a/src/layout_image.c Sat Feb 28 12:50:39 2009 +0000 +++ b/src/layout_image.c Sat Feb 28 14:40:22 2009 +0000 @@ -99,11 +99,7 @@ if (lw->tools) gtk_widget_set_sensitive(lw->tools, FALSE); #endif - if (image_osd_get(lw->full_screen->normal_imd) & OSD_SHOW_INFO) - { - image_osd_set(lw->image, image_osd_get(lw->full_screen->normal_imd)); - image_osd_set(lw->full_screen->normal_imd, OSD_SHOW_NOTHING); - } + image_osd_copy_status(lw->full_screen->normal_imd, lw->image); } void layout_image_full_screen_stop(LayoutWindow *lw) @@ -111,8 +107,7 @@ if (!layout_valid(&lw)) return; if (!lw->full_screen) return; - if (image_osd_get(lw->image) & OSD_SHOW_INFO) - image_osd_set(lw->full_screen->normal_imd, image_osd_get(lw->image)); + image_osd_copy_status(lw->image, lw->full_screen->normal_imd); fullscreen_stop(lw->full_screen);
--- a/src/options.c Sat Feb 28 12:50:39 2009 +0000 +++ b/src/options.c Sat Feb 28 14:40:22 2009 +0000 @@ -59,9 +59,6 @@ options->fullscreen.disable_saver = TRUE; options->fullscreen.screen = -1; - options->image_overlay.common.histogram_channel = HCHAN_RGB; - options->image_overlay.common.histogram_mode = 1; - memset(&options->image.border_color, 0, sizeof(options->image.border_color)); options->image.dither_quality = GDK_RGB_DITHER_NORMAL; options->image.enable_read_ahead = TRUE; @@ -83,11 +80,9 @@ options->image.zoom_quality = GDK_INTERP_BILINEAR; options->image.zoom_to_fit_allow_expand = FALSE; - options->image_overlay.common.state = OSD_SHOW_NOTHING; - options->image_overlay.common.show_at_startup = FALSE; - options->image_overlay.common.template_string = NULL; - options->image_overlay.common.x = 10; - options->image_overlay.common.y = -10; + options->image_overlay.template_string = NULL; + options->image_overlay.x = 10; + options->image_overlay.y = -10; options->layout.dir_view_type = DIRVIEW_LIST; options->layout.file_view_type = FILEVIEW_LIST; @@ -114,7 +109,10 @@ options->layout.tools_float = FALSE; options->layout.tools_hidden = FALSE; options->layout.tools_restore_state = TRUE; - + options->layout.image_overlay.histogram_channel = HCHAN_RGB; + options->layout.image_overlay.histogram_mode = 1; + options->layout.image_overlay.state = OSD_SHOW_NOTHING; + options->lazy_image_sync = FALSE; options->mousewheel_scrolls = FALSE; options->open_recent_list_maxsize = 10; @@ -181,7 +179,7 @@ options->color_profile.input_name[i] = NULL; } - set_default_image_overlay_template_string(&options->image_overlay.common.template_string); + set_default_image_overlay_template_string(&options->image_overlay.template_string); options->sidecar.ext = g_strdup(".jpg;%raw;.xmp"); options->layout.order = g_strdup("123"); @@ -215,7 +213,6 @@ { layout_sync_options_with_current_state(lw); copy_layout_options(&options->layout, &lw->options); - options->image_overlay.common.state = image_osd_get(lw->image); layout_sort_get(lw, &options->file_sort.method, &options->file_sort.ascending);
--- a/src/options.h Sat Feb 28 12:50:39 2009 +0000 +++ b/src/options.h Sat Feb 28 14:40:22 2009 +0000 @@ -140,15 +140,9 @@ /* image overlay */ struct { - struct { - guint state; - gboolean show_at_startup; - gchar *template_string; - gint x; - gint y; - gint histogram_channel; - gint histogram_mode; - } common; + gchar *template_string; + gint x; + gint y; } image_overlay; /* layout */
--- a/src/preferences.c Sat Feb 28 12:50:39 2009 +0000 +++ b/src/preferences.c Sat Feb 28 14:40:22 2009 +0000 @@ -317,10 +317,9 @@ options->fullscreen.clean_flip = c_options->fullscreen.clean_flip; options->fullscreen.disable_saver = c_options->fullscreen.disable_saver; options->fullscreen.above = c_options->fullscreen.above; - options->image_overlay.common.show_at_startup = c_options->image_overlay.common.show_at_startup; - if (c_options->image_overlay.common.template_string) - set_image_overlay_template_string(&options->image_overlay.common.template_string, - c_options->image_overlay.common.template_string); + if (c_options->image_overlay.template_string) + set_image_overlay_template_string(&options->image_overlay.template_string, + c_options->image_overlay.template_string); options->update_on_time_change = c_options->update_on_time_change; options->image.exif_rotate_enable = c_options->image.exif_rotate_enable; @@ -952,7 +951,7 @@ gtk_text_buffer_get_start_iter(pTextBuffer, &iStart); gtk_text_buffer_get_end_iter(pTextBuffer, &iEnd); - set_image_overlay_template_string(&c_options->image_overlay.common.template_string, + set_image_overlay_template_string(&c_options->image_overlay.template_string, gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE)); } @@ -961,11 +960,11 @@ GtkTextView *text_view = data; GtkTextBuffer *buffer; - set_default_image_overlay_template_string(&options->image_overlay.common.template_string); + set_default_image_overlay_template_string(&options->image_overlay.template_string); if (!configwindow) return; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view)); - gtk_text_buffer_set_text(buffer, options->image_overlay.common.template_string, -1); + gtk_text_buffer_set_text(buffer, options->image_overlay.template_string, -1); } static void image_overlay_default_template_cb(GtkWidget *widget, gpointer data) @@ -1536,8 +1535,6 @@ group = pref_group_new(vbox, FALSE, _("Overlay Screen Display"), GTK_ORIENTATION_VERTICAL); - pref_checkbox_new_int(group, _("Always show image overlay at startup"), - options->image_overlay.common.show_at_startup, &c_options->image_overlay.common.show_at_startup); pref_label_new(group, _("Image overlay template")); scrolled = gtk_scrolled_window_new(NULL, NULL); @@ -1580,7 +1577,7 @@ gtk_widget_show(button); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(image_overlay_template_view)); - if (options->image_overlay.common.template_string) gtk_text_buffer_set_text(buffer, options->image_overlay.common.template_string, -1); + if (options->image_overlay.template_string) gtk_text_buffer_set_text(buffer, options->image_overlay.template_string, -1); g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(image_overlay_template_view_changed_cb), image_overlay_template_view);
--- a/src/rcfile.c Sat Feb 28 12:50:39 2009 +0000 +++ b/src/rcfile.c Sat Feb 28 14:40:22 2009 +0000 @@ -370,22 +370,18 @@ WRITE_BOOL(*options, fullscreen.disable_saver); WRITE_BOOL(*options, fullscreen.above); + WRITE_SEPARATOR(); // WRITE_SUBTITLE("Image Overlay Options"); - WRITE_UINT(*options, image_overlay.common.state); - WRITE_BOOL(*options, image_overlay.common.show_at_startup); - WRITE_CHAR(*options, image_overlay.common.template_string); - WRITE_INT(*options, image_overlay.common.histogram_channel); - WRITE_INT(*options, image_overlay.common.histogram_mode); - WRITE_SEPARATOR(); + WRITE_CHAR(*options, image_overlay.template_string); // g_string_append_printf(outstr, "# these are relative positions:\n"); // g_string_append_printf(outstr, "# x >= 0: |x| pixels from left border\n"); // g_string_append_printf(outstr, "# x < 0 : |x| pixels from right border\n"); // g_string_append_printf(outstr, "# y >= 0: |y| pixels from top border\n"); // g_string_append_printf(outstr, "# y < 0 : |y| pixels from bottom border\n"); - WRITE_INT(*options, image_overlay.common.x); - WRITE_INT(*options, image_overlay.common.y); + WRITE_INT(*options, image_overlay.x); + WRITE_INT(*options, image_overlay.y); // WRITE_SUBTITLE("Slideshow Options"); @@ -672,14 +668,9 @@ if (READ_BOOL(*options, fullscreen.above)) continue; /* image overlay */ - if (READ_UINT(*options, image_overlay.common.state)) continue; - if (READ_BOOL(*options, image_overlay.common.show_at_startup)) continue; - if (READ_CHAR(*options, image_overlay.common.template_string)) continue; - if (READ_INT(*options, image_overlay.common.histogram_channel)) continue; - if (READ_INT(*options, image_overlay.common.histogram_mode)) continue; - - if (READ_INT(*options, image_overlay.common.x)) continue; - if (READ_INT(*options, image_overlay.common.y)) continue; + if (READ_CHAR(*options, image_overlay.template_string)) continue; + if (READ_INT(*options, image_overlay.x)) continue; + if (READ_INT(*options, image_overlay.y)) continue; /* slideshow options */
--- a/src/typedefs.h Sat Feb 28 12:50:39 2009 +0000 +++ b/src/typedefs.h Sat Feb 28 14:40:22 2009 +0000 @@ -519,6 +519,12 @@ gint h; } properties_window; + struct { + guint state; + gint histogram_channel; + gint histogram_mode; + } image_overlay; + gboolean save_window_positions; gboolean tools_float;