From 6a51bdac4c43a76cf10bd93a160a4783aba61393 Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Thu, 3 Jan 2013 14:36:09 +0100 Subject: [PATCH] fixed text translation handling --- Vocaluxe/Base/CFont.cs | 2 +- Vocaluxe/Screens/CScreenParty.cs | 17 +++++++++++------ VocaluxeLib/Menu/CText.cs | 21 ++++++++++++++++++++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 28b3d2f7..79120eb4 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -608,7 +608,7 @@ namespace Vocaluxe.Base public static RectangleF GetTextBounds(CText text, float height) { Height = height; - return new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.PartyModeID)), GetTextHeight(CLanguage.Translate(text.Text, text.PartyModeID))); + return new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)), GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID))); } public static float GetTextWidth(string text) diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index acb2d899..452dd271 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -43,7 +43,7 @@ namespace Vocaluxe.Screens public override void LoadTheme(string XmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(XmlPath); } public override bool HandleInput(KeyEvent KeyEvent) @@ -146,12 +146,14 @@ namespace Vocaluxe.Screens if (index >= _PartyModeInfos.Count) return; - //Description - Texts[htTexts(TextDescription)].PartyModeID = _PartyModeInfos[index].PartyModeID; + //Description Texts[htTexts(TextDescription)].Text = _PartyModeInfos[index].Description; + Texts[htTexts(TextDescription)].TranslationID = _PartyModeInfos[index].PartyModeID; + //TargetAudience - Texts[htTexts(TextTargetAudience)].PartyModeID = _PartyModeInfos[index].PartyModeID; + Texts[htTexts(TextTargetAudience)].TranslationID = _PartyModeInfos[index].PartyModeID; Texts[htTexts(TextTargetAudience)].Text = _PartyModeInfos[index].TargetAudience; + //NumTeams if (_PartyModeInfos[index].MaxTeams == 0) Texts[htTexts(TextNumTeams)].Text = "TR_SCREENPARTY_NOTEAMS"; @@ -159,17 +161,20 @@ namespace Vocaluxe.Screens Texts[htTexts(TextNumTeams)].Text = _PartyModeInfos[index].MaxTeams.ToString(); else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams) Texts[htTexts(TextNumTeams)].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; + //NumPlayers if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers) Texts[htTexts(TextNumPlayers)].Text = _PartyModeInfos[index].MaxTeams.ToString(); else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers) Texts[htTexts(TextNumPlayers)].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; + //Author Texts[htTexts(TextAuthor)].Text = _PartyModeInfos[index].Author; - Texts[htTexts(TextAuthor)].PartyModeID = _PartyModeInfos[index].PartyModeID; + Texts[htTexts(TextAuthor)].TranslationID = _PartyModeInfos[index].PartyModeID; + //Version Texts[htTexts(TextVersion)].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; - Texts[htTexts(TextVersion)].PartyModeID = _PartyModeInfos[index].PartyModeID; + Texts[htTexts(TextVersion)].TranslationID = _PartyModeInfos[index].PartyModeID; if (!_PartyModeInfos[index].Playable) { diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index 6b2ac347..42bf4b12 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -40,6 +40,7 @@ namespace Vocaluxe.Menu private SThemeText _Theme; private bool _ThemeLoaded; private int _PartyModeID; + private int _TranslationID; public string GetThemeName() { @@ -209,7 +210,7 @@ namespace Vocaluxe.Menu get { return _Theme.Text; } set { - string translation = _Base.Language.Translate(value, _PartyModeID); + string translation = _Base.Language.Translate(value, _TranslationID); if (_Theme.Text != value || translation != _Text) { _Theme.Text = value; @@ -227,6 +228,18 @@ namespace Vocaluxe.Menu _Text = _Base.Language.Translate(_Text, value); _PositionNeedsUpdate = true; _PartyModeID = value; + _TranslationID = value; + } + } + + public int TranslationID + { + get { return _TranslationID; } + set + { + _Text = _Base.Language.Translate(_Text, value); + _PositionNeedsUpdate = true; + _TranslationID = value; } } @@ -243,6 +256,7 @@ namespace Vocaluxe.Menu _ThemeLoaded = false; _ButtonText = false; _PartyModeID = PartyModeID; + _TranslationID = _PartyModeID; X = 0f; Y = 0f; @@ -274,6 +288,7 @@ namespace Vocaluxe.Menu _ThemeLoaded = false; _ButtonText = false; _PartyModeID = text._PartyModeID; + _TranslationID = text._TranslationID; X = text._X; Y = text._Y; @@ -307,6 +322,7 @@ namespace Vocaluxe.Menu _ThemeLoaded = false; _ButtonText = false; _PartyModeID = -1; + _TranslationID = -1; X = x; Y = y; @@ -346,6 +362,7 @@ namespace Vocaluxe.Menu _ThemeLoaded = false; _ButtonText = false; _PartyModeID = -1; + _TranslationID = -1; X = x; Y = y; @@ -383,6 +400,7 @@ namespace Vocaluxe.Menu _ThemeLoaded = false; _ButtonText = false; _PartyModeID = -1; + _TranslationID = -1; X = x; Y = y; @@ -422,6 +440,7 @@ namespace Vocaluxe.Menu _ThemeLoaded = false; _ButtonText = false; _PartyModeID = -1; + _TranslationID = -1; X = x; Y = y;