From: Colin Clark Date: Wed, 18 Jan 2017 13:57:37 +0000 (+0000) Subject: GIF animation settings X-Git-Tag: v1.4~220 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=78193941124b3d1842f3455c44205bc22099bcb3 GIF animation settings Preserve GIF animation setting between sessions Include GIF animation on View menu. Shortcut key is "A" --- diff --git a/src/layout.c b/src/layout.c index 055a0332..6b40bb24 100644 --- a/src/layout.c +++ b/src/layout.c @@ -2294,6 +2294,8 @@ void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent WRITE_NL(); WRITE_UINT(*layout, image_overlay.state); WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_channel); WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_mode); + + WRITE_NL(); WRITE_BOOL(*layout, animate); } @@ -2363,6 +2365,8 @@ void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names if (READ_INT(*layout, image_overlay.histogram_channel)) continue; if (READ_INT(*layout, image_overlay.histogram_mode)) continue; + if (READ_BOOL(*layout, animate)) continue; + log_printf("unknown attribute %s = %s\n", option, value); } if (id && strcmp(id, LAYOUT_ID_CURRENT) != 0) diff --git a/src/layout_image.c b/src/layout_image.c index e5e5659f..12eb2cf4 100644 --- a/src/layout_image.c +++ b/src/layout_image.c @@ -406,11 +406,17 @@ static gboolean layout_image_animate_new_file(LayoutWindow *lw) return TRUE; } -static void layout_image_animate_toggle(LayoutWindow *lw) +void layout_image_animate_toggle(LayoutWindow *lw) { + GtkAction *action; + if (!lw) return; lw->options.animate = !lw->options.animate; + + action = gtk_action_group_get_action(lw->action_group, "Animate"); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.animate); + layout_image_animate_new_file(lw); } diff --git a/src/layout_image.h b/src/layout_image.h index 383a214b..9f926fd1 100644 --- a/src/layout_image.h +++ b/src/layout_image.h @@ -95,6 +95,7 @@ gboolean layout_image_slideshow_active(LayoutWindow *lw); gboolean layout_image_slideshow_pause_toggle(LayoutWindow *lw); gboolean layout_image_slideshow_paused(LayoutWindow *lw); +void layout_image_animate_toggle(LayoutWindow *lw); void layout_image_overlay_toggle(LayoutWindow *lw); diff --git a/src/layout_util.c b/src/layout_util.c index 659dba53..413294f4 100644 --- a/src/layout_util.c +++ b/src/layout_util.c @@ -705,6 +705,14 @@ static void layout_menu_histogram_cb(GtkToggleAction *action, gpointer data) } } +static void layout_menu_animate_cb(GtkToggleAction *action, gpointer data) +{ + LayoutWindow *lw = data; + + if (lw->options.animate == gtk_toggle_action_get_active(action)) return; + layout_image_animate_toggle(lw); +} + static void layout_menu_rectangular_selection_cb(GtkToggleAction *action, gpointer data) { LayoutWindow *lw = data; @@ -1589,6 +1597,7 @@ static GtkToggleActionEntry menu_toggle_entries[] = { { "ImageOverlay", NULL, N_("Image _Overlay"), NULL, N_("Image Overlay"), CB(layout_menu_overlay_cb), FALSE }, { "ImageHistogram", NULL, N_("_Show Histogram"), NULL, N_("Show Histogram"), CB(layout_menu_histogram_cb), FALSE }, { "RectangularSelection", NULL, N_("Rectangular Selection"), "R", N_("Rectangular Selection"), CB(layout_menu_rectangular_selection_cb), FALSE }, + { "Animate", NULL, N_("GIF _animation"), "A", N_("Toggle GIF animation"), CB(layout_menu_animate_cb), FALSE }, }; static GtkRadioActionEntry menu_radio_entries[] = { @@ -1821,6 +1830,7 @@ static const gchar *menu_ui_description = " " " " " " +" " " " " " " " @@ -2459,6 +2469,9 @@ static void layout_util_sync_views(LayoutWindow *lw) action = gtk_action_group_get_action(lw->action_group, "SlideShow"); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), layout_image_slideshow_active(lw)); + action = gtk_action_group_get_action(lw->action_group, "Animate"); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.animate); + action = gtk_action_group_get_action(lw->action_group, "ImageOverlay"); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), osd_flags != OSD_SHOW_NOTHING);