diff --git a/Output/Fonts/Fonts.xml b/Output/Fonts/Fonts.xml
index 70524adf..2bbf61c3 100644
--- a/Output/Fonts/Fonts.xml
+++ b/Output/Fonts/Fonts.xml
@@ -1,29 +1,31 @@
-
- Normal
- 0,00
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
-
- Outline
- 0,10
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
+
+
+ Normal
+ 0,00
+ 0,00
+ 0,00
+ 0,00
+ 1,00
+ FreeSans
+ FreeSans.ttf
+ FreeSansBold.ttf
+ FreeSansOblique.ttf
+ FreeSansBoldOblique.ttf
+
+
+ Outline
+ 0,10
+ 0,00
+ 0,00
+ 0,00
+ 1,00
+ FreeSans
+ FreeSans.ttf
+ FreeSansBold.ttf
+ FreeSansOblique.ttf
+ FreeSansBoldOblique.ttf
+
+
\ No newline at end of file
diff --git a/Output/PartyModes/Challenge/Fonts/Fonts.xml b/Output/PartyModes/Challenge/Fonts/Fonts.xml
deleted file mode 100644
index 70524adf..00000000
--- a/Output/PartyModes/Challenge/Fonts/Fonts.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- Normal
- 0,00
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
-
- Outline
- 0,10
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
-
\ No newline at end of file
diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSans.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSans.ttf
deleted file mode 100644
index 6de62ebf..00000000
Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSans.ttf and /dev/null differ
diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBold.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBold.ttf
deleted file mode 100644
index e75685be..00000000
Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBold.ttf and /dev/null differ
diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBoldOblique.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBoldOblique.ttf
deleted file mode 100644
index ec3bc02c..00000000
Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBoldOblique.ttf and /dev/null differ
diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansOblique.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansOblique.ttf
deleted file mode 100644
index 733f8829..00000000
Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansOblique.ttf and /dev/null differ
diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/readme.txt b/Output/PartyModes/Challenge/Fonts/FreeSans/readme.txt
deleted file mode 100644
index 33ccd11d..00000000
--- a/Output/PartyModes/Challenge/Fonts/FreeSans/readme.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-Congratulations, you have successfully downloaded font file!
-
-This font is provided to you by Fonts2u.com – the largest online
-repository of free fonts for Windows and Mac.
-
-
-
-How to install this font on your computer?
-
-For Windows 7 / Vista users:
-
-- Right-click the font file(s) and choose "Install".
-
-For users of the previous Windows versions:
-
-- Copy the included file(s) into a default Windows font folder
- (usually C:\WINDOWS\FONTS or C:\WINNT\FONTS)
-
-For Mac users:
-
-Mac OS X 10.3 or above (including the FontBook)
-
-- Double-click the font file and hit "Install font" button at
- the bottom of the preview.
-
-Mac OS X
-
-- Either copy the font file(s) to /Library/Fonts (for all users),
- or to /Users/Your_username/Library/Fonts (for you only).
-
-Mac OS 9 or earlier
-
-- You have to convert the font file(s) you have downloaded.
- Drag the font suitcases into the System folder. The system
- will propose you to add them to the Fonts folder.
-
-For Linux users:
-
-- Copy the font file(s) to /USR/SHARE/FONTS
-
diff --git a/Output/PartyModes/ChallengeMedley/Fonts/Fonts.xml b/Output/PartyModes/ChallengeMedley/Fonts/Fonts.xml
deleted file mode 100644
index 70524adf..00000000
--- a/Output/PartyModes/ChallengeMedley/Fonts/Fonts.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- Normal
- 0,00
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
-
- Outline
- 0,10
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
-
\ No newline at end of file
diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSans.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSans.ttf
deleted file mode 100644
index 6de62ebf..00000000
Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSans.ttf and /dev/null differ
diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBold.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBold.ttf
deleted file mode 100644
index e75685be..00000000
Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBold.ttf and /dev/null differ
diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBoldOblique.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBoldOblique.ttf
deleted file mode 100644
index ec3bc02c..00000000
Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBoldOblique.ttf and /dev/null differ
diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansOblique.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansOblique.ttf
deleted file mode 100644
index 733f8829..00000000
Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansOblique.ttf and /dev/null differ
diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/readme.txt b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/readme.txt
deleted file mode 100644
index 33ccd11d..00000000
--- a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/readme.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-Congratulations, you have successfully downloaded font file!
-
-This font is provided to you by Fonts2u.com – the largest online
-repository of free fonts for Windows and Mac.
-
-
-
-How to install this font on your computer?
-
-For Windows 7 / Vista users:
-
-- Right-click the font file(s) and choose "Install".
-
-For users of the previous Windows versions:
-
-- Copy the included file(s) into a default Windows font folder
- (usually C:\WINDOWS\FONTS or C:\WINNT\FONTS)
-
-For Mac users:
-
-Mac OS X 10.3 or above (including the FontBook)
-
-- Double-click the font file and hit "Install font" button at
- the bottom of the preview.
-
-Mac OS X
-
-- Either copy the font file(s) to /Library/Fonts (for all users),
- or to /Users/Your_username/Library/Fonts (for you only).
-
-Mac OS 9 or earlier
-
-- You have to convert the font file(s) you have downloaded.
- Drag the font suitcases into the System folder. The system
- will propose you to add them to the Fonts folder.
-
-For Linux users:
-
-- Copy the font file(s) to /USR/SHARE/FONTS
-
diff --git a/Output/PartyModes/TicTacToe/Fonts/Fonts.xml b/Output/PartyModes/TicTacToe/Fonts/Fonts.xml
deleted file mode 100644
index 70524adf..00000000
--- a/Output/PartyModes/TicTacToe/Fonts/Fonts.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- Normal
- 0,00
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
-
- Outline
- 0,10
- 0,00
- 0,00
- 0,00
- 1,00
- FreeSans
- FreeSans.ttf
- FreeSansBold.ttf
- FreeSansOblique.ttf
- FreeSansBoldOblique.ttf
-
-
\ No newline at end of file
diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSans.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSans.ttf
deleted file mode 100644
index 6de62ebf..00000000
Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSans.ttf and /dev/null differ
diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBold.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBold.ttf
deleted file mode 100644
index e75685be..00000000
Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBold.ttf and /dev/null differ
diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBoldOblique.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBoldOblique.ttf
deleted file mode 100644
index ec3bc02c..00000000
Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBoldOblique.ttf and /dev/null differ
diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansOblique.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansOblique.ttf
deleted file mode 100644
index 733f8829..00000000
Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansOblique.ttf and /dev/null differ
diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/readme.txt b/Output/PartyModes/TicTacToe/Fonts/FreeSans/readme.txt
deleted file mode 100644
index 33ccd11d..00000000
--- a/Output/PartyModes/TicTacToe/Fonts/FreeSans/readme.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-Congratulations, you have successfully downloaded font file!
-
-This font is provided to you by Fonts2u.com – the largest online
-repository of free fonts for Windows and Mac.
-
-
-
-How to install this font on your computer?
-
-For Windows 7 / Vista users:
-
-- Right-click the font file(s) and choose "Install".
-
-For users of the previous Windows versions:
-
-- Copy the included file(s) into a default Windows font folder
- (usually C:\WINDOWS\FONTS or C:\WINNT\FONTS)
-
-For Mac users:
-
-Mac OS X 10.3 or above (including the FontBook)
-
-- Double-click the font file and hit "Install font" button at
- the bottom of the preview.
-
-Mac OS X
-
-- Either copy the font file(s) to /Library/Fonts (for all users),
- or to /Users/Your_username/Library/Fonts (for you only).
-
-Mac OS 9 or earlier
-
-- You have to convert the font file(s) you have downloaded.
- Drag the font suitcases into the System folder. The system
- will propose you to add them to the Fonts folder.
-
-For Linux users:
-
-- Copy the font file(s) to /USR/SHARE/FONTS
-
diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs
index 1d5c114f..03a4f327 100644
--- a/Vocaluxe/Base/CConfig.cs
+++ b/Vocaluxe/Base/CConfig.cs
@@ -211,26 +211,14 @@ namespace Vocaluxe.Base
if (NumPlayer < 1 || NumPlayer > CSettings.MaxNumPlayer)
NumPlayer = 2;
- List _Languages = new List();
- _Languages = CLanguage.GetLanguages();
-
- bool _LangExists = false;
-
- for (i = 0; i < _Languages.Count; i++)
- {
- if (_Languages[i] == Language)
- {
- _LangExists = true;
- }
- }
+ bool _LangExists = CLanguage.SetLanguage(Language);
//TODO: What should we do, if English not exists?
if(_LangExists == false){
Language = "English";
}
- CLanguage.SetLanguage(Language);
-
+
//Read players from config
for (i = 1; i <= CSettings.MaxNumPlayer; i++)
{
diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs
index 73b50330..25fefc83 100644
--- a/Vocaluxe/Base/CFont.cs
+++ b/Vocaluxe/Base/CFont.cs
@@ -39,22 +39,16 @@ namespace Vocaluxe.Base
Font fo;
Size sizeB;
SizeF size;
- System.Drawing.Graphics g;
- using (Bitmap bmp = new Bitmap(10, 10))
- {
- g = System.Drawing.Graphics.FromImage(bmp);
-
+ using(Graphics g=Graphics.FromHwnd(IntPtr.Zero)){
fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
size = g.MeasureString(chr.ToString(), fo);
-
- g.Dispose();
}
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
{
- g = System.Drawing.Graphics.FromImage(bmp);
+ Graphics g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
@@ -104,9 +98,8 @@ namespace Vocaluxe.Base
//bmp.Save("test.png", ImageFormat.Png);
Chr = chr;
width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width / factor / bmp.Width);
-
- }
- g.Dispose();
+ g.Dispose();
+ }
fo.Dispose();
}
@@ -125,29 +118,20 @@ namespace Vocaluxe.Base
CFonts.Style = EStyle.Normal;
CFonts.Height = SIZEh;
float h_style, h_normal;
- using (Bitmap bmp = new Bitmap(10, 10))
+ using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
- using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
- {
-
- Font fo = CFonts.GetFont();
- Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
- //SizeF size = g.MeasureString(chr.ToString(), fo);
- h_normal = sizeB.Height;
- }
- CFonts.Style = style;
-
+ Font fo = CFonts.GetFont();
+ Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
+ //SizeF size = g.MeasureString(chr.ToString(), fo);
+ h_normal = sizeB.Height;
}
- using (Bitmap bmp = new Bitmap(10, 10))
+ CFonts.Style = style;
+ using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
- using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
- {
-
- Font fo = CFonts.GetFont();
- Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
- //size = g.MeasureString(chr.ToString(), fo);
- h_style = sizeB.Height;
- }
+ Font fo = CFonts.GetFont();
+ Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
+ //size = g.MeasureString(chr.ToString(), fo);
+ h_style = sizeB.Height;
}
return h_normal / h_style;
}
@@ -399,22 +383,25 @@ namespace Vocaluxe.Base
}
public static Font GetFont()
+ {
+ return _GetCurrentFont().GetFont();
+ }
+
+ private static CFont _GetCurrentFont()
{
switch (Style)
{
case EStyle.Normal:
- return _Fonts[_CurrentFont].Normal.GetFont();
+ return _Fonts[_CurrentFont].Normal;
case EStyle.Italic:
- return _Fonts[_CurrentFont].Italic.GetFont();
+ return _Fonts[_CurrentFont].Italic;
case EStyle.Bold:
- return _Fonts[_CurrentFont].Bold.GetFont();
+ return _Fonts[_CurrentFont].Bold;
case EStyle.BoldItalic:
- return _Fonts[_CurrentFont].BoldItalic.GetFont();
- default:
- break;
+ return _Fonts[_CurrentFont].BoldItalic;
}
- // should never happen...
- return null;
+ //Just in case...
+ return _Fonts[_CurrentFont].Normal;
}
#region DrawText
@@ -437,31 +424,13 @@ namespace Vocaluxe.Base
return;
Height = h;
+ CFont Font = _GetCurrentFont();
float dx = x;
foreach (char chr in Text)
{
- switch (Style)
- {
- case EStyle.Normal:
- _Fonts[_CurrentFont].Normal.DrawGlyph(chr, dx, y, Height, z, color);
- dx += _Fonts[_CurrentFont].Normal.GetWidth(chr);
- break;
- case EStyle.Italic:
- _Fonts[_CurrentFont].Italic.DrawGlyph(chr, dx, y, Height, z, color);
- dx += _Fonts[_CurrentFont].Italic.GetWidth(chr);
- break;
- case EStyle.Bold:
- _Fonts[_CurrentFont].Bold.DrawGlyph(chr, dx, y, Height, z, color);
- dx += _Fonts[_CurrentFont].Bold.GetWidth(chr);
- break;
- case EStyle.BoldItalic:
- _Fonts[_CurrentFont].BoldItalic.DrawGlyph(chr, dx, y, Height, z, color);
- dx += _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
- break;
- default:
- break;
- }
+ Font.DrawGlyph(chr, dx, y, Height, z, color);
+ dx += Font.GetWidth(chr);
}
}
@@ -474,31 +443,13 @@ namespace Vocaluxe.Base
return;
Height = h;
+ CFont Font = _GetCurrentFont();
float dx = x;
foreach (char chr in Text)
{
- switch (Style)
- {
- case EStyle.Normal:
- _Fonts[_CurrentFont].Normal.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
- dx += _Fonts[_CurrentFont].Normal.GetWidth(chr);
- break;
- case EStyle.Italic:
- _Fonts[_CurrentFont].Italic.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
- dx += _Fonts[_CurrentFont].Italic.GetWidth(chr);
- break;
- case EStyle.Bold:
- _Fonts[_CurrentFont].Bold.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
- dx += _Fonts[_CurrentFont].Bold.GetWidth(chr);
- break;
- case EStyle.BoldItalic:
- _Fonts[_CurrentFont].BoldItalic.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
- dx += _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
- break;
- default:
- break;
- }
+ Font.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
+ dx += Font.GetWidth(chr);
}
}
@@ -520,56 +471,23 @@ namespace Vocaluxe.Base
float x1 = x + w * begin;
float x2 = x + w * end;
+ CFont Font = _GetCurrentFont();
+
foreach (char chr in Text)
{
- float w2 = 0f;
- switch (Style)
- {
- case EStyle.Normal:
- w2 = _Fonts[_CurrentFont].Normal.GetWidth(chr);
- break;
- case EStyle.Italic:
- w2 = _Fonts[_CurrentFont].Italic.GetWidth(chr);
- break;
- case EStyle.Bold:
- w2 = _Fonts[_CurrentFont].Bold.GetWidth(chr);
- break;
- case EStyle.BoldItalic:
- w2 = _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
- break;
- default:
- break;
- }
-
+ float w2 = Font.GetWidth(chr);
float b = (x1 - dx) / w2;
- if (b < 0f)
- b = 0f;
if (b < 1f)
{
+ if (b < 0f)
+ b = 0f;
float e = (x2 - dx) / w2;
- if (e > 1f)
- e = 1f;
-
if (e > 0f)
{
- switch (Style)
- {
- case EStyle.Normal:
- _Fonts[_CurrentFont].Normal.DrawGlyph(chr, dx, y, Height, z, color, b, e);
- break;
- case EStyle.Italic:
- _Fonts[_CurrentFont].Italic.DrawGlyph(chr, dx, y, Height, z, color, b, e);
- break;
- case EStyle.Bold:
- _Fonts[_CurrentFont].Bold.DrawGlyph(chr, dx, y, Height, z, color, b, e);
- break;
- case EStyle.BoldItalic:
- _Fonts[_CurrentFont].BoldItalic.DrawGlyph(chr, dx, y, Height, z, color, b, e);
- break;
- default:
- break;
- }
+ if (e > 1f)
+ e = 1f;
+ Font.DrawGlyph(chr, dx, y, Height, z, color, b, e);
}
}
dx += w2;
@@ -641,25 +559,10 @@ namespace Vocaluxe.Base
public static float GetTextWidth(string text)
{
float dx = 0;
+ CFont Font = _GetCurrentFont();
foreach (char chr in text)
{
- switch (Style)
- {
- case EStyle.Normal:
- dx += _Fonts[_CurrentFont].Normal.GetWidth(chr);
- break;
- case EStyle.Italic:
- dx += _Fonts[_CurrentFont].Italic.GetWidth(chr);
- break;
- case EStyle.Bold:
- dx += _Fonts[_CurrentFont].Bold.GetWidth(chr);
- break;
- case EStyle.BoldItalic:
- dx += _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
- break;
- default:
- break;
- }
+ dx += Font.GetWidth(chr);
}
return dx;
}
@@ -668,126 +571,39 @@ namespace Vocaluxe.Base
{
//return TextRenderer.MeasureText(text, GetFont()).Height;
float h = 0f;
+ CFont Font = _GetCurrentFont();
foreach (char chr in text)
{
- float hh = 0f;
- switch (Style)
- {
- case EStyle.Normal:
- hh = _Fonts[_CurrentFont].Normal.GetHeight(chr);
- break;
- case EStyle.Italic:
- hh = _Fonts[_CurrentFont].Italic.GetHeight(chr);
- break;
- case EStyle.Bold:
- hh = _Fonts[_CurrentFont].Bold.GetHeight(chr);
- break;
- case EStyle.BoldItalic:
- hh = _Fonts[_CurrentFont].BoldItalic.GetHeight(chr);
- break;
- default:
- break;
- }
-
+ float hh = Font.GetHeight(chr);
if (hh>h)
h = hh;
}
return h;
}
- ///
- /// Load default fonts
- ///
- ///
- private static bool LoadFontList()
- {
- CXMLReader xmlReader = CXMLReader.OpenFile(System.IO.Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts));
- if (xmlReader == null)
- return false;
-
- _Fonts.Clear();
-
- string value = string.Empty;
- int i = 1;
- while (xmlReader.GetValue("//root/Font" + i.ToString() + "/Folder", ref value, value))
- {
- string Folder = value;
-
- xmlReader.GetValue("//root/Font" + i.ToString() + "/FileNormal", ref value, value);
- value = Path.Combine(Directory.GetCurrentDirectory(),
- Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
- CFont f = new CFont(value);
- SFont sf = new SFont();
- sf.Normal = f;
-
- string name = String.Empty;
- xmlReader.GetValue("//root/Font" + i.ToString() + "/Name", ref name, value);
- sf.Name = name;
- sf.IsThemeFont = false;
- sf.ThemeName = String.Empty;
- sf.PartyModeID = -1;
-
- xmlReader.GetValue("//root/Font" + i.ToString() + "/FileItalic", ref value, value);
- value = Path.Combine(Directory.GetCurrentDirectory(),
- Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
- f = new CFont(value);
- sf.Italic = f;
-
- xmlReader.GetValue("//root/Font" + i.ToString() + "/FileBold", ref value, value);
- value = Path.Combine(Directory.GetCurrentDirectory(),
- Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
- f = new CFont(value);
- sf.Bold = f;
-
- xmlReader.GetValue("//root/Font" + i.ToString() + "/FileBoldItalic", ref value, value);
- value = Path.Combine(Directory.GetCurrentDirectory(),
- Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
- f = new CFont(value);
- sf.BoldItalic = f;
-
- sf.Outline = 0f;
- xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/Outline", ref sf.Outline);
-
- sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f);
- xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorR", ref sf.OutlineColor.R);
- xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorG", ref sf.OutlineColor.G);
- xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorB", ref sf.OutlineColor.B);
- xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorA", ref sf.OutlineColor.A);
-
- _Fonts.Add(sf);
- i++;
- }
- return true;
- }
-
- ///
- /// Loads theme fonts from skin file
- ///
- public static void LoadThemeFonts(string ThemeName, string FontFolder, CXMLReader xmlReader)
- {
+ private static void _LoadFontFiles(CXMLReader xmlReader, string FontFolder, string ThemeName="", int PartyModeId=-1){
string value = string.Empty;
int i = 1;
while (xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Folder", ref value, value))
{
SFont sf = new SFont();
sf.Folder = value;
-
- sf.IsThemeFont = true;
+ sf.IsThemeFont = ThemeName.Length>0;
sf.ThemeName = ThemeName;
- sf.PartyModeID = -1;
+ sf.PartyModeID = PartyModeId;
bool ok = true;
+ string name = String.Empty;
+ ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value);
+ sf.Name = name;
+
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value);
sf.FileNormal = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
CFont f = new CFont(value);
sf.Normal = f;
- string name = String.Empty;
- ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value);
- sf.Name = name;
-
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value);
sf.FileItalic = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
@@ -819,16 +635,57 @@ namespace Vocaluxe.Base
_Fonts.Add(sf);
else
{
- CLog.LogError("Error loading theme fonts for theme \"" + ThemeName + "\": Error in Font" + i.ToString());
+ string fontTypes;
+ if (PartyModeId >= 0)
+ fontTypes = "theme fonts for party mode";
+ else if (ThemeName.Length > 0)
+ fontTypes = "theme fonts for theme \"" + ThemeName + "\"";
+ else
+ fontTypes = "basic fonts";
+ CLog.LogError("Error loading "+fontTypes+": Error in Font" + i.ToString());
}
i++;
}
+ }
+ ///
+ /// Load default fonts
+ ///
+ ///
+ private static bool LoadFontList()
+ {
+ CXMLReader xmlReader = CXMLReader.OpenFile(System.IO.Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts));
+ if (xmlReader == null)
+ return false;
+
+ _Fonts.Clear();
+
+ _LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderFonts));
+ return true;
+ }
+
+ ///
+ /// Loads theme fonts from skin file
+ ///
+ public static void LoadThemeFonts(string ThemeName, string FontFolder, CXMLReader xmlReader)
+ {
+ _LoadFontFiles(xmlReader, FontFolder, ThemeName);
CLog.StartBenchmark(1, "BuildGlyphs");
BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
}
+ ///
+ /// Loads party mode fonts from skin file
+ ///
+ public static void LoadPartyModeFonts(int PartyModeID, string FontFolder, CXMLReader xmlReader)
+ {
+ _LoadFontFiles(xmlReader, FontFolder, "", PartyModeID);
+ CLog.StartBenchmark(1, "BuildGlyphs");
+ BuildGlyphs();
+ CLog.StopBenchmark(1, "BuildGlyphs");
+ }
+
public static void SaveThemeFonts(string ThemeName, XmlWriter writer)
{
if (_Fonts.Count == 0)
@@ -895,75 +752,6 @@ namespace Vocaluxe.Base
}
}
- ///
- /// Loads party mode fonts from skin file
- ///
- public static void LoadPartyModeFonts(int PartyModeID, string FontFolder, CXMLReader xmlReader)
- {
- string value = string.Empty;
- int i = 1;
- while (xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Folder", ref value, value))
- {
- SFont sf = new SFont();
- sf.Folder = value;
-
- sf.IsThemeFont = false;
- sf.ThemeName = String.Empty;
- sf.PartyModeID = PartyModeID;
-
- bool ok = true;
-
- ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value);
- sf.FileNormal = value;
- value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
- CFont f = new CFont(value);
- sf.Normal = f;
-
- string name = String.Empty;
- ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value);
- sf.Name = name;
-
- ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value);
- sf.FileItalic = value;
- value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
- f = new CFont(value);
- sf.Italic = f;
-
- ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBold", ref value, value);
- sf.FileBold = value;
- value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
- f = new CFont(value);
- sf.Bold = f;
-
- ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBoldItalic", ref value, value);
- sf.FileBoldItalic = value;
- value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
- f = new CFont(value);
- sf.BoldItalic = f;
-
- sf.Outline = 0f;
- ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/Outline", ref sf.Outline);
-
- sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f);
- ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorR", ref sf.OutlineColor.R);
- ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorG", ref sf.OutlineColor.G);
- ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorB", ref sf.OutlineColor.B);
- ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorA", ref sf.OutlineColor.A);
-
- if (ok)
- _Fonts.Add(sf);
- else
- {
- CLog.LogError("Error loading theme fonts for party mode from Folder \"" + FontFolder + "\": Error in Font" + i.ToString());
- }
- i++;
- }
-
- CLog.StartBenchmark(1, "BuildGlyphs");
- BuildGlyphs();
- CLog.StopBenchmark(1, "BuildGlyphs");
- }
-
private static int GetFontIndex(string ThemeName, string FontName)
{
if (ThemeName.Length == 0 || FontName.Length == 0)
diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs
index c81900b1..e832ed42 100644
--- a/Vocaluxe/Base/CLanguage.cs
+++ b/Vocaluxe/Base/CLanguage.cs
@@ -14,14 +14,14 @@ namespace Vocaluxe.Base
public string Name;
public string LanguageFilePath;
- public Hashtable Texts;
+ public Dictionary Texts;
public List PartyModeTexts;
}
struct SPartyLanguage
{
public int PartyModeID;
- public Hashtable Texts;
+ public Dictionary Texts;
}
static class CLanguage
@@ -31,7 +31,7 @@ namespace Vocaluxe.Base
private static int _CurrentLanguage = 0;
private static int _FallbackLanguage = 0;
- public static int Language
+ public static int LanguageId
{
get { return _CurrentLanguage; }
set
@@ -41,13 +41,18 @@ namespace Vocaluxe.Base
}
}
- public static List GetLanguages()
+ public static string GetLanguageName(int lang)
{
- List Languages = new List();
+ return _Languages[lang].Name;
+ }
+
+ public static string[] GetLanguageNames()
+ {
+ string[] Languages = new string[_Languages.Count];
for (int i = 0; i < _Languages.Count; i++)
{
- Languages.Add(_Languages[i].Name);
+ Languages[i]=_Languages[i].Name;
}
return Languages;
@@ -100,128 +105,54 @@ namespace Vocaluxe.Base
if (KeyWord == null)
return "Error";
- if (KeyWord.Length < 3)
+ if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_")
return KeyWord;
- string tag = KeyWord.Substring(0, 3);
- if (tag != "TR_")
- return KeyWord;
-
- string result = null;
-
- int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
+ string result;
if (PartyModeID != -1)
{
- if (PartyModeNr != -1)
- {
- try
- {
- result = (string)_Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
- }
- catch { }
- }
+ int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
+ if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result))
+ return result;
- if (result == null && (PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage)) != -1)
- {
- try
- {
- result = (string)_Languages[_FallbackLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
- }
- catch { }
- }
+ PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage);
+ if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result))
+ return result;
}
+ if (_Languages[_CurrentLanguage].Texts.TryGetValue(KeyWord, out result))
+ return result;
+ if (_Languages[_FallbackLanguage].Texts.TryGetValue(KeyWord, out result))
+ return result;
- if (result == null)
- {
- try
- {
- result = (string)_Languages[_CurrentLanguage].Texts[KeyWord];
- }
- catch { }
- }
-
- if (result == null)
- {
- // keyword not found, try fallback-language
- try
- {
- result = (string)_Languages[_FallbackLanguage].Texts[KeyWord];
- }
- catch { }
-
- if (result == null)
- return KeyWord;
- }
-
- return result;
+ return KeyWord;
}
- public static bool TranslationExists(string KeyWord)
- {
- return TranslationExists(KeyWord, -1);
- }
-
- public static bool TranslationExists(string KeyWord, int PartyModeID)
+ public static bool TranslationExists(string KeyWord, int PartyModeID = -1)
{
if (KeyWord == null)
return false;
- if (KeyWord.Length < 3)
+ if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_")
return false;
- string tag = KeyWord.Substring(0, 3);
- if (tag != "TR_")
- return false;
-
- string result = String.Empty;
-
- int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
if (PartyModeID != -1)
{
- if (PartyModeNr != -1)
- {
- try
- {
- result = (string)_Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
- }
- catch { }
- }
+ int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
+ if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord))
+ return true;
- if (result == null && (PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage)) != -1)
- {
- try
- {
- result = (string)_Languages[_FallbackLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
- }
- catch { }
- }
+ PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage);
+ if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord))
+ return true;
}
+ if (_Languages[_CurrentLanguage].Texts.ContainsKey(KeyWord))
+ return true;
+ if (_Languages[_FallbackLanguage].Texts.ContainsKey(KeyWord))
+ return true;
- if (result == null)
- {
- try
- {
- result = (string)_Languages[_CurrentLanguage].Texts[KeyWord];
- }
- catch { }
- }
-
- if (result == null)
- {
- // keyword not found, try fallback-language
- try
- {
- result = (string)_Languages[_FallbackLanguage].Texts[KeyWord];
- }
- catch { }
-
- if (result == null)
- return false;
- }
-
- return true;
+ return false;
}
public static bool LoadPartyLanguageFiles(int PartyModeID, string Path)
@@ -237,6 +168,29 @@ namespace Vocaluxe.Base
return true;
}
+ private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary Texts)
+ {
+ Texts = new Dictionary();
+ List names = xmlReader.GetAttributes("resources", "name");
+ string value = string.Empty;
+ foreach(string name in names)
+ {
+ if (xmlReader.GetValue("//resources/string[@name='" + name + "']", ref value, ""))
+ {
+ try
+ {
+ Texts.Add(name, value);
+ }
+ catch (Exception e)
+ {
+ CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message);
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
private static bool LoadPartyLanguageFile(int PartyModeID, string file)
{
CXMLReader xmlReader = CXMLReader.OpenFile(file);
@@ -253,25 +207,9 @@ namespace Vocaluxe.Base
SPartyLanguage lang = new SPartyLanguage();
lang.PartyModeID = PartyModeID;
- lang.Texts = new Hashtable();
-
- List texts = xmlReader.GetAttributes("resources", "name");
- for (int i = 0; i < texts.Count; i++)
- {
- if (xmlReader.GetValue("//resources/string[@name='" + texts[i] + "']", ref value, value))
- {
- try
- {
- lang.Texts.Add(texts[i], value);
- }
- catch (Exception e)
- {
- CLog.LogError("Error reading Party Language File " + file + ": " + e.Message);
- return false;
- }
- }
-
- }
+ if (!_LoadLanguageEntries(xmlReader, ref lang.Texts))
+ return false;
+
_Languages[nr].PartyModeTexts.Add(lang);
return true;
}
@@ -299,25 +237,9 @@ namespace Vocaluxe.Base
if (lang.Name == CSettings.FallbackLanguage)
_FallbackLanguage = _Languages.Count;
- lang.Texts = new Hashtable();
lang.PartyModeTexts = new List();
- List texts = xmlReader.GetAttributes("resources", "name");
- for (int i = 0; i < texts.Count; i++)
- {
- if (xmlReader.GetValue("//resources/string[@name='" + texts[i] + "']", ref value, value))
- {
- try
- {
- lang.Texts.Add(texts[i], value);
- }
- catch (Exception e)
- {
- CLog.LogError("Error reading Language File " + FileName + ": " + e.Message);
- }
- }
-
- }
+ _LoadLanguageEntries(xmlReader, ref lang.Texts);
_Languages.Add(lang);
}
diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs
index ce82f067..0b17b4e9 100644
--- a/Vocaluxe/Base/CParty.cs
+++ b/Vocaluxe/Base/CParty.cs
@@ -360,9 +360,9 @@ namespace Vocaluxe.Base
if (CompileResult.Errors.Count > 0)
{
- for (int i = 0; i < CompileResult.Errors.Count; i++)
+ foreach (CompilerError e in CompileResult.Errors)
{
- CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + CompileResult.Errors[i].ErrorText);
+ CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.ErrorText+" in '"+e.FileName+"' ("+e.Line+")");
}
return null;
}
diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs
index 6e668219..a11f9798 100644
--- a/Vocaluxe/Lib/Draw/CDirect3D.cs
+++ b/Vocaluxe/Lib/Draw/CDirect3D.cs
@@ -631,7 +631,7 @@ namespace Vocaluxe.Lib.Draw
public RectangleF GetTextBounds(CText text, float Height)
{
CFonts.Height = Height;
- CFonts.SetFont(text.Fon);
+ CFonts.SetFont(text.Font);
CFonts.Style = text.Style;
return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text)));
}
diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs
index 7edd16c7..859c8352 100644
--- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs
+++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs
@@ -274,7 +274,7 @@ namespace Vocaluxe.Lib.Draw
public RectangleF GetTextBounds(CText text, float Height)
{
CFonts.Height = Height;
- CFonts.SetFont(text.Fon);
+ CFonts.SetFont(text.Font);
CFonts.Style = text.Style;
return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text)));
}
diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs
index 3ccfd7a9..cb04e34e 100644
--- a/Vocaluxe/Lib/Draw/COpenGL.cs
+++ b/Vocaluxe/Lib/Draw/COpenGL.cs
@@ -534,7 +534,7 @@ namespace Vocaluxe.Lib.Draw
public RectangleF GetTextBounds(CText text, float Height)
{
CFonts.Height = Height;
- CFonts.SetFont(text.Fon);
+ CFonts.SetFont(text.Font);
CFonts.Style = text.Style;
return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text)));
}
diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs
index 1dd242d4..80c4ee3a 100644
--- a/Vocaluxe/Screens/CScreenOptionsGame.cs
+++ b/Vocaluxe/Screens/CScreenOptionsGame.cs
@@ -24,9 +24,6 @@ namespace Vocaluxe.Screens
private const string ButtonExit = "ButtonExit";
- private string[] _Languages;
- private int _CurrentLang = -1;
-
public CScreenOptionsGame()
{
}
@@ -39,24 +36,14 @@ namespace Vocaluxe.Screens
_ScreenVersion = ScreenVersion;
_ThemeButtons = new string[] { ButtonExit };
_ThemeSelectSlides = new string[] { SelectSlideLanguage, SelectSlideDebugLevel, SelectSlideSongMenu, SelectSlideSongSorting, SelectSlideTabs, SelectSlideTimerMode };
-
- _Languages = CLanguage.GetLanguages().ToArray();
-
- for (int i = 0; i < _Languages.Length; i++)
- {
- if (_Languages[i] == CConfig.Language)
- {
- _CurrentLang = i;
- }
- }
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
- SelectSlides[SelectSlideLanguage].AddValues(_Languages);
- SelectSlides[SelectSlideLanguage].Selection = _CurrentLang;
+ SelectSlides[SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames());
+ SelectSlides[SelectSlideLanguage].Selection = CLanguage.LanguageId;
SelectSlides[SelectSlideDebugLevel].SetValues((int)CConfig.DebugLevel);
SelectSlides[SelectSlideSongMenu].SetValues((int)CConfig.SongMenu);
@@ -70,11 +57,7 @@ namespace Vocaluxe.Screens
{
base.HandleInput(KeyEvent);
- if (KeyEvent.KeyPressed)
- {
-
- }
- else
+ if (!KeyEvent.KeyPressed)
{
switch (KeyEvent.Key)
{
@@ -143,7 +126,8 @@ namespace Vocaluxe.Screens
private void SaveConfig()
{
- CConfig.Language = _Languages[SelectSlides[SelectSlideLanguage].Selection];
+ CLanguage.LanguageId = SelectSlides[SelectSlideLanguage].Selection;
+ CConfig.Language = CLanguage.GetLanguageName(CLanguage.LanguageId);
CConfig.DebugLevel = (EDebugLevel)SelectSlides[SelectSlideDebugLevel].Selection;
CConfig.SongMenu = (ESongMenu)SelectSlides[SelectSlideSongMenu].Selection;
CConfig.SongSorting = (ESongSorting)SelectSlides[SelectSlideSongSorting].Selection;
@@ -155,7 +139,6 @@ namespace Vocaluxe.Screens
CSongs.Sorter.SongSorting = CConfig.SongSorting;
CSongs.Categorizer.Tabs = CConfig.Tabs;
- CLanguage.SetLanguage(CConfig.Language);
}
}
}
diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs
index fb5bd244..e76db2b6 100644
--- a/VocaluxeLib/Menu/CMenu.cs
+++ b/VocaluxeLib/Menu/CMenu.cs
@@ -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);
}
diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs
index ca81bd1b..35a99e9d 100644
--- a/VocaluxeLib/Menu/CText.cs
+++ b/VocaluxeLib/Menu/CText.cs
@@ -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(item + "/Align", ref _Align);
xmlReader.TryGetEnumValue(item + "/HAlign", ref _HAlign);
_ThemeLoaded &= xmlReader.TryGetEnumValue(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(": Text font name");
- writer.WriteElementString("Font", Fon);
+ writer.WriteElementString("Font", Font);
writer.WriteComment(": 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;
diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs
index 947877c0..440952eb 100644
--- a/VocaluxeLib/Menu/CXMLReader.cs
+++ b/VocaluxeLib/Menu/CXMLReader.cs
@@ -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;
diff --git a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs
index 445a4c3a..47b1d37a 100644
--- a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs
+++ b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs
@@ -31,7 +31,7 @@ namespace Vocaluxe.PartyModes
Warning.Height = 100f;
Warning.X = 150;
Warning.Y = 300;
- Warning.Fon = "Normal";
+ Warning.Font = "Normal";
Warning.Style = EStyle.Normal;
Warning.Color = new SColorF(1f, 0f, 0f, 1f);
Warning.SColor = new SColorF(1f, 0f, 0f, 1f);