Fix wrong theme stuff

This commit is contained in:
Flamefire committed 2014-10-16 23:47:52 +02:00
1 parent 3f76d039b6
commit 8109d77ab1
10 files changed
+118 -4878

No files matched your search

+5 -4
View File
@@ -70,7 +70,8 @@ namespace VocaluxeLib.Menu
set
{
Text.EditMode = value;
_SelText.EditMode = value;
if (_SelText != null)
_SelText.EditMode = value;
}
}
@@ -123,7 +124,7 @@ namespace VocaluxeLib.Menu
_Theme = theme;
Text = new CText(_Theme.Text, _PartyModeID, buttonText);
_SelText = new CText(_Theme.SText, _PartyModeID, buttonText);
_SelText = _Theme.STextSpecified ? new CText(_Theme.SText, _PartyModeID, buttonText) : null;
Selected = false;
EditMode = false;
@@ -147,7 +148,7 @@ namespace VocaluxeLib.Menu
SelTexture = button.SelTexture;
Text = new CText(button.Text);
_SelText = new CText(button._SelText);
_SelText = _SelText == null ? null : new CText(button._SelText);
Selected = false;
EditMode = false;
_Enabled = button._Enabled;
@@ -282,7 +283,7 @@ namespace VocaluxeLib.Menu
else
Text.DrawRelative(Rect.X, Rect.Y);
}
else if (_Theme.STextSpecified)
else
{
texture = SelTexture ?? CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID);
+1 -1
View File
@@ -385,7 +385,7 @@ namespace VocaluxeLib.Menu
try
{
TextWriter textWriter = new StreamWriter(@Path.Combine(ThemePath, ThemeName + ".xml"));
TextWriter textWriter = new StreamWriter(Path.Combine(ThemePath, ThemeName + ".xml"));
XmlSerializer serializer = new XmlSerializer(typeof(STheme));
serializer.Serialize(textWriter, Theme);
+19 -4
View File
@@ -323,10 +323,18 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HA", ref HighlightColor.A);
}
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextH", ref _Theme.TextH);
xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref _Theme.TextRelativeX);
xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref _Theme.TextRelativeY);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref _Theme.TextMaxW);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftX", ref RectArrowLeft.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftY", ref RectArrowLeft.Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftZ", ref RectArrowLeft.Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftW", ref RectArrowLeft.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftH", ref RectArrowLeft.H);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightX", ref RectArrowRight.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightY", ref RectArrowRight.Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightZ", ref RectArrowRight.Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightW", ref RectArrowRight.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColor.Name, String.Empty))
_ThemeLoaded &= _Theme.ArrowColor.Get(_PartyModeID, out ColorArrow);
else
@@ -366,6 +374,11 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSB", ref SelTextColor.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSA", ref SelTextColor.A);
}
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextH", ref _Theme.TextH);
xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref _Theme.TextRelativeX);
xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref _Theme.TextRelativeY);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref _Theme.TextMaxW);
_ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", out _Theme.TextFont, "Normal");
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/TextStyle", ref _Theme.TextStyle);
@@ -378,6 +391,8 @@ namespace VocaluxeLib.Menu
_Theme.ArrowSColor.Color = SelColorArrow;
_Theme.Color.Color = Color;
_Theme.HColor.Color = HighlightColor;
_Theme.RectArrowLeft = RectArrowLeft;
_Theme.RectArrowRight = RectArrowRight;
_Theme.SColor.Color = SelColor;
_Theme.TextColor.Color = TextColor;
_Theme.TextSColor.Color = SelTextColor;
+54 -10
View File
@@ -102,27 +102,71 @@ namespace VocaluxeLib
[XmlRoot("Color")]
public struct SThemeColor
{
public SColorF Color;
public string Name;
[XmlAttribute] public string Name;
public float? R;
public float? G;
public float? B;
public float? A;
//Needed for serialization
public bool ColorSpecified
{
get { return String.IsNullOrEmpty(Name); }
}
public bool NameSpecified
{
get { return !String.IsNullOrEmpty(Name); }
}
public bool RSpecified
{
get { return R.HasValue; }
}
public bool GSpecified
{
get { return G.HasValue; }
}
public bool BSpecified
{
get { return B.HasValue; }
}
public bool ASpecified
{
get { return A.HasValue; }
}
/// <summary>
/// Use only for old code! Remove when removing old LoadTheme()
/// </summary>
[XmlIgnore]
public SColorF Color
{
set
{
if (NameSpecified)
return;
R = value.R;
G = value.G;
B = value.B;
A = value.A;
}
}
public bool Get(int partyModeId, out SColorF color)
{
if (String.IsNullOrEmpty(Name))
bool ok;
if (!String.IsNullOrEmpty(Name))
ok = CBase.Themes.GetColor(Name, partyModeId, out color);
else
{
color = Color;
return true;
Debug.Assert(R.HasValue && G.HasValue && B.HasValue && A.HasValue);
ok = true;
color = new SColorF(1, 1, 1, 1);
}
return CBase.Themes.GetColor(Name, partyModeId, out color);
if (R.HasValue)
color.R = R.Value;
if (G.HasValue)
color.G = G.Value;
if (B.HasValue)
color.B = B.Value;
if (A.HasValue)
color.A = A.Value;
return ok;
}
}