[gimp] Bug 466958 (plug-ins): step-back button for animation playback.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 466958 (plug-ins): step-back button for animation playback.
- Date: Sat, 20 Apr 2013 22:48:44 +0000 (UTC)
commit e42ff36dff6919fe8620608ee8b493e25d4ebf4e
Author: Jehan <jehan girinstud io>
Date: Thu Nov 15 19:41:11 2012 +0900
Bug 466958 (plug-ins): step-back button for animation playback.
plug-ins/common/animation-play.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
---
diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c
index 65946f0..a5fef1e 100644
--- a/plug-ins/common/animation-play.c
+++ b/plug-ins/common/animation-play.c
@@ -68,6 +68,7 @@ static void do_playback (void);
static void window_destroy (GtkWidget *widget);
static void play_callback (GtkToggleAction *action);
+static void step_back_callback (GtkAction *action);
static void step_callback (GtkAction *action);
static void rewind_callback (GtkAction *action);
static void speed_up_callback (GtkAction *action);
@@ -444,6 +445,10 @@ ui_manager_new (GtkWidget *window)
{
static GtkActionEntry actions[] =
{
+ { "step-back", GTK_STOCK_MEDIA_PREVIOUS,
+ N_("_Step_back"), NULL, N_("Step back to previous frame"),
+ G_CALLBACK (step_back_callback) },
+
{ "step", GTK_STOCK_MEDIA_NEXT,
N_("_Step"), NULL, N_("Step to next frame"),
G_CALLBACK (step_callback) },
@@ -520,6 +525,7 @@ ui_manager_new (GtkWidget *window)
"<ui>"
" <toolbar name=\"anim-play-toolbar\">"
" <toolitem action=\"play\" />"
+ " <toolitem action=\"step-back\" />"
" <toolitem action=\"step\" />"
" <toolitem action=\"rewind\" />"
" <separator />"
@@ -542,6 +548,7 @@ ui_manager_new (GtkWidget *window)
"<ui>"
" <popup name=\"anim-play-popup\">"
" <menuitem action=\"play\" />"
+ " <menuitem action=\"step-back\" />"
" <menuitem action=\"step\" />"
" <menuitem action=\"rewind\" />"
" <separator />"
@@ -964,6 +971,16 @@ remove_timer (void)
}
static void
+do_back_step (void)
+{
+ if (frame_number == 0)
+ frame_number = total_frames - 1;
+ else
+ frame_number = (frame_number - 1) % total_frames;
+ render_frame (frame_number);
+}
+
+static void
do_step (void)
{
frame_number = (frame_number + 1) % total_frames;
@@ -1084,6 +1101,16 @@ get_fps (gint index)
}
static void
+step_back_callback (GtkAction *action)
+{
+ if (playing)
+ gtk_action_activate (gtk_ui_manager_get_action (ui_manager,
+ "/anim-play-toolbar/play"));
+ do_back_step();
+ show_frame();
+}
+
+static void
step_callback (GtkAction *action)
{
if (playing)
@@ -1360,6 +1387,10 @@ init_frames (void)
gtk_action_set_sensitive (action, FALSE);
action = gtk_ui_manager_get_action (ui_manager,
+ "/ui/anim-play-toolbar/step-back");
+ gtk_action_set_sensitive (action, FALSE);
+
+ action = gtk_ui_manager_get_action (ui_manager,
"/ui/anim-play-toolbar/step");
gtk_action_set_sensitive (action, FALSE);
@@ -1374,6 +1405,10 @@ init_frames (void)
gtk_action_set_sensitive (action, TRUE);
action = gtk_ui_manager_get_action (ui_manager,
+ "/ui/anim-play-toolbar/step-back");
+ gtk_action_set_sensitive (action, TRUE);
+
+ action = gtk_ui_manager_get_action (ui_manager,
"/ui/anim-play-toolbar/step");
gtk_action_set_sensitive (action, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]