Files @ 71732f305328
Branch filter:

Location: ATITD-Tools/Desert-Paint-Lab/gtk-gui/MainWindow.cs

jmaltzen
Pre-allocate a bunch of map entries, given that we know there are a fixed set of colors. Use fixed arrays in places where maps/sets were excessive. Switch away from using Gtk.Application.Invoke, which leaks a bunch of memory.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403

// This file has been generated by the GUI designer. Do not modify.

public partial class MainWindow
{
	private global::Gtk.UIManager UIManager;
	
	private global::Gtk.Action FileAction;
	
	private global::Gtk.Action HelpAction;
	
	private global::Gtk.Action AboutAction;
	
	private global::Gtk.Action NewProfileAction;
	
	private global::Gtk.Action OpenProfileAction;
	
	private global::Gtk.Action ExitAction;
	
	private global::Gtk.Action ExportForPracticalPaintAction;
	
	private global::Gtk.Action WindowAction;
	
	private global::Gtk.Action RunSimulatorAction;
	
	private global::Gtk.Action DebugAction;
	
	private global::Gtk.Action ScreenshotAction;
	
	private global::Gtk.Action RecipesAction;
	
	private global::Gtk.Action ReactionStatusAction;
	
	private global::Gtk.Action IngredientsAction;
	
	private global::Gtk.Action ExportProfileAction;
	
	private global::Gtk.Action ImportProfileAction;
	
	private global::Gtk.VBox vbox1;
	
	private global::Gtk.MenuBar menubar1;
	
	private global::Gtk.HBox hbox1;
	
	private global::Gtk.Frame frame2;
	
	private global::Gtk.Alignment GtkAlignment;
	
	private global::Gtk.VBox vbox3;
	
	private global::Gtk.HBox hbox6;
	
	private global::Gtk.Label label4;
	
	private global::Gtk.ComboBox ingredient1ComboBox;
	
	private global::Gtk.HBox hbox7;
	
	private global::Gtk.Label label5;
	
	private global::Gtk.ComboBox ingredient2ComboBox;
	
	private global::Gtk.HBox hbox8;
	
	private global::Gtk.Label label6;
	
	private global::Gtk.ComboBox ingredient3ComboBox;
	
	private global::Gtk.Label GtkLabel2;
	
	private global::Gtk.Frame frame3;
	
	private global::Gtk.Alignment GtkAlignment1;
	
	private global::Gtk.VBox vbox4;
	
	private global::DesertPaintLab.PaintSwatch unmodifiedSwatch;
	
	private global::Gtk.Button captureButton;
	
	private global::Gtk.Label GtkLabel25;
	
	private global::Gtk.Frame frame4;
	
	private global::Gtk.Alignment GtkAlignment2;
	
	private global::Gtk.VBox vbox5;
	
	private global::DesertPaintLab.PaintSwatch reactionSwatch;
	
	private global::Gtk.Button saveButton;
	
	private global::Gtk.Label GtkLabel26;
	
	private global::Gtk.Statusbar statusBar;

