Duplicate Code in CMenu. CFont, CLanguage removed

This commit is contained in:
Flamefire committed 2013-03-18 18:17:50 +01:00
1 parent 1eef829479
commit c3b447ccf6
31 files changed
+302 -755

No files matched your search

+78 -13
View File
@@ -1012,67 +1012,132 @@ namespace Vocaluxe.Menu
#region Elements
public void AddBackground(CBackground bg, String key = null)
public void AddBackground(CBackground bg)
{
AddBackground(bg, null);
}
public void AddButton(CButton button)
{
AddButton(button, null);
}
public void AddSelectSlide(CSelectSlide slide)
{
AddSelectSlide(slide, null);
}
public void AddStatic(CStatic stat)
{
AddStatic(stat, null);
}
public void AddText(CText text)
{
AddText(text, null);
}
public void AddSongMenu(CSongMenu songmenu)
{
AddSongMenu(songmenu, null);
}
public void AddLyric(CLyric lyric)
{
AddLyric(lyric, null);
}
public void AddSingNote(CSingNotes sn)
{
AddSingNote(sn, null);
}
public void AddNameSelection(CNameSelection ns)
{
AddNameSelection(ns, null);
}
public void AddEqualizer(CEqualizer eq)
{
AddEqualizer(eq, null);
}
public void AddPlaylist(CPlaylist pls)
{
AddPlaylist(pls, null);
}
public void AddParticleEffect(CParticleEffect pe)
{
AddParticleEffect(pe, null);
}
public void AddScreenSetting(CScreenSetting se)
{
AddScreenSetting(se, null);
}
public void AddBackground(CBackground bg, String key)
{
_AddInteraction(_Backgrounds.Add(bg, key), EType.TBackground);
}
public void AddButton(CButton button, String key = null)
public void AddButton(CButton button, String key)
{
_AddInteraction(_Buttons.Add(button, key), EType.TButton);
}
public void AddSelectSlide(CSelectSlide slide, String key = null)
public void AddSelectSlide(CSelectSlide slide, String key)
{
_AddInteraction(_SelectSlides.Add(slide, key), EType.TSelectSlide);
}
public void AddStatic(CStatic stat, String key = null)
public void AddStatic(CStatic stat, String key)
{
_AddInteraction(_Statics.Add(stat, key), EType.TStatic);
}
public void AddText(CText text, String key = null)
public void AddText(CText text, String key)
{
_AddInteraction(_Texts.Add(text, key), EType.TText);
}
public void AddSongMenu(CSongMenu songmenu, String key = null)
public void AddSongMenu(CSongMenu songmenu, String key)
{
_AddInteraction(_SongMenus.Add(songmenu, key), EType.TSongMenu);
}
public void AddLyric(CLyric lyric, String key = null)
public void AddLyric(CLyric lyric, String key)
{
_AddInteraction(_Lyrics.Add(lyric, key), EType.TLyric);
}
public void AddSingNote(CSingNotes sn, String key = null)
public void AddSingNote(CSingNotes sn, String key)
{
_AddInteraction(_SingNotes.Add(sn, key), EType.TSingNote);
}
public void AddNameSelection(CNameSelection ns, String key = null)
public void AddNameSelection(CNameSelection ns, String key)
{
_AddInteraction(_NameSelections.Add(ns, key), EType.TNameSelection);
}
public void AddEqualizer(CEqualizer eq, String key = null)
public void AddEqualizer(CEqualizer eq, String key)
{
_AddInteraction(_Equalizers.Add(eq, key), EType.TEqualizer);
}
public void AddPlaylist(CPlaylist pls, String key = null)
public void AddPlaylist(CPlaylist pls, String key)
{
_AddInteraction(_Playlists.Add(pls, key), EType.TPlaylist);
}
public void AddParticleEffect(CParticleEffect pe, String key = null)
public void AddParticleEffect(CParticleEffect pe, String key)
{
_AddInteraction(_ParticleEffects.Add(pe, key), EType.TParticleEffect);
}
public void AddScreenSetting(CScreenSetting se, String key = null)
public void AddScreenSetting(CScreenSetting se, String key)
{
_ScreenSettings.Add(se, key);
}
+19 -19
View File
@@ -181,15 +181,15 @@ namespace Vocaluxe.Menu
}
}
private string _Fon = String.Empty;
public string Fon
private string _Font = String.Empty;
public string Font
{
get { return _Fon; }
get { return _Font; }
set
{
if (_Fon != value)
if (_Font != value)
{
_Fon = value;
_Font = value;
_PositionNeedsUpdate = true;
}
}
@@ -264,7 +264,7 @@ namespace Vocaluxe.Menu
Align = EAlignment.Left;
HAlign = EHAlignment.Center;
Style = EStyle.Normal;
Fon = "Normal";
Font = "Normal";
Color = new SColorF();
SColor = new SColorF();
@@ -295,7 +295,7 @@ namespace Vocaluxe.Menu
Align = text._Align;
HAlign = text._HAlign;
Style = text._Style;
Fon = text._Fon;
Font = text._Font;
Color = new SColorF(text.Color);
SColor = new SColorF(text.SColor);
@@ -327,7 +327,7 @@ namespace Vocaluxe.Menu
Align = align;
HAlign = EHAlignment.Center;
Style = style;
Fon = font;
Font = font;
Color = new SColorF(r, g, b, a);
SColor = new SColorF(r, g, b, a);
@@ -366,7 +366,7 @@ namespace Vocaluxe.Menu
Align = align;
HAlign = EHAlignment.Center;
Style = style;
Fon = font;
Font = font;
Color = new SColorF(r, g, b, a);
SColor = new SColorF(r, g, b, a);
@@ -403,7 +403,7 @@ namespace Vocaluxe.Menu
Align = align;
HAlign = EHAlignment.Center;
Style = style;
Fon = font;
Font = font;
Color = col;
SColor = new SColorF(col);
@@ -442,7 +442,7 @@ namespace Vocaluxe.Menu
Align = align;
HAlign = EHAlignment.Center;
Style = style;
Fon = font;
Font = font;
Color = col;
SColor = new SColorF(col);
@@ -511,7 +511,7 @@ namespace Vocaluxe.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue<EAlignment>(item + "/Align", ref _Align);
xmlReader.TryGetEnumValue<EHAlignment>(item + "/HAlign", ref _HAlign);
_ThemeLoaded &= xmlReader.TryGetEnumValue<EStyle>(item + "/Style", ref _Style);
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", ref _Fon, "Normal");
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", ref _Font, "Normal");
_ThemeLoaded &= xmlReader.GetValue(item + "/Text", ref _Theme.Text, String.Empty);
@@ -531,7 +531,7 @@ namespace Vocaluxe.Menu
Height = _Height;
MaxWidth = _MaxWidth;
Text = _Theme.Text;
Fon = _Fon;
Font = _Font;
Align = _Align;
HAlign = _HAlign;
Style = _Style;
@@ -612,7 +612,7 @@ namespace Vocaluxe.Menu
writer.WriteElementString("Style", Enum.GetName(typeof(EStyle), Style));
writer.WriteComment("<Font>: Text font name");
writer.WriteElementString("Font", Fon);
writer.WriteElementString("Font", Font);
writer.WriteComment("<Text>: Nothing or translation tag");
if (CBase.Language.TranslationExists(_Theme.Text))
@@ -658,7 +658,7 @@ namespace Vocaluxe.Menu
if (_PositionNeedsUpdate)
UpdateTextPosition();
CBase.Fonts.SetFont(Fon);
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
SColorF CurrentColor = new SColorF(Color);
@@ -727,7 +727,7 @@ namespace Vocaluxe.Menu
SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha);
CBase.Fonts.SetFont(Fon);
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
if (!EditMode)
@@ -766,7 +766,7 @@ namespace Vocaluxe.Menu
float x = X + rx;
float y = Y + ry;
CBase.Fonts.SetFont(Fon);
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
RectangleF bounds = CBase.Fonts.GetTextBounds(this, this.Height);
@@ -813,7 +813,7 @@ namespace Vocaluxe.Menu
SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha);
CBase.Fonts.SetFont(Fon);
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
if (!EditMode)
@@ -877,7 +877,7 @@ namespace Vocaluxe.Menu
if (_Text.Length == 0)
return;
CBase.Fonts.SetFont(Fon);
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
float h = Height;
+7 -1
View File
@@ -8,10 +8,17 @@ namespace Vocaluxe.Menu
public class CXMLReader
{
private XPathNavigator _Navigator;
private String _FileName;
public string FileName
{
get { return _FileName; }
}
//Private method. Use OpenFile factory method to get an instance
private CXMLReader(string uri)
{
_FileName = uri;
XPathDocument xPathDoc = new XPathDocument(uri);
_Navigator = xPathDoc.CreateNavigator();
}
@@ -94,7 +101,6 @@ namespace Vocaluxe.Menu
results++;
}
if ((results == 0) || (results > 1))
{
Value = DefaultValue;