[gimp/wip/animation: 79/197] plug-ins: get rid of animation's start position property.



commit 131a5fe1b4330cf28e894d97b6dd173b71b446c4
Author: Jehan <jehan girinstud io>
Date:   Fri Nov 4 00:21:53 2016 +0100

    plug-ins: get rid of animation's start position property.
    
    Adding this concept so low level was an error. Internally everything
    should be counted from 0, be it frames, panels, layers…
    I will later add the concept back, but only for display and image
    export numbering.

 .../animation-play/core/animation-celanimation.c   |   59 +++----
 plug-ins/animation-play/core/animation.c           |   83 +++------
 plug-ins/animation-play/core/animation.h           |    8 +-
 plug-ins/animation-play/core/animationanimatic.c   |  190 ++++++++++----------
 plug-ins/animation-play/core/animationanimatic.h   |   10 +-
 plug-ins/animation-play/widgets/animation-dialog.c |  135 ++++++--------
 .../animation-play/widgets/animation-storyboard.c  |   36 ++--
 plug-ins/animation-play/widgets/animation-xsheet.c |    8 +-
 8 files changed, 233 insertions(+), 296 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-celanimation.c 
b/plug-ins/animation-play/core/animation-celanimation.c
index 34d1057..703605c 100644
--- a/plug-ins/animation-play/core/animation-celanimation.c
+++ b/plug-ins/animation-play/core/animation-celanimation.c
@@ -99,7 +99,7 @@ static void         animation_cel_animation_finalize     (GObject           *obj
 
 /* Virtual methods */
 
-static gint         animation_cel_animation_get_length   (Animation         *animation);
+static gint         animation_cel_animation_get_duration (Animation         *animation);
 
 static void         animation_cel_animation_load         (Animation         *animation);
 static void         animation_cel_animation_load_xml     (Animation         *animation,
@@ -153,12 +153,12 @@ animation_cel_animation_class_init (AnimationCelAnimationClass *klass)
 
   object_class->finalize = animation_cel_animation_finalize;
 
-  anim_class->get_length = animation_cel_animation_get_length;
-  anim_class->load       = animation_cel_animation_load;
-  anim_class->load_xml   = animation_cel_animation_load_xml;
-  anim_class->get_frame  = animation_cel_animation_get_frame;
-  anim_class->serialize  = animation_cel_animation_serialize;
-  anim_class->same       = animation_cel_animation_same;
+  anim_class->get_duration = animation_cel_animation_get_duration;
+  anim_class->load         = animation_cel_animation_load;
+  anim_class->load_xml     = animation_cel_animation_load_xml;
+  anim_class->get_frame    = animation_cel_animation_get_frame;
+  anim_class->serialize    = animation_cel_animation_serialize;
+  anim_class->same         = animation_cel_animation_same;
 
   g_type_class_add_private (klass, sizeof (AnimationCelAnimationPrivate));
 }
@@ -220,11 +220,11 @@ animation_cel_animation_set_layers (AnimationCelAnimation *animation,
           frame_layer->data = 0;
         }
       animation_cel_animation_cache (animation, position);
-      if (animation_get_position (ANIMATION (animation)) - 1 == position)
+      if (animation_get_position (ANIMATION (animation)) == position)
         {
           GeglBuffer *buffer;
 
-          buffer = animation_get_frame (ANIMATION (animation), position + 1);
+          buffer = animation_get_frame (ANIMATION (animation), position);
           g_signal_emit_by_name (animation, "render",
                                  position, buffer, TRUE);
           if (buffer)
@@ -392,7 +392,7 @@ animation_cel_animation_set_track_title (AnimationCelAnimation *animation,
 /**** Virtual methods ****/
 
 static gint
-animation_cel_animation_get_length (Animation *animation)
+animation_cel_animation_get_duration (Animation *animation)
 {
   return ANIMATION_CEL_ANIMATION (animation)->priv->duration;
 }
@@ -496,7 +496,7 @@ animation_cel_animation_load_xml (Animation   *animation,
   else
     {
       AnimationCelAnimation *cel_animation;
-      gint                   duration = animation_get_length (animation);
+      gint                   duration = animation_get_duration (animation);
       gint                   i;
 
       cel_animation = ANIMATION_CEL_ANIMATION (animation);
@@ -526,7 +526,7 @@ animation_cel_animation_get_frame (Animation *animation,
   cel_animation = ANIMATION_CEL_ANIMATION (animation);
 
   cache = g_list_nth_data (cel_animation->priv->cache,
-                           pos - 1);
+                           pos);
   if (cache)
     {
       frame = g_object_ref (cache->buffer);
@@ -606,10 +606,8 @@ animation_cel_animation_serialize (Animation *animation)
         {
           gchar *comment = iter->data;
 
-          /* Comments are for a given panel, not for a frame position. */
           xml2 = g_markup_printf_escaped ("<comment frame-position=\"%d\">%s</comment>",
-                                          i,
-                                          comment);
+                                          i, comment);
           tmp = xml;
           xml = g_strconcat (xml, xml2, NULL);
           g_free (tmp);
@@ -634,16 +632,14 @@ animation_cel_animation_same (Animation *animation,
 
   cel_animation = ANIMATION_CEL_ANIMATION (animation);
 
-  g_return_val_if_fail (pos1 > 0                              &&
-                        pos1 <= cel_animation->priv->duration &&
-                        pos2 > 0                              &&
-                        pos2 <= cel_animation->priv->duration,
+  g_return_val_if_fail (pos1 >= 0                            &&
+                        pos1 < cel_animation->priv->duration &&
+                        pos2 >= 0                            &&
+                        pos2 < cel_animation->priv->duration,
                         FALSE);
 
-  cache1 = g_list_nth_data (cel_animation->priv->cache,
-                            pos1 - 1);
-  cache2 = g_list_nth_data (cel_animation->priv->cache,
-                            pos2 - 1);
+  cache1 = g_list_nth_data (cel_animation->priv->cache, pos1);
+  cache2 = g_list_nth_data (cel_animation->priv->cache, pos2);
 
   return animation_cel_animation_cache_cmp (cache1, cache2);
 }
@@ -877,9 +873,9 @@ animation_cel_animation_start_element (GMarkupParseContext  *context,
 
 static void
 animation_cel_animation_end_element (GMarkupParseContext *context,
-                                const gchar         *element_name,
-                                gpointer             user_data,
-                                GError             **error)
+                                     const gchar         *element_name,
+                                     gpointer             user_data,
+                                     GError             **error)
 {
   ParseStatus *status = (ParseStatus *) user_data;
 
@@ -909,10 +905,10 @@ animation_cel_animation_end_element (GMarkupParseContext *context,
 
 static void
 animation_cel_animation_text (GMarkupParseContext  *context,
-                         const gchar          *text,
-                         gsize                 text_len,
-                         gpointer              user_data,
-                         GError              **error)
+                              const gchar          *text,
+                              gsize                 text_len,
+                              gpointer              user_data,
+                              GError              **error)
 {
   ParseStatus *status = (ParseStatus *) user_data;
   AnimationCelAnimation *cel_animation = ANIMATION_CEL_ANIMATION (status->animation);
@@ -1076,8 +1072,7 @@ animation_cel_animation_cache (AnimationCelAnimation *animation,
       layer = gimp_image_get_layer_by_tattoo (image_id,
                                               cache->composition[i]);
       source = gimp_drawable_get_buffer (layer);
-      gimp_drawable_offsets (layer,
-                             &layer_offx, &layer_offy);
+      gimp_drawable_offsets (layer, &layer_offx, &layer_offy);
       intermediate = normal_blend (preview_width, preview_height,
                                    backdrop, 1.0, 0, 0,
                                    source, proxy_ratio,
diff --git a/plug-ins/animation-play/core/animation.c b/plug-ins/animation-play/core/animation.c
index 7b9b8eb..ad7a8cc 100644
--- a/plug-ins/animation-play/core/animation.c
+++ b/plug-ins/animation-play/core/animation.c
@@ -74,9 +74,6 @@ struct _AnimationPrivate
 
   /* State of the currently loaded animation. */
   gint         position;
-  /* We want to allow animator to set any number as first frame,
-   * for frame export capability. */
-  guint        start_pos;
   /* Playback can be a subset of frames. */
   guint        playback_start;
   guint        playback_stop;
@@ -106,11 +103,9 @@ static void       animation_get_property           (GObject      *object,
                                                     GParamSpec   *pspec);
 
 /* Base implementation of virtual methods. */
-static gint       animation_real_get_start_position (Animation *animation);
 static gboolean   animation_real_same               (Animation *animation,
                                                      gint       prev_pos,
                                                      gint       next_pos);
-gchar           * animation_real_serialize          (Animation *animation);
 
 /* Timer callback for playback. */
 static gboolean   animation_advance_frame_callback  (Animation *animation);
@@ -164,8 +159,7 @@ animation_class_init (AnimationClass *klass)
   /**
    * Animation::loaded:
    * @animation: the animation loading.
-   * @start_pos: the first frame.
-   * @length: number of frames.
+   * @duration: number of frames.
    * @playback_start: the playback start frame.
    * @playback_stop: the playback last frame.
    * @width: display width in pixels.
@@ -183,8 +177,7 @@ animation_class_init (AnimationClass *klass)
                   NULL, NULL,
                   NULL,
                   G_TYPE_NONE,
-                  6,
-                  G_TYPE_INT,
+                  5,
                   G_TYPE_INT,
                   G_TYPE_INT,
                   G_TYPE_INT,
@@ -266,8 +259,7 @@ animation_class_init (AnimationClass *klass)
    * @animation: the animation.
    * @playback_start: the playback start frame.
    * @playback_stop: the playback last frame.
-   * @first_frame: the first frame.
-   * @length: the full length.
+   * @playback_duration: the playback duration (in frames).
    *
    * The ::playback-range signal is emitted when the playback range is
    * updated.
@@ -280,8 +272,7 @@ animation_class_init (AnimationClass *klass)
                   NULL, NULL,
                   NULL,
                   G_TYPE_NONE,
-                  4,
-                  G_TYPE_INT,
+                  3,
                   G_TYPE_INT,
                   G_TYPE_INT,
                   G_TYPE_INT);
@@ -325,9 +316,7 @@ animation_class_init (AnimationClass *klass)
   object_class->set_property = animation_set_property;
   object_class->get_property = animation_get_property;
 
-  klass->get_start_position  = animation_real_get_start_position;
   klass->same                = animation_real_same;
-  klass->serialize           = animation_real_serialize;
 
   /**
    * Animation:image:
@@ -394,7 +383,7 @@ animation_load (Animation *animation)
   AnimationPrivate *priv = ANIMATION_GET_PRIVATE (animation);
   GeglBuffer       *buffer;
   gint              width, height;
-  gint              length;
+  gint              duration;
 
   priv->loaded = FALSE;
   g_signal_emit (animation, animation_signals[LOADING_START], 0);
@@ -409,19 +398,18 @@ animation_load (Animation *animation)
   g_free (priv->xml);
   priv->xml = NULL;
 
-  priv->start_pos = ANIMATION_GET_CLASS (animation)->get_start_position (animation);
-  priv->position  = priv->start_pos;
-  length    = ANIMATION_GET_CLASS (animation)->get_length (animation);
+  duration = ANIMATION_GET_CLASS (animation)->get_duration (animation);
+  priv->position = 0;
 
   /* Default playback is the full range of frames. */
-  priv->playback_start = priv->position;
-  priv->playback_stop  = priv->position + length - 1;
+  priv->playback_start = 0;
+  priv->playback_stop  = duration - 1;
 
   priv->loaded = TRUE;
 
   animation_get_size (animation, &width, &height);
   g_signal_emit (animation, animation_signals[LOADED], 0,
-                 1, length,
+                 duration,
                  priv->playback_start,
                  priv->playback_stop,
                  width,
@@ -514,12 +502,6 @@ animation_save_to_parasite (Animation *animation)
 }
 
 gint
-animation_get_start_position (Animation *animation)
-{
-  return ANIMATION_GET_CLASS (animation)->get_start_position (animation);
-}
-
-gint
 animation_get_position (Animation *animation)
 {
   AnimationPrivate *priv = ANIMATION_GET_PRIVATE (animation);
@@ -528,9 +510,9 @@ animation_get_position (Animation *animation)
 }
 
 gint
-animation_get_length (Animation *animation)
+animation_get_duration (Animation *animation)
 {
-  return ANIMATION_GET_CLASS (animation)->get_length (animation);
+  return ANIMATION_GET_CLASS (animation)->get_duration (animation);
 }
 
 void
@@ -725,14 +707,14 @@ animation_set_playback_start (Animation *animation,
                               gint       frame_number)
 {
   AnimationPrivate *priv = ANIMATION_GET_PRIVATE (animation);
-  gint              length;
+  gint              duration;
 
-  length = animation_get_length (animation);
+  duration = animation_get_duration (animation);
 
-  if (frame_number < priv->start_pos ||
-      frame_number >= priv->start_pos + length)
+  if (frame_number < 0 ||
+      frame_number >= duration)
     {
-      priv->playback_start = priv->start_pos;
+      priv->playback_start = 0;
     }
   else
     {
@@ -740,12 +722,12 @@ animation_set_playback_start (Animation *animation,
     }
   if (priv->playback_stop < priv->playback_start)
     {
-      priv->playback_stop = priv->start_pos + length - 1;
+      priv->playback_stop = duration - 1;
     }
 
   g_signal_emit (animation, animation_signals[PLAYBACK_RANGE], 0,
                  priv->playback_start, priv->playback_stop,
-                 priv->start_pos, length);
+                 duration);
 
   if (priv->position < priv->playback_start ||
       priv->position > priv->playback_stop)
@@ -767,14 +749,14 @@ animation_set_playback_stop (Animation *animation,
                              gint       frame_number)
 {
   AnimationPrivate *priv = ANIMATION_GET_PRIVATE (animation);
-  gint              length;
+  gint              duration;
 
-  length = animation_get_length (animation);
+  duration = animation_get_duration (animation);
 
-  if (frame_number < priv->start_pos ||
-      frame_number >= priv->start_pos + length)
+  if (frame_number < 0 ||
+      frame_number >= duration)
     {
-      priv->playback_stop = priv->start_pos + length - 1;
+      priv->playback_stop = duration - 1;
     }
   else
     {
@@ -782,11 +764,11 @@ animation_set_playback_stop (Animation *animation,
     }
   if (priv->playback_stop < priv->playback_start)
     {
-      priv->playback_start = priv->start_pos;
+      priv->playback_start = 0;
     }
   g_signal_emit (animation, animation_signals[PLAYBACK_RANGE], 0,
                  priv->playback_start, priv->playback_stop,
-                 priv->start_pos, length);
+                 duration);
 
   if (priv->position < priv->playback_start ||
       priv->position > priv->playback_stop)
@@ -877,13 +859,6 @@ animation_get_property (GObject    *object,
     }
 }
 
-static
-gint animation_real_get_start_position (Animation *animation)
-{
-  /* By default, the first frame is numbered 1. */
-  return 1;
-}
-
 static gboolean
 animation_real_same (Animation *animation,
                      gint       previous_pos,
@@ -893,12 +868,6 @@ animation_real_same (Animation *animation,
   return (previous_pos == next_pos);
 }
 
-gchar *
-animation_real_serialize (Animation   *animation)
-{
-  return NULL;
-}
-
 static gboolean
 animation_advance_frame_callback (Animation *animation)
 {
diff --git a/plug-ins/animation-play/core/animation.h b/plug-ins/animation-play/core/animation.h
index 6aa2638..cf826b5 100644
--- a/plug-ins/animation-play/core/animation.h
+++ b/plug-ins/animation-play/core/animation.h
@@ -40,9 +40,6 @@ struct _AnimationClass
 {
   GObjectClass  parent_class;
 
-  /* Defaults to position 1. */
-  gint         (*get_start_position) (Animation *animation);
-
   /* Defaults to returning FALSE for any different position. */
   gboolean     (*same)               (Animation *animation,
                                       gint       prev_pos,
@@ -52,7 +49,7 @@ struct _AnimationClass
   void         (*load)          (Animation   *animation);
   void         (*load_xml)      (Animation   *animation,
                                  const gchar *xml);
-  gint         (*get_length)    (Animation   *animation);
+  gint         (*get_duration)  (Animation   *animation);
 
 
   GeglBuffer * (*get_frame)     (Animation   *animation,
@@ -73,9 +70,8 @@ void          animation_load               (Animation   *animation);
 
 void          animation_save_to_parasite   (Animation   *animation);
 
-gint          animation_get_start_position (Animation   *animation);
 gint          animation_get_position       (Animation   *animation);
-gint          animation_get_length         (Animation   *animation);
+gint          animation_get_duration       (Animation   *animation);
 
 void          animation_set_proxy          (Animation   *animation,
                                             gdouble      ratio);
diff --git a/plug-ins/animation-play/core/animationanimatic.c 
b/plug-ins/animation-play/core/animationanimatic.c
index 84abb0d..756876a 100644
--- a/plug-ins/animation-play/core/animationanimatic.c
+++ b/plug-ins/animation-play/core/animationanimatic.c
@@ -52,7 +52,7 @@ typedef struct
 
 enum
 {
-  IMAGE_DURATION,
+  PANEL_DURATION,
   LAST_SIGNAL
 };
 
@@ -83,18 +83,18 @@ static void         animation_animatic_finalize   (GObject           *object);
 
 /* Virtual methods */
 
-static gint         animation_animatic_get_length  (Animation         *animation);
+static gint         animation_animatic_get_duration (Animation         *animation);
 
-static void         animation_animatic_load        (Animation         *animation);
-static void         animation_animatic_load_xml    (Animation         *animation,
-                                                    const gchar       *xml);
-static GeglBuffer * animation_animatic_get_frame   (Animation         *animation,
-                                                    gint               pos);
-static gchar      * animation_animatic_serialize   (Animation         *animation);
+static void         animation_animatic_load         (Animation         *animation);
+static void         animation_animatic_load_xml     (Animation         *animation,
+                                                     const gchar       *xml);
+static GeglBuffer * animation_animatic_get_frame    (Animation         *animation,
+                                                     gint               pos);
+static gchar      * animation_animatic_serialize    (Animation         *animation);
 
-static gboolean     animation_animatic_same        (Animation         *animation,
-                                                    gint               pos1,
-                                                    gint               pos2);
+static gboolean     animation_animatic_same         (Animation         *animation,
+                                                     gint               pos1,
+                                                     gint               pos2);
 
 /* XML parsing */
 
@@ -146,17 +146,17 @@ animation_animatic_class_init (AnimationAnimaticClass *klass)
   AnimationClass *anim_class   = ANIMATION_CLASS (klass);
 
   /**
-   * AnimationAnimatic::image-duration:
+   * AnimationAnimatic::panel-duration:
    * @animatic: the #AnimationAnimatic.
-   * @layer_id: the #GimpLayer id.
-   * @duration: the new duration for @layer_id (in number of panels).
+   * @panel: the panel number (first panel is 0).
+   * @duration: the new duration for @panel (in number of frames).
    *
-   * The ::image-duration will be emitted when the duration of a layer
+   * The ::panel-duration will be emitted when the duration of a layer
    * changes. It can be %0 meaning that this layer should not be shown
    * in the reel.
    */
-  signals[IMAGE_DURATION] =
-    g_signal_new ("image-duration",
+  signals[PANEL_DURATION] =
+    g_signal_new ("panel-duration",
                   G_TYPE_FROM_CLASS (klass),
                   G_SIGNAL_RUN_FIRST,
                   0,
@@ -169,12 +169,12 @@ animation_animatic_class_init (AnimationAnimaticClass *klass)
 
   object_class->finalize = animation_animatic_finalize;
 
-  anim_class->get_length = animation_animatic_get_length;
-  anim_class->load       = animation_animatic_load;
-  anim_class->load_xml   = animation_animatic_load_xml;
-  anim_class->get_frame  = animation_animatic_get_frame;
-  anim_class->serialize  = animation_animatic_serialize;
-  anim_class->same       = animation_animatic_same;
+  anim_class->get_duration = animation_animatic_get_duration;
+  anim_class->load         = animation_animatic_load;
+  anim_class->load_xml     = animation_animatic_load_xml;
+  anim_class->get_frame    = animation_animatic_get_frame;
+  anim_class->serialize    = animation_animatic_serialize;
+  anim_class->same         = animation_animatic_same;
 
   g_type_class_add_private (klass, sizeof (AnimationAnimaticPrivate));
 }
@@ -223,46 +223,45 @@ animation_animatic_finalize (GObject *object)
 /**** Public Functions ****/
 
 void
-animation_animatic_set_duration (AnimationAnimatic *animatic,
-                                 gint               panel_num,
-                                 gint               duration)
+animation_animatic_set_panel_duration (AnimationAnimatic *animatic,
+                                       gint               panel_num,
+                                       gint               panel_duration)
 {
   AnimationAnimaticPrivate *priv           = GET_PRIVATE (animatic);
   Animation                *animation      = ANIMATION (animatic);
-  gint                      prev_length    = animation_get_length (animation);
+  gint                      prev_length    = animation_get_duration (animation);
   gint                      playback_start = animation_get_playback_start (animation);
   gint                      playback_stop  = animation_get_playback_stop (animation);
   gint                      position       = animation_get_position (animation);
   gint                      layer_id;
   gint                      length;
 
-  g_return_if_fail (duration >= 0  &&
-                    panel_num > 0 &&
-                    panel_num <= priv->n_panels);
+  g_return_if_fail (panel_duration >= 0  &&
+                    panel_num >= 0 &&
+                    panel_num < priv->n_panels);
 
   layer_id = animation_animatic_get_layer (animatic, position);
 
-  priv->durations[panel_num - 1] = duration;
-  length = animation_get_length (animation);
+  priv->durations[panel_num] = panel_duration;
+  length = animation_get_duration (animation);
 
-  if (playback_start > length)
+  if (playback_start >= length)
     {
-      playback_start = animation_get_start_position (animation);
+      playback_start = 0;
     }
-  if (playback_stop > length ||
-      playback_stop == prev_length)
+  if (playback_stop >= length ||
+      playback_stop == prev_length - 1)
     {
-      playback_stop = length;
+      playback_stop = length - 1;
     }
-  g_signal_emit (animatic, signals[IMAGE_DURATION], 0,
-                 panel_num, duration);
+  g_signal_emit (animatic, signals[PANEL_DURATION], 0,
+                 panel_num, panel_duration);
   g_signal_emit_by_name (animatic, "playback-range",
                          playback_start, playback_stop,
-                         animation_get_start_position (animation),
-                         animation_get_length (animation));
-  if (position > length)
+                         animation_get_duration (animation));
+  if (position >= length)
     {
-      animation_jump (animation, length);
+      animation_jump (animation, length - 1);
     }
   else if (layer_id != animation_animatic_get_layer (animatic, position))
     {
@@ -277,16 +276,16 @@ animation_animatic_set_duration (AnimationAnimatic *animatic,
 }
 
 gint
-animation_animatic_get_duration (AnimationAnimatic *animatic,
-                                 gint               panel_num)
+animation_animatic_get_panel_duration (AnimationAnimatic *animatic,
+                                       gint               panel_num)
 {
   AnimationAnimaticPrivate *priv = GET_PRIVATE (animatic);
 
-  g_return_val_if_fail (panel_num > 0 &&
-                        panel_num <= priv->n_panels,
+  g_return_val_if_fail (panel_num >= 0 &&
+                        panel_num < priv->n_panels,
                         0);
 
-  return priv->durations[panel_num - 1];
+  return priv->durations[panel_num];
 }
 
 void
@@ -296,13 +295,13 @@ animation_animatic_set_comment (AnimationAnimatic *animatic,
 {
   AnimationAnimaticPrivate *priv = GET_PRIVATE (animatic);
 
-  g_return_if_fail (panel_num > 0 &&
-                    panel_num <= priv->n_panels);
+  g_return_if_fail (panel_num >= 0 &&
+                    panel_num < priv->n_panels);
 
-  if (priv->comments[panel_num - 1])
-    g_free (priv->comments[panel_num - 1]);
+  if (priv->comments[panel_num])
+    g_free (priv->comments[panel_num]);
 
-  priv->comments[panel_num - 1] = g_strdup (comment);
+  priv->comments[panel_num] = g_strdup (comment);
 }
 
 const gchar *
@@ -311,10 +310,10 @@ animation_animatic_get_comment (AnimationAnimatic *animatic,
 {
   AnimationAnimaticPrivate *priv = GET_PRIVATE (animatic);
 
-  g_return_val_if_fail (panel_num > 0 &&
-                        panel_num <= priv->n_panels,
+  g_return_val_if_fail (panel_num >= 0 &&
+                        panel_num < priv->n_panels,
                         0);
-  return priv->comments[panel_num - 1];
+  return priv->comments[panel_num];
 }
 
 void
@@ -322,14 +321,14 @@ animation_animatic_set_combine (AnimationAnimatic *animatic,
                                 gint               panel_num,
                                 gboolean           combine)
 {
-  AnimationAnimaticPrivate *priv      = GET_PRIVATE (animatic);
+  AnimationAnimaticPrivate *priv = GET_PRIVATE (animatic);
 
-  g_return_if_fail (panel_num > 0 &&
-                    panel_num <= priv->n_panels);
+  g_return_if_fail (panel_num >= 0 &&
+                    panel_num < priv->n_panels);
 
-  if (priv->combine[panel_num - 1] != combine)
+  if (priv->combine[panel_num] != combine)
     {
-      priv->combine[panel_num - 1] = combine;
+      priv->combine[panel_num] = combine;
       animation_animatic_cache (animatic, panel_num, TRUE);
     }
 }
@@ -340,10 +339,10 @@ animation_animatic_get_combine (AnimationAnimatic *animatic,
 {
   AnimationAnimaticPrivate *priv = GET_PRIVATE (animatic);
 
-  g_return_val_if_fail (panel_num > 0 &&
-                        panel_num <= priv->n_panels,
-                        0);
-  return priv->combine[panel_num - 1];
+  g_return_val_if_fail (panel_num >= 0 &&
+                        panel_num < priv->n_panels,
+                        FALSE);
+  return priv->combine[panel_num];
 }
 
 gint
@@ -354,19 +353,19 @@ animation_animatic_get_panel (AnimationAnimatic *animation,
   gint                      count = 0;
   gint                      i     = -1;
 
-  if (pos >= 1       &&
-      pos <= animation_animatic_get_length (ANIMATION (animation)))
+  if (pos >= 0       &&
+      pos < animation_animatic_get_duration (ANIMATION (animation)))
     {
       for (i = 0; i < priv->n_panels; i++)
         {
           count += priv->durations[i];
-          if (count >= pos)
+          if (count > pos)
             break;
         }
     }
 
   if (i != -1 && i < priv->n_panels)
-    return i + 1;
+    return i;
 
   return -1;
 }
@@ -376,12 +375,12 @@ void animation_animatic_jump_panel (AnimationAnimatic *animation,
 {
   AnimationAnimaticPrivate *priv = GET_PRIVATE (animation);
   /* Get the first frame position for a given panel. */
-  gint                      pos = 1;
+  gint                      pos  = 0;
   gint                      i;
 
-  g_return_if_fail (panel <= priv->n_panels);
+  g_return_if_fail (panel < priv->n_panels);
 
-  for (i = 0; i < panel - 1; i++)
+  for (i = 0; i < panel; i++)
     {
       pos += priv->durations[i];
     }
@@ -392,7 +391,7 @@ void animation_animatic_jump_panel (AnimationAnimatic *animation,
 /**** Virtual methods ****/
 
 static gint
-animation_animatic_get_length (Animation *animation)
+animation_animatic_get_duration (Animation *animation)
 {
   AnimationAnimaticPrivate *priv = GET_PRIVATE (animation);
   gint                      count = 0;
@@ -470,7 +469,7 @@ animation_animatic_load (Animation *animation)
       priv->comments[i]  = layer_name;
 
       /* Panel image. */
-      animation_animatic_cache (ANIMATION_ANIMATIC (animation), i + 1, FALSE);
+      animation_animatic_cache (ANIMATION_ANIMATIC (animation), i, FALSE);
     }
   g_free (layers);
 }
@@ -531,7 +530,7 @@ animation_animatic_get_frame (Animation *animation,
   priv = GET_PRIVATE (animation);
   panel = animation_animatic_get_panel (ANIMATION_ANIMATIC (animation),
                                         pos);
-  return g_object_ref (priv->cache[panel - 1]);
+  return g_object_ref (priv->cache[panel]);
 }
 
 static gchar *
@@ -581,7 +580,7 @@ animation_animatic_serialize (Animation *animation)
 
           /* Comments are for a given panel, not for a frame position. */
           comment = g_markup_printf_escaped ("<comment panel=\"%d\">%s</comment>",
-                                             i + 1,
+                                             i,
                                              priv->comments[i]);
           tmp = text;
           text = g_strconcat (text, comment, NULL);
@@ -609,12 +608,12 @@ animation_animatic_same (Animation *animation,
   for (i = 0; i < priv->n_panels; i++)
     {
       count += priv->durations[i];
-      if (count >= pos1 && count >= pos2)
+      if (count > pos1 && count > pos2)
         {
           identical = TRUE;
           break;
         }
-      else if (count >= pos1 || count >= pos2)
+      else if (count > pos1 || count > pos2)
         {
           identical = FALSE;
           break;
@@ -691,6 +690,7 @@ animation_animatic_start_element (GMarkupParseContext *context,
           return;
         }
       status->state = SEQUENCE_STATE;
+      status->panel = -1;
       break;
     case SEQUENCE_STATE:
       if (g_strcmp0 (element_name, "panel") != 0)
@@ -709,7 +709,7 @@ animation_animatic_start_element (GMarkupParseContext *context,
               gint duration = g_ascii_strtoll (*values, NULL, 10);
 
               if (duration > 0)
-                priv->durations[status->panel - 1] = duration;
+                priv->durations[status->panel] = duration;
             }
           else if (strcmp (*names, "blend-mode") == 0 && **values &&
                    strcmp (*values, "normal") == 0)
@@ -721,9 +721,9 @@ animation_animatic_start_element (GMarkupParseContext *context,
           names++;
           values++;
         }
-      if (priv->combine[status->panel - 1] != combine)
+      if (priv->combine[status->panel] != combine)
         {
-          priv->combine[status->panel - 1] = combine;
+          priv->combine[status->panel] = combine;
           animation_animatic_cache (ANIMATION_ANIMATIC (status->animation),
                                     status->panel, FALSE);
         }
@@ -877,7 +877,7 @@ animation_animatic_cache (AnimationAnimatic *animatic,
 
   image_id = animation_get_image_id (animation);
   layer = gimp_image_get_layer_by_tattoo (image_id,
-                                          priv->tattoos[panel - 1]);
+                                          priv->tattoos[panel]);
   if (! layer)
     {
       g_warning ("Caching failed: a layer must have been deleted.");
@@ -885,9 +885,9 @@ animation_animatic_cache (AnimationAnimatic *animatic,
     }
 
   /* Destroy existing cache. */
-  if (priv->cache[panel - 1])
+  if (priv->cache[panel])
     {
-      g_object_unref (priv->cache[panel - 1]);
+      g_object_unref (priv->cache[panel]);
     }
 
   proxy_ratio = animation_get_proxy (animation);
@@ -896,22 +896,22 @@ animation_animatic_cache (AnimationAnimatic *animatic,
   gimp_drawable_offsets (layer,
                          &layer_offx, &layer_offy);
 
-  if (panel > 1 && priv->combine[panel - 1])
+  if (panel > 0 && priv->combine[panel])
     {
-      backdrop_buffer = priv->cache[panel - 2];
+      backdrop_buffer = priv->cache[panel - 1];
     }
 
-  priv->cache[panel - 1] = normal_blend (preview_width, preview_height,
-                                         backdrop_buffer, 1.0, 0, 0,
-                                         buffer, proxy_ratio,
-                                         layer_offx, layer_offy);
+  priv->cache[panel] = normal_blend (preview_width, preview_height,
+                                     backdrop_buffer, 1.0, 0, 0,
+                                     buffer, proxy_ratio,
+                                     layer_offx, layer_offy);
   g_object_unref (buffer);
 
   /* If next panel is in "combine" mode, it must also be re-cached.
    * And so on, recursively. */
-  if (recursion              &&
-      panel < priv->n_panels &&
-      priv->combine[panel])
+  if (recursion                  &&
+      panel < priv->n_panels - 1 &&
+      priv->combine[panel + 1])
     {
       animation_animatic_cache (animatic, panel + 1, TRUE);
     }
@@ -939,8 +939,8 @@ animation_animatic_get_layer (AnimationAnimatic *animation,
   gint                      i     = -1;
 
   if (priv->n_panels > 0 &&
-      pos >= 1           &&
-      pos <= animation_animatic_get_length (ANIMATION (animation)))
+      pos >= 0           &&
+      pos < animation_animatic_get_duration (ANIMATION (animation)))
     {
       for (i = priv->n_panels - 1; i >= 0; i--)
         {
diff --git a/plug-ins/animation-play/core/animationanimatic.h 
b/plug-ins/animation-play/core/animationanimatic.h
index 3463f3e..12e6180 100644
--- a/plug-ins/animation-play/core/animationanimatic.h
+++ b/plug-ins/animation-play/core/animationanimatic.h
@@ -45,11 +45,11 @@ struct _AnimationAnimaticClass
 
 GType            animation_animatic_get_type (void);
 
-void             animation_animatic_set_duration (AnimationAnimatic *animatic,
-                                                  gint               panel_num,
-                                                  gint               duration);
-gint             animation_animatic_get_duration (AnimationAnimatic *animatic,
-                                                  gint               panel_num);
+void             animation_animatic_set_panel_duration (AnimationAnimatic *animatic,
+                                                        gint               panel_num,
+                                                        gint               duration);
+gint             animation_animatic_get_panel_duration (AnimationAnimatic *animatic,
+                                                        gint               panel_num);
 
 void             animation_animatic_set_comment  (AnimationAnimatic *animatic,
                                                   gint               panel_num,
diff --git a/plug-ins/animation-play/widgets/animation-dialog.c 
b/plug-ins/animation-play/widgets/animation-dialog.c
index f73c640..184ba87 100755
--- a/plug-ins/animation-play/widgets/animation-dialog.c
+++ b/plug-ins/animation-play/widgets/animation-dialog.c
@@ -199,7 +199,6 @@ static void        show_loading_progress     (Animation        *animation,
                                               gdouble           load_rate,
                                               AnimationDialog  *dialog);
 static void        animation_update_progress (Animation        *animation,
-                                              gint              first_frame,
                                               gint              num_frames,
                                               gint              playback_start,
                                               gint              playback_stop,
@@ -207,7 +206,6 @@ static void        animation_update_progress (Animation        *animation,
 static void        block_ui                  (Animation        *animation,
                                               AnimationDialog  *dialog);
 static void        unblock_ui                (Animation        *animation,
-                                              gint              first_frame,
                                               gint              num_frames,
                                               gint              playback_start,
                                               gint              playback_stop,
@@ -217,7 +215,6 @@ static void        unblock_ui                (Animation        *animation,
 static void        playback_range_changed    (Animation        *animation,
                                               gint              playback_start,
                                               gint              playback_stop,
-                                              gint              start_pos,
                                               gint              length,
                                               AnimationDialog  *dialog);
 static void        proxy_changed             (Animation        *animation,
@@ -1379,7 +1376,7 @@ update_ui_sensitivity (AnimationDialog *dialog)
 
   /* We can access the progress bar if there are several frames. */
   gtk_widget_set_sensitive (GTK_WIDGET (priv->progress_bar),
-                            animation_get_length (priv->animation) > 1);
+                            animation_get_duration (priv->animation) > 1);
 
   /* Settings are always changeable. */
   gtk_action_group_set_sensitive (priv->settings_actions, TRUE);
@@ -1387,9 +1384,9 @@ update_ui_sensitivity (AnimationDialog *dialog)
 
   /* View are always meaningfull with at least 1 frame. */
   gtk_action_group_set_sensitive (priv->view_actions,
-                                  animation_get_length (priv->animation) >= 1);
+                                  animation_get_duration (priv->animation) >= 1);
   gtk_widget_set_sensitive (GTK_WIDGET (priv->view_bar),
-                            animation_get_length (priv->animation) >= 1);
+                            animation_get_duration (priv->animation) >= 1);
 }
 
 /**** UI CALLBACKS ****/
@@ -1736,7 +1733,7 @@ adjustment_pressed (GtkWidget       *widget,
       GtkAdjustment *adj = gtk_spin_button_get_adjustment (spin);
 
       gtk_adjustment_set_value (adj,
-                                (gdouble) animation_get_position (priv->animation));
+                                (gdouble) animation_get_position (priv->animation) + 1.0);
 
       /* We don't want the middle click to have another usage (in
        * particular, there is likely no need to copy-paste in these spin
@@ -1757,7 +1754,7 @@ startframe_changed (GtkAdjustment   *adjustment,
   if (! priv->animation)
     return;
 
-  animation_set_playback_start (priv->animation, (gint) value);
+  animation_set_playback_start (priv->animation, (gint) value - 1);
 
   update_ui_sensitivity (dialog);
 }
@@ -1772,7 +1769,7 @@ endframe_changed (GtkAdjustment   *adjustment,
   if (! priv->animation)
     return;
 
-  animation_set_playback_stop (priv->animation, (gint) value);
+  animation_set_playback_stop (priv->animation, (gint) value - 1);
 
   update_ui_sensitivity (dialog);
 }
@@ -1949,30 +1946,29 @@ show_loading_progress (Animation       *animation,
 }
 
 static void
-animation_update_progress (Animation      *animation,
-                           gint            first_frame,
-                           gint            num_frames,
-                           gint            playback_start,
-                           gint            playback_stop,
+animation_update_progress (Animation       *animation,
+                           gint             num_frames,
+                           gint             playback_start,
+                           gint             playback_stop,
                            AnimationDialog *dialog)
 {
   AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
   gint frame_spin_size;
-  gint last_frame = num_frames + first_frame - 1;
+  gint last_frame = num_frames;
 
-  frame_spin_size = (gint) (log10 (last_frame - (last_frame % 10))) + 1;
+  frame_spin_size = (gint) (log10 (last_frame + 1 - (last_frame % 10))) + 1;
   gtk_entry_set_width_chars (GTK_ENTRY (priv->startframe_spin), frame_spin_size);
   gtk_entry_set_width_chars (GTK_ENTRY (priv->endframe_spin), frame_spin_size);
 
   gtk_adjustment_configure (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->startframe_spin)),
-                            playback_start,
-                            first_frame,
-                            last_frame,
+                            (gdouble) playback_start + 1.0,
+                            1.0,
+                            (gdouble) last_frame,
                             1.0, 5.0, 0.0);
   gtk_adjustment_configure (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->endframe_spin)),
-                            playback_stop,
-                            playback_start,
-                            last_frame,
+                            (gdouble) playback_stop + 1.0,
+                            (gdouble) playback_start + 1.0,
+                            (gdouble) last_frame,
                             1.0, 5.0, 0.0);
 
   update_ui_sensitivity (dialog);
@@ -1998,7 +1994,6 @@ block_ui (Animation       *animation,
 
 static void
 unblock_ui (Animation      *animation,
-            gint            first_frame,
             gint            num_frames,
             gint            playback_start,
             gint            playback_stop,
@@ -2007,7 +2002,6 @@ unblock_ui (Animation      *animation,
             AnimationDialog *dialog)
 {
   animation_update_progress (animation,
-                             first_frame,
                              num_frames,
                              playback_start,
                              playback_stop,
@@ -2019,7 +2013,6 @@ static void
 playback_range_changed (Animation       *animation,
                         gint             playback_start,
                         gint             playback_stop,
-                        gint             start_pos,
                         gint             length,
                         AnimationDialog *dialog)
 {
@@ -2028,7 +2021,6 @@ playback_range_changed (Animation       *animation,
   GtkAdjustment *stopframe_adjust;
 
   animation_update_progress (animation,
-                             start_pos,
                              length,
                              playback_start,
                              playback_stop,
@@ -2043,8 +2035,8 @@ playback_range_changed (Animation       *animation,
   g_signal_handlers_block_by_func (stopframe_adjust,
                                    G_CALLBACK (endframe_changed),
                                    dialog);
-  gtk_adjustment_set_value (startframe_adjust, playback_start);
-  gtk_adjustment_set_value (stopframe_adjust, playback_stop);
+  gtk_adjustment_set_value (startframe_adjust, playback_start + 1.0);
+  gtk_adjustment_set_value (stopframe_adjust, playback_stop + 1.0);
   g_signal_handlers_unblock_by_func (startframe_adjust,
                                      G_CALLBACK (endframe_changed),
                                      dialog);
@@ -2186,7 +2178,7 @@ repaint_da (GtkWidget       *darea,
                       (gint) ((da_width - priv->zoom * preview_width) / 2),
                       (gint) ((da_height - priv->zoom * preview_height) / 2),
                       da_width, da_height,
-                      (animation_get_length (priv->animation) == 1) ? GDK_RGB_DITHER_MAX : DITHERTYPE,
+                      (animation_get_duration (priv->animation) == 1) ? GDK_RGB_DITHER_MAX : DITHERTYPE,
                       da_data, da_width * 3);
 
   return TRUE;
@@ -2445,7 +2437,7 @@ render_frame (AnimationDialog *dialog,
       drawing_width = priv->shape_drawing_area_width;
       drawing_height = priv->shape_drawing_area_height;
 
-      if (animation_get_length (priv->animation) < 1)
+      if (animation_get_duration (priv->animation) < 1)
         total_alpha_preview (preview_data, drawing_width, drawing_height);
     }
   else
@@ -2460,7 +2452,7 @@ render_frame (AnimationDialog *dialog,
     }
 
   /* When there is no frame to show, we simply display the alpha background and return. */
-  if (buffer && animation_get_length (priv->animation) > 0)
+  if (buffer && animation_get_duration (priv->animation) > 0)
     {
       /* Update the rawframe. */
       if (rawframe_size < drawing_width * drawing_height * 4)
@@ -2535,7 +2527,7 @@ render_frame (AnimationDialog *dialog,
                       (gint) (((gint)drawing_width - priv->zoom * preview_width) / 2),
                       (gint) (((gint)drawing_height - priv->zoom * preview_height) / 2),
                       (gint)drawing_width, (gint)drawing_height,
-                      (animation_get_length (priv->animation) == 1 ?
+                      (animation_get_duration (priv->animation) == 1 ?
                        GDK_RGB_DITHER_MAX : DITHERTYPE),
                       preview_data, drawing_width * 3);
 }
@@ -2588,16 +2580,17 @@ progress_button (GtkWidget       *widget,
   if (event->type == GDK_BUTTON_PRESS)
     {
       GtkAllocation  allocation;
-      guint          goto_frame;
+      gdouble        duration;
+      gint           frame;
 
       gtk_widget_get_allocation (widget, &allocation);
+      duration = (gdouble) animation_get_duration (priv->animation);
 
-      goto_frame = animation_get_start_position (priv->animation) +
-        (gint) (event->x /
-                ((gdouble) allocation.width /
-                 (gdouble) animation_get_length (priv->animation)));
+      frame = (gint) (event->x /
+                      ((gdouble) allocation.width /
+                       ((gdouble) duration - 0.99)));
 
-      animation_jump (priv->animation, goto_frame);
+      animation_jump (priv->animation, frame);
     }
 
   return FALSE;
@@ -2610,16 +2603,17 @@ progress_entered (GtkWidget        *widget,
 {
   AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
   GtkAllocation           allocation;
-  guint                   goto_frame;
+  gdouble                 duration;
+  gint                    frame;
 
   gtk_widget_get_allocation (widget, &allocation);
+  duration = (gdouble) animation_get_duration (priv->animation);
 
-  goto_frame = animation_get_start_position (priv->animation) +
-               (gint) (event->x /
-                       ((gdouble) allocation.width /
-                        (gdouble) animation_get_length (priv->animation)));
+  frame = (gint) (event->x /
+                  ((gdouble) allocation.width /
+                   ((gdouble) duration - 0.99)));
 
-  show_goto_progress (dialog, goto_frame);
+  show_goto_progress (dialog, frame);
 
   return FALSE;
 }
@@ -2631,16 +2625,17 @@ progress_motion (GtkWidget       *widget,
 {
   AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
   GtkAllocation  allocation;
-  guint          goto_frame;
+  gdouble        duration;
+  gint           frame;
 
   gtk_widget_get_allocation (widget, &allocation);
+  duration = (gdouble) animation_get_duration (priv->animation);
 
-  goto_frame = animation_get_start_position (priv->animation) +
-               (gint) (event->x /
-                       ((gdouble) allocation.width /
-                        (gdouble) animation_get_length (priv->animation)));
+  frame = (gint) (event->x /
+                  ((gdouble) allocation.width /
+                   ((gdouble) duration - 0.99)));
 
-  show_goto_progress (dialog, goto_frame);
+  show_goto_progress (dialog, frame);
 
   return FALSE;
 }
@@ -2657,25 +2652,20 @@ progress_left (GtkWidget        *widget,
 
 static void
 show_goto_progress (AnimationDialog *dialog,
-                    gint             goto_frame)
+                    gint             frame)
 {
   AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
   gchar                  *text;
 
   /* update the dialog's progress bar */
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress),
-                                 ((gfloat) (goto_frame - animation_get_start_position (priv->animation)) /
-                                  (gfloat) (animation_get_length (priv->animation) - 0.999)));
+                                 ((gfloat) frame /
+                                  (gfloat) (animation_get_duration (priv->animation) - 0.999)));
+
+  text = g_strdup_printf (_("Go to frame %d of %d"),
+                          frame + 1,
+                          animation_get_duration (priv->animation));
 
-  if (animation_get_start_position (priv->animation) == 1)
-    text = g_strdup_printf (_("Go to frame %d of %d"),
-                            goto_frame,
-                            animation_get_length (priv->animation));
-  else
-    text = g_strdup_printf (_("Go to frame %d [%d-%d]"),
-                            goto_frame,
-                            animation_get_start_position (priv->animation),
-                            animation_get_start_position (priv->animation) + animation_get_length 
(priv->animation) - 1);
   gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress), text);
   g_free (text);
 }
@@ -2688,22 +2678,13 @@ show_playing_progress (AnimationDialog *dialog)
 
   /* update the dialog's progress bar */
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress),
-                                 ((gfloat) (animation_get_position (priv->animation) - 
animation_get_start_position (priv->animation)) /
-                                  (gfloat) (animation_get_length (priv->animation) - 0.999)));
+                                 ((gfloat) animation_get_position (priv->animation) /
+                                  (gfloat) (animation_get_duration (priv->animation) - 0.999)));
+
+  text = g_strdup_printf (_("Frame %d of %d"),
+                          animation_get_position (priv->animation) + 1,
+                          animation_get_duration (priv->animation));
 
-  if (animation_get_start_position (priv->animation) == 1)
-    {
-      text = g_strdup_printf (_("Frame %d of %d"),
-                              animation_get_position (priv->animation),
-                              animation_get_length (priv->animation));
-    }
-  else
-    {
-      text = g_strdup_printf (_("Frame %d [%d-%d]"),
-                              animation_get_position (priv->animation),
-                              animation_get_start_position (priv->animation),
-                              animation_get_start_position (priv->animation) + animation_get_length 
(priv->animation) - 1);
-    }
   gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress), text);
   g_free (text);
 }
diff --git a/plug-ins/animation-play/widgets/animation-storyboard.c 
b/plug-ins/animation-play/widgets/animation-storyboard.c
index 96994b0..613c2de 100644
--- a/plug-ins/animation-play/widgets/animation-storyboard.c
+++ b/plug-ins/animation-play/widgets/animation-storyboard.c
@@ -63,7 +63,6 @@ static void animation_storyboard_finalize              (GObject             *obj
 
 /* Callbacks on animation */
 static void animation_storyboard_load                  (Animation           *animation,
-                                                        G_GNUC_UNUSED gint   first_frame,
                                                         G_GNUC_UNUSED gint   num_frames,
                                                         G_GNUC_UNUSED gint   playback_start,
                                                         G_GNUC_UNUSED gint   playback_stop,
@@ -229,7 +228,6 @@ animation_storyboard_finalize (GObject *object)
  */
 static void
 animation_storyboard_load (Animation           *animation,
-                           gint                 first_frame,
                            gint                 num_frames,
                            gint                 playback_start,
                            gint                 playback_stop,
@@ -285,15 +283,15 @@ animation_storyboard_load (Animation           *animation,
       GtkWidget *duration;
       GtkWidget *disposal;
       gchar     *image_name;
-      gint       panel_num = n_images - i;
+      gint       panel_num = n_images - i - 1;
 
       panel_button = gtk_button_new ();
       gtk_button_set_relief (GTK_BUTTON (panel_button),
                              GTK_RELIEF_NONE);
       gtk_table_attach (GTK_TABLE (view),
                         panel_button, 0, 1,
-                        5 * panel_num - 5,
                         5 * panel_num,
+                        5 * (panel_num + 1),
                         GTK_EXPAND | GTK_FILL,
                         GTK_EXPAND | GTK_FILL,
                         1, 1);
@@ -310,8 +308,8 @@ animation_storyboard_load (Animation           *animation,
       event_box = gtk_event_box_new ();
       gtk_table_attach (GTK_TABLE (view),
                         event_box, 1, 5,
-                        5 * panel_num - 5,
                         5 * panel_num,
+                        5 * (panel_num + 1),
                         GTK_EXPAND | GTK_FILL,
                         GTK_EXPAND | GTK_FILL,
                         1, 1);
@@ -335,8 +333,8 @@ animation_storyboard_load (Animation           *animation,
                          GINT_TO_POINTER (panel_num));
       gtk_table_attach (GTK_TABLE (view),
                         comment, 6, 11,
-                        5 * panel_num - 5,
                         5 * panel_num,
+                        5 * (panel_num + 1),
                         GTK_EXPAND | GTK_FILL,
                         GTK_EXPAND | GTK_FILL,
                         0, 1);
@@ -377,16 +375,16 @@ animation_storyboard_load (Animation           *animation,
       gtk_spin_button_set_increments (GTK_SPIN_BUTTON (duration), 1.0, 10.0);
       gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (duration), TRUE);
       gtk_spin_button_set_value (GTK_SPIN_BUTTON (duration),
-                                 animation_animatic_get_duration (animatic,
-                                                                  panel_num));
+                                 animation_animatic_get_panel_duration (animatic,
+                                                                        panel_num));
       gtk_entry_set_width_chars (GTK_ENTRY (duration), 2);
       /* Allowing non-numeric text to type "ms" or "s". */
       gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (duration), FALSE);
 
       gtk_table_attach (GTK_TABLE (view),
                         duration, 5, 6,
-                        5 * panel_num - 5,
-                        5 * panel_num - 4,
+                        5 * panel_num,
+                        5 * panel_num + 1,
                         0, /* Do not expand nor fill, nor shrink. */
                         0, /* Do not expand nor fill, nor shrink. */
                         0, 1);
@@ -407,8 +405,8 @@ animation_storyboard_load (Animation           *animation,
       gtk_widget_show (image);
       gtk_table_attach (GTK_TABLE (view),
                         disposal, 5, 6,
-                        5 * panel_num - 3,
-                        5 * panel_num - 2,
+                        5 * panel_num + 2,
+                        5 * panel_num + 3,
                         GTK_EXPAND, GTK_EXPAND,
                         0, 1);
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (disposal),
@@ -440,10 +438,10 @@ animation_storyboard_rendered (Animation           *animation,
 
   panel = animation_animatic_get_panel (ANIMATION_ANIMATIC (animation),
                                         frame_number);
-  if (view->priv->current_panel > 0)
+  if (view->priv->current_panel >= 0)
     {
       button = g_list_nth_data (view->priv->panel_buttons,
-                                view->priv->current_panel - 1);
+                                view->priv->current_panel);
       gtk_container_foreach (GTK_CONTAINER (button),
                              (GtkCallback) gtk_widget_destroy,
                              NULL);
@@ -451,7 +449,7 @@ animation_storyboard_rendered (Animation           *animation,
 
   view->priv->current_panel = panel;
   button = g_list_nth_data (view->priv->panel_buttons,
-                            view->priv->current_panel - 1);
+                            view->priv->current_panel);
   arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
   gtk_container_add (GTK_CONTAINER (button), arrow);
   gtk_widget_show (arrow);
@@ -467,9 +465,9 @@ animation_storyboard_duration_spin_changed (GtkSpinButton     *spinbutton,
   panel_num = g_object_get_data (G_OBJECT (spinbutton), "panel-num");
   duration = gtk_spin_button_get_value_as_int (spinbutton);
 
-  animation_animatic_set_duration (animation,
-                                   GPOINTER_TO_INT (panel_num),
-                                   duration);
+  animation_animatic_set_panel_duration (animation,
+                                         GPOINTER_TO_INT (panel_num),
+                                         duration);
 }
 
 static gboolean
@@ -488,7 +486,7 @@ animation_storyboard_comment_keypress (GtkWidget           *entry,
       GtkWidget *comment;
 
       comment = g_list_nth_data (view->priv->comments,
-                                 GPOINTER_TO_INT (panel_num));
+                                 GPOINTER_TO_INT (panel_num) + 1);
       if (comment)
         {
           /* Grab the next comment widget. */
diff --git a/plug-ins/animation-play/widgets/animation-xsheet.c 
b/plug-ins/animation-play/widgets/animation-xsheet.c
index 2913349..4161f3d 100755
--- a/plug-ins/animation-play/widgets/animation-xsheet.c
+++ b/plug-ins/animation-play/widgets/animation-xsheet.c
@@ -72,7 +72,6 @@ static void animation_xsheet_reset_layout (AnimationXSheet *xsheet);
 
 /* Callbacks on animation. */
 static void on_animation_loaded           (Animation       *animation,
-                                           gint             first_frame,
                                            gint             num_frames,
                                            gint             playback_start,
                                            gint             playback_stop,
@@ -185,7 +184,7 @@ animation_xsheet_constructed (GObject *object)
 
   /* We don't know the size yet. */
   xsheet->priv->track_layout = gtk_table_new (1, 1, FALSE);
-  
+
   gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (xsheet),
                                          xsheet->priv->track_layout);
   gtk_table_set_row_spacings (GTK_TABLE (xsheet->priv->track_layout), 0);
@@ -297,7 +296,7 @@ animation_xsheet_reset_layout (AnimationXSheet *xsheet)
    */
 
   n_tracks = animation_cel_animation_get_levels (xsheet->priv->animation);
-  n_frames = animation_get_length (ANIMATION (xsheet->priv->animation));
+  n_frames = animation_get_duration (ANIMATION (xsheet->priv->animation));
 
   /* The cels structure is a matrix of every cel widget. */
   for (j = 0; j < n_tracks; j++)
@@ -479,7 +478,6 @@ on_layer_selection (AnimationLayerView *view,
 
 static void
 on_animation_loaded (Animation       *animation,
-                     gint             first_frame,
                      gint             num_frames,
                      gint             playback_start,
                      gint             playback_stop,
@@ -500,7 +498,7 @@ on_animation_rendered (Animation       *animation,
   GtkWidget *button;
 
   button = g_list_nth_data (xsheet->priv->position_buttons,
-                            frame_number - 1);
+                            frame_number);
   if (xsheet->priv->active_pos_button)
     {
       GtkToggleButton *active_button;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]