	protected virtual void Build ()
	{
		global::Stetic.Gui.Initialize (this);
		// Widget MainWindow
		this.UIManager = new global::Gtk.UIManager ();
		global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default");
		this.FileAction = new global::Gtk.Action ("FileAction", "_File", null, null);
		this.FileAction.ShortLabel = "_File";
		w1.Add (this.FileAction, "<Alt>f");
		this.HelpAction = new global::Gtk.Action ("HelpAction", "_Help", null, null);
		this.HelpAction.ShortLabel = "_Help";
		w1.Add (this.HelpAction, "<Alt>a");
		this.AboutAction = new global::Gtk.Action ("AboutAction", "_About...", null, null);
		this.AboutAction.ShortLabel = "_About...";
		w1.Add (this.AboutAction, "<Alt>a");
		this.NewProfileAction = new global::Gtk.Action ("NewProfileAction", "_New Profile...", null, null);
		this.NewProfileAction.ShortLabel = "_New Profile...";
		w1.Add (this.NewProfileAction, "<Alt>n");
		this.OpenProfileAction = new global::Gtk.Action ("OpenProfileAction", "_Open Profile...", null, null);
		this.OpenProfileAction.ShortLabel = "_Open Profile...";
		w1.Add (this.OpenProfileAction, "<Alt>o");
		this.ExitAction = new global::Gtk.Action ("ExitAction", "E_xit", null, null);
		this.ExitAction.ShortLabel = "E_xit";
		w1.Add (this.ExitAction, "<Alt>x");
		this.ExportForPracticalPaintAction = new global::Gtk.Action ("ExportForPracticalPaintAction", "Export for _PracticalPaint...", null, null);
		this.ExportForPracticalPaintAction.ShortLabel = "Export for _PracticalPaint...";
		w1.Add (this.ExportForPracticalPaintAction, null);
		this.WindowAction = new global::Gtk.Action ("WindowAction", "_Window", null, null);
		this.WindowAction.ShortLabel = "_Window";
		w1.Add (this.WindowAction, null);
		this.RunSimulatorAction = new global::Gtk.Action ("RunSimulatorAction", "_Run Simulator", null, null);
		this.RunSimulatorAction.ShortLabel = "_Run Simulator";
		w1.Add (this.RunSimulatorAction, null);
		this.DebugAction = new global::Gtk.Action ("DebugAction", "Debug", null, null);
		this.DebugAction.ShortLabel = "Debug";
		w1.Add (this.DebugAction, null);
		this.ScreenshotAction = new global::Gtk.Action ("ScreenshotAction", "Screenshot", null, null);
		this.ScreenshotAction.ShortLabel = "Screenshot";
		w1.Add (this.ScreenshotAction, null);
		this.RecipesAction = new global::Gtk.Action ("RecipesAction", "Recipes", null, null);
		this.RecipesAction.ShortLabel = "Recipe Generator";
		w1.Add (this.RecipesAction, null);
		this.ReactionStatusAction = new global::Gtk.Action ("ReactionStatusAction", "Reaction Status", null, null);
		this.ReactionStatusAction.ShortLabel = "Reaction Status";
		w1.Add (this.ReactionStatusAction, null);
		this.IngredientsAction = new global::Gtk.Action ("IngredientsAction", "Ingredients", null, null);
		this.IngredientsAction.ShortLabel = "Ingredients";
		w1.Add (this.IngredientsAction, null);
		this.ExportProfileAction = new global::Gtk.Action ("ExportProfileAction", "Export Profile", null, null);
		this.ExportProfileAction.ShortLabel = "Export Profile";
		w1.Add (this.ExportProfileAction, null);
		this.ImportProfileAction = new global::Gtk.Action ("ImportProfileAction", "Import Profile", null, null);
		this.ImportProfileAction.ShortLabel = "Import Profile";
		w1.Add (this.ImportProfileAction, null);
		this.UIManager.InsertActionGroup (w1, 0);
		this.AddAccelGroup (this.UIManager.AccelGroup);
		this.Name = "MainWindow";
		this.Title = "Desert Paint Lab";
		this.WindowPosition = ((global::Gtk.WindowPosition)(4));
		// Container child MainWindow.Gtk.Container+ContainerChild
		this.vbox1 = new global::Gtk.VBox ();
		this.vbox1.Name = "vbox1";
		// Container child vbox1.Gtk.Box+BoxChild
		this.UIManager.AddUiFromString ("<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='NewProfileAction' action='NewProfileAction'/><menuitem name='OpenProfileAction' action='OpenProfileAction'/><menuitem name='ExportForPracticalPaintAction' action='ExportForPracticalPaintAction'/><menuitem name='ExportProfileAction' action='ExportProfileAction'/><menuitem name='ImportProfileAction' action='ImportProfileAction'/><separator/><menuitem name='ExitAction' action='ExitAction'/></menu><menu name='WindowAction' action='WindowAction'><menuitem name='RunSimulatorAction' action='RunSimulatorAction'/><menuitem name='RecipesAction' action='RecipesAction'/><menuitem name='IngredientsAction' action='IngredientsAction'/></menu><menu name='HelpAction' action='HelpAction'><menuitem name='AboutAction' action='AboutAction'/><menuitem name='ReactionStatusAction' action='ReactionStatusAction'/></menu><menu name='DebugAction' action='DebugAction'><menuitem name='ScreenshotAction' action='ScreenshotAction'/></menu></menubar></ui>");
		this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menubar1")));
		this.menubar1.Name = "menubar1";
		this.vbox1.Add (this.menubar1);
		global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.menubar1]));
		w2.Position = 0;
		w2.Expand = false;
		w2.Fill = false;
		// Container child vbox1.Gtk.Box+BoxChild
		this.hbox1 = new global::Gtk.HBox ();
		this.hbox1.Name = "hbox1";
		this.hbox1.Spacing = 6;
		this.hbox1.BorderWidth = ((uint)(4));
		// Container child hbox1.Gtk.Box+BoxChild
		this.frame2 = new global::Gtk.Frame ();
		this.frame2.Name = "frame2";
		this.frame2.BorderWidth = ((uint)(4));
		// Container child frame2.Gtk.Container+ContainerChild
		this.GtkAlignment = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
		this.GtkAlignment.Name = "GtkAlignment";
		this.GtkAlignment.LeftPadding = ((uint)(6));
		this.GtkAlignment.RightPadding = ((uint)(6));
		// Container child GtkAlignment.Gtk.Container+ContainerChild
		this.vbox3 = new global::Gtk.VBox ();
		this.vbox3.Name = "vbox3";
		this.vbox3.Homogeneous = true;
		this.vbox3.Spacing = 6;
		// Container child vbox3.Gtk.Box+BoxChild
		this.hbox6 = new global::Gtk.HBox ();
		this.hbox6.Name = "hbox6";
		this.hbox6.Spacing = 6;
		// Container child hbox6.Gtk.Box+BoxChild
		this.label4 = new global::Gtk.Label ();
		this.label4.Name = "label4";
		this.label4.LabelProp = "Ingredient 1:";
		this.hbox6.Add (this.label4);
		global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.label4]));
		w3.Position = 0;
		w3.Expand = false;
		w3.Fill = false;
		// Container child hbox6.Gtk.Box+BoxChild
		this.ingredient1ComboBox = global::Gtk.ComboBox.NewText ();
		this.ingredient1ComboBox.Name = "ingredient1ComboBox";
		this.hbox6.Add (this.ingredient1ComboBox);
		global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.ingredient1ComboBox]));
		w4.Position = 1;
		this.vbox3.Add (this.hbox6);
		global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox6]));
		w5.Position = 0;
		w5.Expand = false;
		w5.Fill = false;
		// Container child vbox3.Gtk.Box+BoxChild
		this.hbox7 = new global::Gtk.HBox ();
		this.hbox7.Name = "hbox7";
		this.hbox7.Spacing = 6;
		// Container child hbox7.Gtk.Box+BoxChild
		this.label5 = new global::Gtk.Label ();
		this.label5.Name = "label5";
		this.label5.LabelProp = "Ingredient 2:";
		this.hbox7.Add (this.label5);
		global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox7 [this.label5]));
		w6.Position = 0;
		w6.Expand = false;
		w6.Fill = false;
		// Container child hbox7.Gtk.Box+BoxChild
		this.ingredient2ComboBox = global::Gtk.ComboBox.NewText ();
		this.ingredient2ComboBox.Name = "ingredient2ComboBox";
		this.hbox7.Add (this.ingredient2ComboBox);
		global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox7 [this.ingredient2ComboBox]));
		w7.Position = 1;
		this.vbox3.Add (this.hbox7);
		global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox7]));
		w8.Position = 1;
		w8.Expand = false;
		w8.Fill = false;
		// Container child vbox3.Gtk.Box+BoxChild
		this.hbox8 = new global::Gtk.HBox ();
		this.hbox8.Name = "hbox8";
		this.hbox8.Spacing = 6;
		// Container child hbox8.Gtk.Box+BoxChild
		this.label6 = new global::Gtk.Label ();
		this.label6.Name = "label6";
		this.label6.LabelProp = "Ingredient 3:";
		this.hbox8.Add (this.label6);
		global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox8 [this.label6]));
		w9.Position = 0;
		w9.Expand = false;
		w9.Fill = false;
		// Container child hbox8.Gtk.Box+BoxChild
		this.ingredient3ComboBox = global::Gtk.ComboBox.NewText ();
		this.ingredient3ComboBox.Name = "ingredient3ComboBox";
		this.hbox8.Add (this.ingredient3ComboBox);
		global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox8 [this.ingredient3ComboBox]));
		w10.Position = 1;
		this.vbox3.Add (this.hbox8);
		global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox8]));
		w11.Position = 2;
		w11.Expand = false;
		w11.Fill = false;
		this.GtkAlignment.Add (this.vbox3);
		this.frame2.Add (this.GtkAlignment);
		this.GtkLabel2 = new global::Gtk.Label ();
		this.GtkLabel2.Name = "GtkLabel2";
		this.GtkLabel2.LabelProp = "<b>Select Ingredients</b>";
		this.GtkLabel2.UseMarkup = true;
		this.frame2.LabelWidget = this.GtkLabel2;
		this.hbox1.Add (this.frame2);
		global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.frame2]));
		w14.Position = 0;
		// Container child hbox1.Gtk.Box+BoxChild
		this.frame3 = new global::Gtk.Frame ();
		this.frame3.Name = "frame3";
		this.frame3.BorderWidth = ((uint)(4));
		// Container child frame3.Gtk.Container+ContainerChild
		this.GtkAlignment1 = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
		this.GtkAlignment1.Name = "GtkAlignment1";
		this.GtkAlignment1.LeftPadding = ((uint)(5));
		this.GtkAlignment1.TopPadding = ((uint)(5));
		this.GtkAlignment1.RightPadding = ((uint)(5));
		this.GtkAlignment1.BottomPadding = ((uint)(6));
		// Container child GtkAlignment1.Gtk.Container+ContainerChild
		this.vbox4 = new global::Gtk.VBox ();
		this.vbox4.WidthRequest = 120;
		this.vbox4.Name = "vbox4";
		this.vbox4.Spacing = 6;
		// Container child vbox4.Gtk.Box+BoxChild
		this.unmodifiedSwatch = new global::DesertPaintLab.PaintSwatch ();
		this.unmodifiedSwatch.Events = ((global::Gdk.EventMask)(256));
		this.unmodifiedSwatch.Name = "unmodifiedSwatch";
		this.vbox4.Add (this.unmodifiedSwatch);
		global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.unmodifiedSwatch]));
		w15.Position = 0;
		// Container child vbox4.Gtk.Box+BoxChild
		this.captureButton = new global::Gtk.Button ();
		this.captureButton.WidthRequest = 100;
		this.captureButton.CanFocus = true;
		this.captureButton.Name = "captureButton";
		this.captureButton.UseUnderline = true;
		this.captureButton.Label = "Capture";
		this.vbox4.Add (this.captureButton);
		global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.captureButton]));
		w16.Position = 1;
		w16.Expand = false;
		w16.Fill = false;
		this.GtkAlignment1.Add (this.vbox4);
		this.frame3.Add (this.GtkAlignment1);
		this.GtkLabel25 = new global::Gtk.Label ();
		this.GtkLabel25.Name = "GtkLabel25";
		this.GtkLabel25.LabelProp = "<b>Unmodified</b>";
		this.GtkLabel25.UseMarkup = true;
		this.frame3.LabelWidget = this.GtkLabel25;
		this.hbox1.Add (this.frame3);
		global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.frame3]));
		w19.Position = 1;
		w19.Expand = false;
		w19.Fill = false;
		// Container child hbox1.Gtk.Box+BoxChild
		this.frame4 = new global::Gtk.Frame ();
		this.frame4.Name = "frame4";
		this.frame4.BorderWidth = ((uint)(4));
		// Container child frame4.Gtk.Container+ContainerChild
		this.GtkAlignment2 = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
		this.GtkAlignment2.WidthRequest = 130;
		this.GtkAlignment2.Name = "GtkAlignment2";
		this.GtkAlignment2.LeftPadding = ((uint)(5));
		this.GtkAlignment2.TopPadding = ((uint)(5));
		this.GtkAlignment2.RightPadding = ((uint)(5));
		this.GtkAlignment2.BottomPadding = ((uint)(6));
		// Container child GtkAlignment2.Gtk.Container+ContainerChild
		this.vbox5 = new global::Gtk.VBox ();
		this.vbox5.WidthRequest = 120;
		this.vbox5.Name = "vbox5";
		this.vbox5.Spacing = 6;
		// Container child vbox5.Gtk.Box+BoxChild
		this.reactionSwatch = new global::DesertPaintLab.PaintSwatch ();
		this.reactionSwatch.Events = ((global::Gdk.EventMask)(256));
		this.reactionSwatch.Name = "reactionSwatch";
		this.vbox5.Add (this.reactionSwatch);
		global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.reactionSwatch]));
		w20.Position = 0;
		// Container child vbox5.Gtk.Box+BoxChild
		this.saveButton = new global::Gtk.Button ();
		this.saveButton.WidthRequest = 100;
		this.saveButton.CanFocus = true;
		this.saveButton.Name = "saveButton";
		this.saveButton.UseUnderline = true;
		this.saveButton.Label = "Record";
		this.vbox5.Add (this.saveButton);
		global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.saveButton]));
		w21.Position = 1;
		w21.Expand = false;
		w21.Fill = false;
		this.GtkAlignment2.Add (this.vbox5);
		this.frame4.Add (this.GtkAlignment2);
		this.GtkLabel26 = new global::Gtk.Label ();
		this.GtkLabel26.Name = "GtkLabel26";
		this.GtkLabel26.LabelProp = "<b>Reaction</b>";
		this.GtkLabel26.UseMarkup = true;
		this.frame4.LabelWidget = this.GtkLabel26;
		this.hbox1.Add (this.frame4);
		global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.frame4]));
		w24.Position = 2;
		w24.Expand = false;
		w24.Fill = false;
		this.vbox1.Add (this.hbox1);
		global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox1]));
		w25.Position = 1;
		// Container child vbox1.Gtk.Box+BoxChild
		this.statusBar = new global::Gtk.Statusbar ();
		this.statusBar.Name = "statusBar";
		this.statusBar.Spacing = 6;
		this.vbox1.Add (this.statusBar);
		global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.statusBar]));
		w26.Position = 2;
		w26.Expand = false;
		w26.Fill = false;
		this.Add (this.vbox1);
		if ((this.Child != null)) {
			this.Child.ShowAll ();
		}
		this.DefaultWidth = 629;
		this.DefaultHeight = 265;
		this.Show ();
		this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
		this.AboutAction.Activated += new global::System.EventHandler (this.OnAbout);
		this.NewProfileAction.Activated += new global::System.EventHandler (this.OnNewProfile);
		this.OpenProfileAction.Activated += new global::System.EventHandler (this.OnOpenProfile);
		this.ExitAction.Activated += new global::System.EventHandler (this.OnMenuExit);
		this.ExportForPracticalPaintAction.Activated += new global::System.EventHandler (this.OnExport);
		this.RunSimulatorAction.Activated += new global::System.EventHandler (this.RunSimulator);
		this.ScreenshotAction.Activated += new global::System.EventHandler (this.OnDebugScreenshot);
		this.RecipesAction.Activated += new global::System.EventHandler (this.OnOpenRecipeGenerator);
		this.ReactionStatusAction.Activated += new global::System.EventHandler (this.OnShowReactionStatus);
		this.IngredientsAction.Activated += new global::System.EventHandler (this.OnShowIngredients);
		this.ExportProfileAction.Activated += new global::System.EventHandler (this.OnExportProfile);
		this.ImportProfileAction.Activated += new global::System.EventHandler (this.OnImportProfile);
		this.ingredient1ComboBox.Changed += new global::System.EventHandler (this.OnChangedIngredient1);
		this.ingredient2ComboBox.Changed += new global::System.EventHandler (this.OnChangedIngredient2);
		this.ingredient3ComboBox.Changed += new global::System.EventHandler (this.OnChangedIngredient3);
		this.captureButton.Clicked += new global::System.EventHandler (this.OnCaptureButton);
		this.saveButton.Clicked += new global::System.EventHandler (this.OnSaveButton);
	}
}