annotate FrmEditEquipment.cs @ 149:45c2485f37c0

* Initialise variable - xbuild is more picky than MonoDevelop
author IBBoard <dev@ibboard.co.uk>
date Sun, 27 Nov 2011 14:22:46 +0000
parents 3ec818926241
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (FrmEditEquipment.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // 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.
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
4
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using IBBoard.WarFoundry.API.Objects;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using Gtk;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using IBBoard.WarFoundry.GUI.GTK.Util;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 using IBBoard.GtkSharp;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 using log4net.Repository.Hierarchy;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 using log4net;
76
7055b24cfc79 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 70
diff changeset
13 using IBBoard.GtkSharp.Translatable;
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
14 using IBBoard.Lang;
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
15
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 namespace IBBoard.WarFoundry.GUI.GTK
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 {
76
7055b24cfc79 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 70
diff changeset
18 public partial class FrmEditEquipment : TranslatableDialog, IEditEquipmentUI
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 private static ILog log = LogManager.GetLogger(typeof(FrmAddEquipment));
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
21
76
7055b24cfc79 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 70
diff changeset
22 public event MethodInvoker UnitEquipmentAmountTypeChanged;
7055b24cfc79 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 70
diff changeset
23 public event MethodInvoker UnitEquipmentAmountChanged;
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
24
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
25 private bool isRatioLimited;
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
26
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 public FrmEditEquipment()
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 this.Build();
96
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
30 Translation.TranslationChanged += Retranslate;
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
31 Translate();
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
33
96
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
34 private void Retranslate()
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
35 {
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
36 Translate();
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
37 }
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
38
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
39 public override void Dispose()
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
40 {
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
41 Translation.TranslationChanged -= Retranslate;
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
42 base.Dispose();
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
43 }
b4416ca69153 Fixes #309: Add initial preference dialog with language support
IBBoard <dev@ibboard.co.uk>
parents: 92
diff changeset
44
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
45 public void ListenToWidgets()
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
46 {
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
47 rbEquipAll.Clicked += RadioButtonClicked;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
48 rbEquipNumeric.Clicked += RadioButtonClicked;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
49 rbEquipPercent.Clicked += RadioButtonClicked;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
50 numericAmount.ValueChanged += SpinButtonValueChanged;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
51 percentageAmount.ValueChanged += SpinButtonValueChanged;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
52 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
53
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
54 public void IgnoreWidgets()
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
55 {
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
56 rbEquipAll.Clicked -= RadioButtonClicked;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
57 rbEquipNumeric.Clicked -= RadioButtonClicked;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
58 rbEquipPercent.Clicked -= RadioButtonClicked;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
59 numericAmount.ValueChanged -= SpinButtonValueChanged;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
60 percentageAmount.ValueChanged -= SpinButtonValueChanged;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
61 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
62
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63 private void OnUnitEquipmentAmountChanged()
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65 if (UnitEquipmentAmountChanged != null)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 UnitEquipmentAmountChanged();
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
70
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71 private void OnUnitEquipmentAmountTypeChanged()
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72 {
121
3ec818926241 Code cleanup - remove warnings
IBBoard <dev@ibboard.co.uk>
parents: 97
diff changeset
73 if (UnitEquipmentAmountTypeChanged != null)
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75 UnitEquipmentAmountTypeChanged();
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
79 public void SetUnitEquipmentLimits(bool isRatioLimit, double minPercent, double maxPercent, int minNumber, int maxNumber)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
80 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
81 log.DebugFormat("IsRatio? {0}. Limits: {1}->{2}, {3}%->{4}%", isRatioLimit, minNumber, maxNumber, minPercent, maxPercent);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
82 numericAmount.SetRange(minNumber, maxNumber);
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
83 percentageAmount.SetRange(minPercent, maxPercent);
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
84 SetEquipmentAmountType(isRatioLimit);
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
85 isRatioLimited = isRatioLimit;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
86 }
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
87
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
88 public void SetEquipmentAmountType(bool isRatioAmount)
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
89 {
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
90 if (isRatioAmount)
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
91 {
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
92 if (percentageAmount.Value == 100)
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
93 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
94 rbEquipAll.Active = true;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
95 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
96 else
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
97 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
98 rbEquipPercent.Active = true;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
99 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
100 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
101 else
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
102 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
103 rbEquipNumeric.Active = true;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
104 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
105 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
106
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
107 public void SetUnitEquipmentLimitsEnabled(bool isEnabled)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
108 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
109 SetNumericAmountEnabledState(isEnabled);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
110 SetPercentageAmountEnabledState(isEnabled);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
111 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
112
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
113 public bool ShowControl()
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
114 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
115 int result = Run();
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
116 bool okayClicked = (result == (int)ResponseType.Ok);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
117 this.Hide();
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
118 return okayClicked;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
119 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
120
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
121 protected virtual void CancelButtonClicked(object sender, System.EventArgs e)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
122 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
123 log.Debug("Cancel clicked");
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
124 Respond(ResponseType.Cancel);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
125 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
126
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
127 protected virtual void OkayButtonClicked(object sender, System.EventArgs e)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
128 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
129 log.Debug("Okay clicked");
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
130 Respond(ResponseType.Ok);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
131 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
132
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
133 public void SetOkayEnabledState(bool enabled)
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
134 {
97
6d2c8ad0d8f1 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 96
diff changeset
135 bttnOkay.Sensitive = enabled;
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
136 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
137
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
138 protected virtual void SpinButtonValueChanged(object sender, System.EventArgs e)
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
139 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
140 OnUnitEquipmentAmountChanged();
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
141 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
142
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
143 protected virtual void RadioButtonClicked(object sender, System.EventArgs e)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
144 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
145 OnUnitEquipmentAmountTypeChanged();
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
146 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
147
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
148 public void SetNumericAmountEnabledState(bool enabled)
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
149 {
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
150 double minPercent = GetMinPercentage();
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
151 rbEquipNumeric.Sensitive = enabled && !(isRatioLimited && minPercent == 100);
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
152 numericAmount.Sensitive = rbEquipNumeric.Sensitive;
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
153 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
154
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
155 public void SetPercentageAmountEnabledState(bool enabled)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
156 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
157 if (enabled)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
158 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
159 double minPercentage = GetMinPercentage();
70
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
160 rbEquipPercent.Sensitive = isRatioLimited && minPercentage != 100;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
161 percentageAmount.Sensitive = rbEquipPercent.Sensitive;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
162 double maxPercentage = GetMaxPercentage();
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
163 rbEquipAll.Sensitive = isRatioLimited && maxPercentage == 100;
4b82515586ac Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
164 lblEquipAll.Sensitive = rbEquipAll.Sensitive;
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
165 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
166 else
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
167 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
168 rbEquipPercent.Sensitive = false;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
169 percentageAmount.Sensitive = false;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
170 rbEquipAll.Sensitive = false;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
171 lblEquipAll.Sensitive = false;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
172 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
173 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
174
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
175 private double GetMaxPercentage()
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
176 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
177 double min, max;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
178 percentageAmount.GetRange(out min, out max);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
179 return max;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
180 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
181
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
182 private double GetMinPercentage()
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
183 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
184 double min, max;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
185 percentageAmount.GetRange(out min, out max);
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
186 return min;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
187 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
188
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
189 public bool IsRatioEquipmentAmount
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
190 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
191 get
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
192 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
193 return !rbEquipNumeric.Active;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
194 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
195 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
196
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
197 public int EquipmentNumericAmount
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
198 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
199 get
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
200 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
201 return (int)numericAmount.Value;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
202 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
203
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
204 set
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
205 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
206 numericAmount.Value = value;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
207 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
208 }
92
58779fcd0166 Re #308: Make GTK# UI translatable
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
209
64
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
210 public double EquipmentPercentageAmount
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
211 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
212 get
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
213 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
214 double percent;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
215
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
216 if (rbEquipAll.Active)
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
217 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
218 percent = 100;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
219 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
220 else
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
221 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
222 percent = percentageAmount.Value;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
223 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
224
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
225 return percent;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
226 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
227
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
228 set
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
229 {
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
230 percentageAmount.Value = value;
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
231 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
232 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
233 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
234 }
e3fe48c4d794 Re #60: Add UI to add/remove/edit weapons in GTK
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
235