Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
diff FrmMain.cs @ 190:1ca23c47345a
Re #327: Point names used in the GUI
author | snowblizz |
---|---|
date | Mon, 24 Jan 2011 16:50:31 +0000 |
parents | 75afd724a825 |
children | 70575ace029b |
line wrap: on
line diff
--- a/FrmMain.cs Sun Dec 12 17:30:53 2010 +0000 +++ b/FrmMain.cs Mon Jan 24 16:50:31 2011 +0000 @@ -24,6 +24,7 @@ using IBBoard.WarFoundry.API.Commands; using IBBoard.WarFoundry.API.Exporters; using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.API.Util; using IBBoard.WarFoundry.API.Savers; using IBBoard.WarFoundry.API.Factories; using IBBoard.WarFoundry.API.Factories.Xml; @@ -38,6 +39,12 @@ private static readonly string AppTitle = "WarFoundry"; internal static readonly string VERSION = "0.1"; const string DefaultDataDir = "data"; + /* public static string pointsAbbrevSingle; + public static string pointsAbbrevPlural; + public static string pointsAbbreviation; + public static string pointsNameSingle; + public static string pointsNamePlural; + public static string pointsName;*/ private Preferences preferences; private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); @@ -94,6 +101,7 @@ private IBBToolStripMenuItem miPreferences; private IBBToolStripMenuItem miAbout; + /// <summary> /// The main entry point for the application. /// </summary> @@ -146,8 +154,9 @@ PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); + sbErrorPanel.Color = Color.Red; - sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value"); + SetPointsPanelToolTipText(); // hack to load default files WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir)); @@ -180,7 +189,15 @@ ControlTranslator.TranslateComponents(components.Components); ControlTranslator.TranslateComponent(openArmyDialog); ControlTranslator.TranslateComponent(saveArmyDialog); - } + //make sure translations exist for gamesystem pointsnames + if (CurrentGameSystem != null) + { + CurrentGameSystem.LoadPointsSystemNames(); + } + //translate pointspanel and tooltip + SetPointsPanelToolTipText(); + SetPointsPanelText(); + } void TranslationChanged() { @@ -868,6 +885,7 @@ { SetAppTitle(); RemoveCategoryButtons(); + newSystem.LoadPointsSystemNames(); } private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) @@ -1274,8 +1292,104 @@ SetPointsPanelText(); } } +/* + public static string UsePointsAbbrev(double pointTemp) + { + if (pointTemp == 1) + { + pointsAbbreviation = pointsAbbrevSingle; + } + else + { + pointsAbbreviation = pointsAbbrevPlural; + } + return pointsAbbreviation; + } - private void SetPointsPanelText() + public static string UsePointsName(double pointTemp) + { + + if (pointTemp == 1) + { + pointsName = pointsNameSingle; + } + else + { + pointsName = pointsNamePlural; + } + return pointsName; + } + + private void LoadPointsSystemNames() + { + LoadPointsAbbrevPlural(); + LoadPointsAbbrevSingle(); + LoadPointsNamePlural(); + LoadPointsNameSingle(); + } + private void LoadPointsAbbrevPlural() + { + // Use this before calling on pointsAbbreviationPlural to "populate" the variable + if (CurrentGameSystem != null ) + { + if (CurrentGameSystem.SystemPtsAbbrevPlural == "") + { + pointsAbbrevPlural = String.Format(Translation.GetTranslation("PointsLocalisationAbbrevPlural")); + } + else + { + pointsAbbrevPlural = CurrentGameSystem.SystemPtsAbbrevPlural; + } + } + } + private void LoadPointsAbbrevSingle() + { + // Use this before calling on pointsAbbreviationSingle to "populate" the variable + if (CurrentGameSystem != null ) + { + if (CurrentGameSystem.SystemPtsAbbrevSingle == "") + { + pointsAbbrevSingle = String.Format(Translation.GetTranslation("PointsLocalisationAbbrevSingle")); + } + else + { + pointsAbbrevSingle = CurrentGameSystem.SystemPtsAbbrevSingle; + } + } + } + private void LoadPointsNamePlural() + { + if (CurrentGameSystem != null ) + { + // Use this before calling on pointsNamePlural to "populate" the variable + if (CurrentGameSystem.SystemPtsNamePlural == "") + { + pointsNamePlural = String.Format(Translation.GetTranslation("PointsLocalisationNamePlural")); + } + else + { + pointsNamePlural = CurrentGameSystem.SystemPtsNamePlural; + } + } + } + + private void LoadPointsNameSingle() + { + if (CurrentGameSystem != null ) + { + // Use this before calling on pointsNameSingle to "populate" the variable + if (CurrentGameSystem.SystemPtsNameSingle == "") + { + pointsNameSingle = String.Format(Translation.GetTranslation("PointsLocalisationNameSingle")); + } + else + { + pointsNameSingle = CurrentGameSystem.SystemPtsNameSingle; + } + } + } + */ + private void SetPointsPanelText() { if (CurrentArmy==null) { @@ -1284,7 +1398,8 @@ } else { - sbPointsPanel.Text = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentArmy.MaxPoints); + string pointsPanelText = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentGameSystem.UsePointsName(CurrentArmy.Points), CurrentArmy.MaxPoints, CurrentGameSystem.UsePointsName(CurrentArmy.MaxPoints)); + sbPointsPanel.Text = pointsPanelText; if (CurrentArmy.Points>CurrentArmy.MaxPoints) { @@ -1297,6 +1412,11 @@ } } + private void SetPointsPanelToolTipText() + { + sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value"); + } + private void redoMenu_Click(object sender, EventArgs e) { if (sender is ToolStripDropDownItem)