~ubuntu-branches/debian/jessie/banshee-community-extensions/jessie

« back to all changes in this revision

Viewing changes to src/ClutterFlow/ClutterFlow/TrackCaption.cs

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-09-20 18:45:46 UTC
  • mfrom: (1.2.9 upstream) (5.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20110920184546-3ahue2qplydc4t0e
Tags: 2.2.0-1
* [4940fab] Imported Upstream version 2.2.0
  + Notable bug fixes:
    - Karaoke: Fix crash when switching to Now Playing
    - Lyrics: Fix crash when switching to Now Playing

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
namespace ClutterFlow.Captions
32
32
{
33
 
        
34
 
        
35
 
        public class TrackCaption : Caption
36
 
        {
37
 
                #region Fields
38
 
                protected string defaultValue = "";
39
 
                public override string DefaultValue {
40
 
                        get { return defaultValue; }
41
 
                        set {
42
 
                                if (value!=defaultValue) {
43
 
                                        if (Value==defaultValue) Value = value;
44
 
                                        defaultValue = value;
45
 
                                }
46
 
                        }
47
 
                }
48
 
                #endregion
49
 
                
50
 
                public TrackCaption (CoverManager coverManager, string font_name, Color color) : base (coverManager, font_name, color)
51
 
                {
52
 
                }
53
 
 
54
 
                #region Methods
55
 
 
56
 
                public override void FadeIn ()
57
 
                {
58
 
                        EventHandler hFadeIn = delegate (object sender, EventArgs e) {
59
 
                                this.Value = new_caption;
60
 
                                this.UpdatePosition ();
61
 
                                this.Animatev ((ulong) AnimationMode.Linear.value__, (uint) (CoverManager.MaxAnimationSpan*0.5f), new string[] { "opacity" }, new GLib.Value ((byte) 255));
62
 
                                aFade = null;
63
 
                        };
64
 
                        if (aFade!=null && aFade.Timeline.IsPlaying)
65
 
                                aFade.Completed +=  hFadeIn;
66
 
                        else
67
 
                                hFadeIn (this, EventArgs.Empty);
68
 
                }
69
 
 
70
 
                
71
 
                public override void UpdatePosition ()
72
 
                {
73
 
                        if (Stage!=null) {
74
 
                                SetAnchorPoint (Width*0.5f, Height*0.5f);
75
 
                                SetPosition(CoverManager.Behaviour.CenterX, Math.Max(CoverManager.Behaviour.CenterY - CoverManager.Behaviour.CoverWidth + Height*3, Height*3.6f));
76
 
                        }
77
 
                }
78
 
 
79
 
                private string new_caption;
80
 
                public void SetValueWithAnim (string caption) {
81
 
                        new_caption = caption;
82
 
                        if (Opacity>0) FadeOut ();
83
 
                        FadeIn ();
84
 
                }
85
 
                #endregion
86
 
        }
 
33
    public class TrackCaption : Caption
 
34
    {
 
35
        #region Fields
 
36
        protected string defaultValue = "";
 
37
        public override string DefaultValue {
 
38
            get { return defaultValue; }
 
39
            set {
 
40
                if (value!=defaultValue) {
 
41
                    if (Value==defaultValue) Value = value;
 
42
                    defaultValue = value;
 
43
                }
 
44
            }
 
45
        }
 
46
        #endregion
 
47
 
 
48
        public TrackCaption (CoverManager coverManager, string font_name, Color color) : base (coverManager, font_name, color)
 
49
        {
 
50
        }
 
51
 
 
52
        #region Methods
 
53
 
 
54
        public override void FadeIn ()
 
55
        {
 
56
            EventHandler hFadeIn = delegate (object sender, EventArgs e) {
 
57
                this.Value = new_caption;
 
58
                this.UpdatePosition ();
 
59
                this.Animatev ((ulong) AnimationMode.Linear.value__, (uint) (CoverManager.MaxAnimationSpan*0.5f), new string[] { "opacity" }, new GLib.Value ((byte) 255));
 
60
                aFade = null;
 
61
            };
 
62
            if (aFade!=null && aFade.Timeline.IsPlaying) {
 
63
                aFade.Completed +=  hFadeIn;
 
64
            } else {
 
65
                hFadeIn (this, EventArgs.Empty);
 
66
            }
 
67
        }
 
68
 
 
69
 
 
70
        public override void UpdatePosition ()
 
71
        {
 
72
            if (Stage!=null) {
 
73
                SetAnchorPoint (Width*0.5f, Height*0.5f);
 
74
                SetPosition(CoverManager.Behaviour.CenterX, Math.Max(CoverManager.Behaviour.CenterY - CoverManager.Behaviour.CoverWidth + Height*3, Height*3.6f));
 
75
            }
 
76
        }
 
77
 
 
78
        private string new_caption;
 
79
        public void SetValueWithAnim (string caption) {
 
80
            new_caption = caption;
 
81
            if (Opacity>0) {
 
82
                FadeOut ();
 
83
            }
 
84
            FadeIn ();
 
85
        }
 
86
        #endregion
 
87
    }
87
88
}
88