# HG changeset patch # User IBBoard # Date 1280586381 0 # Node ID 0e17097db8e5715d6b5c9868671fd1b69c9d2623 # Parent 1925af42100ccc4c9a7ba5ae7b5b6c58a131b48c Fixes #300: WinForms UI doesn't make it obvious why nothing is listed on first run * Added a warning icon and tooltip message to the New Army dialog * Added initial English translation text Also: * Layered the enabling of widgets so that they are only enabled when they make sense (so empty list won't be enabled) diff -r 1925af42100c -r 0e17097db8e5 FrmNewArmy.cs --- a/FrmNewArmy.cs Sun Jul 25 17:17:55 2010 +0000 +++ b/FrmNewArmy.cs Sat Jul 31 14:26:21 2010 +0000 @@ -20,10 +20,7 @@ /// public class FrmNewArmy : IBBForm { - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; + private IContainer components; private IBBoard.Windows.Forms.IBBButton bttnCancel; private IBBoard.Windows.Forms.IBBLabel lblRaceList; private IBBoard.Windows.Forms.IBBButton bttnSelectRace; @@ -38,6 +35,7 @@ private GameSystem system; private Race race; private string armyName; + private ToolTip gameSystemToolTip; private int maxPoints; public FrmNewArmy(GameSystem system) @@ -51,6 +49,17 @@ gameSystems.Items.Add(gameSystem); } + if (gameSystems.Items.Count > 0) + { + gameSystems.Enabled = true; + lblGameSystem.Image = null; + } + else + { + gameSystems.Enabled = false; + gameSystemToolTip.SetToolTip(lblGameSystem, Translation.GetTranslation("newArmyNoGameSystems", "could not load data for game systems - please check logs")); + } + if (system != null) { gameSystems.SelectedItem = system; @@ -91,6 +100,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewArmy)); this.lstRaces = new System.Windows.Forms.ListBox(); this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); @@ -100,16 +110,18 @@ this.txtArmyName = new System.Windows.Forms.TextBox(); this.lblArmySize = new IBBoard.Windows.Forms.IBBLabel(); this.armySize = new System.Windows.Forms.NumericUpDown(); + this.gameSystems = new System.Windows.Forms.ComboBox(); this.lblGameSystem = new IBBoard.Windows.Forms.IBBLabel(); - this.gameSystems = new System.Windows.Forms.ComboBox(); - ((System.ComponentModel.ISupportInitialize) (this.armySize)).BeginInit(); + this.gameSystemToolTip = new System.Windows.Forms.ToolTip(this.components); + ((System.ComponentModel.ISupportInitialize)(this.armySize)).BeginInit(); this.SuspendLayout(); // // lstRaces // - this.lstRaces.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.lstRaces.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lstRaces.DisplayMember = "Name"; + this.lstRaces.Enabled = false; this.lstRaces.Location = new System.Drawing.Point(141, 33); this.lstRaces.Name = "lstRaces"; this.lstRaces.Size = new System.Drawing.Size(265, 121); @@ -138,7 +150,7 @@ // // bttnSelectRace // - this.bttnSelectRace.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.bttnSelectRace.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.bttnSelectRace.Enabled = false; this.bttnSelectRace.FlatStyle = System.Windows.Forms.FlatStyle.System; @@ -160,8 +172,9 @@ // // txtArmyName // - this.txtArmyName.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.txtArmyName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.txtArmyName.Enabled = false; this.txtArmyName.Location = new System.Drawing.Point(141, 160); this.txtArmyName.Name = "txtArmyName"; this.txtArmyName.Size = new System.Drawing.Size(265, 20); @@ -179,6 +192,7 @@ // // armySize // + this.armySize.Enabled = false; this.armySize.Increment = new decimal(new int[] { 50, 0, @@ -200,18 +214,9 @@ 0, 0}); // - // lblGameSystem - // - this.lblGameSystem.Location = new System.Drawing.Point(12, 9); - this.lblGameSystem.Name = "lblGameSystem"; - this.lblGameSystem.Size = new System.Drawing.Size(123, 18); - this.lblGameSystem.TabIndex = 12; - this.lblGameSystem.Text = "game system"; - this.lblGameSystem.TextAlign = System.Drawing.ContentAlignment.TopRight; - // // gameSystems // - this.gameSystems.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.gameSystems.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.gameSystems.DisplayMember = "Name"; this.gameSystems.FormattingEnabled = true; @@ -221,6 +226,17 @@ this.gameSystems.TabIndex = 13; this.gameSystems.SelectedValueChanged += new System.EventHandler(this.gameSystems_SelectedValueChanged); // + // lblGameSystem + // + this.lblGameSystem.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.warning_sml; + this.lblGameSystem.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lblGameSystem.Location = new System.Drawing.Point(12, 9); + this.lblGameSystem.Name = "lblGameSystem"; + this.lblGameSystem.Size = new System.Drawing.Size(123, 18); + this.lblGameSystem.TabIndex = 12; + this.lblGameSystem.Text = "game system"; + this.lblGameSystem.TextAlign = System.Drawing.ContentAlignment.TopRight; + // // FrmNewArmy // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); @@ -236,14 +252,14 @@ this.Controls.Add(this.bttnSelectRace); this.Controls.Add(this.lstRaces); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FrmNewArmy"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "FrmNewArmy"; - ((System.ComponentModel.ISupportInitialize) (this.armySize)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.armySize)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -309,6 +325,9 @@ private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) { setSelectRaceEnabledVal(); + bool raceSelected = lstRaces.SelectedItem != null; + txtArmyName.Enabled = raceSelected; + armySize.Enabled = raceSelected; } private void gameSystems_SelectedValueChanged(object sender, EventArgs e) @@ -320,11 +339,13 @@ { SetRaces(selected); - if (lstRaces.Items.Count > 0) + if (lstRaces.Items.Count == 1) { lstRaces.SelectedIndex = 0; } } + + lstRaces.Enabled = lstRaces.Items.Count > 0; } } } diff -r 1925af42100c -r 0e17097db8e5 FrmNewArmy.resx --- a/FrmNewArmy.resx Sun Jul 25 17:17:55 2010 +0000 +++ b/FrmNewArmy.resx Sat Jul 31 14:26:21 2010 +0000 @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + diff -r 1925af42100c -r 0e17097db8e5 IBBoard.WarFoundry.GUI.WinForms.csproj --- a/IBBoard.WarFoundry.GUI.WinForms.csproj Sun Jul 25 17:17:55 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.WinForms.csproj Sat Jul 31 14:26:21 2010 +0000 @@ -109,6 +109,7 @@ + PreserveNewest diff -r 1925af42100c -r 0e17097db8e5 Properties/Resources.Designer.cs --- a/Properties/Resources.Designer.cs Sun Jul 25 17:17:55 2010 +0000 +++ b/Properties/Resources.Designer.cs Sat Jul 31 14:26:21 2010 +0000 @@ -101,5 +101,12 @@ return ((System.Drawing.Bitmap)(obj)); } } + + internal static System.Drawing.Bitmap warning_sml { + get { + object obj = ResourceManager.GetObject("warning-sml", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff -r 1925af42100c -r 0e17097db8e5 Properties/Resources.resx --- a/Properties/Resources.resx Sun Jul 25 17:17:55 2010 +0000 +++ b/Properties/Resources.resx Sat Jul 31 14:26:21 2010 +0000 @@ -118,22 +118,25 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\icons\document-open.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\icons\document-new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\icons\document-save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\icons\edit-redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\icons\edit-undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\icons\document-save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\document-new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icons\document-open.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\icons\list-add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\icons\warning-sml.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff -r 1925af42100c -r 0e17097db8e5 translations/en.translation --- a/translations/en.translation Sun Jul 25 17:17:55 2010 +0000 +++ b/translations/en.translation Sat Jul 31 14:26:21 2010 +0000 @@ -38,6 +38,8 @@ Army name: Army size: Create army + WarFoundry couldn't find any game system data. +Please check the logs for errors and ensure you have some game system data files in the "data" folder. Add New {0} Choice Unit types: Create unit