Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
changeset 222:b3a47b712a8b
* Merge branch (code already merged in Subversion, but Mercurial kept the branch)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 26 Aug 2011 20:11:28 +0100 |
parents | c47094612bac (diff) 9d17b4674f6e (current diff) |
children | ec2b73de16ba |
files | FrmNewArmy.cs IBBoard.WarFoundry.GUI.WinForms.csproj |
diffstat | 28 files changed, 2800 insertions(+), 1971 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,4 @@ +bin/ +obj/ +IBBoard.WarFoundry.GUI.WinForms.csproj.user +IBBoard.WarFoundry.GUI.WinForms.suo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgtags Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,11 @@ +60c795eca8de6f4489bdac974253785c27b3bacd WarFoundry_v0.1beta8_Winforms +acb4456598cea552939eddfaae4239474d210af9 WarFoundry_v0.1beta7_Winforms +e1e3957db12981f40df3b829191e99eb1763a5ca WarFoundry_v0.1beta5_Winforms +e1e3957db12981f40df3b829191e99eb1763a5ca WarFoundry_v0.1beta5a_Winforms +0e7c257ca8d6d920ddf90a4e6c93632af4ad0efa WarFoundry_v0.1beta2_Winforms +e04bea5b7b3d7c722b92993805bb665c50edd812 WarFoundry_v0.1beta3_Winforms +e3488dd61a217bd9a80c835d4d63612816c5b6de WarFoundry_v0.1beta4_Winforms +def0c33a662c1ad53c007367438a30f2a4b40b90 WarFoundry_v0.1RC1_Winforms +def0c33a662c1ad53c007367438a30f2a4b40b90 WarFoundry_v0.1beta9_Winforms +cf644b2c65e608dc8848f05966bcbb7dfece040b WarFoundry_v0.1beta_Winforms +9c5f7c5b0f1cb014266bbf46d063f8938c9718fc WarFoundry_v0.1beta6_Winforms
--- a/AssemblyInfo.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/AssemblyInfo.cs Fri Aug 26 20:11:28 2011 +0100 @@ -15,7 +15,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WarFoundry")] -[assembly: AssemblyCopyright("IBBoard, 2007-2009")] +[assembly: AssemblyCopyright("IBBoard and others, 2007-2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -30,7 +30,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.0.1.*")] +[assembly: AssemblyVersion("0.1.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the
--- a/FrmAbout.Designer.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmAbout.Designer.cs Fri Aug 26 20:11:28 2011 +0100 @@ -28,153 +28,156 @@ /// </summary> private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAbout)); - this.lblWarFoundry = new System.Windows.Forms.Label(); - this.lblVersion = new System.Windows.Forms.Label(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.developersPage = new System.Windows.Forms.TabPage(); - this.listBox1 = new System.Windows.Forms.ListBox(); - this.testersPage = new System.Windows.Forms.TabPage(); - this.listBox2 = new System.Windows.Forms.ListBox(); - this.translatorsPage = new System.Windows.Forms.TabPage(); - this.listBox3 = new System.Windows.Forms.ListBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.tabControl1.SuspendLayout(); - this.developersPage.SuspendLayout(); - this.testersPage.SuspendLayout(); - this.translatorsPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); - // - // lblWarFoundry - // - this.lblWarFoundry.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblWarFoundry.Location = new System.Drawing.Point(12, 9); - this.lblWarFoundry.Name = "lblWarFoundry"; - this.lblWarFoundry.Size = new System.Drawing.Size(212, 45); - this.lblWarFoundry.TabIndex = 0; - this.lblWarFoundry.Text = "WarFoundry"; - // - // lblVersion - // - this.lblVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblVersion.Location = new System.Drawing.Point(16, 54); - this.lblVersion.Name = "lblVersion"; - this.lblVersion.Size = new System.Drawing.Size(264, 23); - this.lblVersion.TabIndex = 1; - this.lblVersion.Text = "v0.1b4"; - // - // tabControl1 - // - this.tabControl1.Controls.Add(this.developersPage); - this.tabControl1.Controls.Add(this.testersPage); - this.tabControl1.Controls.Add(this.translatorsPage); - this.tabControl1.Location = new System.Drawing.Point(12, 80); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(276, 184); - this.tabControl1.TabIndex = 6; - // - // developersPage - // - this.developersPage.Controls.Add(this.listBox1); - this.developersPage.Location = new System.Drawing.Point(4, 22); - this.developersPage.Name = "developersPage"; - this.developersPage.Padding = new System.Windows.Forms.Padding(3); - this.developersPage.Size = new System.Drawing.Size(268, 158); - this.developersPage.TabIndex = 0; - this.developersPage.Text = "Developers"; - this.developersPage.UseVisualStyleBackColor = true; - // - // listBox1 - // - this.listBox1.FormattingEnabled = true; - this.listBox1.Items.AddRange(new object[] { - "IBBoard (Main developer and project lead)"}); - this.listBox1.Location = new System.Drawing.Point(0, 0); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(268, 160); - this.listBox1.TabIndex = 0; - // - // testersPage - // - this.testersPage.Controls.Add(this.listBox2); - this.testersPage.Location = new System.Drawing.Point(4, 22); - this.testersPage.Name = "testersPage"; - this.testersPage.Padding = new System.Windows.Forms.Padding(3); - this.testersPage.Size = new System.Drawing.Size(268, 158); - this.testersPage.TabIndex = 1; - this.testersPage.Text = "Testers"; - this.testersPage.UseVisualStyleBackColor = true; - // - // listBox2 - // - this.listBox2.FormattingEnabled = true; - this.listBox2.Items.AddRange(new object[] { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAbout)); + this.lblWarFoundry = new System.Windows.Forms.Label(); + this.lblVersion = new System.Windows.Forms.Label(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.developersPage = new System.Windows.Forms.TabPage(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.testersPage = new System.Windows.Forms.TabPage(); + this.listBox2 = new System.Windows.Forms.ListBox(); + this.translatorsPage = new System.Windows.Forms.TabPage(); + this.listBox3 = new System.Windows.Forms.ListBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.tabControl1.SuspendLayout(); + this.developersPage.SuspendLayout(); + this.testersPage.SuspendLayout(); + this.translatorsPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // lblWarFoundry + // + this.lblWarFoundry.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblWarFoundry.Location = new System.Drawing.Point(12, 9); + this.lblWarFoundry.Name = "lblWarFoundry"; + this.lblWarFoundry.Size = new System.Drawing.Size(212, 45); + this.lblWarFoundry.TabIndex = 0; + this.lblWarFoundry.Text = "WarFoundry"; + // + // lblVersion + // + this.lblVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblVersion.Location = new System.Drawing.Point(16, 54); + this.lblVersion.Name = "lblVersion"; + this.lblVersion.Size = new System.Drawing.Size(264, 23); + this.lblVersion.TabIndex = 1; + this.lblVersion.Text = "v?.?"; + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.developersPage); + this.tabControl1.Controls.Add(this.testersPage); + this.tabControl1.Controls.Add(this.translatorsPage); + this.tabControl1.Location = new System.Drawing.Point(12, 80); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(276, 184); + this.tabControl1.TabIndex = 6; + // + // developersPage + // + this.developersPage.Controls.Add(this.listBox1); + this.developersPage.Location = new System.Drawing.Point(4, 22); + this.developersPage.Name = "developersPage"; + this.developersPage.Padding = new System.Windows.Forms.Padding(3); + this.developersPage.Size = new System.Drawing.Size(268, 158); + this.developersPage.TabIndex = 0; + this.developersPage.Text = "Developers"; + this.developersPage.UseVisualStyleBackColor = true; + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.Items.AddRange(new object[] { + "IBBoard (Main developer and project lead)", + "Snowblizz (Default army names and translation fixes)"}); + this.listBox1.Location = new System.Drawing.Point(0, 0); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(268, 160); + this.listBox1.TabIndex = 0; + // + // testersPage + // + this.testersPage.Controls.Add(this.listBox2); + this.testersPage.Location = new System.Drawing.Point(4, 22); + this.testersPage.Name = "testersPage"; + this.testersPage.Padding = new System.Windows.Forms.Padding(3); + this.testersPage.Size = new System.Drawing.Size(268, 158); + this.testersPage.TabIndex = 1; + this.testersPage.Text = "Testers"; + this.testersPage.UseVisualStyleBackColor = true; + // + // listBox2 + // + this.listBox2.FormattingEnabled = true; + this.listBox2.Items.AddRange(new object[] { "Snowblizz", "Frostlee", "Lord_Archaon", "Furrie", - "clutch110"}); - this.listBox2.Location = new System.Drawing.Point(0, -1); - this.listBox2.Name = "listBox2"; - this.listBox2.Size = new System.Drawing.Size(268, 160); - this.listBox2.TabIndex = 1; - // - // translatorsPage - // - this.translatorsPage.Controls.Add(this.listBox3); - this.translatorsPage.Location = new System.Drawing.Point(4, 22); - this.translatorsPage.Name = "translatorsPage"; - this.translatorsPage.Size = new System.Drawing.Size(268, 158); - this.translatorsPage.TabIndex = 2; - this.translatorsPage.Text = "Translators"; - this.translatorsPage.UseVisualStyleBackColor = true; - // - // listBox3 - // - this.listBox3.FormattingEnabled = true; - this.listBox3.Items.AddRange(new object[] { - "Snowblizz (Swedish translation)", + "clutch110", + "Mollo", + "HeWhoWatches"}); + this.listBox2.Location = new System.Drawing.Point(0, -1); + this.listBox2.Name = "listBox2"; + this.listBox2.Size = new System.Drawing.Size(268, 160); + this.listBox2.TabIndex = 1; + // + // translatorsPage + // + this.translatorsPage.Controls.Add(this.listBox3); + this.translatorsPage.Location = new System.Drawing.Point(4, 22); + this.translatorsPage.Name = "translatorsPage"; + this.translatorsPage.Size = new System.Drawing.Size(268, 158); + this.translatorsPage.TabIndex = 2; + this.translatorsPage.Text = "Translators"; + this.translatorsPage.UseVisualStyleBackColor = true; + // + // listBox3 + // + this.listBox3.FormattingEnabled = true; + this.listBox3.Items.AddRange(new object[] { + "Snowblizz (Swedish and Finnish translations)", "Frostlee (Italian translation)", "Lord_Archaon (Russian translation)", "Furrie (Dutch translation)", "Dreadaxe (French translation)", "Blackhawk (German translation)"}); - this.listBox3.Location = new System.Drawing.Point(0, -1); - this.listBox3.Name = "listBox3"; - this.listBox3.Size = new System.Drawing.Size(268, 160); - this.listBox3.TabIndex = 1; - // - // pictureBox1 - // - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.Location = new System.Drawing.Point(230, 12); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(68, 68); - this.pictureBox1.TabIndex = 7; - this.pictureBox1.TabStop = false; - // - // FrmAbout - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(300, 276); - this.Controls.Add(this.pictureBox1); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this.lblVersion); - this.Controls.Add(this.lblWarFoundry); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FrmAbout"; - this.Text = "FrmAbout"; - this.tabControl1.ResumeLayout(false); - this.developersPage.ResumeLayout(false); - this.testersPage.ResumeLayout(false); - this.translatorsPage.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); + this.listBox3.Location = new System.Drawing.Point(0, -1); + this.listBox3.Name = "listBox3"; + this.listBox3.Size = new System.Drawing.Size(268, 160); + this.listBox3.TabIndex = 1; + // + // pictureBox1 + // + this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); + this.pictureBox1.Location = new System.Drawing.Point(230, 12); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(68, 68); + this.pictureBox1.TabIndex = 7; + this.pictureBox1.TabStop = false; + // + // FrmAbout + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(300, 276); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.lblVersion); + this.Controls.Add(this.lblWarFoundry); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FrmAbout"; + this.Text = "FrmAbout"; + this.tabControl1.ResumeLayout(false); + this.developersPage.ResumeLayout(false); + this.testersPage.ResumeLayout(false); + this.translatorsPage.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); }
--- a/FrmArmyTree.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmArmyTree.cs Fri Aug 26 20:11:28 2011 +0100 @@ -1,462 +1,469 @@ -// This file (FrmArmyTree.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. -// -// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. - -using System; -using System.Drawing; -using System.Collections.Generic; -using System.ComponentModel; -using System.Windows.Forms; -using IBBoard.Commands; -using IBBoard.Lang; -using IBBoard.Windows.Forms.I18N; -using IBBoard.Windows.Forms; -using IBBoard.WarFoundry.API; -using IBBoard.WarFoundry.API.Commands; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry.GUI.WinForms -{ - /// <summary> - /// Summary description for FrmArmyTree. - /// </summary> - public class FrmArmyTree : IBBoard.Windows.Forms.IBBForm - { - private System.Windows.Forms.TreeView treeView; - private IContainer components; - private Dictionary<string, TreeNode> nodes; - private System.Windows.Forms.ContextMenu contextMenu; - private IBBMenuItem miDeleteUnit; - private IBBMenuItem miEditUnit; - - private ObjectAddDelegate UnitAddedMethod; - private ObjectRemoveDelegate UnitRemovedMethod; - private StringValChangedDelegate UnitNameChangedMethod, ArmyNameChangedMethod, TreeNameChangedMethod; - private ToolBar toolBar; - private IBBToolBarButton bttnEdit; - private IBBToolBarButton bttnDelete; - private ImageList imageList; - private CommandStack commandStack; - - public FrmArmyTree(CommandStack cmdStack) - { - commandStack = cmdStack; - InitializeComponent(); - UnitAddedMethod = new ObjectAddDelegate(UnitAdded); - UnitRemovedMethod = new ObjectRemoveDelegate(UnitRemoved); - UnitNameChangedMethod = new StringValChangedDelegate(UpdateUnitName); - ArmyNameChangedMethod = new StringValChangedDelegate(UpdateArmyName); - TreeNameChangedMethod = new StringValChangedDelegate(FrmArmyTree_TreeNameChanged); - nodes = new Dictionary<string, TreeNode>(); - this.Name = "ArmyTree"; - WarFoundryCore.ArmyChanged+= new ArmyChangedDelegate(FrmArmyTree_ArmyChanged); - TranslateForm(); - Translation.TranslationChanged += new MethodInvoker(TranslateForm); - } - - private void TranslateForm() - { - ControlTranslator.TranslateControl(this); - - foreach (Component comp in components.Components) - { - ControlTranslator.TranslateComponent(comp); - } - - foreach (IBBMenuItem mi in contextMenu.MenuItems) - { - ControlTranslator.TranslateComponent(mi); - } - } - - /// <summary> - /// Clean up any resources being used. - /// </summary> - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if(components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - Translation.TranslationChanged -= new MethodInvoker(TranslateForm); - WarFoundryCore.ArmyChanged -= new ArmyChangedDelegate(FrmArmyTree_ArmyChanged); - } - - #region Windows Form Designer generated code - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmArmyTree)); - this.contextMenu = new System.Windows.Forms.ContextMenu(); - this.miEditUnit = new IBBoard.Windows.Forms.IBBMenuItem(); - this.miDeleteUnit = new IBBoard.Windows.Forms.IBBMenuItem(); - this.imageList = new System.Windows.Forms.ImageList(this.components); - this.toolBar = new System.Windows.Forms.ToolBar(); - this.bttnEdit = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.bttnDelete = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.treeView = new System.Windows.Forms.TreeView(); - this.SuspendLayout(); - // - // contextMenu - // - this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.miEditUnit, - this.miDeleteUnit}); - this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup); - // - // miEditUnit - // - this.miEditUnit.Index = 0; - this.miEditUnit.Text = "&edit unit"; - this.miEditUnit.Click += new System.EventHandler(this.miEdit_Click); - this.miEditUnit.Name = "miEditUnit"; - // - // miDeleteUnit - // - this.miDeleteUnit.Index = 1; - this.miDeleteUnit.Text = "&delete unit"; - this.miDeleteUnit.Click += new System.EventHandler(this.miDelete_Click); - this.miDeleteUnit.Name = "miDeleteUnit"; - // - // imageList - // - this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer) (resources.GetObject("imageList.ImageStream"))); - this.imageList.TransparentColor = System.Drawing.Color.Transparent; - this.imageList.Images.SetKeyName(0, "gtk-edit.png"); - this.imageList.Images.SetKeyName(1, "edit-delete.png"); - // - // toolBar - // - this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { - this.bttnEdit, - this.bttnDelete}); - this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); - this.toolBar.DropDownArrows = true; - this.toolBar.ImageList = this.imageList; - this.toolBar.Location = new System.Drawing.Point(0, 0); - this.toolBar.Name = "toolBar"; - this.toolBar.ShowToolTips = true; - this.toolBar.Size = new System.Drawing.Size(240, 28); - this.toolBar.TabIndex = 3; - this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); - // - // bttnEdit - // - this.bttnEdit.Enabled = false; - this.bttnEdit.ImageIndex = 0; - this.bttnEdit.Name = "bttnEdit"; - // - // bttnDelete - // - this.bttnDelete.Enabled = false; - this.bttnDelete.ImageIndex = 1; - this.bttnDelete.Name = "bttnDelete"; - // - // treeView - // - this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.treeView.ContextMenu = this.contextMenu; - this.treeView.FullRowSelect = true; - this.treeView.Location = new System.Drawing.Point(0, 28); - this.treeView.Name = "treeView"; - this.treeView.Size = new System.Drawing.Size(240, 250); - this.treeView.TabIndex = 0; - this.treeView.DoubleClick += new System.EventHandler(this.treeView_DoubleClick); - this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); - this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown); - // - // FrmArmyTree - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(240, 277); - this.ControlBox = false; - this.Controls.Add(this.toolBar); - this.Controls.Add(this.treeView); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FrmArmyTree"; - this.Text = "FrmArmyTree"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - #endregion - - private void ClearArmy() - { - nodes.Clear(); - treeView.Nodes.Clear(); - } - - private void SetArmy(Army army) - { - ClearArmy(); - - if (army != null) - { - ArmyCategory[] cats = army.Categories; - TreeNode[] catNodes = new TreeNode[cats.Length]; - Unit[] units; - - for (int i = 0; i < cats.Length; i++) - { - ArmyCategory cat = cats[i]; - units = army.GetUnits(cat); - cat.NameChanged += TreeNameChangedMethod; - cat.PointsValueChanged += NodePointsValueChanged; - TreeNode[] unitNodes = new TreeNode[units.Length]; - TreeNode temp; - - for (int j = 0; j < units.Length; j++) - { - unitNodes[j] = CreateTreeNode(units[j]); - } - - temp = new TreeNode(CreateNodeName(cat), unitNodes); - temp.Tag = cat; - catNodes[i] = temp; - nodes[cat.ID] = temp; - } - - TreeNode root = new TreeNode(CreateNodeName(army), catNodes); - root.Tag = army; - army.PointsValueChanged += NodePointsValueChanged; - nodes[army.ID] = root; - treeView.Nodes.Add(root); - root.ExpandAll(); - } - } - - private string CreateNodeName(ICostedWarFoundryObject obj) - { - return Translation.GetTranslation("treeNodeText", "{0} ({1}pts)", obj.Name, obj.Points); - } - - private void NodePointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) - { - if (obj is ICostedWarFoundryObject) - { - SetNodeName(obj); - } - } - - private void SetNodeName(WarFoundryObject obj) - { - TreeNode node = nodes[obj.ID]; - - if (node != null) - { - node.Text = CreateNodeName((ICostedWarFoundryObject)obj); - } - } - - private TreeNode CreateTreeNode(Unit unit) - { - TreeNode temp = new TreeNode(CreateNodeName(unit)); - temp.Tag = unit; - unit.NameChanged+= UnitNameChangedMethod; - unit.PointsValueChanged += NodePointsValueChanged; - nodes[unit.ID] = temp; - return temp; - } - - public void FrmArmyTree_ArmyChanged(Army oldArmy, Army newArmy) - { - if (oldArmy != null) - { - oldArmy.UnitAdded -= UnitAddedMethod; - oldArmy.UnitRemoved -= UnitRemovedMethod; - oldArmy.PointsValueChanged -= NodePointsValueChanged; - } - - if (newArmy != null) - { - newArmy.UnitAdded += UnitAddedMethod; - newArmy.UnitRemoved += UnitRemovedMethod; - newArmy.PointsValueChanged += NodePointsValueChanged; - } - - SetArmy(newArmy); - } - - private void UnitAdded(WarFoundryObject obj) - { - if (obj is Unit) - { - Unit unit = (Unit)obj; - ArmyCategory cat = unit.Category; - TreeNode parent = nodes[cat.ID]; - TreeNode unitNode = CreateTreeNode(unit); - parent.Nodes.Add(unitNode); - parent.Expand(); //make sure it's expanded - } - } - - public new FrmMain MdiParent - { - get { return (FrmMain) base.MdiParent; } - set { base.MdiParent = value; } - } - - private void UnitRemoved(WarFoundryObject obj) - { - if (obj is Unit) - { - Unit unit = (Unit)obj; - RemoveUnitFromTree(unit); - } - } - - private void RemoveUnitFromTree(Unit unit) - { - TreeNode unitNode = nodes[unit.ID]; - unit.NameChanged-= UnitNameChangedMethod; - - if (unitNode!=null) - { - unitNode.Remove(); - nodes.Remove(unit.ID); - } - } - - - private void contextMenu_Popup(object sender, System.EventArgs e) - { - TreeNode node = treeView.SelectedNode; - - if (node!=null && node.Tag is Unit) - { - foreach(MenuItem item in contextMenu.MenuItems) - { - item.Visible = true; - } - } - else - { - foreach(MenuItem item in contextMenu.MenuItems) - { - item.Visible = false; - } - } - } - - private void treeView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - TreeNode tn = treeView.GetNodeAt(e.X, e.Y); - - if (tn!=null) - { - treeView.SelectedNode = tn; - } - else - { - treeView.SelectedNode = null; - } - } - } - - private void miDelete_Click(object sender, System.EventArgs e) - { - DeleteUnit(); - } - - private void DeleteUnit() - { - - TreeNode selected = treeView.SelectedNode; - - if (selected.Tag != null && selected.Tag is Unit) - { - Unit unit = (Unit) selected.Tag; - commandStack.Execute(new RemoveUnitCommand(unit)); - } - } - - private void miEdit_Click(object sender, System.EventArgs e) - { - EditUnit(); - } - - private void treeView_DoubleClick(object sender, System.EventArgs e) - { - EditUnit(); - } - - private void EditUnit() - { - TreeNode selected = treeView.SelectedNode; - object tagData = selected.Tag; - - if (tagData is Unit) - { - Unit unit = (Unit) tagData; - MdiParent.OpenUnitDialog(unit); - } - } - - private void UpdateUnitName(WarFoundryObject obj, string oldValue, string newValue) - { - if (obj is ICostedWarFoundryObject) - { - SetNodeName(obj); - } - } - - private void UpdateArmyName(WarFoundryObject obj, string oldValue, string newValue) - { - if (obj is Army) - { - Army army = (Army)obj; - TreeNode node = treeView.Nodes[0]; - - if (node!=null) - { - node.Text = army.Name; - } - } - } - - private void FrmArmyTree_TreeNameChanged(WarFoundryObject obj, string oldValue, string newValue) - { - TreeNode node = nodes[obj.ID]; - - if (node!=null) - { - node.Text = obj.Name; - } - } - - private void toolBar_ButtonClick(object sender, ToolBarButtonClickEventArgs e) - { - if (e.Button == bttnDelete) - { - DeleteUnit(); - } - else if (e.Button == bttnEdit) - { - EditUnit(); - } - } - - private void treeView_AfterSelect(object sender, TreeViewEventArgs e) - { - TreeNode node = treeView.SelectedNode; - - bttnDelete.Enabled = (node != null && node.Tag is Unit); - bttnEdit.Enabled = bttnDelete.Enabled; - } - } -} +// This file (FrmArmyTree.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using IBBoard.Commands; +using IBBoard.Lang; +using IBBoard.Windows.Forms.I18N; +using IBBoard.Windows.Forms; +using IBBoard.WarFoundry.API; +using IBBoard.WarFoundry.API.Commands; +using IBBoard.WarFoundry.API.Objects; + +namespace IBBoard.WarFoundry.GUI.WinForms +{ + /// <summary> + /// Summary description for FrmArmyTree. + /// </summary> + public class FrmArmyTree : IBBoard.Windows.Forms.IBBForm + { + private System.Windows.Forms.TreeView treeView; + private IContainer components; + private Dictionary<string, TreeNode> nodes; + private System.Windows.Forms.ContextMenu contextMenu; + private IBBMenuItem miDeleteUnit; + private IBBMenuItem miEditUnit; + + private ObjectAddDelegate UnitAddedMethod; + private ObjectRemoveDelegate UnitRemovedMethod; + private StringValChangedDelegate UnitNameChangedMethod, ArmyNameChangedMethod, TreeNameChangedMethod; + private ToolBar toolBar; + private IBBToolBarButton bttnEdit; + private IBBToolBarButton bttnDelete; + private ImageList imageList; + private CommandStack commandStack; + public GameSystem CurrentGameSystem + { + get { return WarFoundryCore.CurrentGameSystem; } + set { WarFoundryCore.CurrentGameSystem = value; } + } + + public FrmArmyTree(CommandStack cmdStack) + { + commandStack = cmdStack; + InitializeComponent(); + UnitAddedMethod = new ObjectAddDelegate(UnitAdded); + UnitRemovedMethod = new ObjectRemoveDelegate(UnitRemoved); + UnitNameChangedMethod = new StringValChangedDelegate(UpdateUnitName); + ArmyNameChangedMethod = new StringValChangedDelegate(UpdateArmyName); + TreeNameChangedMethod = new StringValChangedDelegate(FrmArmyTree_TreeNameChanged); + nodes = new Dictionary<string, TreeNode>(); + this.Name = "ArmyTree"; + WarFoundryCore.ArmyChanged+= new ArmyChangedDelegate(FrmArmyTree_ArmyChanged); + TranslateForm(); + Translation.TranslationChanged += new MethodInvoker(TranslateForm); + } + + private void TranslateForm() + { + ControlTranslator.TranslateControl(this); + + foreach (Component comp in components.Components) + { + ControlTranslator.TranslateComponent(comp); + } + + foreach (IBBMenuItem mi in contextMenu.MenuItems) + { + ControlTranslator.TranslateComponent(mi); + } + foreach (TreeNode node in nodes.Values) + { + node.Text = CreateNodeName((ICostedWarFoundryObject)node.Tag); + } + } + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + Translation.TranslationChanged -= new MethodInvoker(TranslateForm); + WarFoundryCore.ArmyChanged -= new ArmyChangedDelegate(FrmArmyTree_ArmyChanged); + } + + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmArmyTree)); + this.contextMenu = new System.Windows.Forms.ContextMenu(); + this.miEditUnit = new IBBoard.Windows.Forms.IBBMenuItem(); + this.miDeleteUnit = new IBBoard.Windows.Forms.IBBMenuItem(); + this.imageList = new System.Windows.Forms.ImageList(this.components); + this.toolBar = new System.Windows.Forms.ToolBar(); + this.bttnEdit = new IBBoard.Windows.Forms.IBBToolBarButton(); + this.bttnDelete = new IBBoard.Windows.Forms.IBBToolBarButton(); + this.treeView = new System.Windows.Forms.TreeView(); + this.SuspendLayout(); + // + // contextMenu + // + this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.miEditUnit, + this.miDeleteUnit}); + this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup); + // + // miEditUnit + // + this.miEditUnit.Index = 0; + this.miEditUnit.Text = "&edit unit"; + this.miEditUnit.Click += new System.EventHandler(this.miEdit_Click); + // + // miDeleteUnit + // + this.miDeleteUnit.Index = 1; + this.miDeleteUnit.Text = "&delete unit"; + this.miDeleteUnit.Click += new System.EventHandler(this.miDelete_Click); + // + // imageList + // + this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); + this.imageList.TransparentColor = System.Drawing.Color.Transparent; + this.imageList.Images.SetKeyName(0, "gtk-edit.png"); + this.imageList.Images.SetKeyName(1, "edit-delete.png"); + // + // toolBar + // + this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { + this.bttnEdit, + this.bttnDelete}); + this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); + this.toolBar.DropDownArrows = true; + this.toolBar.ImageList = this.imageList; + this.toolBar.Location = new System.Drawing.Point(0, 0); + this.toolBar.Name = "toolBar"; + this.toolBar.ShowToolTips = true; + this.toolBar.Size = new System.Drawing.Size(240, 28); + this.toolBar.TabIndex = 3; + this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); + // + // bttnEdit + // + this.bttnEdit.Enabled = false; + this.bttnEdit.ImageIndex = 0; + this.bttnEdit.Name = "bttnEdit"; + // + // bttnDelete + // + this.bttnDelete.Enabled = false; + this.bttnDelete.ImageIndex = 1; + this.bttnDelete.Name = "bttnDelete"; + // + // treeView + // + this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.treeView.ContextMenu = this.contextMenu; + this.treeView.FullRowSelect = true; + this.treeView.Location = new System.Drawing.Point(0, 28); + this.treeView.Name = "treeView"; + this.treeView.Size = new System.Drawing.Size(240, 250); + this.treeView.TabIndex = 0; + this.treeView.DoubleClick += new System.EventHandler(this.treeView_DoubleClick); + this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); + this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown); + // + // FrmArmyTree + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(240, 277); + this.ControlBox = false; + this.Controls.Add(this.toolBar); + this.Controls.Add(this.treeView); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FrmArmyTree"; + this.Text = "FrmArmyTree"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + private void ClearArmy() + { + nodes.Clear(); + treeView.Nodes.Clear(); + } + + private void SetArmy(Army army) + { + ClearArmy(); + + if (army != null) + { + ArmyCategory[] cats = army.Categories; + TreeNode[] catNodes = new TreeNode[cats.Length]; + Unit[] units; + + for (int i = 0; i < cats.Length; i++) + { + ArmyCategory cat = cats[i]; + units = army.GetUnits(cat); + cat.NameChanged += TreeNameChangedMethod; + cat.PointsValueChanged += NodePointsValueChanged; + TreeNode[] unitNodes = new TreeNode[units.Length]; + TreeNode temp; + + for (int j = 0; j < units.Length; j++) + { + unitNodes[j] = CreateTreeNode(units[j]); + } + + temp = new TreeNode(CreateNodeName(cat), unitNodes); + temp.Tag = cat; + catNodes[i] = temp; + nodes[cat.ID] = temp; + } + + TreeNode root = new TreeNode(CreateNodeName(army), catNodes); + root.Tag = army; + army.PointsValueChanged += NodePointsValueChanged; + nodes[army.ID] = root; + treeView.Nodes.Add(root); + root.ExpandAll(); + } + } + + private string CreateNodeName(ICostedWarFoundryObject obj) + { + return Translation.GetTranslation("treeNodeText", "{0} ({1} pts)", obj.Name, obj.Points, CurrentGameSystem.GetPointsAbbrev(obj.Points)); + } + + private void NodePointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) + { + if (obj is ICostedWarFoundryObject) + { + SetNodeName(obj); + } + } + + private void SetNodeName(WarFoundryObject obj) + { + TreeNode node = nodes[obj.ID]; + + if (node != null) + { + node.Text = CreateNodeName((ICostedWarFoundryObject)obj); + } + } + + private TreeNode CreateTreeNode(Unit unit) + { + TreeNode temp = new TreeNode(CreateNodeName(unit)); + temp.Tag = unit; + unit.NameChanged+= UnitNameChangedMethod; + unit.PointsValueChanged += NodePointsValueChanged; + nodes[unit.ID] = temp; + return temp; + } + + public void FrmArmyTree_ArmyChanged(Army oldArmy, Army newArmy) + { + if (oldArmy != null) + { + oldArmy.UnitAdded -= UnitAddedMethod; + oldArmy.UnitRemoved -= UnitRemovedMethod; + oldArmy.PointsValueChanged -= NodePointsValueChanged; + } + + if (newArmy != null) + { + newArmy.UnitAdded += UnitAddedMethod; + newArmy.UnitRemoved += UnitRemovedMethod; + newArmy.PointsValueChanged += NodePointsValueChanged; + } + + SetArmy(newArmy); + } + + private void UnitAdded(WarFoundryObject obj) + { + if (obj is Unit) + { + Unit unit = (Unit)obj; + ArmyCategory cat = unit.Category; + TreeNode parent = nodes[cat.ID]; + TreeNode unitNode = CreateTreeNode(unit); + parent.Nodes.Add(unitNode); + parent.Expand(); //make sure it's expanded + } + } + + public new FrmMain MdiParent + { + get { return (FrmMain) base.MdiParent; } + set { base.MdiParent = value; } + } + + private void UnitRemoved(WarFoundryObject obj) + { + if (obj is Unit) + { + Unit unit = (Unit)obj; + RemoveUnitFromTree(unit); + } + } + + private void RemoveUnitFromTree(Unit unit) + { + TreeNode unitNode = nodes[unit.ID]; + unit.NameChanged-= UnitNameChangedMethod; + + if (unitNode!=null) + { + unitNode.Remove(); + nodes.Remove(unit.ID); + } + } + + + private void contextMenu_Popup(object sender, System.EventArgs e) + { + TreeNode node = treeView.SelectedNode; + + if (node!=null && node.Tag is Unit) + { + foreach(MenuItem item in contextMenu.MenuItems) + { + item.Visible = true; + } + } + else + { + foreach(MenuItem item in contextMenu.MenuItems) + { + item.Visible = false; + } + } + } + + private void treeView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + TreeNode tn = treeView.GetNodeAt(e.X, e.Y); + + if (tn!=null) + { + treeView.SelectedNode = tn; + } + else + { + treeView.SelectedNode = null; + } + } + } + + private void miDelete_Click(object sender, System.EventArgs e) + { + DeleteUnit(); + } + + private void DeleteUnit() + { + + TreeNode selected = treeView.SelectedNode; + + if (selected.Tag != null && selected.Tag is Unit) + { + Unit unit = (Unit) selected.Tag; + commandStack.Execute(new RemoveUnitCommand(unit)); + } + } + + private void miEdit_Click(object sender, System.EventArgs e) + { + EditUnit(); + } + + private void treeView_DoubleClick(object sender, System.EventArgs e) + { + EditUnit(); + } + + private void EditUnit() + { + TreeNode selected = treeView.SelectedNode; + object tagData = selected.Tag; + + if (tagData is Unit) + { + Unit unit = (Unit) tagData; + MdiParent.OpenUnitDialog(unit); + } + } + + private void UpdateUnitName(WarFoundryObject obj, string oldValue, string newValue) + { + if (obj is ICostedWarFoundryObject) + { + SetNodeName(obj); + } + } + + private void UpdateArmyName(WarFoundryObject obj, string oldValue, string newValue) + { + if (obj is Army) + { + Army army = (Army)obj; + TreeNode node = treeView.Nodes[0]; + + if (node!=null) + { + node.Text = army.Name; + } + } + } + + private void FrmArmyTree_TreeNameChanged(WarFoundryObject obj, string oldValue, string newValue) + { + TreeNode node = nodes[obj.ID]; + + if (node!=null) + { + node.Text = obj.Name; + } + } + + private void toolBar_ButtonClick(object sender, ToolBarButtonClickEventArgs e) + { + if (e.Button == bttnDelete) + { + DeleteUnit(); + } + else if (e.Button == bttnEdit) + { + EditUnit(); + } + } + + private void treeView_AfterSelect(object sender, TreeViewEventArgs e) + { + TreeNode node = treeView.SelectedNode; + + bttnDelete.Enabled = (node != null && node.Tag is Unit); + bttnEdit.Enabled = bttnDelete.Enabled; + } + } +}
--- a/FrmMain.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmMain.cs Fri Aug 26 20:11:28 2011 +0100 @@ -24,7 +24,10 @@ using IBBoard.WarFoundry.API.Commands; using IBBoard.WarFoundry.API.Exporters; using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.API.Objects.Requirement; +using IBBoard.WarFoundry.API.Util; using IBBoard.WarFoundry.API.Savers; +using IBBoard.WarFoundry.API.Savers.Xml; using IBBoard.WarFoundry.API.Factories; using IBBoard.WarFoundry.API.Factories.Xml; @@ -36,8 +39,8 @@ public class FrmMain : System.Windows.Forms.Form { private static readonly string AppTitle = "WarFoundry"; - internal static readonly string VERSION = "0.1RC1"; - const string DefaultDataDir = "data"; + internal static readonly string VERSION = "0.1"; + const string DefaultDataDir = "data"; private Preferences preferences; private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); @@ -47,7 +50,6 @@ public ObjectAddDelegate UnitAddedMethod; public ObjectRemoveDelegate UnitRemovedMethod; public DoubleValChangedDelegate PointsValueChangedMethod; - //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; private FrmArmyTree armyTree; private string loadedFilePath; @@ -63,7 +65,6 @@ private System.Windows.Forms.ContextMenu undoMenu; private System.Windows.Forms.ContextMenu redoMenu; private IBBoard.Windows.Forms.ColorableStatusBar statusBar; - private System.Windows.Forms.Timer statusBarTimer; private MenuStrip menuStrip; private IBBToolStripMenuItem menuFile; private IBBToolStripMenuItem miNewArmy; @@ -92,8 +93,10 @@ private ToolStripPanel toolStripPanel; private ToolStripSeparator toolStripSeparator4; private IBBToolStripMenuItem miPreferences; + private IBBToolStripMenuItem miExportArmyAsBasicXml; private IBBToolStripMenuItem miAbout; + /// <summary> /// The main entry point for the application. /// </summary> @@ -144,16 +147,15 @@ UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod); UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod); 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)); WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory()); WarFoundryLoader.GetDefault().FileLoadingFinished += FileLoadingFinished; - WarFoundrySaver.SetFileSaver(new WarFoundryXmlSaver()); + WarFoundrySaver.SetFileSaver(new WarFoundryXmlFileSaver()); } private FrmArmyTree GetArmyTree() @@ -180,7 +182,10 @@ ControlTranslator.TranslateComponents(components.Components); ControlTranslator.TranslateComponent(openArmyDialog); ControlTranslator.TranslateComponent(saveArmyDialog); - } + //translate pointspanel and tooltip + SetPointsPanelToolTipText(); + SetPointsPanelText(); + } void TranslationChanged() { @@ -238,78 +243,73 @@ /// </summary> private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); - this.undoMenu = new System.Windows.Forms.ContextMenu(); - this.redoMenu = new System.Windows.Forms.ContextMenu(); - this.mainMenu = new System.Windows.Forms.MainMenu(this.components); - this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); - this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); - this.statusBarTimer = new System.Windows.Forms.Timer(this.components); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.mainToolStrip = new System.Windows.Forms.ToolStrip(); - this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); - this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); - this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); - this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); - this.catToolStrip = new System.Windows.Forms.ToolStrip(); - this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); - this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); - this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); - this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); - this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.menuStrip.SuspendLayout(); - this.mainToolStrip.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).BeginInit(); - this.SuspendLayout(); - // - // saveArmyDialog - // - this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; - // - // statusBarTimer - // - this.statusBarTimer.Interval = 5000; - this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick); - // - // menuStrip - // - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); + this.undoMenu = new System.Windows.Forms.ContextMenu(); + this.redoMenu = new System.Windows.Forms.ContextMenu(); + this.mainMenu = new System.Windows.Forms.MainMenu(this.components); + this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); + this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miExportArmyAsBasicXml = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.mainToolStrip = new System.Windows.Forms.ToolStrip(); + this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); + this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); + this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); + this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); + this.catToolStrip = new System.Windows.Forms.ToolStrip(); + this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); + this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); + this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); + this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); + this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); + this.menuStrip.SuspendLayout(); + this.mainToolStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); + this.SuspendLayout(); + // + // saveArmyDialog + // + this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; + // + // menuStrip + // + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuFile, this.menuEdit, this.menuHelp}); - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(790, 24); - this.menuStrip.TabIndex = 6; - this.menuStrip.Text = "menuStrip1"; - // - // menuFile - // - this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(790, 24); + this.menuStrip.TabIndex = 6; + this.menuStrip.Text = "menuStrip1"; + // + // menuFile + // + this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miNewArmy, this.miOpenArmy, this.miSaveArmy, @@ -320,295 +320,303 @@ this.miReloadFiles, this.toolStripSeparator2, this.miExit}); - this.menuFile.Name = "menuFile"; - this.menuFile.Size = new System.Drawing.Size(33, 20); - this.menuFile.Text = "&file"; - // - // miNewArmy - // - this.miNewArmy.Name = "miNewArmy"; - this.miNewArmy.Size = new System.Drawing.Size(164, 22); - this.miNewArmy.Text = "&new army"; - this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); - // - // miOpenArmy - // - this.miOpenArmy.Name = "miOpenArmy"; - this.miOpenArmy.Size = new System.Drawing.Size(164, 22); - this.miOpenArmy.Text = "&open army"; - this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); - // - // miSaveArmy - // - this.miSaveArmy.Enabled = false; - this.miSaveArmy.Name = "miSaveArmy"; - this.miSaveArmy.Size = new System.Drawing.Size(164, 22); - this.miSaveArmy.Text = "&save army"; - this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); - // - // miSaveArmyAs - // - this.miSaveArmyAs.Enabled = false; - this.miSaveArmyAs.Name = "miSaveArmyAs"; - this.miSaveArmyAs.Size = new System.Drawing.Size(164, 22); - this.miSaveArmyAs.Text = "save army &as..."; - this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); - // - // miExportArmyAs - // - this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miExportArmyAsBasicHTML}); - this.miExportArmyAs.Enabled = false; - this.miExportArmyAs.Name = "miExportArmyAs"; - this.miExportArmyAs.Size = new System.Drawing.Size(164, 22); - this.miExportArmyAs.Text = "export army as..."; - // - // miExportArmyAsBasicHTML - // - this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; - this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22); - this.miExportArmyAsBasicHTML.Text = "&basic html"; - this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); - // - // miCloseArmy - // - this.miCloseArmy.Enabled = false; - this.miCloseArmy.Name = "miCloseArmy"; - this.miCloseArmy.Size = new System.Drawing.Size(164, 22); - this.miCloseArmy.Text = "&close army"; - this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(161, 6); - // - // miReloadFiles - // - this.miReloadFiles.Name = "miReloadFiles"; - this.miReloadFiles.Size = new System.Drawing.Size(164, 22); - this.miReloadFiles.Text = "&reload files"; - this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6); - // - // miExit - // - this.miExit.Name = "miExit"; - this.miExit.Size = new System.Drawing.Size(164, 22); - this.miExit.Text = "e&xit"; - this.miExit.Click += new System.EventHandler(this.miExit_Click); - // - // menuEdit - // - this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuFile.Name = "menuFile"; + this.menuFile.Size = new System.Drawing.Size(35, 20); + this.menuFile.Text = "&file"; + // + // miNewArmy + // + this.miNewArmy.Name = "miNewArmy"; + this.miNewArmy.Size = new System.Drawing.Size(160, 22); + this.miNewArmy.Text = "&new army"; + this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); + // + // miOpenArmy + // + this.miOpenArmy.Name = "miOpenArmy"; + this.miOpenArmy.Size = new System.Drawing.Size(160, 22); + this.miOpenArmy.Text = "&open army"; + this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); + // + // miSaveArmy + // + this.miSaveArmy.Enabled = false; + this.miSaveArmy.Name = "miSaveArmy"; + this.miSaveArmy.Size = new System.Drawing.Size(160, 22); + this.miSaveArmy.Text = "&save army"; + this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); + // + // miSaveArmyAs + // + this.miSaveArmyAs.Enabled = false; + this.miSaveArmyAs.Name = "miSaveArmyAs"; + this.miSaveArmyAs.Size = new System.Drawing.Size(160, 22); + this.miSaveArmyAs.Text = "save army &as..."; + this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); + // + // miExportArmyAs + // + this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miExportArmyAsBasicHTML, + this.miExportArmyAsBasicXml}); + this.miExportArmyAs.Enabled = false; + this.miExportArmyAs.Name = "miExportArmyAs"; + this.miExportArmyAs.Size = new System.Drawing.Size(160, 22); + this.miExportArmyAs.Text = "export army as..."; + // + // miExportArmyAsBasicHTML + // + this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; + this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(152, 22); + this.miExportArmyAsBasicHTML.Text = "&basic html"; + this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); + // + // miExportArmyAsBasicXml + // + this.miExportArmyAsBasicXml.Name = "miExportArmyAsBasicXml"; + this.miExportArmyAsBasicXml.Size = new System.Drawing.Size(152, 22); + this.miExportArmyAsBasicXml.Text = "basic xml"; + this.miExportArmyAsBasicXml.Click += new System.EventHandler(this.miExportArmyAsBasicXml_Click); + // + // miCloseArmy + // + this.miCloseArmy.Enabled = false; + this.miCloseArmy.Name = "miCloseArmy"; + this.miCloseArmy.Size = new System.Drawing.Size(160, 22); + this.miCloseArmy.Text = "&close army"; + this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(157, 6); + // + // miReloadFiles + // + this.miReloadFiles.Name = "miReloadFiles"; + this.miReloadFiles.Size = new System.Drawing.Size(160, 22); + this.miReloadFiles.Text = "&reload files"; + this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(157, 6); + // + // miExit + // + this.miExit.Name = "miExit"; + this.miExit.Size = new System.Drawing.Size(160, 22); + this.miExit.Text = "e&xit"; + this.miExit.Click += new System.EventHandler(this.miExit_Click); + // + // menuEdit + // + this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miUndo, this.miRedo, this.toolStripSeparator4, this.miPreferences}); - this.menuEdit.Name = "menuEdit"; - this.menuEdit.Size = new System.Drawing.Size(36, 20); - this.menuEdit.Text = "&edit"; - // - // miUndo - // - this.miUndo.Enabled = false; - this.miUndo.Name = "miUndo"; - this.miUndo.Size = new System.Drawing.Size(152, 22); - this.miUndo.Text = "&undo"; - this.miUndo.Click += new System.EventHandler(this.miUndo_Click); - // - // miRedo - // - this.miRedo.Enabled = false; - this.miRedo.Name = "miRedo"; - this.miRedo.Size = new System.Drawing.Size(152, 22); - this.miRedo.Text = "&redo"; - this.miRedo.Click += new System.EventHandler(this.miRedo_Click); - // - // menuHelp - // - this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuEdit.Name = "menuEdit"; + this.menuEdit.Size = new System.Drawing.Size(39, 20); + this.menuEdit.Text = "&edit"; + // + // miUndo + // + this.miUndo.Enabled = false; + this.miUndo.Name = "miUndo"; + this.miUndo.Size = new System.Drawing.Size(135, 22); + this.miUndo.Text = "&undo"; + this.miUndo.Click += new System.EventHandler(this.miUndo_Click); + // + // miRedo + // + this.miRedo.Enabled = false; + this.miRedo.Name = "miRedo"; + this.miRedo.Size = new System.Drawing.Size(135, 22); + this.miRedo.Text = "&redo"; + this.miRedo.Click += new System.EventHandler(this.miRedo_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(132, 6); + // + // miPreferences + // + this.miPreferences.Name = "miPreferences"; + this.miPreferences.Size = new System.Drawing.Size(135, 22); + this.miPreferences.Text = "&preferences"; + this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click); + // + // menuHelp + // + this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miAbout}); - this.menuHelp.Name = "menuHelp"; - this.menuHelp.Size = new System.Drawing.Size(39, 20); - this.menuHelp.Text = "&help"; - // - // miAbout - // - this.miAbout.Name = "miAbout"; - this.miAbout.Size = new System.Drawing.Size(109, 22); - this.miAbout.Text = "&about"; - this.miAbout.Click += new System.EventHandler(this.miAbout_Click); - // - // mainToolStrip - // - this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None; - this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuHelp.Name = "menuHelp"; + this.menuHelp.Size = new System.Drawing.Size(42, 20); + this.menuHelp.Text = "&help"; + // + // miAbout + // + this.miAbout.Name = "miAbout"; + this.miAbout.Size = new System.Drawing.Size(105, 22); + this.miAbout.Text = "&about"; + this.miAbout.Click += new System.EventHandler(this.miAbout_Click); + // + // mainToolStrip + // + this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None; + this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.bttnNewArmy, this.bttnOpenArmy, this.bttnSaveArmy, this.toolStripSeparator3, this.bttnUndo, this.bttnRedo}); - this.mainToolStrip.Location = new System.Drawing.Point(0, 24); - this.mainToolStrip.Name = "mainToolStrip"; - this.mainToolStrip.Size = new System.Drawing.Size(151, 25); - this.mainToolStrip.TabIndex = 8; - // - // bttnNewArmy - // - this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new; - this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnNewArmy.Name = "bttnNewArmy"; - this.bttnNewArmy.Size = new System.Drawing.Size(23, 22); - this.bttnNewArmy.Text = "new army"; - this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); - // - // bttnOpenArmy - // - this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open; - this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnOpenArmy.Name = "bttnOpenArmy"; - this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22); - this.bttnOpenArmy.Text = "open army"; - this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); - // - // bttnSaveArmy - // - this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnSaveArmy.Enabled = false; - this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save; - this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnSaveArmy.Name = "bttnSaveArmy"; - this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22); - this.bttnSaveArmy.Text = "save army"; - this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); - // - // bttnUndo - // - this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnUndo.Enabled = false; - this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo; - this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnUndo.Name = "bttnUndo"; - this.bttnUndo.Size = new System.Drawing.Size(32, 22); - this.bttnUndo.Text = "undo"; - this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click); - // - // bttnRedo - // - this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnRedo.Enabled = false; - this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo; - this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnRedo.Name = "bttnRedo"; - this.bttnRedo.Size = new System.Drawing.Size(32, 22); - this.bttnRedo.Text = "redo"; - this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click); - // - // catToolStrip - // - this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None; - this.catToolStrip.Location = new System.Drawing.Point(161, 24); - this.catToolStrip.Name = "catToolStrip"; - this.catToolStrip.Size = new System.Drawing.Size(111, 25); - this.catToolStrip.TabIndex = 9; - this.catToolStrip.Visible = false; - // - // statusBar - // - this.statusBar.Location = new System.Drawing.Point(0, 586); - this.statusBar.Name = "statusBar"; - this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { + this.mainToolStrip.Location = new System.Drawing.Point(0, 24); + this.mainToolStrip.Name = "mainToolStrip"; + this.mainToolStrip.Size = new System.Drawing.Size(151, 25); + this.mainToolStrip.TabIndex = 8; + // + // bttnNewArmy + // + this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new; + this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnNewArmy.Name = "bttnNewArmy"; + this.bttnNewArmy.Size = new System.Drawing.Size(23, 22); + this.bttnNewArmy.Text = "new army"; + this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); + // + // bttnOpenArmy + // + this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open; + this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnOpenArmy.Name = "bttnOpenArmy"; + this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22); + this.bttnOpenArmy.Text = "open army"; + this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); + // + // bttnSaveArmy + // + this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnSaveArmy.Enabled = false; + this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save; + this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnSaveArmy.Name = "bttnSaveArmy"; + this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22); + this.bttnSaveArmy.Text = "save army"; + this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); + // + // bttnUndo + // + this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnUndo.Enabled = false; + this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo; + this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnUndo.Name = "bttnUndo"; + this.bttnUndo.Size = new System.Drawing.Size(32, 22); + this.bttnUndo.Text = "undo"; + this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click); + // + // bttnRedo + // + this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnRedo.Enabled = false; + this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo; + this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnRedo.Name = "bttnRedo"; + this.bttnRedo.Size = new System.Drawing.Size(32, 22); + this.bttnRedo.Text = "redo"; + this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click); + // + // catToolStrip + // + this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None; + this.catToolStrip.Location = new System.Drawing.Point(161, 24); + this.catToolStrip.Name = "catToolStrip"; + this.catToolStrip.Size = new System.Drawing.Size(111, 25); + this.catToolStrip.TabIndex = 9; + this.catToolStrip.Visible = false; + // + // statusBar + // + this.statusBar.Location = new System.Drawing.Point(0, 586); + this.statusBar.Name = "statusBar"; + this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.sbMainPanel, this.sbErrorPanel, this.sbPointsPanel}); - this.statusBar.ShowPanels = true; - this.statusBar.Size = new System.Drawing.Size(790, 22); - this.statusBar.TabIndex = 1; - this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); - this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); - // - // sbMainPanel - // - this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; - this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; - this.sbMainPanel.Name = "sbMainPanel"; - this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.sbMainPanel.Width = 473; - // - // sbErrorPanel - // - this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; - this.sbErrorPanel.Name = "sbErrorPanel"; - this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.sbErrorPanel.Width = 150; - // - // sbPointsPanel - // - this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; - this.sbPointsPanel.Name = "sbPointsPanel"; - this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.sbPointsPanel.ToolTipText = "current points total"; - this.sbPointsPanel.Width = 150; - // - // toolStripPanel - // - this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top; - this.toolStripPanel.Location = new System.Drawing.Point(0, 24); - this.toolStripPanel.Name = "toolStripPanel"; - this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; - this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.toolStripPanel.Size = new System.Drawing.Size(790, 0); - // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); - // - // miPreferences - // - this.miPreferences.Name = "miPreferences"; - this.miPreferences.Size = new System.Drawing.Size(152, 22); - this.miPreferences.Text = "&preferences"; - this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click); - // - // FrmMain - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(790, 608); - this.Controls.Add(this.mainToolStrip); - this.Controls.Add(this.toolStripPanel); - this.Controls.Add(this.statusBar); - this.Controls.Add(this.catToolStrip); - this.Controls.Add(this.menuStrip); - this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); - this.IsMdiContainer = true; - this.MainMenuStrip = this.menuStrip; - this.Menu = this.mainMenu; - this.Name = "FrmMain"; - this.Text = "WarFoundry"; - this.Load += new System.EventHandler(this.FrmMain_Load); - this.menuStrip.ResumeLayout(false); - this.menuStrip.PerformLayout(); - this.mainToolStrip.ResumeLayout(false); - this.mainToolStrip.PerformLayout(); - ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit(); - ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit(); - ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.statusBar.ShowPanels = true; + this.statusBar.Size = new System.Drawing.Size(790, 22); + this.statusBar.TabIndex = 1; + this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); + this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); + // + // sbMainPanel + // + this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; + this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; + this.sbMainPanel.Name = "sbMainPanel"; + this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; + this.sbMainPanel.Width = 473; + // + // sbErrorPanel + // + this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; + this.sbErrorPanel.Name = "sbErrorPanel"; + this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; + this.sbErrorPanel.Width = 150; + // + // sbPointsPanel + // + this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; + this.sbPointsPanel.Name = "sbPointsPanel"; + this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; + this.sbPointsPanel.ToolTipText = "current points total"; + this.sbPointsPanel.Width = 150; + // + // toolStripPanel + // + this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top; + this.toolStripPanel.Location = new System.Drawing.Point(0, 24); + this.toolStripPanel.Name = "toolStripPanel"; + this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; + this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.toolStripPanel.Size = new System.Drawing.Size(790, 0); + // + // FrmMain + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(790, 608); + this.Controls.Add(this.mainToolStrip); + this.Controls.Add(this.toolStripPanel); + this.Controls.Add(this.statusBar); + this.Controls.Add(this.catToolStrip); + this.Controls.Add(this.menuStrip); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.IsMdiContainer = true; + this.MainMenuStrip = this.menuStrip; + this.Menu = this.mainMenu; + this.Name = "FrmMain"; + this.Text = "WarFoundry"; + this.Load += new System.EventHandler(this.FrmMain_Load); + this.menuStrip.ResumeLayout(false); + this.menuStrip.PerformLayout(); + this.mainToolStrip.ResumeLayout(false); + this.mainToolStrip.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } #endregion @@ -809,7 +817,7 @@ private bool SaveCurrentArmyToFile(string filePath) { - if (WarFoundrySaver.GetSaver().Save(CurrentArmy, filePath)) + if (WarFoundrySaver.GetSaver().Save(filePath, CurrentArmy)) { loadedFilePath = filePath; miSaveArmy.Enabled = false; @@ -867,6 +875,17 @@ private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) { SetAppTitle(); + + if (newSystem == null) + { + Preferences["currSystem"] = ""; + } + else + { + Preferences["currSystem"] = newSystem.ID; + } + + Preferences.Save(); RemoveCategoryButtons(); } @@ -876,6 +895,7 @@ loadedFilePath = null; miSaveArmy.Enabled = false; bttnSaveArmy.Enabled = false; + //TODO: Subscribe to an "army changed" event here SetPointsPanelText(); SetAppTitle(); } @@ -1197,19 +1217,31 @@ private void FrmMain_UnitAddedMethod(object unitObj) { + ValidateArmy(); + } + + private void ValidateArmy() + { + ICollection<string> failureMessages; + if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages))) + { + sbErrorPanel.Text = ""; + sbErrorPanel.Tag = ""; + } + else + { + sbErrorPanel.Text = failureMessages.Count + " validation errors"; + sbErrorPanel.Tag = String.Join("\n", new List<string>(failureMessages).ToArray()); + } + } + + private void FrmMain_UnitRemovedMethod(object unitObj) + { + ValidateArmy(); + if (unitObj is Unit) { Unit unit = (Unit)unitObj; - sbErrorPanel.Text = ""; - } - } - - private void FrmMain_UnitRemovedMethod(object unitObj) - { - if (unitObj is Unit) - { - Unit unit = (Unit)unitObj; - sbErrorPanel.Text = ""; //check if window is open, and close it if it is foreach (Form frm in this.MdiChildren) @@ -1226,27 +1258,6 @@ } } - /*private void FrmMain_FailedUnitRequirement(FailedUnitRequirement failedRequirement) - { - sbErrorPanel.Text = Translation.GetTranslation("UnitRequirementFailed", "Unit Requirement Failed"); - sbErrorPanel.Tag = failedRequirement.Description; - }*/ - - /*public void MdiChildMoved() - { - Point mouseAt = PointToClient(ActiveMdiChild.Location); - - if (Comparisons.ValueWithinAmount(pnlRight.Right, ActiveMdiChild.Right, 10)) - { - pnlRight.Visible = true; - //pnlRight.Container.Add(ActiveMdiChild); - } - else - { - pnlRight.Visible = false; - } - }*/ - private void miUndo_Click(object sender, System.EventArgs e) { UndoLastAction(); @@ -1275,7 +1286,7 @@ } } - private void SetPointsPanelText() + private void SetPointsPanelText() { if (CurrentArmy==null) { @@ -1284,7 +1295,8 @@ } else { - sbPointsPanel.Text = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentArmy.MaxPoints); + string pointsPanelText = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentGameSystem.GetPointsName(CurrentArmy.Points), CurrentArmy.MaxPoints, CurrentGameSystem.GetPointsName(CurrentArmy.MaxPoints)); + sbPointsPanel.Text = pointsPanelText; if (CurrentArmy.Points>CurrentArmy.MaxPoints) { @@ -1297,6 +1309,11 @@ } } + private void SetPointsPanelToolTipText() + { + sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value"); + } + private void redoMenu_Click(object sender, EventArgs e) { if (sender is ToolStripDropDownItem) @@ -1350,13 +1367,6 @@ { WarFoundryLoader.GetDefault().LoadFiles(); sbMainPanel.Text = Translation.GetTranslation("GameSystemFilesReloaded", "Game system and race files reloaded"); - statusBarTimer.Enabled = true; - } - - private void statusBarTimer_Tick(object sender, System.EventArgs e) - { - sbMainPanel.Text = ""; - statusBarTimer.Enabled = false; } private void statusBar_PanelClick(object sender, StatusBarPanelClickEventArgs e) @@ -1412,5 +1422,11 @@ FrmPreferences prefsForm = new FrmPreferences(Preferences); prefsForm.Show(this); } + + private void miExportArmyAsBasicXml_Click(object sender, EventArgs e) + { + Form xmlOutput = new FrmXmlExport(CurrentArmy); + xmlOutput.ShowDialog(this); + } } }
--- a/FrmMain.resx Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmMain.resx Fri Aug 26 20:11:28 2011 +0100 @@ -112,39 +112,36 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <metadata name="undoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="undoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> - <metadata name="redoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="redoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>122, 17</value> </metadata> - <metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>334, 17</value> </metadata> - <metadata name="openArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="openArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>438, 17</value> </metadata> - <metadata name="saveArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="saveArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>573, 17</value> </metadata> - <metadata name="statusBarTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>707, 17</value> - </metadata> - <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>835, 17</value> </metadata> - <metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 54</value> </metadata> - <metadata name="catToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="catToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>138, 54</value> </metadata> - <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABMLAAATCwAAAAAAAAAA
--- a/FrmNewArmy.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmNewArmy.cs Fri Aug 26 20:11:28 2011 +0100 @@ -20,6 +20,7 @@ /// </summary> public class FrmNewArmy : IBBForm { + private IContainer components; private IBBoard.Windows.Forms.IBBButton bttnCancel; private IBBoard.Windows.Forms.IBBLabel lblRaceList; @@ -35,6 +36,7 @@ private GameSystem system; private Race race; private string armyName; + public bool isDefaultArmyName; private ToolTip gameSystemToolTip; private int maxPoints; @@ -213,7 +215,8 @@ 0, 0, 0}); - // + this.armySize.ValueChanged += new System.EventHandler(this.armySize_ValueChanged); + // // gameSystems // this.gameSystems.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -307,14 +310,23 @@ maxPoints = (int) armySize.Value; } - private GameSystem GetSelectedGameSystem() + private void armySize_ValueChanged(object sender, System.EventArgs e) + { + if (txtArmyName.Enabled && isDefaultArmyName) + { + setTxtArmyNameVal(); + } + } + + private GameSystem GetSelectedGameSystem() { return (GameSystem) gameSystems.SelectedItem; } private void txtArmyName_TextChanged(object sender, System.EventArgs e) { - setSelectRaceEnabledVal(); + isDefaultArmyName = false ; + setSelectRaceEnabledVal(); } private void setSelectRaceEnabledVal() @@ -322,21 +334,34 @@ bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0); } - private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) + private void setTxtArmyNameVal() + { + if (lstRaces.SelectedIndex > -1) + { + txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}pt", armySize.Value)); + isDefaultArmyName = true; + } + } + + private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) { setSelectRaceEnabledVal(); bool raceSelected = lstRaces.SelectedItem != null; txtArmyName.Enabled = raceSelected; armySize.Enabled = raceSelected; race = (Race)lstRaces.SelectedItem; - txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}pt", armySize.Value)); + setTxtArmyNameVal(); } private void gameSystems_SelectedValueChanged(object sender, EventArgs e) { - GameSystem selected = GetSelectedGameSystem(); - lstRaces.Items.Clear(); - + + GameSystem selected = GetSelectedGameSystem(); + txtArmyName.Text = ""; + txtArmyName.Enabled = false; + lstRaces.Items.Clear(); + armySize.Value = selected.SystemArmyDefaultSize; + if (selected != null) { SetRaces(selected);
--- a/FrmNewUnit.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmNewUnit.cs Fri Aug 26 20:11:28 2011 +0100 @@ -2,7 +2,8 @@ // // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. -using System; +using System; +using System.Collections.Generic; using System.Drawing; using System.ComponentModel; using System.Windows.Forms; @@ -10,7 +11,8 @@ using IBBoard.Lang; using IBBoard.Windows.Forms; using IBBoard.WarFoundry.API; -using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.API.Objects.Requirement; using IBBoard.Windows.Forms.I18N; namespace IBBoard.WarFoundry @@ -30,7 +32,6 @@ private System.Windows.Forms.ImageList imageList; private System.Windows.Forms.Label lblNewUnitWarning; private System.Windows.Forms.Label lblWarningIcon; - private bool[] allowed; public FrmNewUnit(Race race, Category cat, Army army) { @@ -38,12 +39,10 @@ ControlTranslator.TranslateControl(this, cat.Name); units = race.GetUnitTypes(cat); - allowed = new bool[units.Length]; this.army = army; for (int i = 0; i<units.Length; i++) { - allowed[i] = army.CanAddUnitType(units[i]).Count == 0; lstUnits.Items.Add(units[i].Name); } } @@ -70,106 +69,106 @@ /// </summary> private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewUnit)); - this.lstUnits = new System.Windows.Forms.ListBox(); - this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); - this.lblUnitList = new IBBoard.Windows.Forms.IBBLabel(); - this.bttnSelectUnit = new IBBoard.Windows.Forms.IBBButton(); - this.lblNewUnitWarning = new System.Windows.Forms.Label(); - this.imageList = new System.Windows.Forms.ImageList(this.components); - this.lblWarningIcon = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // lstUnits - // - this.lstUnits.Location = new System.Drawing.Point(88, 8); - this.lstUnits.Name = "lstUnits"; - this.lstUnits.Size = new System.Drawing.Size(272, 121); - this.lstUnits.TabIndex = 7; - this.lstUnits.SelectedIndexChanged += new System.EventHandler(this.lstUnits_SelectedIndexChanged); - this.lstUnits.DoubleClick += new System.EventHandler(this.lstUnits_DoubleClick); - this.lstUnits.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstUnits_MouseDown); - // - // bttnCancel - // - this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.bttnCancel.Location = new System.Drawing.Point(8, 168); - this.bttnCancel.Name = "bttnCancel"; - this.bttnCancel.Size = new System.Drawing.Size(80, 24); - this.bttnCancel.TabIndex = 6; - this.bttnCancel.Text = "Cancel"; - this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); - // - // lblUnitList - // - this.lblUnitList.Location = new System.Drawing.Point(0, 8); - this.lblUnitList.Name = "lblUnitList"; - this.lblUnitList.Size = new System.Drawing.Size(88, 80); - this.lblUnitList.TabIndex = 5; - this.lblUnitList.Text = "unit list"; - this.lblUnitList.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // bttnSelectUnit - // - this.bttnSelectUnit.Enabled = false; - this.bttnSelectUnit.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.bttnSelectUnit.Location = new System.Drawing.Point(256, 168); - this.bttnSelectUnit.Name = "bttnSelectUnit"; - this.bttnSelectUnit.Size = new System.Drawing.Size(104, 24); - this.bttnSelectUnit.TabIndex = 4; - this.bttnSelectUnit.Text = "create unit"; - this.bttnSelectUnit.Click += new System.EventHandler(this.bttnSelectUnit_Click); - // - // lblNewUnitWarning - // - this.lblNewUnitWarning.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.lblNewUnitWarning.ImageList = this.imageList; - this.lblNewUnitWarning.Location = new System.Drawing.Point(48, 136); - this.lblNewUnitWarning.Name = "lblNewUnitWarning"; - this.lblNewUnitWarning.Size = new System.Drawing.Size(312, 32); - this.lblNewUnitWarning.TabIndex = 9; - this.lblNewUnitWarning.Text = "label1"; - this.lblNewUnitWarning.TextAlign = System.Drawing.ContentAlignment.TopRight; - this.lblNewUnitWarning.Visible = false; - // - // imageList - // - this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); - this.imageList.TransparentColor = System.Drawing.Color.Transparent; - this.imageList.Images.SetKeyName(0, ""); - // - // lblWarningIcon - // - this.lblWarningIcon.Image = ((System.Drawing.Image)(resources.GetObject("lblWarningIcon.Image"))); - this.lblWarningIcon.Location = new System.Drawing.Point(8, 136); - this.lblWarningIcon.Name = "lblWarningIcon"; - this.lblWarningIcon.Size = new System.Drawing.Size(40, 32); - this.lblWarningIcon.TabIndex = 10; - this.lblWarningIcon.Visible = false; - // - // FrmNewUnit - // - this.AcceptButton = this.bttnSelectUnit; - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.CancelButton = this.bttnCancel; - this.ClientSize = new System.Drawing.Size(370, 196); - this.Controls.Add(this.lblWarningIcon); - this.Controls.Add(this.lblNewUnitWarning); - this.Controls.Add(this.bttnCancel); - this.Controls.Add(this.lblUnitList); - this.Controls.Add(this.bttnSelectUnit); - this.Controls.Add(this.lstUnits); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FrmNewUnit"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "FrmNewUni"; - this.ResumeLayout(false); + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewUnit)); + this.lstUnits = new System.Windows.Forms.ListBox(); + this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); + this.lblUnitList = new IBBoard.Windows.Forms.IBBLabel(); + this.bttnSelectUnit = new IBBoard.Windows.Forms.IBBButton(); + this.lblNewUnitWarning = new System.Windows.Forms.Label(); + this.imageList = new System.Windows.Forms.ImageList(this.components); + this.lblWarningIcon = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lstUnits + // + this.lstUnits.Location = new System.Drawing.Point(88, 8); + this.lstUnits.Name = "lstUnits"; + this.lstUnits.Size = new System.Drawing.Size(272, 121); + this.lstUnits.TabIndex = 7; + this.lstUnits.SelectedIndexChanged += new System.EventHandler(this.lstUnits_SelectedIndexChanged); + this.lstUnits.DoubleClick += new System.EventHandler(this.lstUnits_DoubleClick); + this.lstUnits.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstUnits_MouseDown); + // + // bttnCancel + // + this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnCancel.Location = new System.Drawing.Point(8, 168); + this.bttnCancel.Name = "bttnCancel"; + this.bttnCancel.Size = new System.Drawing.Size(80, 24); + this.bttnCancel.TabIndex = 6; + this.bttnCancel.Text = "Cancel"; + this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); + // + // lblUnitList + // + this.lblUnitList.Location = new System.Drawing.Point(0, 8); + this.lblUnitList.Name = "lblUnitList"; + this.lblUnitList.Size = new System.Drawing.Size(88, 80); + this.lblUnitList.TabIndex = 5; + this.lblUnitList.Text = "unit list"; + this.lblUnitList.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // bttnSelectUnit + // + this.bttnSelectUnit.Enabled = false; + this.bttnSelectUnit.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnSelectUnit.Location = new System.Drawing.Point(256, 168); + this.bttnSelectUnit.Name = "bttnSelectUnit"; + this.bttnSelectUnit.Size = new System.Drawing.Size(104, 24); + this.bttnSelectUnit.TabIndex = 4; + this.bttnSelectUnit.Text = "create unit"; + this.bttnSelectUnit.Click += new System.EventHandler(this.bttnSelectUnit_Click); + // + // lblNewUnitWarning + // + this.lblNewUnitWarning.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lblNewUnitWarning.ImageList = this.imageList; + this.lblNewUnitWarning.Location = new System.Drawing.Point(48, 136); + this.lblNewUnitWarning.Name = "lblNewUnitWarning"; + this.lblNewUnitWarning.Size = new System.Drawing.Size(312, 32); + this.lblNewUnitWarning.TabIndex = 9; + this.lblNewUnitWarning.Text = "One or more unit requirements are not satisfied."; + this.lblNewUnitWarning.TextAlign = System.Drawing.ContentAlignment.TopRight; + this.lblNewUnitWarning.Visible = false; + // + // imageList + // + this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); + this.imageList.TransparentColor = System.Drawing.Color.Transparent; + this.imageList.Images.SetKeyName(0, ""); + // + // lblWarningIcon + // + this.lblWarningIcon.Image = ((System.Drawing.Image)(resources.GetObject("lblWarningIcon.Image"))); + this.lblWarningIcon.Location = new System.Drawing.Point(8, 136); + this.lblWarningIcon.Name = "lblWarningIcon"; + this.lblWarningIcon.Size = new System.Drawing.Size(40, 32); + this.lblWarningIcon.TabIndex = 10; + this.lblWarningIcon.Visible = false; + // + // FrmNewUnit + // + this.AcceptButton = this.bttnSelectUnit; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.bttnCancel; + this.ClientSize = new System.Drawing.Size(370, 196); + this.Controls.Add(this.lblWarningIcon); + this.Controls.Add(this.lblNewUnitWarning); + this.Controls.Add(this.bttnCancel); + this.Controls.Add(this.lblUnitList); + this.Controls.Add(this.bttnSelectUnit); + this.Controls.Add(this.lstUnits); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FrmNewUnit"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "FrmNewUni"; + this.ResumeLayout(false); } #endregion @@ -200,14 +199,14 @@ { if (lstUnits.SelectedIndex>-1) { - bttnSelectUnit.Enabled = true; - lblNewUnitWarning.Visible = !allowed[lstUnits.SelectedIndex]; + bttnSelectUnit.Enabled = true; + ICollection<string> failureMessages; + lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army, out failureMessages)); lblWarningIcon.Visible = lblNewUnitWarning.Visible; if (lblNewUnitWarning.Visible) { - //lblNewUnitWarning.Text = army.GetFailedAddRequirement(units[lstUnits.SelectedIndex]).Description; - //FIXME: Add failed requirement text + lblNewUnitWarning.Text = String.Join("\n", new List<string>(failureMessages).ToArray()); } } else
--- a/FrmNewUnit.resx Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmNewUnit.resx Fri Aug 26 20:11:28 2011 +0100 @@ -126,54 +126,54 @@ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4 DAAAAk1TRnQBSQFMAwEBAAEEAQABBAEAASABAAEgAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABgAMA - ASADAAEBAQABIAYAAUD/AP8AJAADAQH/AwEB/wMBAf8DAQH/AwEB/wMBAf8DAQH/AwEB/wMBAf8DAQH/ - AwEB/wMBAf8DAQH/AwEB/wMBAf8DAQH/AwEB/wMBAf8DAQH/AwEB/wMBAf8DAQH/AwEB//8AnQADAQH/ - AwEB/wIBASkB/wIBASwB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIB - ASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIBASoB/wIB - ASoB/wIBASoB/wIBASwB/wIBASwB/wIBASkB/wMBAf//AJEAAwEB/wIBAWsB/wIBAZ0B/wIBAZ8B/wIB - AZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIB - AZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIBAZ8B/wIB - AZ8B/wIBAZ8B/wIBAZ8B/wIBAZ0B/wIBAXEB//8AjQADAQH/AgEBnAH/AjwBxAH/AnEB4AH/AnYB4gH/ - AnUB4gH/AnIB4QH/AnAB4QH/Am0B4AH/AmoB3wH/AmcB3wH/AmUB3gH/AmIB3gH/Al8B3QH/Al0B3AH/ - AloB3AH/AlcB2wH/AlQB2wH/AlIB2gH/Ak8B2gH/AkwB2QH/AkkB2AH/AkYB2AH/AkQB1wH/AkEB1wH/ - Aj8B1gH/AjcB1AH/AhwBvAH/AgEBngH//wCRAAIBAaAB/wJ6Ad0B/wIVAdAB/wIBAcwB/wIBAcwB/wIB - AcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIB - AcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIBAcwB/wIL - Ac4B/wI5Ac8B/wIBAZ8B//8AkQACAQGhAf8CVwHHAf8COwHYAf8CAQHMAf8CowHbAf8C0gHgAf8C0gHg + ASADAAEBAQABIAYAAUD/AP8AJAADAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/ + AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB//8AnQADAgH/ + AwIB/wICASoB/wICAS0B/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wIC + ASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wIC + ASsB/wICASsB/wICAS0B/wICAS0B/wICASoB/wMCAf//AJEAAwIB/wICAWwB/wICAZ0B/wICAZ8B/wIC + AZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wIC + AZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wIC + AZ8B/wICAZ8B/wICAZ8B/wICAZ0B/wICAXIB//8AjQADAgH/AgIBnAH/Aj0BxAH/AnIB4AH/AncB4gH/ + AnYB4gH/AnMB4QH/AnEB4QH/Am4B4AH/AmsB3wH/AmgB3wH/AmYB3gH/AmMB3gH/AmAB3QH/Al4B3AH/ + AlsB3AH/AlgB2wH/AlUB2wH/AlMB2gH/AlAB2gH/Ak0B2QH/AkoB2AH/AkcB2AH/AkUB1wH/AkIB1wH/ + AkAB1gH/AjgB1AH/Ah0BvAH/AgIBngH//wCRAAICAaAB/wJ7Ad0B/wIWAdAB/wICAcwB/wICAcwB/wIC + AcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wIC + AcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wIM + Ac4B/wI6Ac8B/wICAZ8B//8AkQACAgGhAf8CWAHHAf8CPAHYAf8CAgHMAf8CowHbAf8C0gHgAf8C0gHg Af8C0wHhAf8C1AHiAf8C1AHiAf8C1QHjAf8C1gHkAf8C1wHlAf8C2AHmAf8C2AHmAf8C2QHnAf8C2QHn - Af8C2gHoAf8C2gHoAf8C2wHpAf8C3AHqAf8C3QHrAf8C3gHsAf8CwQHnAf8CAQHMAf8CHAHRAf8CKgG/ - Af8CAQGiAf//AJEAAgEBngH/AhcBpwH/AnYB3QH/AgkBzgH/AlEB0wH/A+AB/wPhAf8D4QH/A+IB/wPj - Af8D4wH/A+QB/wPlAf8D5gH/A+YB/wPnAf8D6AH/A+kB/wPqAf8D6gH/A+sB/wPsAf8D7QH/AmoB2wH/ - AgQBzQH/AjwB0wH/Ag0BpQH/AgEBoAH//wCVAAIBAaEB/wJTAcQB/wJFAdoB/wIDAcwB/wKzAdsB/wPg - Af8D4QH/A+EB/wPiAf8D4wH/A+MB/wPkAf8DPQH/AzgB/wPmAf8D5wH/A+gB/wPpAf8D6gH/A+oB/wPr - Af8CzQHnAf8CCAHNAf8CJQHTAf8CLQG7Af8CAQGgAf//AJkAAgEBngH/AhABpgH/AnoB3AH/Ag8BzwH/ - AjwB0QH/A98B/wPgAf8D4AH/A+EB/wPiAf8D4gH/A+MB/wM4Af8DNgH/A+YB/wPmAf8D5wH/A+gB/wPp - Af8D6gH/A+oB/wJTAdcB/wIJAc4B/wJEAdIB/wIJAaIB/wIBAaAB//8AnQACAQGgAf8CRwG9Af8CUgHc - Af8CAQHMAf8CogHaAf8D3wH/A+AB/wPgAf8D4QH/A+IB/wPiAf8D1wH/A9cB/wPlAf8D5gH/A+YB/wPn - Af8D6AH/A+kB/wK6AeMB/wICAcwB/wIwAdUB/wIqAbcB/wIBAaAB//8AoQACAQGiAf8CCQGiAf8CegHa - Af8CGAHRAf8CKwHQAf8C3QHfAf8D3wH/A+AB/wPgAf8D4QH/A+IB/wMmAf8DJgH/A+QB/wPlAf8D5QH/ - A+YB/wPnAf8D6AH/AjwB0wH/Ag8BzwH/AkoB0QH/AgYBogH/AgEBoQH//wClAAIBAZ8B/wI8AbgB/wJf - Ad4B/wIBAcwB/wKNAdcB/wPfAf8D3wH/A+AB/wPgAf8D4QH/AxwB/wMcAf8D4wH/A+QB/wPlAf8D5QH/ - A+YB/wKkAd8B/wIBAcwB/wI9AdcB/wIlAbEB/wIBAaEB//8ArQACBAGiAf8CdAHXAf8CIwHTAf8CHAHO - Af8C1wHdAf8D3wH/A98B/wPgAf8D4AH/Aw4B/wMOAf8D4gH/A+MB/wPkAf8D5QH/AuIB5AH/AikB0QH/ - AhkB0QH/AkwBzgH/AgMBogH/AgEBpAH//wCtAAIBAaAB/wIwAbEB/wJrAd8B/wICAcwB/wJ6AdUB/wPe - Af8D3gH/A98B/wPgAf8DBAH/AwQB/wPhAf8D4gH/A+MB/wPkAf8CjAHaAf8CAgHMAf8CTAHaAf8CHwGs - Af8CAQGfAf//ALUAAgIBoQH/Am0B0wH/AjAB1QH/AhEBzgH/As4B3AH/A94B/wPeAf8D1wH/AwEB/wMB - Af8D2QH/A+EB/wPiAf8C2gHiAf8CGgHPAf8CJQHTAf8CSgHLAf8CAQGhAf//ALkAAgEBoAH/AiMBrAH/ - AnYB4AH/AgUBzQH/AmcB1AH/A90B/wPeAf8DzAH/AwEB/wMBAf8DzgH/A+EB/wPhAf8CdwHYAf8CBQHN - Af8CWAHbAf8CFwGoAf8CAQGfAf//AL0AAgEBoAH/AmMBzAH/AjwB2AH/AggBzQH/AsMB2wH/A90B/wPB - Af8DAQH/AwEB/wPDAf8D4AH/As4B3wH/Ag0BzQH/AjIB1gH/AkYBxwH/AgEBogH//wDBAAIBAZwB/wIY - AakB/wJ9AeAB/wIJAc4B/wJTAdIB/wPdAf8D2gH/A88B/wPPAf8D3AH/A98B/wJiAdUB/wIKAc4B/wJj - AdsB/wIQAaUB/wIBAZ4B//8AxQACAQGgAf8CVwHGAf8CSQHaAf8CAwHMAf8CtAHZAf8D3QH/A90B/wPe - Af8D3gH/AsAB3AH/AgUBzAH/AkEB2QH/Aj8BwQH/AgEBoQH//wDJAAIBAZ4B/wIQAaYB/wKBAeAB/wIQ - Ac8B/wJAAdEB/wPcAf8D3QH/A90B/wPeAf8CSwHSAf8CEgHPAf8CaQHbAf8CCgGiAf8CAQGfAf//AM0A - AgEBnwH/AkwBwAH/AlYB3AH/AgEBzAH/AqIB1wH/A9wB/wPcAf8CrQHZAf8CAgHMAf8CUQHcAf8COAG8 - Af8CAQGgAf//ANEAAgEBpQH/AgkBowH/AoEB3gH/AhoB0QH/Ai0BzwH/AtoB2wH/A9wB/wI2AdAB/wId - AdIB/wJrAdkB/wIFAaIB/wIBAZ4B//8A1QACAQGgAf8CQAG6Af8CZAHfAf8CAQHMAf8CjwHWAf8CmAHW - Af8CAgHMAf8CYgHfAf8CLwG2Af8CAQGgAf//AN0AAgQBoQH/AnsB2gH/AiUB0wH/AhYBzgH/AhgBzQH/ - AisB1AH/AmkB1wH/AgIBoAH/AgEBnwH//wDdAAIBAZ4B/wIzAbQB/wJyAeEB/wICAcwB/wIEAc0B/wJy - AeEB/wIlAa8B/wIBAZ4B//8A5QACAgGhAf8CbwHVAf8CQwHZAf8CRwHaAf8CYAHSAf8CAQGhAf//AOkA - AgEBoAH/AhQBpwH/Am4B2gH/AmsB2gH/AhABpwH/AgEBnwH//wDtAAIBAZ0B/wIBAaEB/wIBAaAB/wIB + Af8C2gHoAf8C2gHoAf8C2wHpAf8C3AHqAf8C3QHrAf8C3gHsAf8CwQHnAf8CAgHMAf8CHQHRAf8CKwG/ + Af8CAgGiAf//AJEAAgIBngH/AhgBpwH/AncB3QH/AgoBzgH/AlIB0wH/A+AB/wPhAf8D4QH/A+IB/wPj + Af8D4wH/A+QB/wPlAf8D5gH/A+YB/wPnAf8D6AH/A+kB/wPqAf8D6gH/A+sB/wPsAf8D7QH/AmsB2wH/ + AgUBzQH/Aj0B0wH/Ag4BpQH/AgIBoAH//wCVAAICAaEB/wJUAcQB/wJGAdoB/wIEAcwB/wKzAdsB/wPg + Af8D4QH/A+EB/wPiAf8D4wH/A+MB/wPkAf8DPgH/AzkB/wPmAf8D5wH/A+gB/wPpAf8D6gH/A+oB/wPr + Af8CzQHnAf8CCQHNAf8CJgHTAf8CLgG7Af8CAgGgAf//AJkAAgIBngH/AhEBpgH/AnsB3AH/AhABzwH/ + Aj0B0QH/A98B/wPgAf8D4AH/A+EB/wPiAf8D4gH/A+MB/wM5Af8DNwH/A+YB/wPmAf8D5wH/A+gB/wPp + Af8D6gH/A+oB/wJUAdcB/wIKAc4B/wJFAdIB/wIKAaIB/wICAaAB//8AnQACAgGgAf8CSAG9Af8CUwHc + Af8CAgHMAf8CogHaAf8D3wH/A+AB/wPgAf8D4QH/A+IB/wPiAf8D1wH/A9cB/wPlAf8D5gH/A+YB/wPn + Af8D6AH/A+kB/wK6AeMB/wIDAcwB/wIxAdUB/wIrAbcB/wICAaAB//8AoQACAgGiAf8CCgGiAf8CewHa + Af8CGQHRAf8CLAHQAf8C3QHfAf8D3wH/A+AB/wPgAf8D4QH/A+IB/wMnAf8DJwH/A+QB/wPlAf8D5QH/ + A+YB/wPnAf8D6AH/Aj0B0wH/AhABzwH/AksB0QH/AgcBogH/AgIBoQH//wClAAICAZ8B/wI9AbgB/wJg + Ad4B/wICAcwB/wKNAdcB/wPfAf8D3wH/A+AB/wPgAf8D4QH/Ax0B/wMdAf8D4wH/A+QB/wPlAf8D5QH/ + A+YB/wKkAd8B/wICAcwB/wI+AdcB/wImAbEB/wICAaEB//8ArQACBQGiAf8CdQHXAf8CJAHTAf8CHQHO + Af8C1wHdAf8D3wH/A98B/wPgAf8D4AH/Aw8B/wMPAf8D4gH/A+MB/wPkAf8D5QH/AuIB5AH/AioB0QH/ + AhoB0QH/Ak0BzgH/AgQBogH/AgIBpAH//wCtAAICAaAB/wIxAbEB/wJsAd8B/wIDAcwB/wJ7AdUB/wPe + Af8D3gH/A98B/wPgAf8DBQH/AwUB/wPhAf8D4gH/A+MB/wPkAf8CjAHaAf8CAwHMAf8CTQHaAf8CIAGs + Af8CAgGfAf//ALUAAgMBoQH/Am4B0wH/AjEB1QH/AhIBzgH/As4B3AH/A94B/wPeAf8D1wH/AwIB/wMC + Af8D2QH/A+EB/wPiAf8C2gHiAf8CGwHPAf8CJgHTAf8CSwHLAf8CAgGhAf//ALkAAgIBoAH/AiQBrAH/ + AncB4AH/AgYBzQH/AmgB1AH/A90B/wPeAf8DzAH/AwIB/wMCAf8DzgH/A+EB/wPhAf8CeAHYAf8CBgHN + Af8CWQHbAf8CGAGoAf8CAgGfAf//AL0AAgIBoAH/AmQBzAH/Aj0B2AH/AgkBzQH/AsMB2wH/A90B/wPB + Af8DAgH/AwIB/wPDAf8D4AH/As4B3wH/Ag4BzQH/AjMB1gH/AkcBxwH/AgIBogH//wDBAAICAZwB/wIZ + AakB/wJ+AeAB/wIKAc4B/wJUAdIB/wPdAf8D2gH/A88B/wPPAf8D3AH/A98B/wJjAdUB/wILAc4B/wJk + AdsB/wIRAaUB/wICAZ4B//8AxQACAgGgAf8CWAHGAf8CSgHaAf8CBAHMAf8CtAHZAf8D3QH/A90B/wPe + Af8D3gH/AsAB3AH/AgYBzAH/AkIB2QH/AkABwQH/AgIBoQH//wDJAAICAZ4B/wIRAaYB/wKBAeAB/wIR + Ac8B/wJBAdEB/wPcAf8D3QH/A90B/wPeAf8CTAHSAf8CEwHPAf8CagHbAf8CCwGiAf8CAgGfAf//AM0A + AgIBnwH/Ak0BwAH/AlcB3AH/AgIBzAH/AqIB1wH/A9wB/wPcAf8CrQHZAf8CAwHMAf8CUgHcAf8COQG8 + Af8CAgGgAf//ANEAAgIBpQH/AgoBowH/AoEB3gH/AhsB0QH/Ai4BzwH/AtoB2wH/A9wB/wI3AdAB/wIe + AdIB/wJsAdkB/wIGAaIB/wICAZ4B//8A1QACAgGgAf8CQQG6Af8CZQHfAf8CAgHMAf8CjwHWAf8CmAHW + Af8CAwHMAf8CYwHfAf8CMAG2Af8CAgGgAf//AN0AAgUBoQH/AnwB2gH/AiYB0wH/AhcBzgH/AhkBzQH/ + AiwB1AH/AmoB1wH/AgMBoAH/AgIBnwH//wDdAAICAZ4B/wI0AbQB/wJzAeEB/wIDAcwB/wIFAc0B/wJz + AeEB/wImAa8B/wICAZ4B//8A5QACAwGhAf8CcAHVAf8CRAHZAf8CSAHaAf8CYQHSAf8CAgGhAf//AOkA + AgIBoAH/AhUBpwH/Am8B2gH/AmwB2gH/AhEBpwH/AgIBnwH//wDtAAICAZ0B/wICAaEB/wICAaAB/wIC AaAB//8A/wD/AP8A/wD/AP8AvwABQgFNAT4HAAE+AwABKAMAAYADAAEgAwABAQEAAQEGAAECFgAD/wEA BP8MAAHwAgABHwwAAcACAAEHDAABgAIAAQMMAAGAAgABAwwAAcACAAEDDAABwAIAAQMMAAHAAgABAwwA AeACAAEHDAAB4AIAAQcMAAHwAgABDwwAAfACAAEPDAAB+AIAAR8MAAH8AgABHwwAAfwCAAE/DAAB/gIA
--- a/FrmUnit.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/FrmUnit.cs Fri Aug 26 20:11:28 2011 +0100 @@ -1,678 +1,684 @@ -// This file (FrmUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. -// -// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. - -using System; -using System.Drawing; -using System.Data; -using System.Collections.Generic; -using System.ComponentModel; -using System.Windows.Forms; -using IBBoard.Commands; -using IBBoard.Lang; -using IBBoard.Windows.Forms; -using IBBoard.Windows.Forms.I18N; -using IBBoard.WarFoundry.API; -using IBBoard.WarFoundry.API.Commands; -using IBBoard.WarFoundry.API.Objects; -using IBBoard.WarFoundry.GUI.WinForms.UI; -using IBBoard.WarFoundry.GUI.WinForms.Util; -using log4net; - -namespace IBBoard.WarFoundry.GUI.WinForms -{ - /// <summary> - /// Summary description for FrmUnit. - /// </summary> - public class FrmUnit : IBBoard.Windows.Forms.IBBForm - { - private static readonly ILog log = LogManager.GetLogger(typeof(FrmUnit)); - private static readonly int BORDER_WIDTH = 1; - private static readonly int NAME_COL_WIDTH_MULTIPLIER = 3; - private Unit unit; - private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>(); - private Dictionary<string, DataGridView> DataGridViews = new Dictionary<string, DataGridView>(); - private CommandStack commandStack; - private System.Windows.Forms.TextBox tbUnitName; - private System.Windows.Forms.NumericUpDown unitSize; - private IBBLabel lblUnitSize; - private IBBButton bttnAddWeapon; - private IBBButton bttnRemoveWeapon; - private IBBLabel lblEquip; - private System.Windows.Forms.ListBox equipmentList; - private IBBButton bttnReplaceWeapon; - private IBBButton bttnEditWeapon; - private Label lblPoints; - private IBBLabel lblNotes; - private TextBox notes; - private ListBox abilitiesList; - private IBBLabel lblAbilities; - private FlowLayoutPanel statsPanel; - /// <summary> - /// Required designer variable. - /// </summary> - private System.ComponentModel.Container components = null; - - public FrmUnit(Unit toDisplay, CommandStack cmdStack) - { - unit = toDisplay; - commandStack = cmdStack; - // - // Required for Windows Form Designer support - // - InitializeComponent(); - TranslateForm(); - Translation.TranslationChanged += new MethodInvoker(TranslateForm); - unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); - unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); - unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); - unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); - - unitSize.Value = unit.Size; - unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); - unitSize.Minimum = unit.UnitType.MinSize; - unitSize.Enabled = (unitSize.Maximum != unitSize.Minimum); - - notes.Text = unit.UnitType.Notes; - abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities()); - abilitiesList.DisplayMember = "Name"; - SetPointsValueText(); - SetStats(); - SetWeapons(); - } - - private void TranslateForm() - { - ControlTranslator.TranslateControl(this); - SetUnitName(); - RefreshUnitEquipment(); - } - - private void SetUnitName() - { - tbUnitName.Text = unit.Name; - Text = Translation.GetTranslation("FrmUnit", "{0} ({1})", unit.Name, unit.UnitType.Name); - } - - void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) - { - SetPointsValueText(); - } - - private void SetPointsValueText() - { - lblPoints.Text = "(" + unit.Points + " pts)"; - } - - private void SetStats() - { - Stat[][] stats = unit.UnitStatsArraysWithName; - string[] statsIDs = unit.UnitStatsArrayIDs; - int statsCount = stats.Length; - log.DebugFormat("Unit {0} has {1} stats arrays", unit.UnitType.Name, statsCount); - - for (int i = 0; i < statsCount; i++) - { - DataGridView statsGrid = GetDataGridView(statsIDs[i]); - DataTable dt = (DataTable)statsGrid.DataSource; - DataRow dr = dt.NewRow(); - dr.ItemArray = stats[i]; - log.DebugFormat("Add row to data table for {0}", statsIDs[i]); - dt.Rows.Add(dr); - statsGrid.ClearSelection(); - } - } - - private DataGridView GetDataGridView(string statsID) - { - DataGridView grid; - - if (DataGridViews.ContainsKey(statsID)) - { - grid = DictionaryUtils.GetValue(DataGridViews, statsID); - } - else - { - grid = CreateDataGridView(statsID); - DataGridViews[statsID] = grid; - } - - return grid; - } - - private DataGridView CreateDataGridView(string statsID) - { - log.DebugFormat("Create DataGridView for stats ID {0}", statsID); - SystemStats sysStats = unit.Race.GameSystem.GetSystemStatsForID(statsID); - StatSlot[] sysStatSlots = sysStats.StatSlots; - int statsCount = sysStatSlots.Length; - int statsWithNameCount = statsCount + 1; - StatSlot[] statsWithName = new StatSlot[statsWithNameCount]; - statsWithName[0] = new StatSlot("Name"); - sysStatSlots.CopyTo(statsWithName, 1); - DataTable dt = new DataTable(); - DataGridView statsGrid = CreateDataGridView(); - statsGrid.DataSource = dt; - int columnWidth = statsGrid.Width / (statsCount + NAME_COL_WIDTH_MULTIPLIER); - - for (int i = 0; i < statsWithNameCount; i++) - { - StatSlot stat = statsWithName[i]; - string slotName = stat.Name; - statsGrid.Columns.Add(CreateStatColumn(slotName, columnWidth)); - dt.Columns.Add(CreateDataColumn(slotName)); - } - - int otherStatsWidth = statsCount * columnWidth; - SetNameColumnWidth(statsGrid, otherStatsWidth); - - return statsGrid; - } - - private static DataGridViewColumn CreateStatColumn(string slotName, int columnWidth) - { - DataGridViewColumn col = new DataGridViewTextBoxColumn(); - col.Width = columnWidth; - col.Name = slotName; - col.HeaderText = slotName; - col.DataPropertyName = slotName; - col.SortMode = DataGridViewColumnSortMode.NotSortable; - col.CellTemplate = new StatsDataGridViewCell(); - col.HeaderCell.Style.WrapMode = DataGridViewTriState.False; - return col; - } - - private static void SetNameColumnWidth(DataGridView statsGrid, int otherStatsWidth) - { - - DataGridViewColumn nameColumn = statsGrid.Columns[0]; - nameColumn.HeaderText = Translation.GetTranslation("StatLineName", "name"); - nameColumn.Width = statsGrid.Width - otherStatsWidth; - } - - private static DataColumn CreateDataColumn(string slotName) - { - log.DebugFormat("Create column {0}", slotName); - DataColumn tempCol = new DataColumn(slotName, typeof(Stat)); - return tempCol; - } - - public DataGridView CreateDataGridView() - { - log.Debug("Create DataGridView widget"); - DataGridView statsGrid = new DataGridView(); - statsGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - statsGrid.CausesValidation = false; - statsGrid.ReadOnly = true; - statsGrid.RowHeadersVisible = false; - statsGrid.Size = new System.Drawing.Size(600, 88); - statsGrid.TabStop = false; - statsGrid.AllowUserToAddRows = false; - statsGrid.ScrollBars = ScrollBars.None; - statsGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - statsGrid.BorderStyle = BorderStyle.None; - statsGrid.BackgroundColor = SystemColors.Control; - statsGrid.RowsAdded += new DataGridViewRowsAddedEventHandler(statsGrid_RowsAdded); - statsPanel.Controls.Add(statsGrid); - statsGrid.Width = statsPanel.Width - (int)Math.Round(SystemInformation.VerticalScrollBarWidth * 1.4); - return statsGrid; - } - - private void statsGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) - { - if (sender is DataGridView) - { - SetGridHeight((DataGridView)sender); - } - } - - private static void SetGridHeight(DataGridView statsGrid) - { - DataGridViewRowCollection rows = statsGrid.Rows; - statsGrid.Height = statsGrid.Columns[0].HeaderCell.Size.Height + (rows.Count * rows[0].Height); - log.DebugFormat("Set height to {0} for grid of {1} rows", statsGrid.Height, rows.Count); - } - - private void SetWeapons() - { - foreach (UnitEquipmentItem item in unit.GetEquipment()) - { - equipmentList.Items.Add(GetEquipmentChoice(item)); - } - } - - private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item) - { - UnitEquipmentChoice choice = null; - equipmentChoices.TryGetValue(item, out choice); - - if (choice == null) - { - choice = new UnitEquipmentChoice(Unit, item); - equipmentChoices[item] = choice; - } - - return choice; - } - - /// <summary> - /// Clean up any resources being used. - /// </summary> - protected override void Dispose(bool disposing) - { - //remove our leave events so that disposing doesn't trigger them - tbUnitName.Leave -= new System.EventHandler(this.tbUnitName_Leave); - unitSize.Leave -= new System.EventHandler(this.unitSize_Leave); - - if (disposing) - { - if (components != null) - { - components.Dispose(); - } - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() - { - this.tbUnitName = new System.Windows.Forms.TextBox(); - this.unitSize = new System.Windows.Forms.NumericUpDown(); - this.lblUnitSize = new IBBoard.Windows.Forms.IBBLabel(); - this.lblEquip = new IBBoard.Windows.Forms.IBBLabel(); - this.bttnAddWeapon = new IBBoard.Windows.Forms.IBBButton(); - this.bttnRemoveWeapon = new IBBoard.Windows.Forms.IBBButton(); - this.equipmentList = new System.Windows.Forms.ListBox(); - this.bttnReplaceWeapon = new IBBoard.Windows.Forms.IBBButton(); - this.bttnEditWeapon = new IBBoard.Windows.Forms.IBBButton(); - this.lblPoints = new System.Windows.Forms.Label(); - this.lblNotes = new IBBoard.Windows.Forms.IBBLabel(); - this.notes = new System.Windows.Forms.TextBox(); - this.abilitiesList = new System.Windows.Forms.ListBox(); - this.lblAbilities = new IBBoard.Windows.Forms.IBBLabel(); - this.statsPanel = new System.Windows.Forms.FlowLayoutPanel(); - ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit(); - this.SuspendLayout(); - // - // tbUnitName - // - this.tbUnitName.Location = new System.Drawing.Point(8, 8); - this.tbUnitName.Name = "tbUnitName"; - this.tbUnitName.Size = new System.Drawing.Size(344, 20); - this.tbUnitName.TabIndex = 1; - this.tbUnitName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbUnitName_KeyDown); - this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave); - // - // unitSize - // - this.unitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.unitSize.Location = new System.Drawing.Point(528, 8); - this.unitSize.Name = "unitSize"; - this.unitSize.Size = new System.Drawing.Size(80, 20); - this.unitSize.TabIndex = 1; - this.unitSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.unitSize.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.unitSize.Leave += new System.EventHandler(this.unitSize_Leave); - this.unitSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unitSize_KeyDown); - // - // lblUnitSize - // - this.lblUnitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.lblUnitSize.Location = new System.Drawing.Point(426, 8); - this.lblUnitSize.Name = "lblUnitSize"; - this.lblUnitSize.Size = new System.Drawing.Size(98, 23); - this.lblUnitSize.TabIndex = 0; - this.lblUnitSize.Text = "unit size"; - this.lblUnitSize.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // lblEquip - // - this.lblEquip.Location = new System.Drawing.Point(15, 126); - this.lblEquip.Name = "lblEquip"; - this.lblEquip.Size = new System.Drawing.Size(81, 108); - this.lblEquip.TabIndex = 3; - this.lblEquip.Text = "equipment"; - this.lblEquip.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // bttnAddWeapon - // - this.bttnAddWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttnAddWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.bttnAddWeapon.Location = new System.Drawing.Point(516, 126); - this.bttnAddWeapon.Name = "bttnAddWeapon"; - this.bttnAddWeapon.Size = new System.Drawing.Size(88, 22); - this.bttnAddWeapon.TabIndex = 4; - this.bttnAddWeapon.Text = "add"; - this.bttnAddWeapon.Click += new System.EventHandler(this.bttnAddWeapon_Click); - // - // bttnRemoveWeapon - // - this.bttnRemoveWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttnRemoveWeapon.Enabled = false; - this.bttnRemoveWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.bttnRemoveWeapon.Location = new System.Drawing.Point(516, 210); - this.bttnRemoveWeapon.Name = "bttnRemoveWeapon"; - this.bttnRemoveWeapon.Size = new System.Drawing.Size(88, 22); - this.bttnRemoveWeapon.TabIndex = 5; - this.bttnRemoveWeapon.Text = "remove"; - this.bttnRemoveWeapon.Click += new System.EventHandler(this.bttnRemoveWeapon_Click); - // - // equipmentList - // - this.equipmentList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.equipmentList.Location = new System.Drawing.Point(102, 126); - this.equipmentList.Name = "equipmentList"; - this.equipmentList.Size = new System.Drawing.Size(408, 108); - this.equipmentList.TabIndex = 6; - this.equipmentList.SelectedIndexChanged += new System.EventHandler(this.equipmentList_SelectedIndexChanged); - this.equipmentList.DoubleClick += new System.EventHandler(this.equipmentList_DoubleClick); - // - // bttnReplaceWeapon - // - this.bttnReplaceWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttnReplaceWeapon.Enabled = false; - this.bttnReplaceWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.bttnReplaceWeapon.Location = new System.Drawing.Point(516, 182); - this.bttnReplaceWeapon.Name = "bttnReplaceWeapon"; - this.bttnReplaceWeapon.Size = new System.Drawing.Size(88, 22); - this.bttnReplaceWeapon.TabIndex = 10; - this.bttnReplaceWeapon.Text = "replace"; - this.bttnReplaceWeapon.Click += new System.EventHandler(this.bttnReplaceWeapon_Click); - // - // bttnEditWeapon - // - this.bttnEditWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttnEditWeapon.Enabled = false; - this.bttnEditWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.bttnEditWeapon.Location = new System.Drawing.Point(516, 154); - this.bttnEditWeapon.Name = "bttnEditWeapon"; - this.bttnEditWeapon.Size = new System.Drawing.Size(88, 22); - this.bttnEditWeapon.TabIndex = 11; - this.bttnEditWeapon.Text = "edit"; - this.bttnEditWeapon.Click += new System.EventHandler(this.bttnEditWeapon_Click); - // - // lblPoints - // - this.lblPoints.Location = new System.Drawing.Point(358, 8); - this.lblPoints.Name = "lblPoints"; - this.lblPoints.Size = new System.Drawing.Size(77, 21); - this.lblPoints.TabIndex = 12; - this.lblPoints.Text = "(points)"; - // - // lblNotes - // - this.lblNotes.Location = new System.Drawing.Point(13, 317); - this.lblNotes.Name = "lblNotes"; - this.lblNotes.Size = new System.Drawing.Size(84, 62); - this.lblNotes.TabIndex = 13; - this.lblNotes.Text = "notes"; - this.lblNotes.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // notes - // - this.notes.Location = new System.Drawing.Point(102, 317); - this.notes.Multiline = true; - this.notes.Name = "notes"; - this.notes.ReadOnly = true; - this.notes.Size = new System.Drawing.Size(408, 62); - this.notes.TabIndex = 14; - // - // abilitiesList - // - this.abilitiesList.FormattingEnabled = true; - this.abilitiesList.Location = new System.Drawing.Point(102, 240); - this.abilitiesList.Name = "abilitiesList"; - this.abilitiesList.Size = new System.Drawing.Size(408, 69); - this.abilitiesList.TabIndex = 15; - // - // lblAbilities - // - this.lblAbilities.Location = new System.Drawing.Point(13, 240); - this.lblAbilities.Name = "lblAbilities"; - this.lblAbilities.Size = new System.Drawing.Size(84, 62); - this.lblAbilities.TabIndex = 16; - this.lblAbilities.Text = "abilities"; - this.lblAbilities.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // statsPanel - // - this.statsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.statsPanel.AutoScroll = true; - this.statsPanel.Location = new System.Drawing.Point(8, 35); - this.statsPanel.Name = "statsPanel"; - this.statsPanel.Size = new System.Drawing.Size(600, 85); - this.statsPanel.TabIndex = 17; - // - // FrmUnit - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(616, 391); - this.Controls.Add(this.statsPanel); - this.Controls.Add(this.lblAbilities); - this.Controls.Add(this.abilitiesList); - this.Controls.Add(this.notes); - this.Controls.Add(this.lblNotes); - this.Controls.Add(this.lblPoints); - this.Controls.Add(this.bttnEditWeapon); - this.Controls.Add(this.bttnReplaceWeapon); - this.Controls.Add(this.equipmentList); - this.Controls.Add(this.bttnRemoveWeapon); - this.Controls.Add(this.bttnAddWeapon); - this.Controls.Add(this.lblEquip); - this.Controls.Add(this.lblUnitSize); - this.Controls.Add(this.unitSize); - this.Controls.Add(this.tbUnitName); - this.Name = "FrmUnit"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.Text = "FrmUnit"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmUnit_FormClosing); - ((System.ComponentModel.ISupportInitialize)(this.unitSize)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - #endregion - - public Unit Unit - { - get { return unit; } - } - - private void tbUnitName_Leave(object sender, System.EventArgs e) - { - UpdateUnitName(); - } - - private void tbUnitName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - { - UpdateUnitName(); - } - } - - private void UpdateUnitName() - { - if (unit.Name != tbUnitName.Text) - { - commandStack.Execute(new SetNameCommand(unit, tbUnitName.Text)); - } - } - - private void unitSize_Leave(object sender, System.EventArgs e) - { - UpdateUnitSize(); - } - - private void unitSize_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - { - UpdateUnitSize(); - } - } - - private void UpdateUnitSize() - { - if (unit.Size != unitSize.Value) - { - commandStack.Execute(new SetUnitSizeCommand(unit, (int) unitSize.Value)); - } - } - - private void unit_NameChanged(WarFoundryObject obj, string oldValue, string newValue) - { - if (obj is Unit && obj.Equals(unit)) - { - SetUnitName(); - } - } - - private void unit_UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue) - { - if (obj is Unit && obj.Equals(unit)) - { - unitSize.Value = newValue; - } - } - - private void RefreshUnitEquipment() - { - foreach (UnitEquipmentChoice choice in equipmentChoices.Values) - { - SetEquipmentListValue(choice); - } - } - - private void equipmentList_SelectedIndexChanged(object sender, System.EventArgs e) - { - SetButtonsEnabledState(); - } - - private void SetButtonsEnabledState() - { - - UnitEquipmentItem equipItem = GetSelectedUnitEquipmentItem(); - bttnReplaceWeapon.Enabled = (equipItem != null && equipItem.HasAlternatives()); - bttnEditWeapon.Enabled = (equipItem != null); - bttnRemoveWeapon.Enabled = (equipItem != null && !equipItem.IsRequired); - } - - private void unit_UnitEquipmentAmountChanged(WarFoundryObject obj, double oldValue, double newValue) - { - if (obj is UnitEquipmentItem) - { - UnitEquipmentItem equip = (UnitEquipmentItem) obj; - UnitEquipmentChoice equipChoice = GetEquipmentChoice(equip); - - if (newValue == 0) - { - equipmentList.Items.Remove(equipChoice); - } - else - { - SetEquipmentListValue(equipChoice); - } - } - } - - private void SetEquipmentListValue(UnitEquipmentChoice equipChoice) - { - int idx = equipmentList.Items.IndexOf(equipChoice); - - if (idx > -1) - { - equipmentList.Items[idx] = equipChoice; - } - else - { - equipmentList.Items.Add(equipChoice); - } - } - - private void EditWeapon() - { - UnitEquipmentItem item = GetSelectedUnitEquipmentItem(); - - if (item != null) - { - FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, item, commandStack); - editEquip.ShowDialog(this); - } - } - - private UnitEquipmentItem GetSelectedUnitEquipmentItem() - { - UnitEquipmentChoice selectedItem = GetSelectedUnitEquipmentChoice(); - UnitEquipmentItem equipItem = null; - - if (selectedItem!=null) - { - equipItem = selectedItem.Item; - } - - return equipItem; - } - - private UnitEquipmentChoice GetSelectedUnitEquipmentChoice() - { - return (UnitEquipmentChoice) equipmentList.SelectedItem; - } - - private void bttnEditWeapon_Click(object sender, System.EventArgs e) - { - EditWeapon(); - } - - private void equipmentList_DoubleClick(object sender, System.EventArgs e) - { - EditWeapon(); - } - - private void AddWeapon() - { - FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack); - newEquip.ShowDialog(this); - } - - private void bttnAddWeapon_Click(object sender, System.EventArgs e) - { - AddWeapon(); - } - - private void RemoveWeapon() - { - commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, GetSelectedUnitEquipmentItem(), 0)); - } - - private void bttnRemoveWeapon_Click(object sender, System.EventArgs e) - { - RemoveWeapon(); - } - - private void bttnReplaceWeapon_Click(object sender, System.EventArgs e) - { - FrmReplaceUnitEquipment replace = new FrmReplaceUnitEquipment(unit, GetSelectedUnitEquipmentItem(), commandStack); - replace.ShowDialog(this); - } - - private void FrmUnit_FormClosing(object sender, FormClosingEventArgs e) - { - UpdateUnitName(); - UpdateUnitSize(); - } - } +// This file (FrmUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Data; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using IBBoard.Commands; +using IBBoard.Lang; +using IBBoard.Windows.Forms; +using IBBoard.Windows.Forms.I18N; +using IBBoard.WarFoundry.API; +using IBBoard.WarFoundry.API.Commands; +using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.GUI.WinForms.UI; +using IBBoard.WarFoundry.GUI.WinForms.Util; +using log4net; + +namespace IBBoard.WarFoundry.GUI.WinForms +{ + /// <summary> + /// Summary description for FrmUnit. + /// </summary> + public class FrmUnit : IBBoard.Windows.Forms.IBBForm + { + private static readonly ILog log = LogManager.GetLogger(typeof(FrmUnit)); + private static readonly int BORDER_WIDTH = 1; + private static readonly int NAME_COL_WIDTH_MULTIPLIER = 3; + private Unit unit; + private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>(); + private Dictionary<string, DataGridView> DataGridViews = new Dictionary<string, DataGridView>(); + private CommandStack commandStack; + private System.Windows.Forms.TextBox tbUnitName; + private System.Windows.Forms.NumericUpDown unitSize; + private IBBLabel lblUnitSize; + private IBBButton bttnAddWeapon; + private IBBButton bttnRemoveWeapon; + private IBBLabel lblEquip; + private System.Windows.Forms.ListBox equipmentList; + private IBBButton bttnReplaceWeapon; + private IBBButton bttnEditWeapon; + private Label lblPoints; + private IBBLabel lblNotes; + private TextBox notes; + private ListBox abilitiesList; + private IBBLabel lblAbilities; + private FlowLayoutPanel statsPanel; + public GameSystem CurrentGameSystem + { + get { return WarFoundryCore.CurrentGameSystem; } + set { WarFoundryCore.CurrentGameSystem = value; } + } + + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.Container components = null; + + public FrmUnit(Unit toDisplay, CommandStack cmdStack) + { + unit = toDisplay; + commandStack = cmdStack; + // + // Required for Windows Form Designer support + // + InitializeComponent(); + TranslateForm(); + Translation.TranslationChanged += new MethodInvoker(TranslateForm); + unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); + unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); + unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); + unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); + + unitSize.Value = unit.Size; + unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); + unitSize.Minimum = unit.UnitType.MinSize; + unitSize.Enabled = (unitSize.Maximum != unitSize.Minimum); + + notes.Text = unit.UnitType.Notes; + abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities()); + abilitiesList.DisplayMember = "Name"; + SetPointsValueText(); + SetStats(); + SetWeapons(); + } + + private void TranslateForm() + { + ControlTranslator.TranslateControl(this); + SetUnitName(); + RefreshUnitEquipment(); + } + + private void SetUnitName() + { + tbUnitName.Text = unit.Name; + Text = Translation.GetTranslation("FrmUnit", "{0} ({1})", unit.Name, unit.UnitType.Name); + } + + void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) + { + SetPointsValueText(); + } + + private void SetPointsValueText() + { + lblPoints.Text = Translation.GetTranslation("FrmUnitlblPoints", "(" + unit.Points + " pts)", unit.Points, CurrentGameSystem.GetPointsAbbrev(unit.Points)); + } + + private void SetStats() + { + Stat[][] stats = unit.UnitStatsArraysWithName; + string[] statsIDs = unit.UnitStatsArrayIDs; + int statsCount = stats.Length; + log.DebugFormat("Unit {0} has {1} stats arrays", unit.UnitType.Name, statsCount); + + for (int i = 0; i < statsCount; i++) + { + DataGridView statsGrid = GetDataGridView(statsIDs[i]); + DataTable dt = (DataTable)statsGrid.DataSource; + DataRow dr = dt.NewRow(); + dr.ItemArray = stats[i]; + log.DebugFormat("Add row to data table for {0}", statsIDs[i]); + dt.Rows.Add(dr); + statsGrid.ClearSelection(); + } + } + + private DataGridView GetDataGridView(string statsID) + { + DataGridView grid; + + if (DataGridViews.ContainsKey(statsID)) + { + grid = DictionaryUtils.GetValue(DataGridViews, statsID); + } + else + { + grid = CreateDataGridView(statsID); + DataGridViews[statsID] = grid; + } + + return grid; + } + + private DataGridView CreateDataGridView(string statsID) + { + log.DebugFormat("Create DataGridView for stats ID {0}", statsID); + SystemStats sysStats = unit.Race.GameSystem.GetSystemStatsForID(statsID); + StatSlot[] sysStatSlots = sysStats.StatSlots; + int statsCount = sysStatSlots.Length; + int statsWithNameCount = statsCount + 1; + StatSlot[] statsWithName = new StatSlot[statsWithNameCount]; + statsWithName[0] = new StatSlot("Name"); + sysStatSlots.CopyTo(statsWithName, 1); + DataTable dt = new DataTable(); + DataGridView statsGrid = CreateDataGridView(); + statsGrid.DataSource = dt; + int columnWidth = statsGrid.Width / (statsCount + NAME_COL_WIDTH_MULTIPLIER); + + for (int i = 0; i < statsWithNameCount; i++) + { + StatSlot stat = statsWithName[i]; + string slotName = stat.Name; + statsGrid.Columns.Add(CreateStatColumn(slotName, columnWidth)); + dt.Columns.Add(CreateDataColumn(slotName)); + } + + int otherStatsWidth = statsCount * columnWidth; + SetNameColumnWidth(statsGrid, otherStatsWidth); + + return statsGrid; + } + + private static DataGridViewColumn CreateStatColumn(string slotName, int columnWidth) + { + DataGridViewColumn col = new DataGridViewTextBoxColumn(); + col.Width = columnWidth; + col.Name = slotName; + col.HeaderText = slotName; + col.DataPropertyName = slotName; + col.SortMode = DataGridViewColumnSortMode.NotSortable; + col.CellTemplate = new StatsDataGridViewCell(); + col.HeaderCell.Style.WrapMode = DataGridViewTriState.False; + return col; + } + + private static void SetNameColumnWidth(DataGridView statsGrid, int otherStatsWidth) + { + + DataGridViewColumn nameColumn = statsGrid.Columns[0]; + nameColumn.HeaderText = Translation.GetTranslation("StatLineName", "name"); + nameColumn.Width = statsGrid.Width - otherStatsWidth; + } + + private static DataColumn CreateDataColumn(string slotName) + { + log.DebugFormat("Create column {0}", slotName); + DataColumn tempCol = new DataColumn(slotName, typeof(Stat)); + return tempCol; + } + + public DataGridView CreateDataGridView() + { + log.Debug("Create DataGridView widget"); + DataGridView statsGrid = new DataGridView(); + statsGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + statsGrid.CausesValidation = false; + statsGrid.ReadOnly = true; + statsGrid.RowHeadersVisible = false; + statsGrid.Size = new System.Drawing.Size(600, 88); + statsGrid.TabStop = false; + statsGrid.AllowUserToAddRows = false; + statsGrid.ScrollBars = ScrollBars.None; + statsGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + statsGrid.BorderStyle = BorderStyle.None; + statsGrid.BackgroundColor = SystemColors.Control; + statsGrid.RowsAdded += new DataGridViewRowsAddedEventHandler(statsGrid_RowsAdded); + statsPanel.Controls.Add(statsGrid); + statsGrid.Width = statsPanel.Width - (int)Math.Round(SystemInformation.VerticalScrollBarWidth * 1.4); + return statsGrid; + } + + private void statsGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) + { + if (sender is DataGridView) + { + SetGridHeight((DataGridView)sender); + } + } + + private static void SetGridHeight(DataGridView statsGrid) + { + DataGridViewRowCollection rows = statsGrid.Rows; + statsGrid.Height = statsGrid.Columns[0].HeaderCell.Size.Height + (rows.Count * rows[0].Height); + log.DebugFormat("Set height to {0} for grid of {1} rows", statsGrid.Height, rows.Count); + } + + private void SetWeapons() + { + foreach (UnitEquipmentItem item in unit.GetEquipment()) + { + equipmentList.Items.Add(GetEquipmentChoice(item)); + } + } + + private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item) + { + UnitEquipmentChoice choice = null; + equipmentChoices.TryGetValue(item, out choice); + + if (choice == null) + { + choice = new UnitEquipmentChoice(Unit, item); + equipmentChoices[item] = choice; + } + + return choice; + } + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose(bool disposing) + { + //remove our leave events so that disposing doesn't trigger them + tbUnitName.Leave -= new System.EventHandler(this.tbUnitName_Leave); + unitSize.Leave -= new System.EventHandler(this.unitSize_Leave); + + if (disposing) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.tbUnitName = new System.Windows.Forms.TextBox(); + this.unitSize = new System.Windows.Forms.NumericUpDown(); + this.lblUnitSize = new IBBoard.Windows.Forms.IBBLabel(); + this.lblEquip = new IBBoard.Windows.Forms.IBBLabel(); + this.bttnAddWeapon = new IBBoard.Windows.Forms.IBBButton(); + this.bttnRemoveWeapon = new IBBoard.Windows.Forms.IBBButton(); + this.equipmentList = new System.Windows.Forms.ListBox(); + this.bttnReplaceWeapon = new IBBoard.Windows.Forms.IBBButton(); + this.bttnEditWeapon = new IBBoard.Windows.Forms.IBBButton(); + this.lblPoints = new System.Windows.Forms.Label(); + this.lblNotes = new IBBoard.Windows.Forms.IBBLabel(); + this.notes = new System.Windows.Forms.TextBox(); + this.abilitiesList = new System.Windows.Forms.ListBox(); + this.lblAbilities = new IBBoard.Windows.Forms.IBBLabel(); + this.statsPanel = new System.Windows.Forms.FlowLayoutPanel(); + ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit(); + this.SuspendLayout(); + // + // tbUnitName + // + this.tbUnitName.Location = new System.Drawing.Point(8, 8); + this.tbUnitName.Name = "tbUnitName"; + this.tbUnitName.Size = new System.Drawing.Size(344, 20); + this.tbUnitName.TabIndex = 1; + this.tbUnitName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbUnitName_KeyDown); + this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave); + // + // unitSize + // + this.unitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.unitSize.Location = new System.Drawing.Point(528, 8); + this.unitSize.Name = "unitSize"; + this.unitSize.Size = new System.Drawing.Size(80, 20); + this.unitSize.TabIndex = 1; + this.unitSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.unitSize.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.unitSize.Leave += new System.EventHandler(this.unitSize_Leave); + this.unitSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unitSize_KeyDown); + // + // lblUnitSize + // + this.lblUnitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblUnitSize.Location = new System.Drawing.Point(426, 8); + this.lblUnitSize.Name = "lblUnitSize"; + this.lblUnitSize.Size = new System.Drawing.Size(98, 23); + this.lblUnitSize.TabIndex = 0; + this.lblUnitSize.Text = "unit size"; + this.lblUnitSize.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // lblEquip + // + this.lblEquip.Location = new System.Drawing.Point(15, 126); + this.lblEquip.Name = "lblEquip"; + this.lblEquip.Size = new System.Drawing.Size(81, 108); + this.lblEquip.TabIndex = 3; + this.lblEquip.Text = "equipment"; + this.lblEquip.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // bttnAddWeapon + // + this.bttnAddWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttnAddWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnAddWeapon.Location = new System.Drawing.Point(516, 126); + this.bttnAddWeapon.Name = "bttnAddWeapon"; + this.bttnAddWeapon.Size = new System.Drawing.Size(88, 22); + this.bttnAddWeapon.TabIndex = 4; + this.bttnAddWeapon.Text = "add"; + this.bttnAddWeapon.Click += new System.EventHandler(this.bttnAddWeapon_Click); + // + // bttnRemoveWeapon + // + this.bttnRemoveWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttnRemoveWeapon.Enabled = false; + this.bttnRemoveWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnRemoveWeapon.Location = new System.Drawing.Point(516, 210); + this.bttnRemoveWeapon.Name = "bttnRemoveWeapon"; + this.bttnRemoveWeapon.Size = new System.Drawing.Size(88, 22); + this.bttnRemoveWeapon.TabIndex = 5; + this.bttnRemoveWeapon.Text = "remove"; + this.bttnRemoveWeapon.Click += new System.EventHandler(this.bttnRemoveWeapon_Click); + // + // equipmentList + // + this.equipmentList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.equipmentList.Location = new System.Drawing.Point(102, 126); + this.equipmentList.Name = "equipmentList"; + this.equipmentList.Size = new System.Drawing.Size(408, 108); + this.equipmentList.TabIndex = 6; + this.equipmentList.SelectedIndexChanged += new System.EventHandler(this.equipmentList_SelectedIndexChanged); + this.equipmentList.DoubleClick += new System.EventHandler(this.equipmentList_DoubleClick); + // + // bttnReplaceWeapon + // + this.bttnReplaceWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttnReplaceWeapon.Enabled = false; + this.bttnReplaceWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnReplaceWeapon.Location = new System.Drawing.Point(516, 182); + this.bttnReplaceWeapon.Name = "bttnReplaceWeapon"; + this.bttnReplaceWeapon.Size = new System.Drawing.Size(88, 22); + this.bttnReplaceWeapon.TabIndex = 10; + this.bttnReplaceWeapon.Text = "replace"; + this.bttnReplaceWeapon.Click += new System.EventHandler(this.bttnReplaceWeapon_Click); + // + // bttnEditWeapon + // + this.bttnEditWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttnEditWeapon.Enabled = false; + this.bttnEditWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnEditWeapon.Location = new System.Drawing.Point(516, 154); + this.bttnEditWeapon.Name = "bttnEditWeapon"; + this.bttnEditWeapon.Size = new System.Drawing.Size(88, 22); + this.bttnEditWeapon.TabIndex = 11; + this.bttnEditWeapon.Text = "edit"; + this.bttnEditWeapon.Click += new System.EventHandler(this.bttnEditWeapon_Click); + // + // lblPoints + // + this.lblPoints.Location = new System.Drawing.Point(358, 8); + this.lblPoints.Name = "lblPoints"; + this.lblPoints.Size = new System.Drawing.Size(77, 21); + this.lblPoints.TabIndex = 12; + this.lblPoints.Text = "(points)"; + // + // lblNotes + // + this.lblNotes.Location = new System.Drawing.Point(13, 317); + this.lblNotes.Name = "lblNotes"; + this.lblNotes.Size = new System.Drawing.Size(84, 62); + this.lblNotes.TabIndex = 13; + this.lblNotes.Text = "notes"; + this.lblNotes.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // notes + // + this.notes.Location = new System.Drawing.Point(102, 317); + this.notes.Multiline = true; + this.notes.Name = "notes"; + this.notes.ReadOnly = true; + this.notes.Size = new System.Drawing.Size(408, 62); + this.notes.TabIndex = 14; + // + // abilitiesList + // + this.abilitiesList.FormattingEnabled = true; + this.abilitiesList.Location = new System.Drawing.Point(102, 240); + this.abilitiesList.Name = "abilitiesList"; + this.abilitiesList.Size = new System.Drawing.Size(408, 69); + this.abilitiesList.TabIndex = 15; + // + // lblAbilities + // + this.lblAbilities.Location = new System.Drawing.Point(13, 240); + this.lblAbilities.Name = "lblAbilities"; + this.lblAbilities.Size = new System.Drawing.Size(84, 62); + this.lblAbilities.TabIndex = 16; + this.lblAbilities.Text = "abilities"; + this.lblAbilities.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // statsPanel + // + this.statsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.statsPanel.AutoScroll = true; + this.statsPanel.Location = new System.Drawing.Point(8, 35); + this.statsPanel.Name = "statsPanel"; + this.statsPanel.Size = new System.Drawing.Size(600, 85); + this.statsPanel.TabIndex = 17; + // + // FrmUnit + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(616, 391); + this.Controls.Add(this.statsPanel); + this.Controls.Add(this.lblAbilities); + this.Controls.Add(this.abilitiesList); + this.Controls.Add(this.notes); + this.Controls.Add(this.lblNotes); + this.Controls.Add(this.lblPoints); + this.Controls.Add(this.bttnEditWeapon); + this.Controls.Add(this.bttnReplaceWeapon); + this.Controls.Add(this.equipmentList); + this.Controls.Add(this.bttnRemoveWeapon); + this.Controls.Add(this.bttnAddWeapon); + this.Controls.Add(this.lblEquip); + this.Controls.Add(this.lblUnitSize); + this.Controls.Add(this.unitSize); + this.Controls.Add(this.tbUnitName); + this.Name = "FrmUnit"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "FrmUnit"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmUnit_FormClosing); + ((System.ComponentModel.ISupportInitialize)(this.unitSize)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + public Unit Unit + { + get { return unit; } + } + + private void tbUnitName_Leave(object sender, System.EventArgs e) + { + UpdateUnitName(); + } + + private void tbUnitName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + UpdateUnitName(); + } + } + + private void UpdateUnitName() + { + if (unit.Name != tbUnitName.Text) + { + commandStack.Execute(new SetNameCommand(unit, tbUnitName.Text)); + } + } + + private void unitSize_Leave(object sender, System.EventArgs e) + { + UpdateUnitSize(); + } + + private void unitSize_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + UpdateUnitSize(); + } + } + + private void UpdateUnitSize() + { + if (unit.Size != unitSize.Value) + { + commandStack.Execute(new SetUnitSizeCommand(unit, (int) unitSize.Value)); + } + } + + private void unit_NameChanged(WarFoundryObject obj, string oldValue, string newValue) + { + if (obj is Unit && obj.Equals(unit)) + { + SetUnitName(); + } + } + + private void unit_UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue) + { + if (obj is Unit && obj.Equals(unit)) + { + unitSize.Value = newValue; + } + } + + private void RefreshUnitEquipment() + { + foreach (UnitEquipmentChoice choice in equipmentChoices.Values) + { + SetEquipmentListValue(choice); + } + } + + private void equipmentList_SelectedIndexChanged(object sender, System.EventArgs e) + { + SetButtonsEnabledState(); + } + + private void SetButtonsEnabledState() + { + + UnitEquipmentItem equipItem = GetSelectedUnitEquipmentItem(); + bttnReplaceWeapon.Enabled = (equipItem != null && equipItem.HasAlternatives()); + bttnEditWeapon.Enabled = (equipItem != null); + bttnRemoveWeapon.Enabled = (equipItem != null && !equipItem.IsRequired); + } + + private void unit_UnitEquipmentAmountChanged(WarFoundryObject obj, double oldValue, double newValue) + { + if (obj is UnitEquipmentItem) + { + UnitEquipmentItem equip = (UnitEquipmentItem) obj; + UnitEquipmentChoice equipChoice = GetEquipmentChoice(equip); + + if (newValue == 0) + { + equipmentList.Items.Remove(equipChoice); + } + else + { + SetEquipmentListValue(equipChoice); + } + } + } + + private void SetEquipmentListValue(UnitEquipmentChoice equipChoice) + { + int idx = equipmentList.Items.IndexOf(equipChoice); + + if (idx > -1) + { + equipmentList.Items[idx] = equipChoice; + } + else + { + equipmentList.Items.Add(equipChoice); + } + } + + private void EditWeapon() + { + UnitEquipmentItem item = GetSelectedUnitEquipmentItem(); + + if (item != null) + { + FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, item, commandStack); + editEquip.ShowDialog(this); + } + } + + private UnitEquipmentItem GetSelectedUnitEquipmentItem() + { + UnitEquipmentChoice selectedItem = GetSelectedUnitEquipmentChoice(); + UnitEquipmentItem equipItem = null; + + if (selectedItem!=null) + { + equipItem = selectedItem.Item; + } + + return equipItem; + } + + private UnitEquipmentChoice GetSelectedUnitEquipmentChoice() + { + return (UnitEquipmentChoice) equipmentList.SelectedItem; + } + + private void bttnEditWeapon_Click(object sender, System.EventArgs e) + { + EditWeapon(); + } + + private void equipmentList_DoubleClick(object sender, System.EventArgs e) + { + EditWeapon(); + } + + private void AddWeapon() + { + FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack); + newEquip.ShowDialog(this); + } + + private void bttnAddWeapon_Click(object sender, System.EventArgs e) + { + AddWeapon(); + } + + private void RemoveWeapon() + { + commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, GetSelectedUnitEquipmentItem(), 0)); + } + + private void bttnRemoveWeapon_Click(object sender, System.EventArgs e) + { + RemoveWeapon(); + } + + private void bttnReplaceWeapon_Click(object sender, System.EventArgs e) + { + FrmReplaceUnitEquipment replace = new FrmReplaceUnitEquipment(unit, GetSelectedUnitEquipmentItem(), commandStack); + replace.ShowDialog(this); + } + + private void FrmUnit_FormClosing(object sender, FormClosingEventArgs e) + { + UpdateUnitName(); + UpdateUnitSize(); + } + } } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmXmlExport.Designer.cs Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,162 @@ +namespace IBBoard.WarFoundry.GUI.WinForms +{ + partial class FrmXmlExport + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.lbTitle = new IBBoard.Windows.Forms.IBBLabel(); + this.tbOutputFile = new System.Windows.Forms.TextBox(); + this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); + this.bttnOutputSelect = new IBBoard.Windows.Forms.IBBButton(); + this.cbApplyTransform = new System.Windows.Forms.CheckBox(); + this.bttnExport = new IBBoard.Windows.Forms.IBBButton(); + this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); + this.tbXslPath = new System.Windows.Forms.TextBox(); + this.bttnXslSelect = new IBBoard.Windows.Forms.IBBButton(); + this.SuspendLayout(); + // + // lbTitle + // + this.lbTitle.AutoSize = true; + this.lbTitle.Location = new System.Drawing.Point(12, 9); + this.lbTitle.Name = "lbTitle"; + this.lbTitle.Size = new System.Drawing.Size(61, 13); + this.lbTitle.TabIndex = 0; + this.lbTitle.Text = "XML Ouput"; + // + // tbOutputFile + // + this.tbOutputFile.Location = new System.Drawing.Point(15, 28); + this.tbOutputFile.Name = "tbOutputFile"; + this.tbOutputFile.Size = new System.Drawing.Size(179, 20); + this.tbOutputFile.TabIndex = 1; + this.tbOutputFile.TextChanged += new System.EventHandler(this.tbOutputFile_Change); + // + // bttnOutputSelect + // + this.bttnOutputSelect.Location = new System.Drawing.Point(202, 28); + this.bttnOutputSelect.Name = "bttnOutputSelect"; + this.bttnOutputSelect.Size = new System.Drawing.Size(32, 20); + this.bttnOutputSelect.TabIndex = 2; + this.bttnOutputSelect.Text = "..."; + this.bttnOutputSelect.UseVisualStyleBackColor = true; + this.bttnOutputSelect.Click += new System.EventHandler(this.bttnOutputSelect_Click); + // + // cbApplyTransform + // + this.cbApplyTransform.AutoSize = true; + this.cbApplyTransform.Location = new System.Drawing.Point(15, 54); + this.cbApplyTransform.Name = "cbApplyTransform"; + this.cbApplyTransform.Size = new System.Drawing.Size(125, 17); + this.cbApplyTransform.TabIndex = 3; + this.cbApplyTransform.Text = "Apply XSL Transform"; + this.cbApplyTransform.UseVisualStyleBackColor = true; + this.cbApplyTransform.CheckedChanged += new System.EventHandler(this.cbApplyTransform_CheckedChanged); + // + // bttnExport + // + this.bttnExport.Enabled = false; + this.bttnExport.Location = new System.Drawing.Point(78, 116); + this.bttnExport.Name = "bttnExport"; + this.bttnExport.Size = new System.Drawing.Size(75, 23); + this.bttnExport.TabIndex = 5; + this.bttnExport.Text = "&Export"; + this.bttnExport.UseVisualStyleBackColor = true; + this.bttnExport.Click += new System.EventHandler(this.bttnExport_Click); + // + // bttnCancel + // + this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttnCancel.Location = new System.Drawing.Point(159, 116); + this.bttnCancel.Name = "bttnCancel"; + this.bttnCancel.Size = new System.Drawing.Size(75, 23); + this.bttnCancel.TabIndex = 6; + this.bttnCancel.Text = "&Cancel"; + this.bttnCancel.UseVisualStyleBackColor = true; + this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); + // + // tbXslPath + // + this.tbXslPath.Enabled = false; + this.tbXslPath.Location = new System.Drawing.Point(15, 77); + this.tbXslPath.Name = "tbXslPath"; + this.tbXslPath.Size = new System.Drawing.Size(179, 20); + this.tbXslPath.TabIndex = 7; + // + // bttnXslSelect + // + this.bttnXslSelect.Enabled = false; + this.bttnXslSelect.Location = new System.Drawing.Point(202, 77); + this.bttnXslSelect.Name = "bttnXslSelect"; + this.bttnXslSelect.Size = new System.Drawing.Size(32, 20); + this.bttnXslSelect.TabIndex = 8; + this.bttnXslSelect.Text = "..."; + this.bttnXslSelect.UseVisualStyleBackColor = true; + this.bttnXslSelect.Click += new System.EventHandler(this.bttnXslSelect_Click); + // + // FrmXmlExport + // + this.AcceptButton = this.bttnExport; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttnCancel; + this.ClientSize = new System.Drawing.Size(241, 145); + this.ControlBox = false; + this.Controls.Add(this.bttnXslSelect); + this.Controls.Add(this.tbXslPath); + this.Controls.Add(this.bttnCancel); + this.Controls.Add(this.bttnExport); + this.Controls.Add(this.cbApplyTransform); + this.Controls.Add(this.bttnOutputSelect); + this.Controls.Add(this.tbOutputFile); + this.Controls.Add(this.lbTitle); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "FrmXmlExport"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Export as XML"; + this.TopMost = true; + this.Load += new System.EventHandler(this.FrmXmlExport_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Windows.Forms.IBBLabel lbTitle; + private System.Windows.Forms.TextBox tbOutputFile; + private System.Windows.Forms.SaveFileDialog saveFileDialog1; + private Windows.Forms.IBBButton bttnOutputSelect; + private System.Windows.Forms.CheckBox cbApplyTransform; + private Windows.Forms.IBBButton bttnExport; + private Windows.Forms.IBBButton bttnCancel; + private System.Windows.Forms.TextBox tbXslPath; + private Windows.Forms.IBBButton bttnXslSelect; + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmXmlExport.cs Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.IO; +using System.Windows.Forms; +using System.Xml.Xsl; +using IBBoard.Lang; +using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.API.Exporters; +using System.Xml.Xsl; + +namespace IBBoard.WarFoundry.GUI.WinForms +{ + public partial class FrmXmlExport : Form + { + Army myArmy = null; + public FrmXmlExport(Army army) + { + InitializeComponent(); + myArmy = army; + } + + private void FrmXmlExport_Load(object sender, EventArgs e) + { + tbXslPath.Text = Directory.GetCurrentDirectory() + "\\xsl\\default_html.xsl"; + } + + private void bttnOutputSelect_Click(object sender, EventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Filter = "XML File|*.xml|HTML File|*.html|XHTML File|*.xhtml"; + sfd.Title = "Save XML output"; + sfd.ShowDialog(); + + if (sfd.FileName != "") + { + tbOutputFile.Text = sfd.FileName; + } + } + + private void bttnCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Hide(); + } + + private void bttnExport_Click(object sender, EventArgs e) + { + string errorMessage = ""; + // Catch potential errors with the file export or XSL compiliation + try + { + if (cbApplyTransform.Checked) + { + WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(myArmy, tbOutputFile.Text, tbXslPath.Text); + } + else + { + WarFoundryXmlWithXslExporter.GetDefault().ExportArmy(myArmy, tbOutputFile.Text); + } + } + catch (XsltCompileException ex) + { + errorMessage = Translation.GetTranslation("mbErrorCompileFailed", "") + + ":\n" + ex.Message; + } + catch (XsltException ex) + { + + errorMessage = Translation.GetTranslation("mbErrorXSLTFailed", "") + + ":\n" + ex.Message; + } + catch (FileNotFoundException ex) + { + errorMessage = Translation.GetTranslation("mbErrorFileNotFoundFailed", "") + + ":\n" + ex.Message; + } + catch (IOException ex) + { + errorMessage = Translation.GetTranslation("mbErrorIOFailed", "") + + ":\n" + ex.Message; + } + catch (Exception ex) + { + errorMessage = Translation.GetTranslation("mbErrorFailed", "") + + ":\n" + ex.Message; + } + if (errorMessage != "") + { + MessageBox.Show(errorMessage, "Error During Export", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + this.DialogResult = DialogResult.OK; + this.Hide(); + } + + private void tbOutputFile_Change(object sender, EventArgs e) + { + if (tbOutputFile.Text != "") + { + bttnExport.Enabled = true; + } + else + { + bttnExport.Enabled = false; + } + } + + private void cbApplyTransform_CheckedChanged(object sender, EventArgs e) + { + if (cbApplyTransform.Checked) + { + tbXslPath.Enabled = true; + bttnXslSelect.Enabled = true; + } + else + { + tbXslPath.Enabled = false; + bttnXslSelect.Enabled = false; + } + } + + private void bttnXslSelect_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + + ofd.InitialDirectory = Directory.GetCurrentDirectory() + "\\xsl"; + ofd.Filter = "XSL Files|*.xsl"; + DialogResult result = ofd.ShowDialog(); + + if (result == DialogResult.OK) + { + tbXslPath.Text = ofd.FileName; + } + + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmXmlExport.resx Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file
--- a/IBBoard.WarFoundry.GUI.WinForms.csproj Wed Sep 08 20:10:57 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.WinForms.csproj Fri Aug 26 20:11:28 2011 +0100 @@ -1,7 +1,8 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>8.0.50727</ProductVersion> + <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{72C59D77-E2A4-401C-91F2-12728056D9A9}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -24,8 +25,9 @@ </FileUpgradeFlags> <UpgradeBackupLocation> </UpgradeBackupLocation> - <OldToolsVersion>2.0</OldToolsVersion> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <OldToolsVersion>3.5</OldToolsVersion> + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> @@ -38,9 +40,9 @@ <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> - <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <OutputPath>bin\Debug\</OutputPath> @@ -91,10 +93,6 @@ <UseVSHostingProcess>true</UseVSHostingProcess> </PropertyGroup> <ItemGroup> - <Reference Include="IBBoardWF, Version=1.0.0.27120, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\IBBoard.Windows.Forms\obj\Release\IBBoardWF.dll</HintPath> - </Reference> <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" /> <Reference Include="System"> <Name>System</Name> @@ -117,6 +115,7 @@ <Content Include="icons\document-new.png" /> <Content Include="icons\document-open.png" /> <Content Include="icons\document-save.png" /> + <None Include="app.config" /> <None Include="icons\edit-redo.png" /> <None Include="icons\edit-undo.png" /> <Content Include="icons\list-add.png" /> @@ -164,6 +163,12 @@ <Compile Include="FrmUnit.cs"> <SubType>Form</SubType> </Compile> + <Compile Include="FrmXmlExport.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="FrmXmlExport.Designer.cs"> + <DependentUpon>FrmXmlExport.cs</DependentUpon> + </Compile> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> @@ -220,6 +225,9 @@ <DependentUpon>FrmUnit.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="FrmXmlExport.resx"> + <DependentUpon>FrmXmlExport.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <SubType>Designer</SubType> <Generator>ResXFileCodeGenerator</Generator> @@ -238,6 +246,9 @@ <None Include="translations\en.translation"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="translations\fi.translation"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> <None Include="translations\fr.translation"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -294,6 +305,10 @@ <Project>{951E6C7A-7FBA-4F68-9D9E-F48618BB9626}</Project> <Name>IBBoard.WarFoundry.API</Name> </ProjectReference> + <ProjectReference Include="..\IBBoard.Windows.Forms\IBBoard.Windows.Forms.csproj"> + <Project>{E3790268-2082-4975-B1A3-C70B37842CE8}</Project> + <Name>IBBoard.Windows.Forms</Name> + </ProjectReference> <ProjectReference Include="..\IBBoard\IBBoard.csproj"> <Project>{5DFD64F6-FC2B-4B4F-B92E-483BAC468105}</Project> <Name>IBBoard</Name>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IBBoard.WarFoundry.GUI.WinForms.sln Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,117 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C# Express 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBBoard.WarFoundry.GUI.WinForms", "IBBoard.WarFoundry.GUI.WinForms.csproj", "{72C59D77-E2A4-401C-91F2-12728056D9A9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBBoard", "..\IBBoard\IBBoard.csproj", "{5DFD64F6-FC2B-4B4F-B92E-483BAC468105}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBBoard.Tests", "..\IBBoard.Tests\IBBoard.Tests.csproj", "{4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBBoard.WarFoundry.API", "..\IBBoard.WarFoundry.API\IBBoard.WarFoundry.API.csproj", "{951E6C7A-7FBA-4F68-9D9E-F48618BB9626}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBBoard.NUnit", "..\IBBoard.NUnit\IBBoard.NUnit.csproj", "{C52AFD32-B869-4E14-AACE-2846AD2CC742}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBBoard.Windows.Forms", "..\IBBoard.Windows.Forms\IBBoard.Windows.Forms.csproj", "{E3790268-2082-4975-B1A3-C70B37842CE8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBBoard.WarFoundry.API.Tests", "..\IBBoard.WarFoundry.API.Tests\IBBoard.WarFoundry.API.Tests.csproj", "{B20E808D-878E-4F6D-B1E3-84A9A49905CB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpZLib", "..\SharpZipLib\ICSharpCode.SharpZLib.csproj", "{0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Debug|x86.ActiveCfg = Debug|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Release|Any CPU.Build.0 = Release|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {72C59D77-E2A4-401C-91F2-12728056D9A9}.Release|x86.ActiveCfg = Release|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Debug|x86.ActiveCfg = Debug|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Release|Any CPU.Build.0 = Release|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105}.Release|x86.ActiveCfg = Release|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Debug|x86.ActiveCfg = Debug|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Release|Any CPU.Build.0 = Release|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4160F7B6-4CFA-41FC-B5D7-5C9AE06FEBA7}.Release|x86.ActiveCfg = Release|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Debug|Any CPU.Build.0 = Debug|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Debug|x86.ActiveCfg = Debug|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Release|Any CPU.ActiveCfg = Release|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Release|Any CPU.Build.0 = Release|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {951E6C7A-7FBA-4F68-9D9E-F48618BB9626}.Release|x86.ActiveCfg = Release|Any CPU + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Debug|Any CPU.ActiveCfg = Debug|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Debug|x86.ActiveCfg = Debug|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Debug|x86.Build.0 = Debug|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Release|Any CPU.ActiveCfg = Release|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Release|Mixed Platforms.Build.0 = Release|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Release|x86.ActiveCfg = Release|x86 + {C52AFD32-B869-4E14-AACE-2846AD2CC742}.Release|x86.Build.0 = Release|x86 + {E3790268-2082-4975-B1A3-C70B37842CE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Debug|x86.ActiveCfg = Debug|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Release|Any CPU.Build.0 = Release|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E3790268-2082-4975-B1A3-C70B37842CE8}.Release|x86.ActiveCfg = Release|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Debug|x86.ActiveCfg = Debug|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Release|Any CPU.Build.0 = Release|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B20E808D-878E-4F6D-B1E3-84A9A49905CB}.Release|x86.ActiveCfg = Release|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Debug|x86.ActiveCfg = Debug|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|Any CPU.Build.0 = Release|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|x86.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = IBBoard.WarFoundry.GUI.WinForms.csproj + EndGlobalSection +EndGlobal
--- a/Properties/Resources.Designer.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/Properties/Resources.Designer.cs Fri Aug 26 20:11:28 2011 +0100 @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:2.0.50727.4200 +// Runtime Version:4.0.30319.235 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources {
--- a/Util/UnitEquipmentChoice.cs Wed Sep 08 20:10:57 2010 +0000 +++ b/Util/UnitEquipmentChoice.cs Fri Aug 26 20:11:28 2011 +0100 @@ -6,6 +6,7 @@ using IBBoard.Lang; using IBBoard.WarFoundry.API.Objects; using IBBoard.WarFoundry.API.Util; +using IBBoard.WarFoundry.API; namespace IBBoard.WarFoundry.GUI.WinForms.Util { @@ -17,6 +18,11 @@ { private Unit unit; private UnitEquipmentItem item; + public GameSystem CurrentGameSystem + { + get { return WarFoundryCore.CurrentGameSystem; } + set { WarFoundryCore.CurrentGameSystem = value; } + } public UnitEquipmentChoice(Unit unit, UnitEquipmentItem unitItem) { @@ -34,7 +40,7 @@ } else { - translation = Translation.GetTranslation("equipmentAmountWithCost", "{0} ({1} at {2}pts each)", item.Name, GetAmountString(), item.Cost); + translation = Translation.GetTranslation("equipmentAmountWithCost", "{0} ({1} at {2}pts each)", item.Name, GetAmountString(), item.Cost, CurrentGameSystem.GetPointsAbbrev(item.Cost)); } return translation;
--- a/WarFoundry.exe.log4net Wed Sep 08 20:10:57 2010 +0000 +++ b/WarFoundry.exe.log4net Fri Aug 26 20:11:28 2011 +0100 @@ -1,1 +1,1 @@ -<?xml version="1.0" encoding="utf-8" ?> <log4net> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" /> </layout> </appender> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="logs/WarFoundry.log" /> <appendToFile value="false" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="-1" /> <maximumFileSize value="100MB" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="ConsoleAppender" /> <appender-ref ref="RollingLogFileAppender" /> </root> </log4net> \ No newline at end of file +<?xml version="1.0" encoding="utf-8" ?> <log4net> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" /> </layout> </appender> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="logs/WarFoundry.log" /> <appendToFile value="false" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="25" /> <maximumFileSize value="100MB" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="ConsoleAppender" /> <appender-ref ref="RollingLogFileAppender" /> </root> </log4net> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app.config Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,3 @@ +<?xml version="1.0"?> +<configuration> + <startup/></configuration>
--- a/translations/de.translation Wed Sep 08 20:10:57 2010 +0000 +++ b/translations/de.translation Fri Aug 26 20:11:28 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Speichern unter...</translation> <translation id="miExportArmyAs">Exportieren</translation> <translation id="miExportArmyAsBasicHTML">Einfaches HTML</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">Schließen</translation> <translation id="miReloadFiles">Dateien neu laden</translation> <translation id="miExit">Beenden</translation> @@ -38,10 +39,13 @@ <translation id="lblArmyName">Armeename:</translation> <translation id="lblArmySize">Armeegröße:</translation> <translation id="bttnSelectRace">Neue Armee erstellen</translation> + <translation id="newArmyNoGameSystems">WarFoundry konnte keine Spielsystemdaten finden. +Bitte überprüfe die Logdatei auf Fehler und stelle sicher, dass du entsprechende Dateien im "data"-Ordner hast.</translation> <translation id="FrmNewUnit">Füge eine neue {0}-Auswahl hinzu</translation> <translation id="lblUnitList">Einheiten:</translation> <translation id="bttnSelectUnit">Einheit hinzufügen</translation> <translation id="FrmNewUnitEquipment">Neue Ausrüstung für {0}</translation> + <translation id="FrmReplaceUnitEquipment">Ersetze {0} mit neuer Ausrüstung</translation> <translation id="lblAmount">Anzahl:</translation> <translation id="lblItem">Ausrüstung:</translation> <translation id="rbEquipAll">Alle ausrüsten</translation> @@ -118,5 +122,10 @@ <translation id="FrmPreferences">Einstellungen</translation> <translation id="languagePrefSection">Sprache</translation> <translation id="lblLanguage">Sprache:</translation> - <translation id="languagesGroup">Sprache</translation> + <translation id="languagesGroup">Sprache</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/en.translation Wed Sep 08 20:10:57 2010 +0000 +++ b/translations/en.translation Fri Aug 26 20:11:28 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Save army &as...</translation> <translation id="miExportArmyAs">&Export army</translation> <translation id="miExportArmyAsBasicHTML">Basic HTML</translation> + <translation id="miExportArmyAsBasicXml">XML...</translation> <translation id="miCloseArmy">&Close army</translation> <translation id="miReloadFiles">&Reload files</translation> <translation id="miExit">E&xit</translation> @@ -29,7 +30,11 @@ <translation id="openArmyDialog">Open Army</translation> <translation id="saveArmyDialog">Save Army</translation> <translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation> - <translation id="statusPanelPoints">{0} pts / {1} pts</translation> + <translation id="PointsLocalisationAbbrevSingle">pt</translation> + <translation id="PointsLocalisationAbbrevPlural">pts</translation> + <translation id="PointsLocalisationNameSingle">point</translation> + <translation id="PointsLocalisationNamePlural">points</translation> + <translation id="statusPanelPoints">{0} {1} / {2} {3}</translation> <translation id="statusPanelPointsToolTip">Current army points value</translation> <translation id="defaultUnitName">Unit of {0} {1}</translation> <translation id="FrmNewArmy">Create new army</translation> @@ -66,6 +71,7 @@ <translation id="lblDevelopers">Developers:</translation> <translation id="lblThanks">Thanks to:</translation> <translation id="FrmUnit">{0} ({1})</translation> + <translation id="FrmUnitlblPoints">({0} {1})</translation> <translation id="lblUnitSize">Unit size:</translation> <translation id="StatLineName">Type Name</translation> <translation id="lblEquip">Equipment:</translation> @@ -75,7 +81,7 @@ <translation id="bttnRemoveWeapon">Remove</translation> <translation id="bttnReplaceWeapon">Replace</translation> <translation id="bttnEditWeapon">Edit</translation> - <translation id="equipmentAmountWithCost">{0} ({1} at {2}pts each)</translation> + <translation id="equipmentAmountWithCost">{0} ({1} at {2}{3} each)</translation> <translation id="equipmentAmountWithZeroCost">{0} ({1} for free)</translation> <translation id="equipmentChoiceAmountAll">For all ({1})</translation> <translation id="equipmentChoiceAmountPercentage">For {0}% ({1})</translation> @@ -122,4 +128,13 @@ <translation id="languagePrefSection">Language</translation> <translation id="lblLanguage">Language:</translation> <translation id="languagesGroup">Language</translation> + <translation id="GameSystemFilesReloaded">Game system and race files reloaded</translation> + <translation id="treeNodeText">{0} ({1} {2})</translation> + <translation id="setUnitEquipmentItemName">( {0} {1} each)</translation> + <translation id="FailedRequirementMessage">Army Requirement Failures</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/translations/fi.translation Fri Aug 26 20:11:28 2011 +0100 @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<translations xmlns="http://ibboard.co.uk/translation" lang="fi"> + <translation id="menuFile">&Tiedosto</translation> + <translation id="menuEdit">&Muokkaa</translation> + <translation id="menuHelp">&Ohje</translation> + <translation id="miNewArmy">&Luo uusi armeija</translation> + <translation id="miOpenArmy">&Avaa...</translation> + <translation id="miSaveArmy">&Tallenna</translation> + <translation id="miSaveArmyAs">Tallenna &nimellä...</translation> + <translation id="miExportArmyAs">&Vie...</translation> + <translation id="miExportArmyAsBasicHTML">Perus HTML:nä</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> + <translation id="miCloseArmy">&Sulje armeija</translation> + <translation id="miReloadFiles">&Lataa tiedostot uudelleen</translation> + <translation id="miExit">Lo&peta</translation> + <translation id="miUndo">&Kumoa</translation> + <translation id="miRedo">&Toista</translation> + <translation id="miPreferences">Asetukset</translation> + <translation id="miAbout">&Tietoja WarFoundry:stä</translation> + <translation id="bttnOkay">OK</translation> + <translation id="bttnCancel">Peruuta</translation> + <translation id="bttnNewArmy">Luo armeija</translation> + <translation id="bttnOpenArmy">Avaa armeija</translation> + <translation id="bttnSaveArmy">Tallenna armeija</translation> + <translation id="bttnUndo">Kumoa</translation> + <translation id="bttnRedo">Toista</translation> + <translation id="ArmyTree">Armeijakatsaus</translation> + <translation id="miDeleteUnit">&Poista yksikkö</translation> + <translation id="miEditUnit">&Muokka yksikkö</translation> + <translation id="openArmyDialog">Avaa armeija</translation> + <translation id="saveArmyDialog">Tallenna armeija</translation> + <translation id="armyFileFilter">WarFoundry armeija tiedostot (*.army)</translation> + <translation id="statusPanelPoints">{0} pistettä / {1} pisteestä</translation> + <translation id="statusPanelPointsToolTip">Armeijan pistemäärä</translation> + <translation id="defaultUnitName">Yksikkö {0} {1}</translation> + <translation id="FrmNewArmy">Luo uusi armeija</translation> + <translation id="lblGameSystem">Pelisysteemejä:</translation> + <translation id="lblRaceList">Rodut:</translation> + <translation id="lblArmyName">Armeijan nimi:</translation> + <translation id="lblArmySize">Armeijan koko:</translation> + <translation id="bttnSelectRace">Luo armeija</translation> + <translation id="newArmyNoGameSystems">WarFoundry ei löytänyt pelisysteemi datatiedostoja. +Tarkista virheilmoituksia lokista ja varmista että sinulla on pelisysteemi datatiedostoja "data" mapissa.</translation> + <translation id="FrmNewUnit">Lisää uusi {0} valinta</translation> + <translation id="lblUnitList">Yksikköitä:</translation> + <translation id="bttnSelectUnit">Lisää yksikkö</translation> + <translation id="FrmNewUnitEquipment">Uusi varustus {0}ille</translation> + <translation id="FrmReplaceUnitEquipment">Korvaa {0} uudella varusteella</translation> + <translation id="lblAmount">Määrä:</translation> + <translation id="lblItem">Varustus:</translation> + <translation id="rbEquipAll">Varustele kaikki</translation> + <translation id="equipPercentageTooLarge"> ({0}%) on suurempi kuin varusteen enimmäisprosenttimäärä ({1}%). Enimmäisprosenttimäärä käytetään.</translation> + <translation id="equipPercentageTooLargeTitle">Varusteen prosenttimäärä liian suuri</translation> + <translation id="equipPercentageTooSmall"> ({0}%) on pienempi kuin varusteen vähimmmäisprosenttimäärä ({1}%). Vähimmäisprosenttimäärä käytetään.</translation> + <translation id="equipPercentageTooSmallTitle">Varusteen prosenttimäärä liian pieni</translation> + <translation id="equipNumberTooLarge"> ({0}) on suurempi kuin varusteen enimmäismäärä ({1}). Enimmäismäärä käytetään.</translation> + <translation id="equipNumberTooLargeTitle">Varusteen määrä liian suuri</translation> + <translation id="equipNumberTooSmall"> ({0}) on pienempi kuin varusteen vähimmäismäärä ({1}). Vähimmäismäärä käytetään.</translation> + <translation id="equipNumberTooSmallTitle">Varusteen määrä liian pieni</translation> + <translation id="FrmEditUnitEquipment">Muokkaa {0} {1}ille</translation> + <translation id="removeRequiredEquipmentText">Tämä on pakollinen varustus jota ei voi poistaa. Sen määrä on oltava ainakin yksi tai sen on vaihdettava toiseen vaihtoehtoon.</translation> + <translation id="removeRequiredEquipmentTitle">Pakollinen varustus ei voi poistaa</translation> + <translation id="removeEquipmentText">Tämä poistaa varusteen yksiköltä. Jatkaa?</translation> + <translation id="removeEquipmentTitle">Vahvista varusteen poisto</translation> + <translation id="FrmAbout">Tietoja WarFoundry:stä</translation> + <translation id="lblVersion">Versio: {0}</translation> + <translation id="lblDevelopers">Kehittäjiä:</translation> + <translation id="lblThanks">Kiitoksia:</translation> + <translation id="FrmUnit">{0}</translation> + <translation id="lblUnitSize">Yksikön koko:</translation> + <translation id="StatLineName">Nimike</translation> + <translation id="lblEquip">Varustelu:</translation> + <translation id="bttnAddWeapon">Lisää</translation> + <translation id="lblAbilities">Kykyjä:</translation> + <translation id="lblNotes">Muistiinpanoja:</translation> + <translation id="bttnRemoveWeapon">Poista</translation> + <translation id="bttnReplaceWeapon">Korvaa</translation> + <translation id="bttnEditWeapon">Muokkaa</translation> + <translation id="equipmentAmountWithCost">{0} ({1} {2} piste(ttä) jokaiselle)</translation> + <translation id="equipmentAmountWithZeroCost">{0} ({1} ilmaiseksi)</translation> + <translation id="equipmentChoiceAmountAll">kaikille ({1})</translation> + <translation id="equipmentChoiceAmountPercentage">{0}%:ille ({1})</translation> + <translation id="equipmentChoiceAmountNumber">{0}</translation> + <translation id="InvalidRaceFileBoxTitle">Rotutiedosto on epäkelpo</translation> + <translation id="InvalidArmyFileBoxTitle">Armeijatiedosto on epäkelpo</translation> + <translation id="SaveChangesQuestion">Armeija nimeltä "{0}" on muokattu. +Tallenna muokkaukset ennen sulkemista?</translation> + <translation id="SaveChangesTitle">Tallentamattomia muokkauksia </translation> + <translation id="SaveFailed">WarFoundry ei voinut tallentaa tiedostoa. Lue tarkemmin tiedot logista.</translation> + <translation id="SaveFailedTitle">Tiedoston tallentaminen epäonnistui</translation> + <translation id="armyHtmlOutputBodyHeader">{0} – {1} pistettä</translation> + <translation id="armyHtmlOutputTableHeaderUnitName">Nimi</translation> + <translation id="armyHtmlOutputTableHeaderUnitNotes">Muistiinpanot</translation> + <translation id="armyHtmlOutputTableHeaderUnitPoints">Pisteitä</translation> + <translation id="armyHtmlExportEquipAmountAll">kaikki ({1}) </translation> + <translation id="armyHtmlExportEquipAmountPercentage">{0}% ({1}) </translation> + <translation id="armyHtmlExportEquipAmountNumber">{0}</translation> + <translation id="armyHtmlExportEquipAmountRatio">{0} {1}:lle </translation> + <translation id="equipmentAmountAll">kaikki ({1})</translation> + <translation id="equipmentAmountPercentage">{0}% ({1})</translation> + <translation id="equipmentAmountNumber">{0}</translation> + <translation id="setEquipmentAmountCommandDescription">Muuta {0}in määrä {1}:issä {2}:een</translation> + <translation id="setEquipmentAmountCommandUndoDescription">Muuta {0}in määrä {1}:issä {2}:een</translation> + <translation id="replaceUnitEquipmentCommandDescription">Korvaa {0} {1}llä {2}ille</translation> + <translation id="replaceUnitEquipmentCommandUndoDescription">Korvaa {0} {1}llä {2}ille</translation> + <translation id="createAndAddUnitCommandDescription">Lisää yksikkö {0}</translation> + <translation id="createAndAddUnitCommandUndoDescription">Poista yksikkö {0}</translation> + <translation id="removeUnitCommandDescription">Poista {0}</translation> + <translation id="removeUnitCommandUndoDescription">Lisää {0}</translation> + <translation id="setUnitNameCommandDescription">Muuta nimi "{0}"sta "{1}"ksi</translation> + <translation id="setUnitNameCommandUndoDescription">Muuta nimi "{0}"sta "{1}"ksi</translation> + <translation id="setUnitSizeCommandDescription">Muokkaa {0}in kokoa {1}:een</translation> + <translation id="setUnitSizeCommandUndoDescription">Muokkaa {0}in kokoa {1}:een</translation> + <translation id="requirementAND">{0}; ja {1}</translation> + <translation id="requirementOR">{0}; tai {1}</translation> + <translation id="requirementUnitExcludes">{0} voidaan valita vain jos ei mikään näistä on valittu: {1}</translation> + <translation id="requirementUnitMaxNumber">{1} voidaan vain ottaa {0} kertaa</translation> + <translation id="requirementUnitMinNumber">{1} täytyy ottaa {0} kertaa</translation> + <translation id="requirementUnitTypeAtLeastSingle">{1} {0}</translation> + <translation id="requirementUnitTypeAtLeastJoiner">{0}, {1}</translation> + <translation id="requirementUnitTypeAtLeast">{0} voidaan valita vain jos joku näistä on valittu: {1}</translation> + <translation id="FrmPreferences">Asetukset</translation> + <translation id="languagePrefSection">Kieli</translation> + <translation id="lblLanguage">Kieli:</translation> + <translation id="languagesGroup">Kieli</translation> + <translation id="GameSystemFilesReloaded">Pelisysteemi ja rotutiedostot ovat ladatut.</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> +</translations> + +
--- a/translations/fr.translation Wed Sep 08 20:10:57 2010 +0000 +++ b/translations/fr.translation Fri Aug 26 20:11:28 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Enregistrer une armée sous…</translation> <translation id="miExportArmyAs">&Exporter une armée</translation> <translation id="miExportArmyAsBasicHTML">HTML Basic</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">&Fermer une armée</translation> <translation id="miReloadFiles">&Recharger les fichiers</translation> <translation id="miExit">&Sortir</translation> @@ -108,4 +109,9 @@ <translation id="requirementUnitTypeAtLeastSingle">{1} {0}</translation> <translation id="requirementUnitTypeAtLeastJoiner">{0}, {1}</translation> <translation id="requirementUnitTypeAtLeast">{0} peut être sélectionné seulement si l'objet suivant est sélectionné : {1}</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/it.translation Wed Sep 08 20:10:57 2010 +0000 +++ b/translations/it.translation Fri Aug 26 20:11:28 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Salve &lista come...</translation> <translation id="miExportArmyAs">&Esporta lista</translation> <translation id="miExportArmyAsBasicHTML">HTML Base</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">&Chiudi lista</translation> <translation id="miReloadFiles">&Ricarica files</translation> <translation id="miExit">E&sci</translation> @@ -122,4 +123,9 @@ <translation id="languagePrefSection">Lingua</translation> <translation id="lblLanguage">Lingua:</translation> <translation id="languagesGroup">Lingua</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/nl.translation Wed Sep 08 20:10:57 2010 +0000 +++ b/translations/nl.translation Fri Aug 26 20:11:28 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Opslaan als</translation> <translation id="miExportArmyAs">Exporteren</translation> <translation id="miExportArmyAsBasicHTML">Standaard HTML</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">Sluit Leger</translation> <translation id="miReloadFiles">Herlaad bestanden</translation> <translation id="miExit">Afsluiten</translation> @@ -107,4 +108,9 @@ <translation id="requirementUnitTypeAtLeastSingle">{1} {0}</translation> <translation id="requirementUnitTypeAtLeastJoiner">{0}, {1}</translation> <translation id="requirementUnitTypeAtLeast">{0} kan alleen gekozen worden als een van de volgende dingen genomen is: {1}</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/ru.translation Wed Sep 08 20:10:57 2010 +0000 +++ b/translations/ru.translation Fri Aug 26 20:11:28 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Сохранить армию &как...</translation> <translation id="miExportArmyAs">&Экспортировать армию</translation> <translation id="miExportArmyAsBasicHTML">Basic HTML</translation> + <translation id="miExportArmyAsBasicXML">XML</translation> <translation id="miCloseArmy">&Закрыть армию</translation> <translation id="miReloadFiles">&Перезагрузить файлы</translation> <translation id="miExit">&Выход</translation> @@ -93,4 +94,9 @@ <translation id="setUnitNameCommandUndoDescription">Поменять название "{0}" на "{1}"</translation> <translation id="setUnitSizeCommandDescription">Сделать размер {0} - {1}</translation> <translation id="setUnitSizeCommandUndoDescription">Сделать размер {0} - {1}</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/sv.translation Wed Sep 08 20:10:57 2010 +0000 +++ b/translations/sv.translation Fri Aug 26 20:11:28 2011 +0100 @@ -1,126 +1,139 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <translations xmlns="http://ibboard.co.uk/translation" lang="sv"> - <translation id="menuFile">&Arkiv</translation> - <translation id="menuEdit">&Redigera</translation> - <translation id="menuHelp">&Hjälp</translation> - <translation id="miNewArmy">&Skapa ny armé</translation> - <translation id="miOpenArmy">&Öppna sparad armé</translation> - <translation id="miSaveArmy">&Spara armé</translation> - <translation id="miSaveArmyAs">Spara armé &som...</translation> - <translation id="miExportArmyAs">&Exportera armé</translation> - <translation id="miExportArmyAsBasicHTML">Normal HTML</translation> - <translation id="miCloseArmy">&Stäng armé</translation> - <translation id="miReloadFiles">&Läs in filer på nytt</translation> - <translation id="miExit">A&vsluta</translation> - <translation id="miUndo">&Återställ</translation> - <translation id="miRedo">&Gör om</translation> - <translation id="miPreferences">&Inställningar</translation> - <translation id="miAbout">&Om</translation> + <translation id="armyFileFilter">WarFoundry arméfiler (*.army)</translation> + <translation id="armyHtmlExportEquipAmountAll">alla ({1})</translation> + <translation id="armyHtmlExportEquipAmountNumber">{0}</translation> + <translation id="armyHtmlExportEquipAmountPercentage">{0}% ({1})</translation> + <translation id="armyHtmlExportEquipAmountRatio">{0} för {1}</translation> + <translation id="armyHtmlOutputBodyHeader">{0} - {1}poäng</translation> + <translation id="armyHtmlOutputTableHeaderUnitName">Namn</translation> + <translation id="armyHtmlOutputTableHeaderUnitNotes">Anteckningar</translation> + <translation id="armyHtmlOutputTableHeaderUnitPoints">Poäng</translation> + <translation id="ArmyTree">Arméöversikt</translation> + <translation id="bttnAddWeapon">Lägg till</translation> + <translation id="bttnCancel">Avbryt</translation> + <translation id="bttnEditWeapon">Redigera</translation> + <translation id="bttnNewArmy">Skapa ny armé</translation> <translation id="bttnOkay">OK</translation> - <translation id="bttnCancel">Avbryt</translation> - <translation id="bttnNewArmy">Skapa ny armé</translation> <translation id="bttnOpenArmy">Öppna sparad armé</translation> - <translation id="bttnSaveArmy">Spara armé</translation> - <translation id="bttnUndo">Återställ</translation> <translation id="bttnRedo">Gör om</translation> - <translation id="ArmyTree">Arméöversikt</translation> - <translation id="miDeleteUnit">&Ta bort enhet</translation> - <translation id="miEditUnit">&Redigera enhet</translation> - <translation id="openArmyDialog">Öppna armé</translation> - <translation id="saveArmyDialog">Spara armé</translation> - <translation id="armyFileFilter">WarFoundry arméfiler (*.army)</translation> - <translation id="statusPanelPoints">{0} poäng / {1} poäng</translation> - <translation id="statusPanelPointsToolTip">Aktuellt poängvärde för armé</translation> + <translation id="bttnRemoveWeapon">Ta bort</translation> + <translation id="bttnReplaceWeapon">Ersätt</translation> + <translation id="bttnSaveArmy">Spara armé</translation> + <translation id="bttnSelectRace">Skapa armé</translation> + <translation id="bttnSelectUnit">Skapa enhet</translation> + <translation id="bttnUndo">Återställ</translation> + <translation id="createAndAddUnitCommandDescription">Lägg till enhet av {0}</translation> + <translation id="createAndAddUnitCommandUndoDescription">Ta bort enhet av {0}</translation> <translation id="defaultUnitName">Enhet av {0} {1}</translation> - <translation id="FrmNewArmy">Skapa ny armé</translation> - <translation id="lblGameSystem">Spelsystem:</translation> - <translation id="lblRaceList">Raser:</translation> - <translation id="lblArmyName">Arménamn:</translation> - <translation id="lblArmySize">Arméstorlek:</translation> - <translation id="bttnSelectRace">Skapa armé</translation> - <translation id="newArmyNoGameSystems">WarFoundry kunde inte hitta data för spel system. -Vänligen kontrollera felmeddelanden i loggen och se till att du har datafielr för spelsystme i "data" mappen.</translation> - <translation id="FrmNewUnit">Lägg till en ny {0}</translation> - <translation id="lblUnitList">Enheter:</translation> - <translation id="bttnSelectUnit">Skapa enhet</translation> - <translation id="FrmNewUnitEquipment">Ny utrustning för {0}</translation> - <translation id="FrmReplaceUnitEquipment">Ersätt {0} med ny utrustning</translation> - <translation id="lblAmount">Antal:</translation> - <translation id="lblItem">Utrustning:</translation> - <translation id="rbEquipAll">Utrusta alla</translation> + <translation id="equipmentAmountAll">alla ({1})</translation> + <translation id="equipmentAmountNumber">{0}</translation> + <translation id="equipmentAmountPercentage">{0}% ({1})</translation> + <translation id="equipmentAmountWithCost">{0} ({1} för {2} {3} var)</translation> + <translation id="equipmentAmountWithZeroCost">{0} ({1} gratis)</translation> + <translation id="equipmentChoiceAmountAll">För alla ({1})</translation> + <translation id="equipmentChoiceAmountNumber">{0}</translation> + <translation id="equipmentChoiceAmountPercentage">För {0}% ({1})</translation> + <translation id="equipNumberTooLarge">Det nuvarande antalet ({0}) är större än det maximalt tillåtna antalet för utrustningen ({1}). Det maximala antalet kommer att användas istället.</translation> + <translation id="equipNumberTooLargeTitle">Utrustningens antal för stort</translation> + <translation id="equipNumberTooSmall"> Det nuvarande antalet ({0}) är mindre än det tillåtna minimiantalet för utrustningen({1}). Minimivärdet kommer att användas istället.</translation> + <translation id="equipNumberTooSmallTitle">Utrustningens antal för litet</translation> <translation id="equipPercentageTooLarge">Den numvarande procenten ({0}%) är större än det maximala tillåtna värdet för utrustningen ({1}%). Det maximala värdet kommer att användas istället.</translation> <translation id="equipPercentageTooLargeTitle">Utrustningsprocenten för stor</translation> <translation id="equipPercentageTooSmall"> Den numvarande procenten ({0}%) är mindre än det tillåtna minimivärdet för utrustningen ({1}%). Minimivärdet kommer att användas istället.</translation> <translation id="equipPercentageTooSmallTitle">Utrustningsprocenten för liten</translation> - <translation id="equipNumberTooLarge">Det nuvarande antalet ({0}) är större än det maximalt tillåtna antalet för utrustningen ({1}). Det maximala antalet kommer att användas istället.</translation> - <translation id="equipNumberTooLargeTitle">Utrustningens antal för stort</translation> - <translation id="equipNumberTooSmall"> Det nuvarande antalet ({0}) är mindre än det tillåtna minimiantalet för utrustningen({1}). Minimivärdet kommer att användas istället.</translation> - <translation id="equipNumberTooSmallTitle">Utrustningens antal för litet</translation> + <translation id="FrmAbout">Om WarFoundry</translation> <translation id="FrmEditUnitEquipment">Ändra {0} för {1}</translation> - <translation id="removeRequiredEquipmentText">Utrustningen är obligatorisk och kan inte tas bort. Det måste finnas minst en, eller ersättas med ett alternativ.</translation> - <translation id="removeRequiredEquipmentTitle">Kan inte ta bort obligatorisk utrustnign </translation> + <translation id="FrmNewArmy">Skapa ny armé</translation> + <translation id="FrmNewUnit">Lägg till en ny {0}</translation> + <translation id="FrmNewUnitEquipment">Ny utrustning för {0}</translation> + <translation id="FrmPreferences">Inställningar</translation> + <translation id="FrmReplaceUnitEquipment">Ersätt {0} med ny utrustning</translation> + <translation id="FrmUnit">{0}</translation> + <translation id="GameSystemFilesReloaded">System och ras filer har laddats in.</translation> + <translation id="InvalidArmyFileBoxTitle">Ogiltig arméfil</translation> + <translation id="InvalidRaceFileBoxTitle">Ogiltig rasfil</translation> + <translation id="languagePrefSection">Språk</translation> + <translation id="languagesGroup">Språk</translation> + <translation id="lblAbilities">Förmågor:</translation> + <translation id="lblAmount">Antal:</translation> + <translation id="lblArmyName">Arménamn:</translation> + <translation id="lblArmySize">Arméstorlek:</translation> + <translation id="lblDevelopers">Utvecklare:</translation> + <translation id="lblEquip">Utrustning:</translation> + <translation id="lblGameSystem">Spelsystem:</translation> + <translation id="lblItem">Utrustning:</translation> + <translation id="lblLanguage">Språk:</translation> + <translation id="lblNotes">Anteckningar:</translation> + <translation id="FrmUnitlblPoints">({0} {1})</translation> + <translation id="lblRaceList">Raser:</translation> + <translation id="lblThanks">Tack till:</translation> + <translation id="lblUnitList">Enheter:</translation> + <translation id="lblUnitSize">Storlek:</translation> + <translation id="lblVersion">Version: {0}</translation> + <translation id="menuEdit">&Redigera</translation> + <translation id="menuFile">&Arkiv</translation> + <translation id="menuHelp">&Hjälp</translation> + <translation id="miAbout">&Om</translation> + <translation id="miCloseArmy">&Stäng armé</translation> + <translation id="miDeleteUnit">&Ta bort enhet</translation> + <translation id="miEditUnit">&Redigera enhet</translation> + <translation id="miExit">A&vsluta</translation> + <translation id="miExportArmyAs">&Exportera armé</translation> + <translation id="miExportArmyAsBasicHTML">Normal HTML</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> + <translation id="miNewArmy">&Skapa ny armé</translation> + <translation id="miOpenArmy">&Öppna sparad armé</translation> + <translation id="miPreferences">&Inställningar</translation> + <translation id="miRedo">&Gör om</translation> + <translation id="miReloadFiles">&Läs in filer på nytt</translation> + <translation id="miSaveArmy">&Spara armé</translation> + <translation id="miSaveArmyAs">Spara armé &som...</translation> + <translation id="miUndo">&Återställ</translation> + <translation id="newArmyNoGameSystems">WarFoundry kunde inte hitta data för spel system. + Vänligen kontrollera felmeddelanden i loggen och se till att du har datafiler för spelsystemet i "data" mappen.</translation> + <translation id="openArmyDialog">Öppna armé</translation> + <translation id="PointsLocalisationAbbrevPlural">png</translation> + <translation id="PointsLocalisationAbbrevSingle">png</translation> + <translation id="PointsLocalisationNamePlural">poäng</translation> + <translation id="PointsLocalisationNameSingle">poäng</translation> + <translation id="rbEquipAll">Utrusta alla</translation> <translation id="removeEquipmentText">Utrustningen kommer att tas bort. Fortsätt?</translation> <translation id="removeEquipmentTitle">Bekräfta byte av utrustning</translation> - <translation id="FrmAbout">Om WarFoundry</translation> - <translation id="lblVersion">Version: {0}</translation> - <translation id="lblDevelopers">Utvecklare:</translation> - <translation id="lblThanks">Tack till:</translation> - <translation id="FrmUnit">{0}</translation> - <translation id="lblUnitSize">Storlek:</translation> - <translation id="StatLineName">Typ</translation> - <translation id="lblEquip">Utrustning:</translation> - <translation id="bttnAddWeapon">Lägg till</translation> - <translation id="lblAbilities">Förmågor:</translation> - <translation id="lblNotes">Anteckningar:</translation> - <translation id="bttnRemoveWeapon">Ta bort</translation> - <translation id="bttnReplaceWeapon">Ersätt</translation> - <translation id="bttnEditWeapon">Redigera</translation> - <translation id="equipmentAmountWithCost">{0} ({1} för {2} poäng var)</translation> - <translation id="equipmentAmountWithZeroCost">{0} ({1} gratis)</translation> - <translation id="equipmentChoiceAmountAll">För alla ({1})</translation> - <translation id="equipmentChoiceAmountPercentage">För {0}% ({1})</translation> - <translation id="equipmentChoiceAmountNumber">{0}</translation> - <translation id="InvalidRaceFileBoxTitle">Ogiltig rasfil</translation> - <translation id="InvalidArmyFileBoxTitle">Ogiltig arméfil</translation> - <translation id="SaveChangesQuestion">Armén "{0}" har ändrats. -Vill du spara ändringarna innan armén stängs?</translation> - - <translation id="SaveChangesTitle">Osparade förändringar</translation> - <translation id="SaveFailed">WarFoundry kunde inte spara filen. Var god och kontrollera loggen för mera detaljer.</translation> - <translation id="SaveFailedTitle">Filen kunde inte sparas</translation> - <translation id="armyHtmlOutputBodyHeader">{0} - {1}poäng</translation> - <translation id="armyHtmlOutputTableHeaderUnitName">Namn</translation> - <translation id="armyHtmlOutputTableHeaderUnitNotes">Anteckningar</translation> - <translation id="armyHtmlOutputTableHeaderUnitPoints">Poäng</translation> - <translation id="armyHtmlExportEquipAmountAll">alla ({1})</translation> - <translation id="armyHtmlExportEquipAmountPercentage">{0}% ({1})</translation> - <translation id="armyHtmlExportEquipAmountNumber">{0}</translation> - <translation id="armyHtmlExportEquipAmountRatio">{0} för {1}</translation> - <translation id="equipmentAmountAll">alla ({1})</translation> - <translation id="equipmentAmountPercentage">{0}% ({1})</translation> - <translation id="equipmentAmountNumber">{0}</translation> - <translation id="setEquipmentAmountCommandDescription">ändra {0} amount för {1} till {2}</translation> - <translation id="setEquipmentAmountCommandUndoDescription">ändra {0} amount för {1} till {2}</translation> + <translation id="removeRequiredEquipmentText">Utrustningen är obligatorisk och kan inte tas bort. Det måste finnas minst en, eller ersättas med ett alternativ.</translation> + <translation id="removeRequiredEquipmentTitle">Kan inte ta bort obligatorisk utrustnign </translation> + <translation id="removeUnitCommandDescription">Ta bort {0}</translation> + <translation id="removeUnitCommandUndoDescription">Lägg till på nytt {0}</translation> <translation id="replaceUnitEquipmentCommandDescription">Ersätt {0} med {1} för {2}</translation> <translation id="replaceUnitEquipmentCommandUndoDescription">Ersätt {0} med {1} för {2}</translation> - <translation id="createAndAddUnitCommandDescription">Lägg till enhet av {0}</translation> - <translation id="createAndAddUnitCommandUndoDescription">Ta bort enhet av {0}</translation> - <translation id="removeUnitCommandDescription">Ta bort {0}</translation> - <translation id="removeUnitCommandUndoDescription">Lägg till på nytt {0}</translation> - <translation id="setUnitNameCommandDescription">Byt namn från "{0}" till "{1}"</translation> - <translation id="setUnitNameCommandUndoDescription">Byt namn från "{0}" till "{1}"</translation> - <translation id="setUnitSizeCommandDescription">ändra storleken på {0} till {1}</translation> - <translation id="setUnitSizeCommandUndoDescription"> ändra storleken på {0} till {1}</translation> <translation id="requirementAND">{0}; och {1}</translation> <translation id="requirementOR">{0}; eller {1}</translation> <translation id="requirementUnitExcludes">{0} kan bara väljas om ingen av följande har valts: {1}</translation> <translation id="requirementUnitMaxNumber">{1} kan bara väljas {0} gånger</translation> <translation id="requirementUnitMinNumber">{1} måste väljas minst {0} gånger</translation> - <translation id="requirementUnitTypeAtLeastSingle">{1} {0}</translation> + <translation id="requirementUnitTypeAtLeast">{0} kan bara väljas om följande har valts: {1}</translation> <translation id="requirementUnitTypeAtLeastJoiner">{0}, {1}</translation> - <translation id="requirementUnitTypeAtLeast">{0} kan bara väljas om följande har valts: {1}</translation> - <translation id="FrmPreferences">Inställningar</translation> - <translation id="languagePrefSection">Språk</translation> - <translation id="lblLanguage">Språk:</translation> - <translation id="languagesGroup">Språk</translation> + <translation id="requirementUnitTypeAtLeastSingle">{1} {0}</translation> + <translation id="saveArmyDialog">Spara armé</translation> + <translation id="SaveChangesQuestion">Armén "{0}" har ändrats. + Vill du spara ändringarna innan armén stängs? </translation> + <translation id="SaveChangesTitle">Osparade förändringar</translation> + <translation id="SaveFailed">WarFoundry kunde inte spara filen. Var god och kontrollera loggen för mera detaljer.</translation> + <translation id="SaveFailedTitle">Filen kunde inte sparas</translation> + <translation id="setEquipmentAmountCommandDescription">ändra {0} amount för {1} till {2}</translation> + <translation id="setEquipmentAmountCommandUndoDescription">ändra {0} amount för {1} till {2}</translation> + <translation id="setUnitNameCommandDescription">Byt namn från "{0}" till "{1}"</translation> + <translation id="setUnitNameCommandUndoDescription">Byt namn från "{0}" till "{1}"</translation> + <translation id="setUnitSizeCommandDescription">ändra storleken på {0} till {1}</translation> + <translation id="setUnitSizeCommandUndoDescription"> ändra storleken på {0} till {1}</translation> + <translation id="StatLineName">Typ</translation> + <translation id="statusPanelPoints">{0} {1} / {2} {3}</translation> + <translation id="statusPanelPointsToolTip">Aktuellt poängvärde för armé</translation> + <translation id="treeNodeText">{0} ({1} {2})</translation> + <translation id="setUnitEquipmentItemName">( {0} {1} var)</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations>