From 9ab0ea5f34554636bce578a886a8828705a3e970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Mon, 15 Sep 2014 19:35:00 +0200 Subject: [PATCH] Update more LoadTextures-methods. Some changes are a bit ugly, but will removed later. --- VocaluxeLib/Menu/CButton.cs | 46 +++++- VocaluxeLib/Menu/CEqualizer.cs | 13 ++ VocaluxeLib/Menu/CLyric.cs | 6 + VocaluxeLib/Menu/CNameSelection.cs | 68 +++++---- VocaluxeLib/Menu/CParticle.cs | 59 ++++---- VocaluxeLib/Menu/CPlaylist.cs | 106 ++++++++------ .../Menu/SongMenu/CSongMenuFramework.cs | 134 ++--------------- .../Menu/SongMenu/CSongMenuTileBoard.cs | 136 ++++++++++++++---- 8 files changed, 298 insertions(+), 270 deletions(-) diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index 82f0970a..8d88f7f7 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -39,6 +39,9 @@ namespace VocaluxeLib.Menu public SThemeColor SelColor; [XmlElement("Text")] public SThemeText Text; + [XmlElement("SText")] + public SThemeText SText; + public bool STextSpecified; [XmlElement("Reflection")] public SReflection Reflection; [XmlElement("SelReflection")] @@ -53,8 +56,10 @@ namespace VocaluxeLib.Menu Color = new SThemeColor(theme.Color); SelColor = new SThemeColor(theme.SelColor); Text = new SThemeText(theme.Text); + SText = new SThemeText(theme.SText); Reflection = new SReflection(theme.Reflection); SelReflection = new SReflection(theme.SelReflection); + STextSpecified = theme.STextSpecified; } } @@ -70,9 +75,8 @@ namespace VocaluxeLib.Menu public SColorF Color; public SColorF SelColor; - private bool _IsSelText; - public readonly CText Text; - private readonly CText _SelText; + public CText Text; + private CText _SelText; private bool _Reflection; private float _ReflectionSpace; @@ -216,7 +220,7 @@ namespace VocaluxeLib.Menu Text.Z = Rect.Z; if (xmlReader.ItemExists(item + "/SText")) { - _IsSelText = true; + _Theme.STextSpecified = true; _ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true); _SelText.Z = Rect.Z; } @@ -258,6 +262,7 @@ namespace VocaluxeLib.Menu _Theme.Color.Color = new SColorF(Color); _Theme.SelColor.Color = new SColorF(SelColor); _Theme.Text = Text.GetTheme(); + _Theme.SText = _SelText.GetTheme(); LoadTextures(); } @@ -308,7 +313,7 @@ namespace VocaluxeLib.Menu } Text.SaveTheme(writer); - if (_IsSelText) + if (_Theme.STextSpecified) _SelText.SaveTheme(writer); writer.WriteComment(" If exists:"); @@ -361,7 +366,7 @@ namespace VocaluxeLib.Menu else Text.DrawRelative(Rect.X, Rect.Y); } - else if (!_IsSelText) + else if (!_Theme.STextSpecified) { texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); @@ -375,7 +380,7 @@ namespace VocaluxeLib.Menu else Text.DrawRelative(Rect.X, Rect.Y); } - else if (_IsSelText) + else if (_Theme.STextSpecified) { texture = SelTexture ?? CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); @@ -403,13 +408,40 @@ namespace VocaluxeLib.Menu public void LoadTextures() { + Text = new CText(_Theme.Text, _PartyModeID); Text.LoadTextures(); + if (_Theme.STextSpecified) + { + _SelText = new CText(_Theme.SText, _PartyModeID); + _SelText.LoadTextures(); + } + if (!String.IsNullOrEmpty(_Theme.Color.Name)) Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID); + else + Color = _Theme.Color.Color; if (!String.IsNullOrEmpty(_Theme.SelColor.Name)) SelColor = CBase.Theme.GetColor(_Theme.SelColor.Name, _PartyModeID); + else + SelColor = _Theme.SelColor.Color; + + Rect = _Theme.Rect; + + _Reflection = _Theme.Reflection.Enabled; + if (_Reflection) + { + _ReflectionHeight = _Theme.Reflection.Height; + _ReflectionSpace = _Theme.Reflection.Space; + } + + _SelReflection = _Theme.Reflection.Enabled; + if (_SelReflection) + { + _SelReflectionHeight = _Theme.SelReflection.Height; + _SelReflectionSpace = _Theme.SelReflection.Space; + } } public void ReloadTextures() diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index 958db155..1f533e7e 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -344,9 +344,22 @@ namespace VocaluxeLib.Menu { if (!String.IsNullOrEmpty(_Theme.Color.Name)) Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID); + else + Color = _Theme.Color.Color; if (!String.IsNullOrEmpty(_Theme.MaxColor.Name)) MaxColor = CBase.Theme.GetColor(_Theme.MaxColor.Name, _PartyModeID); + else + MaxColor = _Theme.MaxColor.Color; + + Rect = _Theme.Rect; + Space = _Theme.Space; + Reflection = _Theme.Reflection.Enabled; + if(Reflection) + { + ReflectionHeight = _Theme.Reflection.Height; + ReflectionSpace = _Theme.Reflection.Space; + } } public void ReloadTextures() diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index bc2418b1..c7e20105 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -507,9 +507,15 @@ namespace VocaluxeLib.Menu { if (!String.IsNullOrEmpty(_Theme.Color.Name)) _Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID); + else + _Color = _Theme.Color.Color; if (!String.IsNullOrEmpty(_Theme.SColor.Name)) _ColorProcessed = CBase.Theme.GetColor(_Theme.SColor.Name, _PartyModeID); + else + _ColorProcessed = _Theme.SColor.Color; + + Rect = _Theme.Rect; } public void ReloadTextures() diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index a8d93e17..1e061cf4 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -62,6 +62,10 @@ namespace VocaluxeLib.Menu public int NumW; [XmlElement("NumH")] public int NumH; + [XmlElement("SpaceW")] + public float SpaceW; + [XmlElement("SpaceH")] + public float SpaceH; [XmlElement("Name")] public SThemeNameSelectionName Name; @@ -71,6 +75,8 @@ namespace VocaluxeLib.Menu H = theme.H; NumW = theme.NumW; NumH = theme.NumH; + SpaceW = theme.SpaceW; + SpaceH = theme.SpaceH; Name = new SThemeNameSelectionName(theme.Name); } } @@ -143,14 +149,6 @@ namespace VocaluxeLib.Menu public SColorF ColorEmptyTile; - private int _NumW; - private int _NumH; - - private float _SpaceW; - private float _SpaceH; - - private int _TileW; - private int _TileH; public int Offset; private int _ActualSelection = -1; @@ -194,7 +192,7 @@ namespace VocaluxeLib.Menu _PlayerSelector = new CStatic(_PartyModeID) { Texture = _TextureTileSelected, - Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f), + Rect = new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f), Visible = false }; @@ -228,12 +226,12 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", out _Theme.TextureTileSelectedName, String.Empty); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _TileW); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _TileH); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumW", ref _NumW); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumH", ref _NumH); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceW", ref _SpaceW); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _SpaceH); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _Theme.Tiles.W); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _Theme.Tiles.H); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumW", ref _Theme.Tiles.NumW); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumH", ref _Theme.Tiles.NumH); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceW", ref _Theme.Tiles.SpaceW); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _Theme.Tiles.SpaceH); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.Tiles.Name.Space); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.Tiles.Name.Height); _ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", out _Theme.Tiles.Name.Font, "Normal"); @@ -256,10 +254,6 @@ namespace VocaluxeLib.Menu _Theme.Name = elementName; _Theme.Rect = new SRectF(Rect); - _Theme.Tiles.H = _TileH; - _Theme.Tiles.W = _TileW; - _Theme.Tiles.NumH = _NumH; - _Theme.Tiles.NumW = _NumW; _Theme.ColorEmptyTile.Color = new SColorF(ColorEmptyTile); LoadTextures(); @@ -301,14 +295,14 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Options for tiles"); writer.WriteStartElement("Tiles"); writer.WriteComment(", : Width and height of tile"); - writer.WriteElementString("W", _TileW.ToString()); - writer.WriteElementString("H", _TileH.ToString()); + writer.WriteElementString("W", _Theme.Tiles.W.ToString()); + writer.WriteElementString("H", _Theme.Tiles.H.ToString()); writer.WriteComment(", : Number of tiles"); - writer.WriteElementString("NumW", _NumW.ToString()); - writer.WriteElementString("NumH", _NumH.ToString()); + writer.WriteElementString("NumW", _Theme.Tiles.NumW.ToString()); + writer.WriteElementString("NumH", _Theme.Tiles.NumH.ToString()); writer.WriteComment(", : Space between tiles"); - writer.WriteElementString("SpaceW", _SpaceW.ToString("#0.00")); - writer.WriteElementString("SpaceH", _SpaceH.ToString("#0.00")); + writer.WriteElementString("SpaceW", _Theme.Tiles.SpaceW.ToString("#0.00")); + writer.WriteElementString("SpaceH", _Theme.Tiles.SpaceH.ToString("#0.00")); writer.WriteComment(": Options for player-name"); writer.WriteStartElement("Name"); writer.WriteComment(": Space between name and tile"); @@ -395,20 +389,20 @@ namespace VocaluxeLib.Menu break; case Keys.Up: - if (_ActualSelection - _NumW > -1) - _ActualSelection -= _NumW; + if (_ActualSelection - _Theme.Tiles.NumW > -1) + _ActualSelection -= _Theme.Tiles.NumW; else if (Offset > 0) { UpdateList(Offset - 1); - _ActualSelection += _Tiles.Count - _NumW; + _ActualSelection += _Tiles.Count - _Theme.Tiles.NumW; } break; case Keys.Down: - if (_ActualSelection + _NumW < _Tiles.Count) + if (_ActualSelection + _Theme.Tiles.NumW < _Tiles.Count) { - if (_Tiles[_ActualSelection + _NumW].ProfileID != -1) - _ActualSelection += _NumW; + if (_Tiles[_ActualSelection + _Theme.Tiles.NumW].ProfileID != -1) + _ActualSelection += _Theme.Tiles.NumW; } else { @@ -416,7 +410,7 @@ namespace VocaluxeLib.Menu UpdateList(Offset + 1); if (offset != Offset) { - _ActualSelection = _ActualSelection - _Tiles.Count + _NumW; + _ActualSelection = _ActualSelection - _Tiles.Count + _Theme.Tiles.NumW; if (_Tiles[_ActualSelection].ProfileID == -1) { for (int i = _Tiles.Count - 1; i >= 0; i--) @@ -558,9 +552,13 @@ namespace VocaluxeLib.Menu if (!String.IsNullOrEmpty(_Theme.ColorEmptyTile.Name)) ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTile.Name, _PartyModeID); + else + ColorEmptyTile = _Theme.ColorEmptyTile.Color; if (!String.IsNullOrEmpty(_Theme.Tiles.Name.Color.Name)) _Theme.Tiles.Name.Color.Color = CBase.Theme.GetColor(_Theme.Tiles.Name.Color.Name, _PartyModeID); + + Rect = _Theme.Rect; } public void ReloadTextures() @@ -616,11 +614,11 @@ namespace VocaluxeLib.Menu private void _PrepareTiles() { _Tiles.Clear(); - for (int i = 0; i < _NumH; i++) + for (int i = 0; i < _Theme.Tiles.NumH; i++) { - for (int j = 0; j < _NumW; j++) + for (int j = 0; j < _Theme.Tiles.NumW; j++) { - var rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z); + var rect = new SRectF(Rect.X + j * (_Theme.Tiles.W + _Theme.Tiles.SpaceW), Rect.Y + i * (_Theme.Tiles.H + _Theme.Tiles.SpaceH), _Theme.Tiles.W, _Theme.Tiles.H, Rect.Z); var tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect) {Aspect = EAspect.Crop}; var tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.Tiles.Name.Space, rect.Z, _Theme.Tiles.Name.Height, rect.W, EAlignment.Center, _Theme.Tiles.Name.Style, _Theme.Tiles.Name.Font, _Theme.Tiles.Name.Color.Color, ""); diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index 7f6aec9a..7dc321de 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -335,9 +335,6 @@ namespace VocaluxeLib.Menu public bool Visible; private readonly List _Stars; - private int _MaxNumber; - private float _Size; - private EParticleType _Type; private readonly Stopwatch _SpawnTimer; private float _NextSpawnTime; @@ -376,9 +373,9 @@ namespace VocaluxeLib.Menu Rect = rect; Color = color; _Theme.TextureName = textureName; - _MaxNumber = maxNumber; - _Size = size; - _Type = type; + _Theme.MaxNumber = maxNumber; + _Theme.Size = size; + _Theme.Type = type; _SpawnTimer = new Stopwatch(); _NextSpawnTime = 0f; Visible = true; @@ -393,9 +390,9 @@ namespace VocaluxeLib.Menu Color = color; _Theme.TextureName = String.Empty; Texture = texture; - _MaxNumber = maxNumber; - _Size = size; - _Type = type; + _Theme.MaxNumber = maxNumber; + _Theme.Size = size; + _Theme.Type = type; _SpawnTimer = new Stopwatch(); _NextSpawnTime = 0f; Visible = true; @@ -436,18 +433,15 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); } - _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Type); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Size); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _MaxNumber); + _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Theme.Size); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _Theme.MaxNumber); if (_ThemeLoaded) { _Theme.Name = elementName; _Theme.Rect = new SRectF(Rect); _Theme.Color.Color = new SColorF(Color); - _Theme.Type = _Type; - _Theme.Size = _Size; - _Theme.MaxNumber = _MaxNumber; LoadTextures(); } return _ThemeLoaded; @@ -482,11 +476,11 @@ namespace VocaluxeLib.Menu } writer.WriteComment(": Type of ParticleEffect: " + CHelper.ListStrings(Enum.GetNames(typeof(EParticleType)))); - writer.WriteElementString("Type", Enum.GetName(typeof(EParticleType), _Type)); + writer.WriteElementString("Type", Enum.GetName(typeof(EParticleType), _Theme.Type)); writer.WriteComment(": Size of particle"); - writer.WriteElementString("Size", _Size.ToString("#0.00")); + writer.WriteElementString("Size", _Theme.Size.ToString("#0.00")); writer.WriteComment(": Max number of drawn particles"); - writer.WriteElementString("MaxNumber", _MaxNumber.ToString("#0")); + writer.WriteElementString("MaxNumber", _Theme.MaxNumber.ToString("#0")); writer.WriteEndElement(); return true; @@ -511,9 +505,9 @@ namespace VocaluxeLib.Menu _SpawnTimer.Start(); } - while (_Stars.Count < _MaxNumber && doSpawn) + while (_Stars.Count < _Theme.MaxNumber && doSpawn) { - float size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2; + float size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2; float lifetime = 0f; float vx = 0f; float vy = 0f; @@ -521,10 +515,10 @@ namespace VocaluxeLib.Menu float vsize = 0f; _NextSpawnTime = 0f; - switch (_Type) + switch (_Theme.Type) { case EParticleType.Twinkle: - size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2; + size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2; lifetime = CBase.Game.GetRandom(500) / 1000f + 0.5f; vx = -CBase.Game.GetRandom(10000) / 50f + 100f; vy = -CBase.Game.GetRandom(10000) / 50f + 100f; @@ -533,7 +527,7 @@ namespace VocaluxeLib.Menu break; case EParticleType.Star: - size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2; + size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2; lifetime = CBase.Game.GetRandom(1000) / 500f + 0.2f; vx = -CBase.Game.GetRandom(1000) / 50f + 10f; vy = -CBase.Game.GetRandom(1000) / 50f + 10f; @@ -542,19 +536,19 @@ namespace VocaluxeLib.Menu break; case EParticleType.Snow: - size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2; + size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2; lifetime = CBase.Game.GetRandom(5000) / 50f + 10f; vx = -CBase.Game.GetRandom(1000) / 50f + 10f; vy = CBase.Game.GetRandom(1000) / 50f + Math.Abs(vx) + 10f; vr = -CBase.Game.GetRandom(200) / 50f + 2f; vsize = lifetime * 2f; - _NextSpawnTime = lifetime / _MaxNumber; + _NextSpawnTime = lifetime / _Theme.MaxNumber; doSpawn = false; break; case EParticleType.Flare: - size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2; + size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2; lifetime = CBase.Game.GetRandom(500) / 1000f + 0.1f; vx = -CBase.Game.GetRandom(2000) / 50f; vy = -CBase.Game.GetRandom(2000) / 50f + 20f; @@ -563,7 +557,7 @@ namespace VocaluxeLib.Menu break; case EParticleType.PerfNoteStar: - size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2; + size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2; lifetime = CBase.Game.GetRandom(1000) / 500f + 1.2f; vx = 0f; vy = 0f; @@ -587,20 +581,20 @@ namespace VocaluxeLib.Menu star = new CParticle(_PartyModeID, _Theme.TextureName, Color, CBase.Game.GetRandom(w) + Rect.X - size / 4f, CBase.Game.GetRandom(h) + Rect.Y - size / 4f, - size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type); + size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type); } else { star = new CParticle(_PartyModeID, Texture, Color, CBase.Game.GetRandom(w) + Rect.X - size / 4f, CBase.Game.GetRandom(h) + Rect.Y - size / 4f, - size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type); + size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type); } _Stars.Add(star); } - if (_Type == EParticleType.Flare || _Type == EParticleType.PerfNoteStar || _Type == EParticleType.Twinkle) + if (_Theme.Type == EParticleType.Flare || _Theme.Type == EParticleType.PerfNoteStar || _Theme.Type == EParticleType.Twinkle) _NextSpawnTime = -1f; int i = 0; @@ -645,8 +639,13 @@ namespace VocaluxeLib.Menu { if (!String.IsNullOrEmpty(_Theme.Color.Name)) Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID); + else + Color = _Theme.Color.Color; + if (!String.IsNullOrEmpty(_Theme.TextureName)) Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); + + Rect = _Theme.Rect; } public void ReloadTextures() diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 9deddea3..84d77420 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -372,53 +372,6 @@ namespace VocaluxeLib.Menu _Theme.SButtonPlaylistSave =ButtonPlaylistSave.GetTheme(); _Theme.SButtonPlaylistDelete =ButtonPlaylistDelete.GetTheme(); - //Check for highest x/y-coords - CompleteRect = Rect; - //ButtonPlaylistClose - if (ButtonPlaylistClose.Rect.X < CompleteRect.X) - CompleteRect.X = ButtonPlaylistClose.Rect.X; - if (ButtonPlaylistClose.Rect.Y < CompleteRect.Y) - CompleteRect.Y = ButtonPlaylistClose.Rect.Y; - if (ButtonPlaylistClose.Rect.W + ButtonPlaylistClose.Rect.X > CompleteRect.W + CompleteRect.X) - CompleteRect.W = ButtonPlaylistClose.Rect.W + ButtonPlaylistClose.Rect.X - CompleteRect.X; - if (ButtonPlaylistClose.Rect.Y + ButtonPlaylistClose.Rect.H > CompleteRect.Y + CompleteRect.H) - CompleteRect.H = ButtonPlaylistClose.Rect.H + ButtonPlaylistClose.Rect.Y - CompleteRect.Y; - //ButtonPlaylistName - if (ButtonPlaylistName.Rect.X < CompleteRect.X) - CompleteRect.X = ButtonPlaylistName.Rect.X; - if (ButtonPlaylistName.Rect.Y < CompleteRect.Y) - CompleteRect.Y = ButtonPlaylistName.Rect.Y; - if (ButtonPlaylistName.Rect.W + ButtonPlaylistName.Rect.X > CompleteRect.W + CompleteRect.X) - CompleteRect.W = ButtonPlaylistName.Rect.W + ButtonPlaylistName.Rect.X - CompleteRect.X; - if (ButtonPlaylistName.Rect.Y + ButtonPlaylistName.Rect.H > CompleteRect.Y + CompleteRect.H) - CompleteRect.H = ButtonPlaylistName.Rect.H + ButtonPlaylistName.Rect.Y - CompleteRect.Y; - //ButtonPlaylistSing - if (ButtonPlaylistSing.Rect.X < CompleteRect.X) - CompleteRect.X = ButtonPlaylistSing.Rect.X; - if (ButtonPlaylistSing.Rect.Y < CompleteRect.Y) - CompleteRect.Y = ButtonPlaylistSing.Rect.Y; - if (ButtonPlaylistSing.Rect.W + ButtonPlaylistSing.Rect.X > CompleteRect.W + CompleteRect.X) - CompleteRect.W = ButtonPlaylistSing.Rect.W + ButtonPlaylistSing.Rect.X - CompleteRect.X; - if (ButtonPlaylistSing.Rect.Y + ButtonPlaylistSing.Rect.H > CompleteRect.Y + CompleteRect.H) - CompleteRect.H = ButtonPlaylistSing.Rect.H + ButtonPlaylistSing.Rect.Y - CompleteRect.Y; - //ButtonPlaylistSave - if (ButtonPlaylistSave.Rect.X < CompleteRect.X) - CompleteRect.X = ButtonPlaylistSave.Rect.X; - if (ButtonPlaylistSave.Rect.Y < CompleteRect.Y) - CompleteRect.Y = ButtonPlaylistSave.Rect.Y; - if (ButtonPlaylistSave.Rect.W + ButtonPlaylistSave.Rect.X > CompleteRect.W + CompleteRect.X) - CompleteRect.W = ButtonPlaylistSave.Rect.W + ButtonPlaylistSave.Rect.X - CompleteRect.X; - if (ButtonPlaylistSave.Rect.Y + ButtonPlaylistSave.Rect.H > CompleteRect.Y + CompleteRect.H) - CompleteRect.H = ButtonPlaylistSave.Rect.H + ButtonPlaylistSave.Rect.Y - CompleteRect.Y; - //ButtonPlaylistDelete - if (ButtonPlaylistDelete.Rect.X < CompleteRect.X) - CompleteRect.X = ButtonPlaylistDelete.Rect.X; - if (ButtonPlaylistDelete.Rect.Y < CompleteRect.Y) - CompleteRect.Y = ButtonPlaylistDelete.Rect.Y; - if (ButtonPlaylistDelete.Rect.W + ButtonPlaylistDelete.Rect.X > CompleteRect.W + CompleteRect.X) - CompleteRect.W = ButtonPlaylistDelete.Rect.W + ButtonPlaylistDelete.Rect.X - CompleteRect.X; - if (ButtonPlaylistDelete.Rect.Y + ButtonPlaylistDelete.Rect.H > CompleteRect.Y + CompleteRect.H) - CompleteRect.H = ButtonPlaylistDelete.Rect.H + ButtonPlaylistDelete.Rect.Y - CompleteRect.Y; LoadTextures(); } return _ThemeLoaded; @@ -540,9 +493,15 @@ namespace VocaluxeLib.Menu { if (!String.IsNullOrEmpty(_Theme.ColorBackground.Name)) BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackground.Name, _PartyModeID); + else + BackgroundColor = _Theme.ColorBackground.Color; if (!String.IsNullOrEmpty(_Theme.SelColorBackground.Name)) BackgroundSelColor = CBase.Theme.GetColor(_Theme.SelColorBackground.Name, _PartyModeID); + else + BackgroundSelColor = _Theme.SelColorBackground.Color; + + Rect = _Theme.Rect; Text1.LoadTextures(); ButtonPlaylistClose.LoadTextures(); @@ -557,6 +516,8 @@ namespace VocaluxeLib.Menu SelectSlideGameMode.LoadTextures(); + _UpdateRect(); + Init(); } @@ -1319,6 +1280,57 @@ namespace VocaluxeLib.Menu return _Theme; } + private void _UpdateRect() + { + //Check for highest x/y-coords + CompleteRect = Rect; + //ButtonPlaylistClose + if (ButtonPlaylistClose.Rect.X < CompleteRect.X) + CompleteRect.X = ButtonPlaylistClose.Rect.X; + if (ButtonPlaylistClose.Rect.Y < CompleteRect.Y) + CompleteRect.Y = ButtonPlaylistClose.Rect.Y; + if (ButtonPlaylistClose.Rect.W + ButtonPlaylistClose.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W = ButtonPlaylistClose.Rect.W + ButtonPlaylistClose.Rect.X - CompleteRect.X; + if (ButtonPlaylistClose.Rect.Y + ButtonPlaylistClose.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H = ButtonPlaylistClose.Rect.H + ButtonPlaylistClose.Rect.Y - CompleteRect.Y; + //ButtonPlaylistName + if (ButtonPlaylistName.Rect.X < CompleteRect.X) + CompleteRect.X = ButtonPlaylistName.Rect.X; + if (ButtonPlaylistName.Rect.Y < CompleteRect.Y) + CompleteRect.Y = ButtonPlaylistName.Rect.Y; + if (ButtonPlaylistName.Rect.W + ButtonPlaylistName.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W = ButtonPlaylistName.Rect.W + ButtonPlaylistName.Rect.X - CompleteRect.X; + if (ButtonPlaylistName.Rect.Y + ButtonPlaylistName.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H = ButtonPlaylistName.Rect.H + ButtonPlaylistName.Rect.Y - CompleteRect.Y; + //ButtonPlaylistSing + if (ButtonPlaylistSing.Rect.X < CompleteRect.X) + CompleteRect.X = ButtonPlaylistSing.Rect.X; + if (ButtonPlaylistSing.Rect.Y < CompleteRect.Y) + CompleteRect.Y = ButtonPlaylistSing.Rect.Y; + if (ButtonPlaylistSing.Rect.W + ButtonPlaylistSing.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W = ButtonPlaylistSing.Rect.W + ButtonPlaylistSing.Rect.X - CompleteRect.X; + if (ButtonPlaylistSing.Rect.Y + ButtonPlaylistSing.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H = ButtonPlaylistSing.Rect.H + ButtonPlaylistSing.Rect.Y - CompleteRect.Y; + //ButtonPlaylistSave + if (ButtonPlaylistSave.Rect.X < CompleteRect.X) + CompleteRect.X = ButtonPlaylistSave.Rect.X; + if (ButtonPlaylistSave.Rect.Y < CompleteRect.Y) + CompleteRect.Y = ButtonPlaylistSave.Rect.Y; + if (ButtonPlaylistSave.Rect.W + ButtonPlaylistSave.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W = ButtonPlaylistSave.Rect.W + ButtonPlaylistSave.Rect.X - CompleteRect.X; + if (ButtonPlaylistSave.Rect.Y + ButtonPlaylistSave.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H = ButtonPlaylistSave.Rect.H + ButtonPlaylistSave.Rect.Y - CompleteRect.Y; + //ButtonPlaylistDelete + if (ButtonPlaylistDelete.Rect.X < CompleteRect.X) + CompleteRect.X = ButtonPlaylistDelete.Rect.X; + if (ButtonPlaylistDelete.Rect.Y < CompleteRect.Y) + CompleteRect.Y = ButtonPlaylistDelete.Rect.Y; + if (ButtonPlaylistDelete.Rect.W + ButtonPlaylistDelete.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W = ButtonPlaylistDelete.Rect.W + ButtonPlaylistDelete.Rect.X - CompleteRect.X; + if (ButtonPlaylistDelete.Rect.Y + ButtonPlaylistDelete.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H = ButtonPlaylistDelete.Rect.H + ButtonPlaylistDelete.Rect.Y - CompleteRect.Y; + } + #region ThemeEdit public void MoveElement(int stepX, int stepY) { diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 05b36cf7..d30ff70b 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -112,41 +112,23 @@ namespace VocaluxeLib.Menu.SongMenu [XmlElement("TextArtist")] public SThemeText STextArtist; - [XmlIgnore] - public CText TextArtist; [XmlElement("TextTitle")] public SThemeText STextTitle; - [XmlIgnore] - public CText TextTitle; [XmlElement("TextSongLength")] public SThemeText STextSongLength; - [XmlIgnore] - public CText TextSongLength; [XmlElement("StaticCoverBig")] public SThemeStatic SStaticCoverBig; - [XmlIgnore] - public CStatic StaticCoverBig; [XmlElement("StaticTextBG")] public SThemeStatic SStaticTextBG; - [XmlIgnore] - public CStatic StaticTextBG; [XmlElement("StaticDuetIcon")] public SThemeStatic SStaticDuetIcon; - [XmlIgnore] - public CStatic StaticDuetIcon; [XmlElement("StaticVideoIcon")] public SThemeStatic SStaticVideoIcon; - [XmlIgnore] - public CStatic StaticVideoIcon; [XmlElement("StaticMedleyCalcIcon")] public SThemeStatic SStaticMedleyCalcIcon; - [XmlIgnore] - public CStatic StaticMedleyCalcIcon; [XmlElement("StaticMedleyTagIcon")] public SThemeStatic SStaticMedleyTagIcon; - [XmlIgnore] - public CStatic StaticMedleyTagIcon; public SThemeSongMenuTileBoard(SThemeSongMenuTileBoard theme) { @@ -159,23 +141,14 @@ namespace VocaluxeLib.Menu.SongMenu TileRect = new SRectF(theme.TileRect); TileRectSmall = new SRectF(theme.TileRectSmall); STextArtist = new SThemeText(theme.STextArtist); - TextArtist = new CText(theme.TextArtist); - STextTitle = new SThemeText(theme.STextTitle); - TextTitle = new CText(theme.TextTitle); - STextSongLength = new SThemeText(theme.STextSongLength); - TextSongLength = new CText(theme.TextSongLength); - SStaticCoverBig = new SThemeStatic(theme.SStaticCoverBig); - StaticCoverBig = new CStatic(theme.StaticCoverBig); - SStaticTextBG = new SThemeStatic(theme.SStaticTextBG); - StaticTextBG = new CStatic(theme.StaticTextBG); - SStaticDuetIcon = new SThemeStatic(theme.SStaticDuetIcon); - StaticDuetIcon = new CStatic(theme.StaticDuetIcon); - SStaticVideoIcon = new SThemeStatic(theme.SStaticVideoIcon); - StaticVideoIcon = new CStatic(theme.StaticVideoIcon); - SStaticMedleyCalcIcon = new SThemeStatic(theme.SStaticMedleyCalcIcon); - StaticMedleyCalcIcon = new CStatic(theme.StaticMedleyCalcIcon); + STextTitle = new SThemeText(theme.STextTitle); + STextSongLength = new SThemeText(theme.STextSongLength); + SStaticCoverBig = new SThemeStatic(theme.SStaticCoverBig); + SStaticTextBG = new SThemeStatic(theme.SStaticTextBG); + SStaticDuetIcon = new SThemeStatic(theme.SStaticDuetIcon); + SStaticVideoIcon = new SThemeStatic(theme.SStaticVideoIcon); + SStaticMedleyCalcIcon = new SThemeStatic(theme.SStaticMedleyCalcIcon); SStaticMedleyTagIcon = new SThemeStatic(theme.SStaticMedleyTagIcon); - StaticMedleyTagIcon = new CStatic(theme.StaticMedleyTagIcon); } } @@ -249,21 +222,6 @@ namespace VocaluxeLib.Menu.SongMenu { Visible = true; _PartyModeID = partyModeID; - _Theme = new SThemeSongMenu - { - SongMenuTileBoard = - { - TextArtist = new CText(_PartyModeID), - TextTitle = new CText(_PartyModeID), - TextSongLength = new CText(_PartyModeID), - StaticCoverBig = new CStatic(_PartyModeID), - StaticTextBG = new CStatic(_PartyModeID), - StaticDuetIcon = new CStatic(_PartyModeID), - StaticVideoIcon = new CStatic(_PartyModeID), - StaticMedleyCalcIcon = new CStatic(_PartyModeID), - StaticMedleyTagIcon = new CStatic(_PartyModeID) - } - }; } protected CSongMenuFramework(SThemeSongMenu theme, int partyModeID) @@ -286,7 +244,7 @@ namespace VocaluxeLib.Menu.SongMenu return new SThemeSongMenu(_Theme); } - public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) + public virtual bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { string item = xmlPath + "/" + elementName; _ThemeLoaded = true; @@ -318,17 +276,6 @@ namespace VocaluxeLib.Menu.SongMenu _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumWsmall", ref _Theme.SongMenuTileBoard.NumWsmall); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumHsmall", ref _Theme.SongMenuTileBoard.NumHsmall); - _ThemeLoaded &= _Theme.SongMenuTileBoard.TextArtist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SongMenuTileBoard.TextTitle.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SongMenuTileBoard.TextSongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, skinIndex); - - _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticCoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticTextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticDuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticVideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticMedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, skinIndex); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectX", ref _Theme.SongMenuTileBoard.TileRect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectY", ref _Theme.SongMenuTileBoard.TileRect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectZ", ref _Theme.SongMenuTileBoard.TileRect.Z); @@ -346,16 +293,6 @@ namespace VocaluxeLib.Menu.SongMenu { _Theme.Name = elementName; - _Theme.SongMenuTileBoard.STextArtist = _Theme.SongMenuTileBoard.TextArtist.GetTheme(); - _Theme.SongMenuTileBoard.STextSongLength = _Theme.SongMenuTileBoard.TextSongLength.GetTheme(); - _Theme.SongMenuTileBoard.STextTitle = _Theme.SongMenuTileBoard.TextTitle.GetTheme(); - _Theme.SongMenuTileBoard.SStaticCoverBig = _Theme.SongMenuTileBoard.StaticCoverBig.GetTheme(); - _Theme.SongMenuTileBoard.SStaticDuetIcon = _Theme.SongMenuTileBoard.StaticDuetIcon.GetTheme(); - _Theme.SongMenuTileBoard.SStaticMedleyCalcIcon = _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.GetTheme(); - _Theme.SongMenuTileBoard.SStaticMedleyTagIcon = _Theme.SongMenuTileBoard.StaticMedleyTagIcon.GetTheme(); - _Theme.SongMenuTileBoard.SStaticTextBG = _Theme.SongMenuTileBoard.StaticTextBG.GetTheme(); - _Theme.SongMenuTileBoard.SStaticVideoIcon = _Theme.SongMenuTileBoard.StaticVideoIcon.GetTheme(); - LoadTextures(); Init(); } @@ -363,7 +300,7 @@ namespace VocaluxeLib.Menu.SongMenu return _ThemeLoaded; } - public bool SaveTheme(XmlWriter writer) + public virtual bool SaveTheme(XmlWriter writer) { if (_ThemeLoaded) { @@ -399,56 +336,6 @@ namespace VocaluxeLib.Menu.SongMenu writer.WriteElementString("A", _Color.A.ToString("#0.00")); } - #region SongMenuTileBoard - writer.WriteComment(": Config for TileBoard view"); - writer.WriteStartElement("SongMenuTileBoard"); - - writer.WriteComment(": Number of tiles horizontal"); - writer.WriteElementString("NumW", _Theme.SongMenuTileBoard.NumW.ToString()); - - writer.WriteComment(": Number of tiles vertical"); - writer.WriteElementString("NumH", _Theme.SongMenuTileBoard.NumH.ToString()); - - writer.WriteComment(": Space between tiles horizontal"); - writer.WriteElementString("SpaceW", _Theme.SongMenuTileBoard.SpaceW.ToString("#0.00")); - - writer.WriteComment(": Space between tiles vertical"); - writer.WriteElementString("SpaceH", _Theme.SongMenuTileBoard.SpaceH.ToString("#0.00")); - - writer.WriteComment(": Number of tiles horizontal in small-mode"); - writer.WriteElementString("NumWsmall", _Theme.SongMenuTileBoard.NumWsmall.ToString()); - - writer.WriteComment(": Number of tiles vertical in small-mode"); - writer.WriteElementString("NumHsmall", _Theme.SongMenuTileBoard.NumHsmall.ToString()); - - writer.WriteComment(", , , , : SongMenu position, width and height"); - writer.WriteElementString("TileRectX", _Theme.SongMenuTileBoard.TileRect.X.ToString("#0")); - writer.WriteElementString("TileRectY", _Theme.SongMenuTileBoard.TileRect.Y.ToString("#0")); - writer.WriteElementString("TileRectZ", _Theme.SongMenuTileBoard.TileRect.Z.ToString("#0.00")); - writer.WriteElementString("TileRectW", _Theme.SongMenuTileBoard.TileRect.W.ToString("#0")); - writer.WriteElementString("TileRectH", _Theme.SongMenuTileBoard.TileRect.H.ToString("#0")); - - writer.WriteComment(", , , , : SongMenu position, width and height in small-mode"); - writer.WriteElementString("TileRectSmallX", _Theme.SongMenuTileBoard.TileRectSmall.X.ToString("#0")); - writer.WriteElementString("TileRectSmallY", _Theme.SongMenuTileBoard.TileRectSmall.Y.ToString("#0")); - writer.WriteElementString("TileRectSmallZ", _Theme.SongMenuTileBoard.TileRectSmall.Z.ToString("#0.00")); - writer.WriteElementString("TileRectSmallW", _Theme.SongMenuTileBoard.TileRectSmall.W.ToString("#0")); - writer.WriteElementString("TileRectSmallH", _Theme.SongMenuTileBoard.TileRectSmall.H.ToString("#0")); - - _Theme.SongMenuTileBoard.TextArtist.SaveTheme(writer); - _Theme.SongMenuTileBoard.TextTitle.SaveTheme(writer); - _Theme.SongMenuTileBoard.TextSongLength.SaveTheme(writer); - - _Theme.SongMenuTileBoard.StaticCoverBig.SaveTheme(writer); - _Theme.SongMenuTileBoard.StaticTextBG.SaveTheme(writer); - _Theme.SongMenuTileBoard.StaticDuetIcon.SaveTheme(writer); - _Theme.SongMenuTileBoard.StaticVideoIcon.SaveTheme(writer); - _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer); - _Theme.SongMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer); - - writer.WriteEndElement(); - #endregion SongMenuTileBoard - writer.WriteEndElement(); return true; @@ -547,6 +434,9 @@ namespace VocaluxeLib.Menu.SongMenu if (!String.IsNullOrEmpty(_Theme.Color.Name)) _ColorInternal = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID); + else + _ColorInternal = _Theme.Color.Color; + } public void ReloadTextures() diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index b33a1d16..71d57dc9 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Windows.Forms; +using System.Xml; using VocaluxeLib.Draw; using VocaluxeLib.PartyModes; using VocaluxeLib.Songs; @@ -47,9 +48,6 @@ namespace VocaluxeLib.Menu.SongMenu private int _NumW; private int _NumH; - private float _SpaceW; - private float _SpaceH; - private int _TileW; private int _TileH; @@ -120,24 +118,103 @@ namespace VocaluxeLib.Menu.SongMenu } } + public override bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) + { + string item = xmlPath + "/" + elementName; + + bool themeLoaded = true; + themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader, skinIndex); + + + themeLoaded &= _Artist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, skinIndex); + themeLoaded &= _Title.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, skinIndex); + themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, skinIndex); + + themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, skinIndex); + themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, skinIndex); + themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, skinIndex); + themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, skinIndex); + themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, skinIndex); + themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, skinIndex); + + if (themeLoaded) + { + _Theme.Name = elementName; + + _Theme.SongMenuTileBoard.STextArtist = _Artist.GetTheme(); + _Theme.SongMenuTileBoard.STextSongLength = _SongLength.GetTheme(); + _Theme.SongMenuTileBoard.STextTitle = _Title.GetTheme(); + _Theme.SongMenuTileBoard.SStaticCoverBig = _CoverBig.GetTheme(); + _Theme.SongMenuTileBoard.SStaticDuetIcon = _DuetIcon.GetTheme(); + _Theme.SongMenuTileBoard.SStaticMedleyCalcIcon = _MedleyCalcIcon.GetTheme(); + _Theme.SongMenuTileBoard.SStaticMedleyTagIcon = _MedleyTagIcon.GetTheme(); + _Theme.SongMenuTileBoard.SStaticTextBG = _TextBG.GetTheme(); + _Theme.SongMenuTileBoard.SStaticVideoIcon = _VideoIcon.GetTheme(); + + LoadTextures(); + Init(); + } + + return themeLoaded; + } + + public override bool SaveTheme(XmlWriter writer) + { + writer.WriteComment(": Config for TileBoard view"); + writer.WriteStartElement("SongMenuTileBoard"); + + writer.WriteComment(": Number of tiles horizontal"); + writer.WriteElementString("NumW", _Theme.SongMenuTileBoard.NumW.ToString()); + + writer.WriteComment(": Number of tiles vertical"); + writer.WriteElementString("NumH", _Theme.SongMenuTileBoard.NumH.ToString()); + + writer.WriteComment(": Space between tiles horizontal"); + writer.WriteElementString("SpaceW", _Theme.SongMenuTileBoard.SpaceW.ToString("#0.00")); + + writer.WriteComment(": Space between tiles vertical"); + writer.WriteElementString("SpaceH", _Theme.SongMenuTileBoard.SpaceH.ToString("#0.00")); + + writer.WriteComment(": Number of tiles horizontal in small-mode"); + writer.WriteElementString("NumWsmall", _Theme.SongMenuTileBoard.NumWsmall.ToString()); + + writer.WriteComment(": Number of tiles vertical in small-mode"); + writer.WriteElementString("NumHsmall", _Theme.SongMenuTileBoard.NumHsmall.ToString()); + + writer.WriteComment(", , , , : SongMenu position, width and height"); + writer.WriteElementString("TileRectX", _Theme.SongMenuTileBoard.TileRect.X.ToString("#0")); + writer.WriteElementString("TileRectY", _Theme.SongMenuTileBoard.TileRect.Y.ToString("#0")); + writer.WriteElementString("TileRectZ", _Theme.SongMenuTileBoard.TileRect.Z.ToString("#0.00")); + writer.WriteElementString("TileRectW", _Theme.SongMenuTileBoard.TileRect.W.ToString("#0")); + writer.WriteElementString("TileRectH", _Theme.SongMenuTileBoard.TileRect.H.ToString("#0")); + + writer.WriteComment(", , , , : SongMenu position, width and height in small-mode"); + writer.WriteElementString("TileRectSmallX", _Theme.SongMenuTileBoard.TileRectSmall.X.ToString("#0")); + writer.WriteElementString("TileRectSmallY", _Theme.SongMenuTileBoard.TileRectSmall.Y.ToString("#0")); + writer.WriteElementString("TileRectSmallZ", _Theme.SongMenuTileBoard.TileRectSmall.Z.ToString("#0.00")); + writer.WriteElementString("TileRectSmallW", _Theme.SongMenuTileBoard.TileRectSmall.W.ToString("#0")); + writer.WriteElementString("TileRectSmallH", _Theme.SongMenuTileBoard.TileRectSmall.H.ToString("#0")); + + _Artist.SaveTheme(writer); + _Title.SaveTheme(writer); + _SongLength.SaveTheme(writer); + + _CoverBig.SaveTheme(writer); + _TextBG.SaveTheme(writer); + _DuetIcon.SaveTheme(writer); + _VideoIcon.SaveTheme(writer); + _MedleyCalcIcon.SaveTheme(writer); + _MedleyTagIcon.SaveTheme(writer); + + writer.WriteEndElement(); + + return true; + } + public override void Init() { base.Init(); - _SpaceW = _Theme.SongMenuTileBoard.SpaceW; - _SpaceH = _Theme.SongMenuTileBoard.SpaceH; - - _CoverBig = _Theme.SongMenuTileBoard.StaticCoverBig; - _TextBG = _Theme.SongMenuTileBoard.StaticTextBG; - _DuetIcon = _Theme.SongMenuTileBoard.StaticDuetIcon; - _VideoIcon = _Theme.SongMenuTileBoard.StaticVideoIcon; - _MedleyCalcIcon = _Theme.SongMenuTileBoard.StaticMedleyCalcIcon; - _MedleyTagIcon = _Theme.SongMenuTileBoard.StaticMedleyTagIcon; - - _Artist = _Theme.SongMenuTileBoard.TextArtist; - _Title = _Theme.SongMenuTileBoard.TextTitle; - _SongLength = _Theme.SongMenuTileBoard.TextSongLength; - _PreviewNr = -1; _InitTiles(); } @@ -157,8 +234,8 @@ namespace VocaluxeLib.Menu.SongMenu Rect = _Theme.SongMenuTileBoard.TileRect; } - _TileW = (int)((Rect.W - _SpaceW * (_NumW - 1)) / _NumW); - _TileH = (int)((Rect.H - _SpaceH * (_NumH - 1)) / _NumH); + _TileW = (int)((Rect.W - _Theme.SongMenuTileBoard.SpaceW * (_NumW - 1)) / _NumW); + _TileH = (int)((Rect.H - _Theme.SongMenuTileBoard.SpaceH * (_NumH - 1)) / _NumH); _CoverBGTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID); _CoverBigBGTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID); @@ -168,7 +245,7 @@ namespace VocaluxeLib.Menu.SongMenu { for (int j = 0; j < _NumW; j++) { - var rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z); + var rect = new SRectF(Rect.X + j * (_TileW + _Theme.SongMenuTileBoard.SpaceW), Rect.Y + i * (_TileH + _Theme.SongMenuTileBoard.SpaceH), _TileW, _TileH, Rect.Z); var tile = new CStatic(_PartyModeID, _CoverBGTexture, _Color, rect); _Tiles.Add(tile); } @@ -593,16 +670,17 @@ namespace VocaluxeLib.Menu.SongMenu { base.LoadTextures(); - _Theme.SongMenuTileBoard.StaticCoverBig.ReloadTextures(); - _Theme.SongMenuTileBoard.StaticTextBG.ReloadTextures(); - _Theme.SongMenuTileBoard.StaticDuetIcon.ReloadTextures(); - _Theme.SongMenuTileBoard.StaticVideoIcon.ReloadTextures(); - _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.ReloadTextures(); - _Theme.SongMenuTileBoard.StaticMedleyTagIcon.ReloadTextures(); + _Artist = new CText(_Theme.SongMenuTileBoard.STextArtist, _PartyModeID); + _Title = new CText(_Theme.SongMenuTileBoard.STextTitle, _PartyModeID); + _SongLength = new CText(_Theme.SongMenuTileBoard.STextSongLength, _PartyModeID); + _CoverBig = new CStatic(_Theme.SongMenuTileBoard.SStaticCoverBig, _PartyModeID); + _TextBG = new CStatic(_Theme.SongMenuTileBoard.SStaticTextBG, _PartyModeID); + _DuetIcon = new CStatic(_Theme.SongMenuTileBoard.SStaticDuetIcon, _PartyModeID); + _VideoIcon = new CStatic(_Theme.SongMenuTileBoard.SStaticVideoIcon, _PartyModeID); + _MedleyCalcIcon = new CStatic(_Theme.SongMenuTileBoard.SStaticMedleyCalcIcon, _PartyModeID); + _MedleyTagIcon = new CStatic(_Theme.SongMenuTileBoard.SStaticMedleyTagIcon, _PartyModeID); - _Theme.SongMenuTileBoard.TextArtist.ReloadTextures(); - _Theme.SongMenuTileBoard.TextTitle.ReloadTextures(); - _Theme.SongMenuTileBoard.TextSongLength.ReloadTextures(); + Init(); } } } \ No newline at end of file