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

« back to all changes in this revision

Viewing changes to src/ClutterFlow/ClutterFlow/Caption.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:
31
31
 
32
32
namespace ClutterFlow.Captions
33
33
{
34
 
        
35
 
        
36
 
        public abstract class Caption : Clutter.Text
37
 
        {
38
 
                
39
 
                #region Fields
40
 
                public abstract string DefaultValue { get; set; }
41
 
 
42
 
                private CoverManager coverManager;
43
 
                public CoverManager CoverManager {
 
34
 
 
35
 
 
36
    public abstract class Caption : Clutter.Text
 
37
    {
 
38
 
 
39
        #region Fields
 
40
        public abstract string DefaultValue { get; set; }
 
41
 
 
42
        private CoverManager coverManager;
 
43
        public CoverManager CoverManager {
44
44
            get { return coverManager; }
45
45
        }
46
 
                
47
 
                protected Animation aFade = null;
48
 
                #endregion
49
 
                
50
 
                public Caption (CoverManager coverManager, string font_name, Color color) : base (clutter_text_new ())
51
 
                {
52
 
                        this.coverManager = coverManager;
53
 
                        Editable = false;
54
 
                        Selectable = false;
55
 
                        Activatable = false;
56
 
                        CursorVisible = false;
57
 
                        LineAlignment = Pango.Alignment.Center;
58
 
                        FontName = font_name;
59
 
                        SetColor (color);
60
 
                        Value = DefaultValue;
61
 
 
62
 
                        UpdatePosition ();
63
 
                }
64
 
 
65
 
                #region Methods
66
 
                [DllImport("libclutter-glx-1.0.so.0")]
67
 
                static extern IntPtr clutter_text_new ();
68
 
                
69
 
                public virtual void FadeOut ()
70
 
                {
71
 
                        EventHandler hFadeOut = delegate (object sender, EventArgs e) {
72
 
                                aFade = this.Animatev ((ulong) AnimationMode.Linear.value__, (uint) (CoverManager.MaxAnimationSpan*0.5f), new string[] { "opacity" }, new GLib.Value ((byte) 0));
73
 
                        };
74
 
                        if (aFade!=null && aFade.Timeline!=null && aFade.Timeline.IsPlaying)
75
 
                                aFade.Completed +=  hFadeOut;
76
 
                        else
77
 
                                hFadeOut (this, EventArgs.Empty);
78
 
                }
79
 
 
80
 
                public virtual void FadeIn ()
81
 
                {
82
 
                        EventHandler hFadeIn = delegate (object sender, EventArgs e) {
83
 
                                aFade = this.Animatev ((ulong) AnimationMode.Linear.value__, (uint) (CoverManager.MaxAnimationSpan*0.5f), new string[] { "opacity" }, new GLib.Value ((byte) 255));
84
 
                        };
85
 
                        if (aFade!=null && aFade.Timeline!=null && aFade.Timeline.IsPlaying)
86
 
                                aFade.Completed +=  hFadeIn;
87
 
                        else
88
 
                                hFadeIn (this, EventArgs.Empty);
89
 
                }
90
 
 
91
 
                public virtual void Update ()
92
 
                {
93
 
                        UpdatePosition ();
94
 
                }
95
 
                
96
 
                public abstract void UpdatePosition ();
97
 
                #endregion
98
 
        }
 
46
 
 
47
        protected Animation aFade = null;
 
48
        #endregion
 
49
 
 
50
        public Caption (CoverManager coverManager, string font_name, Color color) : base (clutter_text_new ())
 
51
        {
 
52
            this.coverManager = coverManager;
 
53
            Editable = false;
 
54
            Selectable = false;
 
55
            Activatable = false;
 
56
            CursorVisible = false;
 
57
            LineAlignment = Pango.Alignment.Center;
 
58
            FontName = font_name;
 
59
            SetColor (color);
 
60
            Value = DefaultValue;
 
61
 
 
62
            UpdatePosition ();
 
63
        }
 
64
 
 
65
        #region Methods
 
66
        [DllImport("libclutter-glx-1.0.so.0")]
 
67
        static extern IntPtr clutter_text_new ();
 
68
 
 
69
        public virtual void FadeOut ()
 
70
        {
 
71
            EventHandler hFadeOut = delegate (object sender, EventArgs e) {
 
72
                aFade = this.Animatev ((ulong) AnimationMode.Linear.value__, (uint) (CoverManager.MaxAnimationSpan*0.5f), new string[] { "opacity" }, new GLib.Value ((byte) 0));
 
73
            };
 
74
            if (aFade!=null && aFade.Timeline!=null && aFade.Timeline.IsPlaying)
 
75
                aFade.Completed +=  hFadeOut;
 
76
            else
 
77
                hFadeOut (this, EventArgs.Empty);
 
78
        }
 
79
 
 
80
        public virtual void FadeIn ()
 
81
        {
 
82
            EventHandler hFadeIn = delegate (object sender, EventArgs e) {
 
83
                aFade = this.Animatev ((ulong) AnimationMode.Linear.value__, (uint) (CoverManager.MaxAnimationSpan*0.5f), new string[] { "opacity" }, new GLib.Value ((byte) 255));
 
84
            };
 
85
            if (aFade!=null && aFade.Timeline!=null && aFade.Timeline.IsPlaying)
 
86
                aFade.Completed +=  hFadeIn;
 
87
            else
 
88
                hFadeIn (this, EventArgs.Empty);
 
89
        }
 
90
 
 
91
        public virtual void Update ()
 
92
        {
 
93
            UpdatePosition ();
 
94
        }
 
95
 
 
96
        public abstract void UpdatePosition ();
 
97
        #endregion
 
98
    }
99
99
}