From c9fb10a20bf8b949aa7cb923d8f391924e98c9f2 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Sat, 4 Aug 2012 20:12:38 +0200 Subject: [PATCH] Remove some unused statics. --- Output/Themes/Ambient/Screens/ScreenNames.xml | 98 +--------------- Vocaluxe/Menu/Animations/CAnimation.cs | 92 +++++++++++++++ .../Menu/Animations/CAnimationFramework.cs | 95 ++++++++++++++++ Vocaluxe/Menu/Animations/CAnimationResize.cs | 106 ++++++++++++++++++ Vocaluxe/Menu/Animations/IAnimation.cs | 30 +++++ 5 files changed, 324 insertions(+), 97 deletions(-) create mode 100644 Vocaluxe/Menu/Animations/CAnimation.cs create mode 100644 Vocaluxe/Menu/Animations/CAnimationFramework.cs create mode 100644 Vocaluxe/Menu/Animations/CAnimationResize.cs create mode 100644 Vocaluxe/Menu/Animations/IAnimation.cs diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index 289409b4..cbc3beb1 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -28,103 +28,7 @@ - - - - SelectSlidePlayer - - 20 - 105 - -4,00 - 108 - 20 - - - SelectSlideColor - - - - - - - SelectSlidePlayer - - 20 - 260 - -4,00 - 108 - 20 - - - SelectSlideColor - - - - - - - SelectSlidePlayer - - 20 - 415 - -4,00 - 108 - 20 - - - SelectSlideColor - - - - - - - SelectSlidePlayer - - 1152 - 105 - -4,00 - 108 - 20 - - - SelectSlideColor - - - - - - - SelectSlidePlayer - - 1152 - 260 - -4,00 - 108 - 20 - - - SelectSlideColor - - - - - - - SelectSlidePlayer - - 1152 - 415 - -4,00 - 108 - 20 - - - SelectSlideColor - - - - + PlayerSelector diff --git a/Vocaluxe/Menu/Animations/CAnimation.cs b/Vocaluxe/Menu/Animations/CAnimation.cs new file mode 100644 index 00000000..2d062033 --- /dev/null +++ b/Vocaluxe/Menu/Animations/CAnimation.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +using Vocaluxe.Base; +using Vocaluxe.Lib.Draw; + +namespace Vocaluxe.Menu.Animations +{ + public class CAnimation:IAnimation + { + private IAnimation _Animation; + + public CAnimation(EAnimationType Type) + { + setAnimation(Type); + } + + public void Init() + { + _Animation.Init(); + } + + public bool LoadAnimation(string item, XPathNavigator navigator) + { + return _Animation.LoadAnimation(item, navigator); + } + + public bool SaveAnimation(XmlWriter writer) + { + return _Animation.SaveAnimation(writer); + } + + public void StartAnimation() + { + _Animation.StartAnimation(); + } + + public void StopAnimation() + { + _Animation.StopAnimation(); + } + + public void ResetAnimation() + { + _Animation.ResetAnimation(); + } + + public bool AnimationActive() + { + return _Animation.AnimationActive(); + } + + public void Update() + { + _Animation.Update(); + } + + public void setRect(SRectF rect) + { + _Animation.setRect(rect); + } + + public SRectF getRect() + { + return _Animation.getRect(); + } + + public void setColor(SColorF color) + { + _Animation.setColor(color); + } + + public SColorF getColor() + { + return _Animation.getColor(); + } + + public void setAnimation(EAnimationType Type) + { + switch (Type) + { + case EAnimationType.Resize: + _Animation = new CAnimationResize(); + break; + } + } + } +} diff --git a/Vocaluxe/Menu/Animations/CAnimationFramework.cs b/Vocaluxe/Menu/Animations/CAnimationFramework.cs new file mode 100644 index 00000000..3ac3d18c --- /dev/null +++ b/Vocaluxe/Menu/Animations/CAnimationFramework.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +using Vocaluxe.Base; +using Vocaluxe.Lib.Draw; + +namespace Vocaluxe.Menu.Animations +{ + public enum EAnimationType + { + Resize + } + + public enum EAnimationRepeat + { + None, + Reset, + Repeat, + RepeatWithReset + } + + public abstract class CAnimationFramework:IAnimation + { + public bool _AnimationLoaded; + + public EAnimationType Type; + public EAnimationRepeat Repeat; + public float Speed; + + public Stopwatch Timer = new Stopwatch(); + public bool ResetMode = false; + + public abstract void Init(); + + public virtual bool LoadAnimation(string item, XPathNavigator navigator) + { + _AnimationLoaded = true; + + _AnimationLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Speed", navigator, ref Speed); + _AnimationLoaded &= CHelper.TryGetEnumValueFromXML(item + "/Repeat", navigator, ref Repeat); + + return _AnimationLoaded; + } + + public virtual bool SaveAnimation(XmlWriter writer) + { + return false; + } + + public virtual void StartAnimation() + { + Timer.Start(); + } + + public virtual void StopAnimation() + { + Timer.Stop(); + Timer.Reset(); + } + + public virtual void ResetAnimation() + { + ResetMode = !ResetMode; + } + + public virtual bool AnimationActive() + { + return Timer.IsRunning; + } + + public virtual void setRect(SRectF rect) + { + } + + public virtual SRectF getRect() + { + return new SRectF(); + } + + public virtual void setColor(SColorF color) + { + } + + public virtual SColorF getColor() + { + return new SColorF(); + } + + public abstract void Update(); + } +} diff --git a/Vocaluxe/Menu/Animations/CAnimationResize.cs b/Vocaluxe/Menu/Animations/CAnimationResize.cs new file mode 100644 index 00000000..ecc77feb --- /dev/null +++ b/Vocaluxe/Menu/Animations/CAnimationResize.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +using Vocaluxe.Base; +using Vocaluxe.Lib.Draw; + +namespace Vocaluxe.Menu.Animations +{ + public class CAnimationResize : CAnimationFramework + { + public SRectF FinalRect; + public SRectF CurrentRect; + public SRectF OriginalRect; + + public CAnimationResize() + { + } + + public override void Init() + { + Type = EAnimationType.Resize; + } + + public override bool LoadAnimation(string item, XPathNavigator navigator) + { + //Load normal animation-options + _AnimationLoaded &= base.LoadAnimation(item, navigator); + + //Load specific animation-options + _AnimationLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref FinalRect.X); + _AnimationLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref FinalRect.Y); + _AnimationLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref FinalRect.W); + _AnimationLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref FinalRect.H); + + return _AnimationLoaded; + } + + public override void setRect(SRectF rect) + { + OriginalRect = rect; + } + + public override SRectF getRect() + { + return CurrentRect; + } + + public override void StartAnimation() + { + base.StartAnimation(); + + CurrentRect = OriginalRect; + } + + public override void Update() + { + //Update CurrentRect + if (!ResetMode) + { + CLog.LogError((CurrentRect.X + ((FinalRect.X - CurrentRect.X) / Speed * Timer.ElapsedMilliseconds)).ToString("#.#####")); + CurrentRect.X = CurrentRect.X + ((FinalRect.X - CurrentRect.X) / Speed * Timer.ElapsedMilliseconds); + CurrentRect.Y = CurrentRect.Y + ((FinalRect.Y - CurrentRect.Y) / Speed * Timer.ElapsedMilliseconds); + CurrentRect.H = CurrentRect.H + ((FinalRect.H - CurrentRect.H) / Speed * Timer.ElapsedMilliseconds); + CurrentRect.W = CurrentRect.W + ((FinalRect.W - CurrentRect.W) / Speed * Timer.ElapsedMilliseconds); + } + else + { + CurrentRect.X = CurrentRect.X + ((OriginalRect.X - CurrentRect.X) / Speed * Timer.ElapsedMilliseconds); + CurrentRect.Y = CurrentRect.Y + ((OriginalRect.Y - CurrentRect.Y) / Speed * Timer.ElapsedMilliseconds); + CurrentRect.H = CurrentRect.H + ((OriginalRect.H - CurrentRect.H) / Speed * Timer.ElapsedMilliseconds); + CurrentRect.W = CurrentRect.W + ((OriginalRect.W - CurrentRect.W) / Speed * Timer.ElapsedMilliseconds); + } + + if (CurrentRect.X == FinalRect.X && CurrentRect.Y == FinalRect.Y && CurrentRect.H == FinalRect.H && CurrentRect.W == FinalRect.W) + { + switch (Repeat) + { + case EAnimationRepeat.Repeat: + StopAnimation(); + CurrentRect = OriginalRect; + StartAnimation(); + break; + + case EAnimationRepeat.RepeatWithReset: + ResetAnimation(); + break; + + case EAnimationRepeat.Reset: + if (!ResetMode) + ResetAnimation(); + else + StopAnimation(); + break; + + case EAnimationRepeat.None: + StopAnimation(); + break; + } + } + } + } +} diff --git a/Vocaluxe/Menu/Animations/IAnimation.cs b/Vocaluxe/Menu/Animations/IAnimation.cs new file mode 100644 index 00000000..444181c7 --- /dev/null +++ b/Vocaluxe/Menu/Animations/IAnimation.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +using Vocaluxe.Base; +using Vocaluxe.Lib.Draw; + +namespace Vocaluxe.Menu.Animations +{ + interface IAnimation + { + void Init(); + bool LoadAnimation(string item, XPathNavigator navigator); + bool SaveAnimation(XmlWriter writer); + + void setRect(SRectF rect); + SRectF getRect(); + void setColor(SColorF color); + SColorF getColor(); + + void StartAnimation(); + void StopAnimation(); + void ResetAnimation(); + bool AnimationActive(); + void Update(); + } +}