changeset 8:0dadaa315430

Category Tab Updates: Remove 'Edit' Button, clicking on the list will populate the category fields Add 'Apply' Button, make it so changes to the category enable it Max points for category set to default army size(disabled)
author Tsudico
date Thu, 16 Dec 2010 18:52:30 -0600
parents d4c03cc5bfb7
children b42ba80ec613 43d88f50c712
files .hgignore FrmSystem.Designer.cs FrmSystem.cs
diffstat 3 files changed, 346 insertions(+), 56 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Thu Dec 16 16:14:46 2010 -0600
     1.2 +++ b/.hgignore	Thu Dec 16 18:52:30 2010 -0600
     1.3 @@ -1,6 +1,7 @@
     1.4  syntax:glob
     1.5  bin/*
     1.6  obj/*
     1.7 +bin/Debug/*
     1.8  *.orig
     1.9  *.user
    1.10  *.userprefs
     2.1 --- a/FrmSystem.Designer.cs	Thu Dec 16 16:14:46 2010 -0600
     2.2 +++ b/FrmSystem.Designer.cs	Thu Dec 16 18:52:30 2010 -0600
     2.3 @@ -69,7 +69,7 @@
     2.4  			this.btnCategoryDown = new System.Windows.Forms.Button();
     2.5  			this.btnCategoryAdd = new System.Windows.Forms.Button();
     2.6  			this.btnCategoryRemove = new System.Windows.Forms.Button();
     2.7 -			this.btnCategoryEdit = new System.Windows.Forms.Button();
     2.8 +			this.btnCategoryApply = new System.Windows.Forms.Button();
     2.9  			this.tabStats = new System.Windows.Forms.TabPage();
    2.10  			this.btnStatsDefault = new System.Windows.Forms.Button();
    2.11  			this.lvStats = new System.Windows.Forms.ListView();
    2.12 @@ -92,18 +92,18 @@
    2.13  			// 
    2.14  			// btnSystemSave
    2.15  			// 
    2.16 -			this.btnSystemSave.Location = new System.Drawing.Point(527, 328);
    2.17 +			this.btnSystemSave.Location = new System.Drawing.Point(517, 328);
    2.18  			this.btnSystemSave.Name = "btnSystemSave";
    2.19 -			this.btnSystemSave.Size = new System.Drawing.Size(75, 23);
    2.20 +			this.btnSystemSave.Size = new System.Drawing.Size(85, 23);
    2.21  			this.btnSystemSave.TabIndex = 2;
    2.22  			this.btnSystemSave.Text = "Save";
    2.23  			this.btnSystemSave.UseVisualStyleBackColor = true;
    2.24  			// 
    2.25  			// btnSystemClose
    2.26  			// 
    2.27 -			this.btnSystemClose.Location = new System.Drawing.Point(446, 328);
    2.28 +			this.btnSystemClose.Location = new System.Drawing.Point(426, 328);
    2.29  			this.btnSystemClose.Name = "btnSystemClose";
    2.30 -			this.btnSystemClose.Size = new System.Drawing.Size(75, 23);
    2.31 +			this.btnSystemClose.Size = new System.Drawing.Size(85, 23);
    2.32  			this.btnSystemClose.TabIndex = 3;
    2.33  			this.btnSystemClose.Text = "Close";
    2.34  			this.btnSystemClose.UseVisualStyleBackColor = true;
    2.35 @@ -303,7 +303,7 @@
    2.36  			this.tabCategories.Controls.Add(this.btnCategoryDown);
    2.37  			this.tabCategories.Controls.Add(this.btnCategoryAdd);
    2.38  			this.tabCategories.Controls.Add(this.btnCategoryRemove);
    2.39 -			this.tabCategories.Controls.Add(this.btnCategoryEdit);
    2.40 +			this.tabCategories.Controls.Add(this.btnCategoryApply);
    2.41  			this.tabCategories.Location = new System.Drawing.Point(4, 22);
    2.42  			this.tabCategories.Name = "tabCategories";
    2.43  			this.tabCategories.Padding = new System.Windows.Forms.Padding(3);
    2.44 @@ -326,7 +326,7 @@
    2.45  			this.gbCategoryLimits.Controls.Add(this.lblPointLimit);
    2.46  			this.gbCategoryLimits.Location = new System.Drawing.Point(298, 63);
    2.47  			this.gbCategoryLimits.Name = "gbCategoryLimits";
    2.48 -			this.gbCategoryLimits.Size = new System.Drawing.Size(277, 207);
    2.49 +			this.gbCategoryLimits.Size = new System.Drawing.Size(277, 130);
    2.50  			this.gbCategoryLimits.TabIndex = 23;
    2.51  			this.gbCategoryLimits.TabStop = false;
    2.52  			this.gbCategoryLimits.Text = "Category Limits";
    2.53 @@ -349,9 +349,11 @@
    2.54  			this.cbPercentMax.TabIndex = 10;
    2.55  			this.cbPercentMax.Text = "Maximum:";
    2.56  			this.cbPercentMax.UseVisualStyleBackColor = true;
    2.57 +			this.cbPercentMax.CheckedChanged += new System.EventHandler(this.cbPercentMax_CheckedChanged);
    2.58  			// 
    2.59  			// numPercentMax
    2.60  			// 
    2.61 +			this.numPercentMax.Enabled = false;
    2.62  			this.numPercentMax.Increment = new decimal(new int[] {
    2.63              5,
    2.64              0,
    2.65 @@ -362,6 +364,12 @@
    2.66  			this.numPercentMax.Size = new System.Drawing.Size(42, 20);
    2.67  			this.numPercentMax.TabIndex = 9;
    2.68  			this.numPercentMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
    2.69 +			this.numPercentMax.Value = new decimal(new int[] {
    2.70 +            100,
    2.71 +            0,
    2.72 +            0,
    2.73 +            0});
    2.74 +			this.numPercentMax.ValueChanged += new System.EventHandler(this.numPercentMax_ValueChanged);
    2.75  			// 
    2.76  			// cbPercentMin
    2.77  			// 
    2.78 @@ -372,9 +380,11 @@
    2.79  			this.cbPercentMin.TabIndex = 8;
    2.80  			this.cbPercentMin.Text = "Minimum:";
    2.81  			this.cbPercentMin.UseVisualStyleBackColor = true;
    2.82 +			this.cbPercentMin.CheckedChanged += new System.EventHandler(this.cbPercentMin_CheckedChanged);
    2.83  			// 
    2.84  			// numPercentMin
    2.85  			// 
    2.86 +			this.numPercentMin.Enabled = false;
    2.87  			this.numPercentMin.Increment = new decimal(new int[] {
    2.88              5,
    2.89              0,
    2.90 @@ -385,6 +395,7 @@
    2.91  			this.numPercentMin.Size = new System.Drawing.Size(42, 20);
    2.92  			this.numPercentMin.TabIndex = 7;
    2.93  			this.numPercentMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
    2.94 +			this.numPercentMin.ValueChanged += new System.EventHandler(this.numPercentMin_ValueChanged);
    2.95  			// 
    2.96  			// cbPointMax
    2.97  			// 
    2.98 @@ -395,9 +406,11 @@
    2.99  			this.cbPointMax.TabIndex = 6;
   2.100  			this.cbPointMax.Text = "Maximum:";
   2.101  			this.cbPointMax.UseVisualStyleBackColor = true;
   2.102 +			this.cbPointMax.CheckedChanged += new System.EventHandler(this.cbPointMax_CheckedChanged);
   2.103  			// 
   2.104  			// numPointMax
   2.105  			// 
   2.106 +			this.numPointMax.Enabled = false;
   2.107  			this.numPointMax.Increment = new decimal(new int[] {
   2.108              50,
   2.109              0,
   2.110 @@ -405,7 +418,7 @@
   2.111              0});
   2.112  			this.numPointMax.Location = new System.Drawing.Point(202, 45);
   2.113  			this.numPointMax.Maximum = new decimal(new int[] {
   2.114 -            1000000,
   2.115 +            2147483647,
   2.116              0,
   2.117              0,
   2.118              0});
   2.119 @@ -413,6 +426,7 @@
   2.120  			this.numPointMax.Size = new System.Drawing.Size(69, 20);
   2.121  			this.numPointMax.TabIndex = 5;
   2.122  			this.numPointMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
   2.123 +			this.numPointMax.ValueChanged += new System.EventHandler(this.numPointMax_ValueChanged);
   2.124  			// 
   2.125  			// cbPointMin
   2.126  			// 
   2.127 @@ -423,9 +437,11 @@
   2.128  			this.cbPointMin.TabIndex = 4;
   2.129  			this.cbPointMin.Text = "Minimum:";
   2.130  			this.cbPointMin.UseVisualStyleBackColor = true;
   2.131 +			this.cbPointMin.CheckedChanged += new System.EventHandler(this.cbPointMin_CheckedChanged);
   2.132  			// 
   2.133  			// numPointMin
   2.134  			// 
   2.135 +			this.numPointMin.Enabled = false;
   2.136  			this.numPointMin.Increment = new decimal(new int[] {
   2.137              50,
   2.138              0,
   2.139 @@ -441,6 +457,7 @@
   2.140  			this.numPointMin.Size = new System.Drawing.Size(69, 20);
   2.141  			this.numPointMin.TabIndex = 2;
   2.142  			this.numPointMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
   2.143 +			this.numPointMin.ValueChanged += new System.EventHandler(this.numPointMin_ValueChanged);
   2.144  			// 
   2.145  			// lblPointLimit
   2.146  			// 
   2.147 @@ -467,6 +484,7 @@
   2.148  			this.txtCategoryID.Name = "txtCategoryID";
   2.149  			this.txtCategoryID.Size = new System.Drawing.Size(99, 20);
   2.150  			this.txtCategoryID.TabIndex = 21;
   2.151 +			this.txtCategoryID.TextChanged += new System.EventHandler(this.txtCategoryID_TextChanged);
   2.152  			// 
   2.153  			// lblCategoryID
   2.154  			// 
   2.155 @@ -483,6 +501,7 @@
   2.156  			this.txtCategoryName.Name = "txtCategoryName";
   2.157  			this.txtCategoryName.Size = new System.Drawing.Size(182, 20);
   2.158  			this.txtCategoryName.TabIndex = 19;
   2.159 +			this.txtCategoryName.TextChanged += new System.EventHandler(this.txtCategoryName_TextChanged);
   2.160  			// 
   2.161  			// lblCategoryName
   2.162  			// 
   2.163 @@ -495,7 +514,7 @@
   2.164  			// 
   2.165  			// btnCategoryUp
   2.166  			// 
   2.167 -			this.btnCategoryUp.Location = new System.Drawing.Point(216, 121);
   2.168 +			this.btnCategoryUp.Location = new System.Drawing.Point(216, 92);
   2.169  			this.btnCategoryUp.Name = "btnCategoryUp";
   2.170  			this.btnCategoryUp.Size = new System.Drawing.Size(62, 23);
   2.171  			this.btnCategoryUp.TabIndex = 17;
   2.172 @@ -509,10 +528,11 @@
   2.173  			this.listCategories.Name = "listCategories";
   2.174  			this.listCategories.Size = new System.Drawing.Size(207, 264);
   2.175  			this.listCategories.TabIndex = 12;
   2.176 +			this.listCategories.SelectedIndexChanged += new System.EventHandler(this.listCategories_SelectedIndexChanged);
   2.177  			// 
   2.178  			// btnCategoryDown
   2.179  			// 
   2.180 -			this.btnCategoryDown.Location = new System.Drawing.Point(216, 150);
   2.181 +			this.btnCategoryDown.Location = new System.Drawing.Point(216, 121);
   2.182  			this.btnCategoryDown.Name = "btnCategoryDown";
   2.183  			this.btnCategoryDown.Size = new System.Drawing.Size(62, 23);
   2.184  			this.btnCategoryDown.TabIndex = 16;
   2.185 @@ -531,22 +551,23 @@
   2.186  			// 
   2.187  			// btnCategoryRemove
   2.188  			// 
   2.189 -			this.btnCategoryRemove.Location = new System.Drawing.Point(216, 63);
   2.190 +			this.btnCategoryRemove.Location = new System.Drawing.Point(216, 34);
   2.191  			this.btnCategoryRemove.Name = "btnCategoryRemove";
   2.192  			this.btnCategoryRemove.Size = new System.Drawing.Size(62, 23);
   2.193  			this.btnCategoryRemove.TabIndex = 15;
   2.194  			this.btnCategoryRemove.Text = "Remove";
   2.195  			this.btnCategoryRemove.UseVisualStyleBackColor = true;
   2.196 +			this.btnCategoryRemove.Click += new System.EventHandler(this.btnCategoryRemove_Click);
   2.197  			// 
   2.198 -			// btnCategoryEdit
   2.199 +			// btnCategoryApply
   2.200  			// 
   2.201 -			this.btnCategoryEdit.Location = new System.Drawing.Point(216, 34);
   2.202 -			this.btnCategoryEdit.Name = "btnCategoryEdit";
   2.203 -			this.btnCategoryEdit.Size = new System.Drawing.Size(62, 23);
   2.204 -			this.btnCategoryEdit.TabIndex = 14;
   2.205 -			this.btnCategoryEdit.Text = "Edit";
   2.206 -			this.btnCategoryEdit.UseVisualStyleBackColor = true;
   2.207 -			this.btnCategoryEdit.Click += new System.EventHandler(this.btnCategoryEdit_Click);
   2.208 +			this.btnCategoryApply.Enabled = false;
   2.209 +			this.btnCategoryApply.Location = new System.Drawing.Point(500, 199);
   2.210 +			this.btnCategoryApply.Name = "btnCategoryApply";
   2.211 +			this.btnCategoryApply.Size = new System.Drawing.Size(76, 23);
   2.212 +			this.btnCategoryApply.TabIndex = 14;
   2.213 +			this.btnCategoryApply.Text = "Apply";
   2.214 +			this.btnCategoryApply.UseVisualStyleBackColor = true;
   2.215  			// 
   2.216  			// tabStats
   2.217  			// 
   2.218 @@ -661,7 +682,7 @@
   2.219  		private System.Windows.Forms.Button btnCategoryDown;
   2.220  		private System.Windows.Forms.Button btnCategoryAdd;
   2.221  		private System.Windows.Forms.Button btnCategoryRemove;
   2.222 -		private System.Windows.Forms.Button btnCategoryEdit;
   2.223 +		private System.Windows.Forms.Button btnCategoryApply;
   2.224  		private System.Windows.Forms.TabPage tabStats;
   2.225  		private System.Windows.Forms.Button btnStatsDefault;
   2.226  		private System.Windows.Forms.ListView lvStats;
     3.1 --- a/FrmSystem.cs	Thu Dec 16 16:14:46 2010 -0600
     3.2 +++ b/FrmSystem.cs	Thu Dec 16 18:52:30 2010 -0600
     3.3 @@ -16,12 +16,71 @@
     3.4  	{
     3.5  		private IBBoard.WarFoundry.API.Objects.GameSystem system;
     3.6  		
     3.7 +		private bool UpdateCategory
     3.8 +		{
     3.9 +			get
    3.10 +			{
    3.11 +				if(this.listCategories.SelectedIndex >= 0)
    3.12 +				{
    3.13 +					foreach(IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
    3.14 +					{
    3.15 +						if(cat.Name == this.listCategories.SelectedItem)
    3.16 +						{
    3.17 +							if(cat.Name != this.txtCategoryName.Text)
    3.18 +							{
    3.19 +								return true;
    3.20 +							}
    3.21 +							if(cat.ID != this.txtCategoryID.Text)
    3.22 +							{
    3.23 +								return true;
    3.24 +							}
    3.25 +							if(cat.MinimumPoints > 0 && !this.cbPointMin.Checked)
    3.26 +							{
    3.27 +								return true;
    3.28 +							}
    3.29 +							else if(cat.MinimumPoints != this.numPointMin.Value)
    3.30 +							{
    3.31 +								return true;
    3.32 +							}
    3.33 +							if(cat.MaximumPoints < this.numPointMax.Maximum && !this.cbPointMax.Checked)
    3.34 +							{
    3.35 +								return true;
    3.36 +							}
    3.37 +							else if(cat.MaximumPoints != this.numPointMax.Value)
    3.38 +							{
    3.39 +								return true;
    3.40 +							}
    3.41 +							if(cat.MinimumPercentage > 0 && !this.cbPercentMin.Checked)
    3.42 +							{
    3.43 +								return true;
    3.44 +							}
    3.45 +							else if(cat.MinimumPercentage != this.numPercentMin.Value)
    3.46 +							{
    3.47 +								return true;
    3.48 +							}
    3.49 +							if(cat.MaximumPercentage < this.numPercentMax.Maximum && !this.cbPercentMax.Checked)
    3.50 +							{
    3.51 +								return true;
    3.52 +							}
    3.53 +							else if(cat.MaximumPercentage != this.numPercentMax.Value)
    3.54 +							{
    3.55 +								return true;
    3.56 +							}
    3.57 +						}
    3.58 +					}
    3.59 +				}
    3.60 +				return false;
    3.61 +			}
    3.62 +		}
    3.63 +		
    3.64  		public FrmSystem(IBBoard.WarFoundry.API.Objects.GameSystem loadSystem)
    3.65  		{
    3.66  			InitializeComponent();
    3.67  			system = loadSystem;
    3.68  			this.txtSystemName.Text = system.Name;
    3.69  			this.txtSystemId.Text = system.ID;
    3.70 +			this.numDefaultSize.Value = system.SystemArmyDefaultSize;
    3.71 +			this.numPointMax.Value = this.numDefaultSize.Value;
    3.72  			if(system.AllowAllies)
    3.73  			{
    3.74  				this.radSystemAlliesYes.Checked = true;
    3.75 @@ -38,14 +97,7 @@
    3.76  			{
    3.77  				this.radSystemWarnNo.Checked = true;
    3.78  			}
    3.79 -			if(system.Categories.Length > 0)
    3.80 -			{
    3.81 -				this.listCategories.Items.Clear();
    3.82 -				for(int i = 0; i < system.Categories.Length; i++)
    3.83 -				{
    3.84 -					this.listCategories.Items.Add(system.Categories[i].Name);
    3.85 -				}
    3.86 -			}
    3.87 +			updateCategoryList();
    3.88  		}
    3.89  		
    3.90  		private string generateID(string name)
    3.91 @@ -65,6 +117,36 @@
    3.92  
    3.93  			return newId.ToLower();
    3.94  		}
    3.95 +		
    3.96 +		private void clearCategory()
    3.97 +		{
    3.98 +			this.txtCategoryName.Text = string.Empty;
    3.99 +			this.txtCategoryID.Text = string.Empty;
   3.100 +			this.cbPointMin.Checked = false;
   3.101 +			this.cbPointMax.Checked = false;
   3.102 +			this.cbPercentMin.Checked = false;
   3.103 +			this.cbPercentMax.Checked = false;
   3.104 +			this.numPointMin.Value = 0;
   3.105 +			this.numPointMin.Enabled = false;
   3.106 +			this.numPointMax.Value = this.numDefaultSize.Value;
   3.107 +			this.numPointMax.Enabled = false;
   3.108 +			this.numPercentMin.Value = 0;
   3.109 +			this.numPercentMin.Enabled = false;
   3.110 +			this.numPercentMax.Value = 100;
   3.111 +			this.numPercentMax.Enabled = false;
   3.112 +		}
   3.113 +		
   3.114 +		private void updateCategoryList()
   3.115 +		{
   3.116 +			if (system.Categories.Length > 0)
   3.117 +			{
   3.118 +				this.listCategories.Items.Clear();
   3.119 +				for (int i = 0; i < system.Categories.Length; i++)
   3.120 +				{
   3.121 +					this.listCategories.Items.Add(system.Categories[i].Name);
   3.122 +				}
   3.123 +			}
   3.124 +		}
   3.125  
   3.126  		private void btnSystemClose_Click(object sender, EventArgs e)
   3.127  		{
   3.128 @@ -76,6 +158,61 @@
   3.129  			this.txtSystemId.Text = generateID(this.txtSystemName.Text);
   3.130  		}
   3.131  
   3.132 +		private void listCategories_SelectedIndexChanged(object sender, EventArgs e)
   3.133 +		{
   3.134 +			foreach (IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
   3.135 +			{
   3.136 +				if (cat.Name == this.listCategories.SelectedItem)
   3.137 +				{
   3.138 +					this.txtCategoryName.Text = cat.Name;
   3.139 +					this.txtCategoryID.Text = cat.ID;
   3.140 +					if (cat.MinimumPoints > 0)
   3.141 +					{
   3.142 +						this.numPointMin.Value = cat.MinimumPoints;
   3.143 +						this.cbPointMin.Checked = true;
   3.144 +						this.numPointMin.Enabled = true;
   3.145 +					}
   3.146 +					else
   3.147 +					{
   3.148 +						this.numPointMin.Enabled = false;
   3.149 +					}
   3.150 +					if (cat.MaximumPoints > 0 && cat.MaximumPoints < this.numPercentMax.Maximum)
   3.151 +					{
   3.152 +						this.numPointMax.Value = cat.MaximumPoints;
   3.153 +						this.cbPointMax.Checked = true;
   3.154 +						this.numPointMax.Enabled = true;
   3.155 +					}
   3.156 +					else
   3.157 +					{
   3.158 +						this.numPointMax.Value = this.numDefaultSize.Value;
   3.159 +						this.numPointMax.Enabled = false;
   3.160 +					}
   3.161 +					if (cat.MinimumPercentage > 0)
   3.162 +					{
   3.163 +						this.numPercentMin.Value = cat.MinimumPercentage;
   3.164 +						this.cbPercentMin.Checked = true;
   3.165 +						this.numPercentMin.Enabled = true;
   3.166 +					}
   3.167 +					else
   3.168 +					{
   3.169 +						this.numPercentMin.Enabled = false;
   3.170 +					}
   3.171 +					if (cat.MaximumPercentage < 100)
   3.172 +					{
   3.173 +						this.numPercentMax.Value = cat.MaximumPercentage;
   3.174 +						this.cbPercentMax.Checked = true;
   3.175 +						this.numPercentMax.Enabled = true;
   3.176 +					}
   3.177 +					else
   3.178 +					{
   3.179 +						this.numPercentMax.Enabled = false;
   3.180 +					}
   3.181 +					this.btnCategoryApply.Enabled = false;
   3.182 +					break;
   3.183 +				}
   3.184 +			}
   3.185 +		}
   3.186 +
   3.187  		private void btnCategoryAdd_Click(object sender, EventArgs e)
   3.188  		{
   3.189  			if(this.txtCategoryName.Text == string.Empty)
   3.190 @@ -99,48 +236,179 @@
   3.191  			cat.MaximumPercentage = (int)this.numPercentMax.Value;
   3.192  			
   3.193  			system.AddCategory(cat);
   3.194 -
   3.195 -			if (system.Categories.Length > 0)
   3.196 -			{
   3.197 -				this.listCategories.Items.Clear();
   3.198 -				for (int i = 0; i < system.Categories.Length; i++)
   3.199 -				{
   3.200 -					this.listCategories.Items.Add(system.Categories[i].Name);
   3.201 -				}
   3.202 -			}
   3.203 +			updateCategoryList();
   3.204 +			clearCategory();
   3.205  		}
   3.206  
   3.207 -		private void btnCategoryEdit_Click(object sender, EventArgs e)
   3.208 +		private void btnCategoryRemove_Click(object sender, EventArgs e)
   3.209  		{
   3.210  			foreach(IBBoard.WarFoundry.API.Objects.Category cat in system.Categories)
   3.211  			{
   3.212  				if(cat.Name == this.listCategories.SelectedItem)
   3.213  				{
   3.214 -					this.txtCategoryName.Text = cat.Name;
   3.215 -					this.txtCategoryID.Text = cat.ID;
   3.216 -					if(cat.MinimumPoints >= 0)
   3.217 -					{
   3.218 -						this.numPointMin.Value = cat.MinimumPoints;
   3.219 -					}
   3.220 -					if(cat.MaximumPoints > 0 && cat.MaximumPoints < this.numPointMax.Maximum)
   3.221 -					{	
   3.222 -						this.numPointMax.Value = cat.MaximumPoints;
   3.223 -					}
   3.224 -					if(cat.MinimumPercentage >= 0)
   3.225 -					{
   3.226 -						this.numPercentMin.Value = cat.MinimumPercentage;
   3.227 -					}
   3.228 -					if(cat.MaximumPercentage <= 100)
   3.229 -					{
   3.230 -						this.numPercentMax.Value = cat.MaximumPercentage;
   3.231 -					}
   3.232 +					system.RemoveCategory(cat.ID);
   3.233 +					this.listCategories.ClearSelected();
   3.234 +					break;
   3.235  				}
   3.236  			}
   3.237 +			updateCategoryList();
   3.238 +		}
   3.239 +
   3.240 +		private void txtCategoryName_TextChanged(object sender, EventArgs e)
   3.241 +		{
   3.242 +			if (this.UpdateCategory)
   3.243 +			{
   3.244 +				this.btnCategoryApply.Enabled = true;
   3.245 +			}
   3.246 +			else
   3.247 +			{
   3.248 +				this.btnCategoryApply.Enabled = false;
   3.249 +			}
   3.250 +		}
   3.251 +
   3.252 +		private void txtCategoryID_TextChanged(object sender, EventArgs e)
   3.253 +		{
   3.254 +			if (this.UpdateCategory)
   3.255 +			{
   3.256 +				this.btnCategoryApply.Enabled = true;
   3.257 +			}
   3.258 +			else
   3.259 +			{
   3.260 +				this.btnCategoryApply.Enabled = false;
   3.261 +			}
   3.262  		}
   3.263  
   3.264  		private void btnGenerateCatID_Click(object sender, EventArgs e)
   3.265  		{
   3.266  			this.txtCategoryID.Text = generateID(this.txtCategoryName.Text);
   3.267  		}
   3.268 +
   3.269 +		private void cbPointMin_CheckedChanged(object sender, EventArgs e)
   3.270 +		{
   3.271 +			if(this.cbPointMin.Checked)
   3.272 +			{
   3.273 +				this.numPointMin.Enabled = true;
   3.274 +			}
   3.275 +			else
   3.276 +			{
   3.277 +				this.numPointMin.Enabled = false;
   3.278 +			}
   3.279 +			if(this.UpdateCategory)
   3.280 +			{
   3.281 +				this.btnCategoryApply.Enabled = true;
   3.282 +			}
   3.283 +			else
   3.284 +			{
   3.285 +				this.btnCategoryApply.Enabled = false;
   3.286 +			}
   3.287 +		}
   3.288 +
   3.289 +		private void cbPointMax_CheckedChanged(object sender, EventArgs e)
   3.290 +		{
   3.291 +			if (this.cbPointMax.Checked)
   3.292 +			{
   3.293 +				this.numPointMax.Enabled = true;
   3.294 +			}
   3.295 +			else
   3.296 +			{
   3.297 +				this.numPointMax.Enabled = false;
   3.298 +			}
   3.299 +			if (this.UpdateCategory)
   3.300 +			{
   3.301 +				this.btnCategoryApply.Enabled = true;
   3.302 +			}
   3.303 +			else
   3.304 +			{
   3.305 +				this.btnCategoryApply.Enabled = false;
   3.306 +			}
   3.307 +		}
   3.308 +
   3.309 +		private void cbPercentMin_CheckedChanged(object sender, EventArgs e)
   3.310 +		{
   3.311 +			if (this.cbPercentMin.Checked)
   3.312 +			{
   3.313 +				this.numPercentMin.Enabled = true;
   3.314 +			}
   3.315 +			else
   3.316 +			{
   3.317 +				this.numPercentMin.Enabled = false;
   3.318 +			}
   3.319 +			if (this.UpdateCategory)
   3.320 +			{
   3.321 +				this.btnCategoryApply.Enabled = true;
   3.322 +			}
   3.323 +			else
   3.324 +			{
   3.325 +				this.btnCategoryApply.Enabled = false;
   3.326 +			}
   3.327 +		}
   3.328 +
   3.329 +		private void cbPercentMax_CheckedChanged(object sender, EventArgs e)
   3.330 +		{
   3.331 +			if (this.cbPercentMax.Checked)
   3.332 +			{
   3.333 +				this.numPercentMax.Enabled = true;
   3.334 +			}
   3.335 +			else
   3.336 +			{
   3.337 +				this.numPercentMax.Enabled = false;
   3.338 +			}
   3.339 +			if (this.UpdateCategory)
   3.340 +			{
   3.341 +				this.btnCategoryApply.Enabled = true;
   3.342 +			}
   3.343 +			else
   3.344 +			{
   3.345 +				this.btnCategoryApply.Enabled = false;
   3.346 +			}
   3.347 +		}
   3.348 +
   3.349 +		private void numPointMin_ValueChanged(object sender, EventArgs e)
   3.350 +		{
   3.351 +			if (this.UpdateCategory)
   3.352 +			{
   3.353 +				this.btnCategoryApply.Enabled = true;
   3.354 +			}
   3.355 +			else
   3.356 +			{
   3.357 +				this.btnCategoryApply.Enabled = false;
   3.358 +			}
   3.359 +		}
   3.360 +
   3.361 +		private void numPointMax_ValueChanged(object sender, EventArgs e)
   3.362 +		{
   3.363 +			if (this.UpdateCategory)
   3.364 +			{
   3.365 +				this.btnCategoryApply.Enabled = true;
   3.366 +			}
   3.367 +			else
   3.368 +			{
   3.369 +				this.btnCategoryApply.Enabled = false;
   3.370 +			}
   3.371 +		}
   3.372 +
   3.373 +		private void numPercentMin_ValueChanged(object sender, EventArgs e)
   3.374 +		{
   3.375 +			if (this.UpdateCategory)
   3.376 +			{
   3.377 +				this.btnCategoryApply.Enabled = true;
   3.378 +			}
   3.379 +			else
   3.380 +			{
   3.381 +				this.btnCategoryApply.Enabled = false;
   3.382 +			}
   3.383 +		}
   3.384 +
   3.385 +		private void numPercentMax_ValueChanged(object sender, EventArgs e)
   3.386 +		{
   3.387 +			if (this.UpdateCategory)
   3.388 +			{
   3.389 +				this.btnCategoryApply.Enabled = true;
   3.390 +			}
   3.391 +			else
   3.392 +			{
   3.393 +				this.btnCategoryApply.Enabled = false;
   3.394 +			}
   3.395 +		}
   3.396  	}
   3.397  }