private void HandleActorActivated(ClutterFlowBaseActor actor, EventArgs e)
        {
            var album_actor = actor as ClutterFlowAlbum;

            if (album_actor != null)
            {
                UpdateAlbum(album_actor);
            }
        }
        private void ScrollTo(string key)
        {
            ClutterFlowBaseActor actor = null;

            album_loader.Cache.TryGetValue(key, out actor);
            if (actor != null && cover_manager.Covers.Contains(actor))
            {
                cover_manager.TargetIndex = actor.Index;
            }
        }
 protected void SetTextFromCover(ClutterFlowBaseActor cover)
 {
     //Console.WriteLine ("SetTextFromCover called");
     if (cover != null && cover.Label != "")
     {
         Value = cover.Label;
     }
     else
     {
         Value = DefaultValue;
     }
 }
 protected virtual void HandleNewCurrentCover(ClutterFlowBaseActor cover, EventArgs e)
 {
     if (Opacity > 0)
     {
         FadeOut();
     }
     Update();
     if (IsVisible)
     {
         FadeIn();
     }
 }
        private ClutterFlowBaseActor AddActorToList(AlbumInfo generator, SortedList <AlbumInfo, ClutterFlowBaseActor> list, CoverManager cover_manager)
        {
            if (generator == null)
            {
                generator = new AlbumInfo(AlbumInfo.UnknownAlbumTitle);
            }
            string key = ClutterFlowAlbum.CreateCacheKey(generator);
            ClutterFlowBaseActor actor = null;

            if (!Cache.TryGetValue(key, out actor))
            {
                actor = new ClutterFlowAlbum(generator, cover_manager);
                actor.Hide();
                Cache.Add(key, actor);
            }
            actor.SortLabel = Comparer.GetSortLabel(generator);
            list[generator] = actor;
            actor.Index     = list.Count;
            return(actor);
        }
        public List <ClutterFlowBaseActor> GetActors(CoverManager cover_manager)
        {
            SortedList <AlbumInfo, ClutterFlowBaseActor> list =
                new SortedList <AlbumInfo, ClutterFlowBaseActor>(Comparer);

            if (Model != null)
            {
                for (int i = 1; i < Model.Count; i++)
                {
                    AddActorToList(Model[i], list, cover_manager);
                }
                index_map = new List <int>(list.Values.Count);
                for (int i = 0; i < list.Values.Count; i++)
                {
                    ClutterFlowBaseActor actor = list.Values[i];
                    index_map.Add(actor.Index);
                    actor.Index = i;
                }
            }
            return(new List <ClutterFlowBaseActor>(list.Values));
        }
 internal void InvokeActorActivated(ClutterFlowBaseActor cover)
 {
     var handler = ActorActivated;
     if (handler != null) {
         handler (cover, System.EventArgs.Empty);
     }
 }
 public void UpdateLetterLookup(ClutterFlowBaseActor actor)
 {
     string label = actor.SortLabel.ToUpper ().Normalize (System.Text.NormalizationForm.FormKD);
     char letter = label.Length>0 ? char.Parse(label.Substring (0,1)) : '?';
     AlphabetChars key;
     if (char.IsLetter(letter))
         key = (AlphabetChars) letter;
     else
         key = AlphabetChars.unknown;
     if (letter_lookup.ContainsKey (key) && letter_lookup[key] == -1)
         letter_lookup[key] = actor.Index;
 }
        public void Dispose()
        {
            if (reload_timeout > 0) {
                GLib.Source.Remove (reload_timeout);
            }

            behaviour.Dispose ();
            timeline.Dispose ();

            covers.Clear ();
            covers = null;
            current_cover = null;

            base.Dispose ();
        }
 protected void SetTextFromCover(ClutterFlowBaseActor cover)
 {
     //Console.WriteLine ("SetTextFromCover called");
     if (cover!=null && cover.Label!="")
         Value = cover.Label;
     else
         Value = DefaultValue;
 }
 protected virtual void HandleNewCurrentCover(ClutterFlowBaseActor cover, EventArgs e)
 {
     if (Opacity>0) FadeOut ();
     Update ();
     if (IsVisible) FadeIn ();
 }
 private void HandleActorActivated(ClutterFlowBaseActor actor, EventArgs e)
 {
     var album_actor = actor as ClutterFlowAlbum;
     if (album_actor != null) {
         UpdateAlbum (album_actor);
     }
 }
        public void CreateClickedCloneAnimation(ClutterFlowBaseActor actor, uint delay)
        {
            if (actor.Parent!=null) {
                Clone clone = new Clone(actor);
                MoveAndRotateActorCentrally (clone, 0);
                double scaleX, scaleY; actor.GetScale (out scaleX, out scaleY); clone.SetScale (scaleX, scaleY);

                ((Container) actor.Parent).Add (clone);
                clone.Hide ();
                clone.Opacity = 255;
                clone.Depth = ZNear+1;
                Timeline timeline = new Timeline (CoverManager.MaxAnimationSpan*4);
                timeline.Delay = delay;
                timeline.AddMarkerAtTime ("start", 1);
                timeline.MarkerReached += delegate {
                    clone.ShowAll ();
                };
                Animation anmn = clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "opacity" }, new GLib.Value ((byte) 50));
                clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "scale-x" }, new GLib.Value (scaleX*2));
                clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "scale-y" }, new GLib.Value (scaleY*2));
                clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "fixed::anchor-x" }, new GLib.Value (clone.Width/2));
                clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "fixed::anchor-y" }, new GLib.Value (clone.Height/4));
                anmn.Completed += HandleClickedCloneCompleted;
            }
        }
 protected void HideActor(ClutterFlowBaseActor actor)
 {
     actor.Hide ();
 }
 internal void InvokeActorActivated(ClutterFlowBaseActor cover)
 {
     if (ActorActivated!=null) ActorActivated (cover, EventArgs.Empty);
 }
 protected double AlphaFunc(ClutterFlowBaseActor actor, double progress)
 {
     if (actor.Index < 0)
         actor.Data["last_alpha"] = (double) 0;
     else {
         double previous_alpha = (CoverManager.HalfVisCovers - (CoverManager.TotalCovers-1)
                       * progress + actor.Index)
                       / (CoverManager.VisibleCovers-1);
         if (previous_alpha<0) previous_alpha=0;
         if (previous_alpha>1) previous_alpha=1;
         actor.Data["last_alpha"] = previous_alpha;
     }
     return (double) actor.Data["last_alpha"];
 }
 protected double AlphaFunc(ClutterFlowBaseActor actor)
 {
     return AlphaFunc (actor, CoverManager.Timeline.Progress);
 }
 public void CreateClickedCloneAnimation(ClutterFlowBaseActor actor)
 {
     CreateClickedCloneAnimation (actor, 0);
 }
 protected void InvokeNewCurrentCover(ClutterFlowBaseActor cover)
 {
     var handler = NewCurrentCover;
     if (handler != null) {
         handler (cover, System.EventArgs.Empty);
     }
 }
        protected void UpdateActorWithAlpha(ClutterFlowBaseActor actor, double alpha)
        {
            float ratio = Math.Min (0.75f * (float) coverManager.Timeline.Delta / (float) coverManager.VisibleCovers, 1.25f);
            OffsetRotationAngle = (float) ((rotationAngle / 5) * ratio);
            OffsetCenterX = -(float) ((CenterMargin / 2) * ratio);
            OffsetZNear = (int) (-(ZNear-ZFar) * 1.5 * ratio);
            if (coverManager.Timeline.Direction!=TimelineDirection.Forward) {
                OffsetRotationAngle = -OffsetRotationAngle;
                OffsetCenterX = -OffsetCenterX;
            }

            actor.SetScale (coverWidth/actor.Width, coverWidth/actor.Width);
            if (alpha!=0 || alpha!=1) {
                //if (!visible_actors.Contains (actor)) visible_actors.Add (actor);
                actor.Show ();
                if (alpha<AlphaStep) {
                    MoveAndFadeOutActor			(actor, (float) (alpha / AlphaStep), true);
                } else if (alpha>=AlphaStep && alpha<=0.5-AlphaStep) {
                    MoveActorSideways			(actor, (float) ((alpha - AlphaStep) / (0.5f - 2*AlphaStep)), true);
                } else if (alpha>0.5f-AlphaStep && alpha<0.5f+AlphaStep) {
                    MoveAndRotateActorCentrally (actor, (float) ((alpha - 0.5f) / AlphaStep));
                } else if (alpha>=0.5f+AlphaStep && alpha<=1-AlphaStep) {
                    MoveActorSideways			(actor, (float) ((1 - AlphaStep - alpha) / (0.5f - 2*AlphaStep)), false);
                } else if (alpha>1-AlphaStep) {
                    MoveAndFadeOutActor			(actor,  (float) ((1 - alpha) / AlphaStep), false);
                }
            } else {
                //if (visible_actors.Contains (actor)) visible_actors.Remove (actor);
                actor.Hide ();
            }
        }
 protected void UpdateActor(ClutterFlowBaseActor actor)
 {
     UpdateActor (actor, Progress);
 }
 protected void InvokeNewCurrentCover(ClutterFlowBaseActor cover)
 {
     if (NewCurrentCover!=null) NewCurrentCover(cover, EventArgs.Empty);
 }
 private void HandleNewCurrentCover(ClutterFlowBaseActor Actor, EventArgs args)
 {
     if (CoverManager.CurrentCover==this) {
         CoverManager.NewCurrentCover -= HandleNewCurrentCover;
         CoverManager.Behaviour.CreateClickedCloneAnimation (this, CoverManager.MaxAnimationSpan);
     }
 }
 protected void UpdateActor(ClutterFlowBaseActor actor, double progress)
 {
     UpdateActorWithAlpha (actor, AlphaFunc(actor));
 }