changeset 14:26f7f6d2b4f8

Implement most of the buttons on the stats tab and adjust button enabling on category tab.
author Tsudico
date Sat, 18 Dec 2010 21:04:51 -0600
parents 372f921c20fc
children 3a347947ecea
files FrmSystem.Designer.cs FrmSystem.cs
diffstat 2 files changed, 339 insertions(+), 107 deletions(-) [+]
line diff
     1.1 --- a/FrmSystem.Designer.cs	Sat Dec 18 13:20:18 2010 -0600
     1.2 +++ b/FrmSystem.Designer.cs	Sat Dec 18 21:04:51 2010 -0600
     1.3 @@ -71,10 +71,10 @@
     1.4  			this.btnCategoryRemove = new System.Windows.Forms.Button();
     1.5  			this.btnCategoryApply = new System.Windows.Forms.Button();
     1.6  			this.tabStats = new System.Windows.Forms.TabPage();
     1.7 -			this.btnMoveStatDown = new System.Windows.Forms.Button();
     1.8 -			this.btnMoveStatUp = new System.Windows.Forms.Button();
     1.9 -			this.btnRemoveStat = new System.Windows.Forms.Button();
    1.10 -			this.btnAddStat = new System.Windows.Forms.Button();
    1.11 +			this.btnStatListDown = new System.Windows.Forms.Button();
    1.12 +			this.btnStatListUp = new System.Windows.Forms.Button();
    1.13 +			this.btnStatListRemove = new System.Windows.Forms.Button();
    1.14 +			this.btnStatListAdd = new System.Windows.Forms.Button();
    1.15  			this.gbStats = new System.Windows.Forms.GroupBox();
    1.16  			this.listStatNames = new System.Windows.Forms.ListBox();
    1.17  			this.txtStatName = new System.Windows.Forms.TextBox();
    1.18 @@ -558,6 +558,7 @@
    1.19  			// 
    1.20  			// btnCategoryAdd
    1.21  			// 
    1.22 +			this.btnCategoryAdd.Enabled = false;
    1.23  			this.btnCategoryAdd.Location = new System.Drawing.Point(216, 5);
    1.24  			this.btnCategoryAdd.Name = "btnCategoryAdd";
    1.25  			this.btnCategoryAdd.Size = new System.Drawing.Size(62, 23);
    1.26 @@ -568,6 +569,7 @@
    1.27  			// 
    1.28  			// btnCategoryRemove
    1.29  			// 
    1.30 +			this.btnCategoryRemove.Enabled = false;
    1.31  			this.btnCategoryRemove.Location = new System.Drawing.Point(216, 34);
    1.32  			this.btnCategoryRemove.Name = "btnCategoryRemove";
    1.33  			this.btnCategoryRemove.Size = new System.Drawing.Size(62, 23);
    1.34 @@ -585,13 +587,14 @@
    1.35  			this.btnCategoryApply.TabIndex = 14;
    1.36  			this.btnCategoryApply.Text = "Apply";
    1.37  			this.btnCategoryApply.UseVisualStyleBackColor = true;
    1.38 +			this.btnCategoryApply.Click += new System.EventHandler(this.btnCategoryApply_Click);
    1.39  			// 
    1.40  			// tabStats
    1.41  			// 
    1.42 -			this.tabStats.Controls.Add(this.btnMoveStatDown);
    1.43 -			this.tabStats.Controls.Add(this.btnMoveStatUp);
    1.44 -			this.tabStats.Controls.Add(this.btnRemoveStat);
    1.45 -			this.tabStats.Controls.Add(this.btnAddStat);
    1.46 +			this.tabStats.Controls.Add(this.btnStatListDown);
    1.47 +			this.tabStats.Controls.Add(this.btnStatListUp);
    1.48 +			this.tabStats.Controls.Add(this.btnStatListRemove);
    1.49 +			this.tabStats.Controls.Add(this.btnStatListAdd);
    1.50  			this.tabStats.Controls.Add(this.gbStats);
    1.51  			this.tabStats.Controls.Add(this.txtStatName);
    1.52  			this.tabStats.Controls.Add(this.label1);
    1.53 @@ -612,45 +615,49 @@
    1.54  			this.tabStats.Text = "Stat Lines";
    1.55  			this.tabStats.UseVisualStyleBackColor = true;
    1.56  			// 
    1.57 -			// btnMoveStatDown
    1.58 +			// btnStatListDown
    1.59  			// 
    1.60 -			this.btnMoveStatDown.Enabled = false;
    1.61 -			this.btnMoveStatDown.Location = new System.Drawing.Point(500, 205);
    1.62 -			this.btnMoveStatDown.Name = "btnMoveStatDown";
    1.63 -			this.btnMoveStatDown.Size = new System.Drawing.Size(76, 23);
    1.64 -			this.btnMoveStatDown.TabIndex = 25;
    1.65 -			this.btnMoveStatDown.Text = "Down";
    1.66 -			this.btnMoveStatDown.UseVisualStyleBackColor = true;
    1.67 +			this.btnStatListDown.Enabled = false;
    1.68 +			this.btnStatListDown.Location = new System.Drawing.Point(500, 205);
    1.69 +			this.btnStatListDown.Name = "btnStatListDown";
    1.70 +			this.btnStatListDown.Size = new System.Drawing.Size(76, 23);
    1.71 +			this.btnStatListDown.TabIndex = 25;
    1.72 +			this.btnStatListDown.Text = "Down";
    1.73 +			this.btnStatListDown.UseVisualStyleBackColor = true;
    1.74 +			this.btnStatListDown.Click += new System.EventHandler(this.btnStatListDown_Click);
    1.75  			// 
    1.76 -			// btnMoveStatUp
    1.77 +			// btnStatListUp
    1.78  			// 
    1.79 -			this.btnMoveStatUp.Enabled = false;
    1.80 -			this.btnMoveStatUp.Location = new System.Drawing.Point(500, 176);
    1.81 -			this.btnMoveStatUp.Name = "btnMoveStatUp";
    1.82 -			this.btnMoveStatUp.Size = new System.Drawing.Size(76, 23);
    1.83 -			this.btnMoveStatUp.TabIndex = 24;
    1.84 -			this.btnMoveStatUp.Text = "Up";
    1.85 -			this.btnMoveStatUp.UseVisualStyleBackColor = true;
    1.86 +			this.btnStatListUp.Enabled = false;
    1.87 +			this.btnStatListUp.Location = new System.Drawing.Point(500, 176);
    1.88 +			this.btnStatListUp.Name = "btnStatListUp";
    1.89 +			this.btnStatListUp.Size = new System.Drawing.Size(76, 23);
    1.90 +			this.btnStatListUp.TabIndex = 24;
    1.91 +			this.btnStatListUp.Text = "Up";
    1.92 +			this.btnStatListUp.UseVisualStyleBackColor = true;
    1.93 +			this.btnStatListUp.Click += new System.EventHandler(this.btnStatListUp_Click);
    1.94  			// 
    1.95 -			// btnRemoveStat
    1.96 +			// btnStatListRemove
    1.97  			// 
    1.98 -			this.btnRemoveStat.Enabled = false;
    1.99 -			this.btnRemoveStat.Location = new System.Drawing.Point(500, 147);
   1.100 -			this.btnRemoveStat.Name = "btnRemoveStat";
   1.101 -			this.btnRemoveStat.Size = new System.Drawing.Size(76, 23);
   1.102 -			this.btnRemoveStat.TabIndex = 23;
   1.103 -			this.btnRemoveStat.Text = "Remove";
   1.104 -			this.btnRemoveStat.UseVisualStyleBackColor = true;
   1.105 +			this.btnStatListRemove.Enabled = false;
   1.106 +			this.btnStatListRemove.Location = new System.Drawing.Point(500, 147);
   1.107 +			this.btnStatListRemove.Name = "btnStatListRemove";
   1.108 +			this.btnStatListRemove.Size = new System.Drawing.Size(76, 23);
   1.109 +			this.btnStatListRemove.TabIndex = 23;
   1.110 +			this.btnStatListRemove.Text = "Remove";
   1.111 +			this.btnStatListRemove.UseVisualStyleBackColor = true;
   1.112 +			this.btnStatListRemove.Click += new System.EventHandler(this.btnStatListRemove_Click);
   1.113  			// 
   1.114 -			// btnAddStat
   1.115 +			// btnStatListAdd
   1.116  			// 
   1.117 -			this.btnAddStat.Enabled = false;
   1.118 -			this.btnAddStat.Location = new System.Drawing.Point(500, 118);
   1.119 -			this.btnAddStat.Name = "btnAddStat";
   1.120 -			this.btnAddStat.Size = new System.Drawing.Size(76, 23);
   1.121 -			this.btnAddStat.TabIndex = 22;
   1.122 -			this.btnAddStat.Text = "Add";
   1.123 -			this.btnAddStat.UseVisualStyleBackColor = true;
   1.124 +			this.btnStatListAdd.Enabled = false;
   1.125 +			this.btnStatListAdd.Location = new System.Drawing.Point(500, 118);
   1.126 +			this.btnStatListAdd.Name = "btnStatListAdd";
   1.127 +			this.btnStatListAdd.Size = new System.Drawing.Size(76, 23);
   1.128 +			this.btnStatListAdd.TabIndex = 22;
   1.129 +			this.btnStatListAdd.Text = "Add";
   1.130 +			this.btnStatListAdd.UseVisualStyleBackColor = true;
   1.131 +			this.btnStatListAdd.Click += new System.EventHandler(this.btnStatListAdd_Click);
   1.132  			// 
   1.133  			// gbStats
   1.134  			// 
   1.135 @@ -660,7 +667,7 @@
   1.136  			this.gbStats.Size = new System.Drawing.Size(204, 103);
   1.137  			this.gbStats.TabIndex = 21;
   1.138  			this.gbStats.TabStop = false;
   1.139 -			this.gbStats.Text = "Stat List";
   1.140 +			this.gbStats.Text = "Stat Names";
   1.141  			// 
   1.142  			// listStatNames
   1.143  			// 
   1.144 @@ -669,6 +676,7 @@
   1.145  			this.listStatNames.Name = "listStatNames";
   1.146  			this.listStatNames.Size = new System.Drawing.Size(191, 69);
   1.147  			this.listStatNames.TabIndex = 0;
   1.148 +			this.listStatNames.SelectedIndexChanged += new System.EventHandler(this.listStatNames_SelectedIndexChanged);
   1.149  			// 
   1.150  			// txtStatName
   1.151  			// 
   1.152 @@ -676,6 +684,7 @@
   1.153  			this.txtStatName.Name = "txtStatName";
   1.154  			this.txtStatName.Size = new System.Drawing.Size(126, 20);
   1.155  			this.txtStatName.TabIndex = 20;
   1.156 +			this.txtStatName.TextChanged += new System.EventHandler(this.txtStatName_TextChanged);
   1.157  			// 
   1.158  			// label1
   1.159  			// 
   1.160 @@ -692,6 +701,7 @@
   1.161  			this.txtStatLineID.Name = "txtStatLineID";
   1.162  			this.txtStatLineID.Size = new System.Drawing.Size(126, 20);
   1.163  			this.txtStatLineID.TabIndex = 18;
   1.164 +			this.txtStatLineID.TextChanged += new System.EventHandler(this.txtStatLineID_TextChanged);
   1.165  			// 
   1.166  			// lblStatLineID
   1.167  			// 
   1.168 @@ -723,6 +733,7 @@
   1.169  			this.btnStatLineApply.TabIndex = 15;
   1.170  			this.btnStatLineApply.Text = "Apply";
   1.171  			this.btnStatLineApply.UseVisualStyleBackColor = true;
   1.172 +			this.btnStatLineApply.Click += new System.EventHandler(this.btnStatLineApply_Click);
   1.173  			// 
   1.174  			// lblStatLinePreview
   1.175  			// 
   1.176 @@ -735,6 +746,7 @@
   1.177  			// 
   1.178  			// btnStatsDefault
   1.179  			// 
   1.180 +			this.btnStatsDefault.Enabled = false;
   1.181  			this.btnStatsDefault.Location = new System.Drawing.Point(203, 64);
   1.182  			this.btnStatsDefault.Name = "btnStatsDefault";
   1.183  			this.btnStatsDefault.Size = new System.Drawing.Size(81, 23);
   1.184 @@ -774,15 +786,18 @@
   1.185  			// 
   1.186  			// btnStatsRemove
   1.187  			// 
   1.188 +			this.btnStatsRemove.Enabled = false;
   1.189  			this.btnStatsRemove.Location = new System.Drawing.Point(203, 35);
   1.190  			this.btnStatsRemove.Name = "btnStatsRemove";
   1.191  			this.btnStatsRemove.Size = new System.Drawing.Size(81, 23);
   1.192  			this.btnStatsRemove.TabIndex = 9;
   1.193  			this.btnStatsRemove.Text = "Remove";
   1.194  			this.btnStatsRemove.UseVisualStyleBackColor = true;
   1.195 +			this.btnStatsRemove.Click += new System.EventHandler(this.btnStatsRemove_Click);
   1.196  			// 
   1.197  			// btnStatsAdd
   1.198  			// 
   1.199 +			this.btnStatsAdd.Enabled = false;
   1.200  			this.btnStatsAdd.Location = new System.Drawing.Point(203, 6);
   1.201  			this.btnStatsAdd.Name = "btnStatsAdd";
   1.202  			this.btnStatsAdd.Size = new System.Drawing.Size(81, 23);
   1.203 @@ -879,11 +894,11 @@
   1.204  		private System.Windows.Forms.Label label1;
   1.205  		private System.Windows.Forms.TextBox txtStatLineID;
   1.206  		private System.Windows.Forms.Label lblStatLineID;
   1.207 -		private System.Windows.Forms.Button btnRemoveStat;
   1.208 -		private System.Windows.Forms.Button btnAddStat;
   1.209 +		private System.Windows.Forms.Button btnStatListRemove;
   1.210 +		private System.Windows.Forms.Button btnStatListAdd;
   1.211  		private System.Windows.Forms.GroupBox gbStats;
   1.212 -		private System.Windows.Forms.Button btnMoveStatDown;
   1.213 -		private System.Windows.Forms.Button btnMoveStatUp;
   1.214 +		private System.Windows.Forms.Button btnStatListDown;
   1.215 +		private System.Windows.Forms.Button btnStatListUp;
   1.216  		private System.Windows.Forms.ListBox listStatNames;
   1.217  
   1.218  	}
     2.1 --- a/FrmSystem.cs	Sat Dec 18 13:20:18 2010 -0600
     2.2 +++ b/FrmSystem.cs	Sat Dec 18 21:04:51 2010 -0600
     2.3 @@ -15,58 +15,60 @@
     2.4  	public partial class FrmSystem : IBBoard.Windows.Forms.IBBForm
     2.5  	{
     2.6  		private IBBoard.WarFoundry.API.Objects.GameSystem system;
     2.7 +		private IBBoard.WarFoundry.API.Objects.Category currentCategory;
     2.8 +		private IBBoard.WarFoundry.API.Objects.SystemStats currentStats;
     2.9  		
    2.10  		private bool UpdateCategory
    2.11  		{
    2.12  			get
    2.13  			{
    2.14 -				if(this.listCategories.SelectedIndex >= 0)
    2.15 +				if(currentCategory == null)
    2.16  				{
    2.17 -					foreach(IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
    2.18 +					return false;
    2.19 +				}
    2.20 +				if (currentCategory.Name == (string)this.listCategories.SelectedItem)
    2.21 +				{
    2.22 +					if (currentCategory.Name != this.txtCategoryName.Text)
    2.23  					{
    2.24 -						if(cat.Name == this.listCategories.SelectedItem)
    2.25 -						{
    2.26 -							if(cat.Name != this.txtCategoryName.Text)
    2.27 -							{
    2.28 -								return true;
    2.29 -							}
    2.30 -							if(cat.ID != this.txtCategoryID.Text)
    2.31 -							{
    2.32 -								return true;
    2.33 -							}
    2.34 -							if(cat.MinimumPoints > 0 && !this.cbPointMin.Checked)
    2.35 -							{
    2.36 -								return true;
    2.37 -							}
    2.38 -							else if(cat.MinimumPoints != this.numPointMin.Value)
    2.39 -							{
    2.40 -								return true;
    2.41 -							}
    2.42 -							if(cat.MaximumPoints < this.numPointMax.Maximum && !this.cbPointMax.Checked)
    2.43 -							{
    2.44 -								return true;
    2.45 -							}
    2.46 -							else if(cat.MaximumPoints != this.numPointMax.Value)
    2.47 -							{
    2.48 -								return true;
    2.49 -							}
    2.50 -							if(cat.MinimumPercentage > 0 && !this.cbPercentMin.Checked)
    2.51 -							{
    2.52 -								return true;
    2.53 -							}
    2.54 -							else if(cat.MinimumPercentage != this.numPercentMin.Value)
    2.55 -							{
    2.56 -								return true;
    2.57 -							}
    2.58 -							if(cat.MaximumPercentage < this.numPercentMax.Maximum && !this.cbPercentMax.Checked)
    2.59 -							{
    2.60 -								return true;
    2.61 -							}
    2.62 -							else if(cat.MaximumPercentage != this.numPercentMax.Value)
    2.63 -							{
    2.64 -								return true;
    2.65 -							}
    2.66 -						}
    2.67 +						return true;
    2.68 +					}
    2.69 +					if (currentCategory.ID != this.txtCategoryID.Text)
    2.70 +					{
    2.71 +						return true;
    2.72 +					}
    2.73 +					if (currentCategory.MinimumPoints > 0 && !this.cbPointMin.Checked)
    2.74 +					{
    2.75 +						return true;
    2.76 +					}
    2.77 +					else if (currentCategory.MinimumPoints != this.numPointMin.Value)
    2.78 +					{
    2.79 +						return true;
    2.80 +					}
    2.81 +					if (currentCategory.MaximumPoints < this.numPointMax.Maximum
    2.82 +						&& !this.cbPointMax.Checked)
    2.83 +					{
    2.84 +						return true;
    2.85 +					}
    2.86 +					else if (currentCategory.MaximumPoints != this.numPointMax.Value)
    2.87 +					{
    2.88 +						return true;
    2.89 +					}
    2.90 +					if (currentCategory.MinimumPercentage > 0 && !this.cbPercentMin.Checked)
    2.91 +					{
    2.92 +						return true;
    2.93 +					}
    2.94 +					else if (currentCategory.MinimumPercentage != this.numPercentMin.Value)
    2.95 +					{
    2.96 +						return true;
    2.97 +					}
    2.98 +					if (currentCategory.MaximumPercentage < this.numPercentMax.Maximum
    2.99 +						&& !this.cbPercentMax.Checked)
   2.100 +					{
   2.101 +						return true;
   2.102 +					}
   2.103 +					else if (currentCategory.MaximumPercentage != this.numPercentMax.Value)
   2.104 +					{
   2.105 +						return true;
   2.106  					}
   2.107  				}
   2.108  				return false;
   2.109 @@ -135,6 +137,7 @@
   2.110  			this.numPercentMin.Enabled = false;
   2.111  			this.numPercentMax.Value = 100;
   2.112  			this.numPercentMax.Enabled = false;
   2.113 +			currentCategory = null;
   2.114  		}
   2.115  		
   2.116  		private void updateCategoryList()
   2.117 @@ -147,6 +150,10 @@
   2.118  					this.listCategories.Items.Add(system.Categories[i].Name);
   2.119  				}
   2.120  			}
   2.121 +			else
   2.122 +			{
   2.123 +				this.btnCategoryRemove.Enabled = false;
   2.124 +			}
   2.125  		}
   2.126  		
   2.127  		private void updateSystemStatsList()
   2.128 @@ -165,6 +172,8 @@
   2.129  					this.lviewStats.Items.Add(item);
   2.130  				}
   2.131  			}
   2.132 +			this.lviewStats.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent);
   2.133 +			this.lviewStats.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.HeaderSize);
   2.134  		}
   2.135  		
   2.136  		private void updateStatLinePreview(IBBoard.WarFoundry.API.Objects.SystemStats stats)
   2.137 @@ -181,10 +190,7 @@
   2.138  					column.TextAlign = HorizontalAlignment.Center;
   2.139  					this.lviewStatPreview.Columns.Add(column);
   2.140  				}
   2.141 -				for(int i = 0; i < this.lviewStatPreview.Columns.Count; i++)
   2.142 -				{
   2.143 -					this.lviewStatPreview.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
   2.144 -				}
   2.145 +				this.lviewStatPreview.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
   2.146  				this.lviewStatPreview.Items.Add(" ");
   2.147  			}
   2.148  		}
   2.149 @@ -213,53 +219,61 @@
   2.150  
   2.151  		private void listCategories_SelectedIndexChanged(object sender, EventArgs e)
   2.152  		{
   2.153 +			currentCategory = null;
   2.154  			foreach (IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
   2.155  			{
   2.156  				if (cat.Name == this.listCategories.SelectedItem)
   2.157  				{
   2.158 -					this.txtCategoryName.Text = cat.Name;
   2.159 -					this.txtCategoryID.Text = cat.ID;
   2.160 -					if (cat.MinimumPoints > 0)
   2.161 +					currentCategory = cat;
   2.162 +					this.txtCategoryName.Text = currentCategory.Name;
   2.163 +					this.txtCategoryID.Text = currentCategory.ID;
   2.164 +					if (currentCategory.MinimumPoints > 0)
   2.165  					{
   2.166 -						this.numPointMin.Value = cat.MinimumPoints;
   2.167 +						this.numPointMin.Value = currentCategory.MinimumPoints;
   2.168  						this.cbPointMin.Checked = true;
   2.169  						this.numPointMin.Enabled = true;
   2.170  					}
   2.171  					else
   2.172  					{
   2.173 +						this.cbPointMin.Checked = false;
   2.174  						this.numPointMin.Enabled = false;
   2.175  					}
   2.176 -					if (cat.MaximumPoints > 0 && cat.MaximumPoints < this.numPercentMax.Maximum)
   2.177 +					if (currentCategory.MaximumPoints > 0
   2.178 +						&& currentCategory.MaximumPoints < this.numPercentMax.Maximum)
   2.179  					{
   2.180 -						this.numPointMax.Value = cat.MaximumPoints;
   2.181 +						this.numPointMax.Value = currentCategory.MaximumPoints;
   2.182  						this.cbPointMax.Checked = true;
   2.183  						this.numPointMax.Enabled = true;
   2.184  					}
   2.185  					else
   2.186  					{
   2.187  						this.numPointMax.Value = this.numDefaultSize.Value;
   2.188 +						this.cbPointMax.Checked = false;
   2.189  						this.numPointMax.Enabled = false;
   2.190  					}
   2.191 -					if (cat.MinimumPercentage > 0)
   2.192 +					if (currentCategory.MinimumPercentage > 0)
   2.193  					{
   2.194 -						this.numPercentMin.Value = cat.MinimumPercentage;
   2.195 +						this.numPercentMin.Value = currentCategory.MinimumPercentage;
   2.196  						this.cbPercentMin.Checked = true;
   2.197  						this.numPercentMin.Enabled = true;
   2.198  					}
   2.199  					else
   2.200  					{
   2.201 +						this.cbPercentMin.Checked = false;
   2.202  						this.numPercentMin.Enabled = false;
   2.203  					}
   2.204 -					if (cat.MaximumPercentage < 100)
   2.205 +					if (currentCategory.MaximumPercentage < 100)
   2.206  					{
   2.207 -						this.numPercentMax.Value = cat.MaximumPercentage;
   2.208 +						this.numPercentMax.Value = currentCategory.MaximumPercentage;
   2.209  						this.cbPercentMax.Checked = true;
   2.210  						this.numPercentMax.Enabled = true;
   2.211  					}
   2.212  					else
   2.213  					{
   2.214 +						this.cbPercentMax.Checked = false;
   2.215  						this.numPercentMax.Enabled = false;
   2.216  					}
   2.217 +					this.btnCategoryRemove.Enabled = true;
   2.218  					this.btnCategoryApply.Enabled = false;
   2.219  					break;
   2.220  				}
   2.221 @@ -317,6 +331,7 @@
   2.222  				{
   2.223  					system.RemoveCategory(cat.ID);
   2.224  					this.listCategories.ClearSelected();
   2.225 +					this.btnCategoryRemove.Enabled = false;
   2.226  					break;
   2.227  				}
   2.228  			}
   2.229 @@ -387,6 +402,14 @@
   2.230  			{
   2.231  				this.btnCategoryApply.Enabled = false;
   2.232  			}
   2.233 +			if(this.txtCategoryName.Text != string.Empty && this.txtCategoryID.Text != string.Empty)
   2.234 +			{
   2.235 +				this.btnCategoryAdd.Enabled = true;
   2.236 +			}
   2.237 +			else
   2.238 +			{
   2.239 +				this.btnCategoryAdd.Enabled = false;
   2.240 +			}
   2.241  		}
   2.242  
   2.243  		private void txtCategoryID_TextChanged(object sender, EventArgs e)
   2.244 @@ -534,27 +557,221 @@
   2.245  			}
   2.246  		}
   2.247  
   2.248 +		private void btnCategoryApply_Click(object sender, EventArgs e)
   2.249 +		{
   2.250 +			currentCategory.Name = this.txtCategoryName.Text;
   2.251 +			currentCategory.ID = this.txtCategoryID.Text;
   2.252 +			if(this.cbPointMin.Checked)
   2.253 +			{
   2.254 +				currentCategory.MinimumPoints = (int)this.numPointMin.Value;
   2.255 +			}
   2.256 +			else
   2.257 +			{
   2.258 +				currentCategory.MinimumPoints = 0;
   2.259 +			}
   2.260 +			if (this.cbPointMax.Checked)
   2.261 +			{
   2.262 +				currentCategory.MaximumPoints = (int)this.numPointMax.Value;
   2.263 +			}
   2.264 +			else
   2.265 +			{
   2.266 +				currentCategory.MaximumPoints = IBBoard.WarFoundry.API.WarFoundryCore.INFINITY;
   2.267 +			}
   2.268 +			if (this.cbPercentMin.Checked)
   2.269 +			{
   2.270 +				currentCategory.MinimumPercentage = (int)this.numPercentMin.Value;
   2.271 +			}
   2.272 +			else
   2.273 +			{
   2.274 +				currentCategory.MinimumPercentage = 0;
   2.275 +			}
   2.276 +			if (this.cbPercentMax.Checked)
   2.277 +			{
   2.278 +				currentCategory.MinimumPercentage = (int)this.numPercentMax.Value;
   2.279 +			}
   2.280 +			else
   2.281 +			{
   2.282 +				currentCategory.MaximumPercentage = 100;
   2.283 +			}
   2.284 +			system.SetCategory(currentCategory);
   2.285 +			updateCategoryList();
   2.286 +			this.listCategories.ClearSelected();
   2.287 +		}
   2.288 +
   2.289  		void lviewStats_SelectedIndexChanged(object sender, System.EventArgs e)
   2.290  		{
   2.291 +			currentStats = null;
   2.292  			foreach(IBBoard.WarFoundry.API.Objects.SystemStats stat in system.SystemStats)
   2.293  			{
   2.294  				ListView.SelectedListViewItemCollection items = this.lviewStats.SelectedItems;
   2.295 +				if(items.Count > 0)
   2.296 +				{
   2.297 +					this.btnStatsRemove.Enabled = true;
   2.298 +				}
   2.299  				foreach(ListViewItem item in items)
   2.300  				{
   2.301  					if(stat.ID == item.Text)
   2.302  					{
   2.303 -						this.txtStatLineID.Text = stat.ID;
   2.304 -						updateStatNames(stat);
   2.305 -						updateStatLinePreview(stat);
   2.306 +						currentStats = stat;
   2.307 +						if(currentStats.ID.Equals(system.StandardSystemStatsID))
   2.308 +						{
   2.309 +							this.btnStatsDefault.Enabled = false;
   2.310 +						}
   2.311 +						else
   2.312 +						{
   2.313 +							this.btnStatsDefault.Enabled = true;
   2.314 +						}
   2.315 +						this.txtStatLineID.Text = currentStats.ID;
   2.316 +						updateStatNames(currentStats);
   2.317 +						updateStatLinePreview(currentStats);
   2.318  					}
   2.319  				}
   2.320  			}
   2.321  		}
   2.322  
   2.323 +		private void btnStatsRemove_Click(object sender, EventArgs e)
   2.324 +		{
   2.325 +			system.RemoveSystemStats(currentStats.ID);
   2.326 +			this.btnStatsRemove.Enabled = false;
   2.327 +			updateSystemStatsList();
   2.328 +		}
   2.329 +
   2.330  		private void btnStatsDefault_Click(object sender, EventArgs e)
   2.331  		{
   2.332  			system.StandardSystemStatsID = this.lviewStats.SelectedItems[0].Text;
   2.333  			updateSystemStatsList();
   2.334  		}
   2.335 +
   2.336 +		private void txtStatLineID_TextChanged(object sender, EventArgs e)
   2.337 +		{
   2.338 +			if(this.txtStatLineID.Text != string.Empty)
   2.339 +			{
   2.340 +				this.btnStatsAdd.Enabled = true;
   2.341 +			}
   2.342 +			else
   2.343 +			{
   2.344 +				this.btnStatsAdd.Enabled = false;
   2.345 +			}
   2.346 +		}
   2.347 +
   2.348 +		private void txtStatName_TextChanged(object sender, EventArgs e)
   2.349 +		{
   2.350 +			if(this.txtStatName.Text != string.Empty)
   2.351 +			{
   2.352 +				this.btnStatListAdd.Enabled = true;
   2.353 +			}
   2.354 +			else
   2.355 +			{
   2.356 +				this.btnStatListAdd.Enabled = false;
   2.357 +			}
   2.358 +		}
   2.359 +
   2.360 +		private void btnStatListAdd_Click(object sender, EventArgs e)
   2.361 +		{
   2.362 +			if(this.txtStatName.Text != string.Empty)
   2.363 +			{
   2.364 +				currentStats.AddStatSlot(this.txtStatName.Text);
   2.365 +			}
   2.366 +			updateStatNames(currentStats);
   2.367 +			updateStatLinePreview(currentStats);
   2.368 +		}
   2.369 +
   2.370 +		private void listStatNames_SelectedIndexChanged(object sender, EventArgs e)
   2.371 +		{
   2.372 +			if(this.listStatNames.SelectedIndex >= 0)
   2.373 +			{
   2.374 +				this.btnStatListRemove.Enabled = true;
   2.375 +				if(this.listStatNames.SelectedIndex == 0)
   2.376 +				{
   2.377 +					this.btnStatListUp.Enabled = false;
   2.378 +				}
   2.379 +				else
   2.380 +				{
   2.381 +					this.btnStatListUp.Enabled = true;
   2.382 +				}
   2.383 +				if(this.listStatNames.SelectedIndex == this.listStatNames.Items.Count - 1)
   2.384 +				{
   2.385 +					this.btnStatListDown.Enabled = false;
   2.386 +				}
   2.387 +				else
   2.388 +				{
   2.389 +					this.btnStatListDown.Enabled = true;
   2.390 +				}
   2.391 +			}
   2.392 +			else
   2.393 +			{
   2.394 +				this.btnStatListRemove.Enabled = false;
   2.395 +				this.btnStatListUp.Enabled = false;
   2.396 +				this.btnStatListDown.Enabled = false;
   2.397 +			}
   2.398 +		}
   2.399 +
   2.400 +		private void btnStatListRemove_Click(object sender, EventArgs e)
   2.401 +		{
   2.402 +			currentStats.RemoveStatSlot((string)this.listStatNames.SelectedItem);
   2.403 +			updateStatNames(currentStats);
   2.404 +			updateStatLinePreview(currentStats);
   2.405 +		}
   2.406 +
   2.407 +		private void btnStatListUp_Click(object sender, EventArgs e)
   2.408 +		{
   2.409 +			int index = this.listStatNames.SelectedIndex;
   2.410 +			string[] slotList = new string[this.listStatNames.Items.Count];
   2.411 +
   2.412 +			for (int i = 0; i < currentStats.SlotCount; i++)
   2.413 +			{
   2.414 +				slotList[i] = currentStats.StatSlots[i].Name;
   2.415 +			}
   2.416 +			for (int i = 0; i < slotList.Length; i++)
   2.417 +			{
   2.418 +				currentStats.RemoveStatSlot(slotList[i]);
   2.419 +			}
   2.420 +
   2.421 +			string temp = slotList[index];
   2.422 +			slotList[index] = slotList[index - 1];
   2.423 +			slotList[index - 1] = temp;
   2.424 +
   2.425 +			for (int i = 0; i < slotList.Length; i++)
   2.426 +			{
   2.427 +				currentStats.AddStatSlot(slotList[i]);
   2.428 +			}
   2.429 +
   2.430 +			updateStatNames(currentStats);
   2.431 +			updateStatLinePreview(currentStats);
   2.432 +			this.listStatNames.SelectedIndex = index - 1;
   2.433 +		}
   2.434 +
   2.435 +		private void btnStatListDown_Click(object sender, EventArgs e)
   2.436 +		{
   2.437 +			int index = this.listStatNames.SelectedIndex;
   2.438 +			string[] slotList = new string[this.listStatNames.Items.Count];
   2.439 +
   2.440 +			for (int i = 0; i < currentStats.SlotCount; i++)
   2.441 +			{
   2.442 +				slotList[i] = currentStats.StatSlots[i].Name;
   2.443 +			}
   2.444 +			for (int i = 0; i < slotList.Length; i++)
   2.445 +			{
   2.446 +				currentStats.RemoveStatSlot(slotList[i]);
   2.447 +			}
   2.448 +
   2.449 +			string temp = slotList[index];
   2.450 +			slotList[index] = slotList[index + 1];
   2.451 +			slotList[index + 1] = temp;
   2.452 +
   2.453 +			for (int i = 0; i < slotList.Length; i++)
   2.454 +			{
   2.455 +				currentStats.AddStatSlot(slotList[i]);
   2.456 +			}
   2.457 +
   2.458 +			updateStatNames(currentStats);
   2.459 +			updateStatLinePreview(currentStats);
   2.460 +			this.listStatNames.SelectedIndex = index + 1;
   2.461 +		}
   2.462 +
   2.463 +		private void btnStatLineApply_Click(object sender, EventArgs e)
   2.464 +		{
   2.465 +			system.SetSystemStats(currentStats);
   2.466 +		}
   2.467  	}
   2.468  }