Changeset - dd3cd8c7f2ba
[Not reviewed]
default
0 2 0
Jason Maltzen (jmaltzen) - 9 years ago 2015-12-27 11:01:22
jason.maltzen@unsanctioned.net
Fix up toggling of reagents in recipe generator window.
2 files changed with 12 insertions and 8 deletions:
0 comments (0 inline, 0 general)
RecipeGeneratorWindow.cs
Show inline comments
 
/*
 
 * Copyright (c) 2015, Jason Maltzen
 

	
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 
 of this software and associated documentation files (the "Software"), to deal
 
 in the Software without restriction, including without limitation the rights
 
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
 copies of the Software, and to permit persons to whom the Software is
 
 furnished to do so, subject to the following conditions:
 

	
 
 The above copyright notice and this permission notice shall be included in
 
 all copies or substantial portions of the Software.
 

	
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
 THE SOFTWARE.
 
*/
 

	
 
using System;
 
using System.IO;
 
using System.Collections.Generic;
 
using System.Collections.Concurrent;
 

	
 
namespace DesertPaintLab
 
{
 
    public partial class RecipeGeneratorWindow : Gtk.Window
 
    {
 
        RecipeGenerator generator;
 
        PlayerProfile profile;
 
        bool canceling = false;
 
        bool running = false;
 
        bool pauseForCheckpoint = false;
 

	
 
        const long RECIPE_SAVE_INTERVAL = 30000; // msec between saving recipes
 
        const long CHECKPOINT_INTERVAL = 17000; // msec between saving out generator state
 
        const string STATE_FILE = "dp_generator_state";
 

	
 
        static Gtk.ListStore colorStore = new Gtk.ListStore(typeof(string));
 

	
 
        List<KeyValuePair<string, string>> missingReactions = new List<KeyValuePair<string, string>>();
 

	
 
        long lastProgressUpdate;
 
        long lastStatusUpdate;
 
        long lastProfileSave;
 
        long lastCheckpoint;
 

	
 
        static public Gtk.ListStore RecipeModel
 
        {
 
            get
 
            {
 
                return colorStore;   
 
            }
 
        }
 

	
 
        Gtk.ThreadNotify notifyFinished;
 
        Gtk.ThreadNotify notifyProgress;
 
        Gtk.ThreadNotify notifyNewRecipe;
 

	
 
        ConcurrentQueue<PaintRecipe> pendingNewRecipes = new ConcurrentQueue<PaintRecipe>();
 

	
 
        Gtk.ListStore reagentListStore;
 
        // end reagent view
 

	
 
        public RecipeGeneratorWindow(PlayerProfile profile) : base(Gtk.WindowType.Toplevel)
 
        {
 
            this.profile = profile;
 
            this.Build();
 
            maxIngredientsSpinButton.Value = 5; // TODO: read/save profile info
 
            maxRecipeSpinButton.Value = 20; // TODO: read/save profile info
 
            fullQuantitySpinButton.Value = 20; // TODO: read/save profile info
 
            fullQuantityDepthSpinButton.Value = 4; // TODO: read/save profile info
 

	
 
            fullQuantityDepthSpinButton.SetRange(0, ReagentManager.Names.Count);
 
            maxIngredientsSpinButton.SetRange(0, ReagentManager.Names.Count);
 

	
 

	
 
            Gtk.TreeViewColumn recipeColorColumn = new Gtk.TreeViewColumn();
 
            Gtk.CellRendererText recipeColumnCell = new Gtk.CellRendererText();
 
            recipeColorColumn.PackStart(recipeColumnCell, true);       
 
            recipeColorColumn.Title = "Color";
 

	
 
            recipeList.AppendColumn(recipeColorColumn);
 
            recipeColorColumn.AddAttribute(recipeColumnCell, "text", 0);
 

	
 
            colorStore.Clear();
 

	
 
            colorStore.SetSortColumnId(0, Gtk.SortType.Ascending);
 
            recipeList.Model = RecipeModel;
 

	
 
            recipeList.Selection.Changed += OnColorSelected;
 

	
 
            recipeIngredientsView.AppendColumn("Quantity", new Gtk.CellRendererText(), "text", 0);
 
            recipeIngredientsView.AppendColumn("Ingredient", new Gtk.CellRendererText(), "text", 1);
 
            recipeIngredientsView.Model = new Gtk.ListStore(typeof(string), typeof(string));
 

	
 
            profile.LoadRecipes();
 

	
 
            // init UI
 
            foreach (KeyValuePair<string, PaintRecipe> pair in profile.Recipes)
 
            {
 
                if (pair.Value.IsValid)
 
                {
 
                    string colorName = pair.Key;
 
                    colorStore.AppendValues(colorName);
 
                }
 
            }
 

	
 
            canceling = false;
 
            running = false;
 
            pauseForCheckpoint = false;
 

	
 
            generator = new RecipeGenerator(profile.Reactions);
 
            generator.InitRecipes(profile.Recipes);
 

	
 
            generator.Progress += OnProgress;
 
            generator.Finished += OnFinished;
 
            generator.NewRecipe += OnNewRecipe;
 

	
 
            string stateFile = System.IO.Path.Combine(profile.Directory, STATE_FILE);
 
            if (System.IO.File.Exists(stateFile))
 
            {
 
                generator.LoadState(stateFile);
 
                if (generator.CanResume)
 
                {
 
                    beginButton.Label = "Restart";
 
                    stopResumeButton.Label = "Resume";
 
                    stopResumeButton.Sensitive = true;
 

	
 
                    maxRecipeSpinButton.Value = Math.Max(generator.MaxQuantity, 14); //
 
                    fullQuantitySpinButton.Value = generator.FullQuantity; // TODO: read/save profile info
 
                    fullQuantityDepthSpinButton.Value = generator.FullQuantityDepth; // TODO: read/save profile info
 
                    maxIngredientsSpinButton.Value = generator.MaxReagents;
 
                }
 
            }
 
            //generator.Log = System.IO.Path.Combine(profile.Directory, "dp_log.txt");
 
            countLabel.Text = String.Format("{0} / {1}", profile.RecipeCount, Palette.Count);
 

	
 
            Destroyed += OnDestroyed;
 

	
 
            notifyFinished = new Gtk.ThreadNotify(new Gtk.ReadyEvent(HandleFinished));
 
            notifyProgress = new Gtk.ThreadNotify(new Gtk.ReadyEvent(HandleProgress));
 
            notifyNewRecipe = new Gtk.ThreadNotify(new Gtk.ReadyEvent(HandleNewRecipe));
 

	
 
            // initialize reagent list
 
 
 
            // Add the columns to the TreeView
 
            Gtk.TreeViewColumn reagentEnabledColumn = new Gtk.TreeViewColumn ();
 
            reagentEnabledColumn.Title = "Enabled";
 
            Gtk.CellRendererToggle reagentEnabledCell = new Gtk.CellRendererToggle ();
 
            reagentEnabledCell.Activatable = true;
 
            reagentEnabledCell.Sensitive = true;
 
            reagentEnabledCell.Mode = Gtk.CellRendererMode.Activatable;
 
            reagentEnabledCell.Visible = true;
 
            reagentEnabledCell.Toggled += new Gtk.ToggledHandler(OnReagentEnableToggled);
 
            reagentEnabledColumn.PackStart (reagentEnabledCell, true);
 
            //reagentEnabledColumn.AddAttribute(reagentEnabledCell, "active", 0);
 

	
 
            Gtk.TreeViewColumn reagentNameColumn = new Gtk.TreeViewColumn ();
 
            reagentNameColumn.Title = "Ingredient";
 
            Gtk.CellRendererText reagentNameCell = new Gtk.CellRendererText ();
 
            reagentNameCell.Mode = Gtk.CellRendererMode.Inert;
 
            reagentNameColumn.PackStart (reagentNameCell, true);
 
            reagentNameColumn.AddAttribute(reagentNameCell, "text", 1);
 
            reagentNameColumn.Expand = true;
 

	
 
            Gtk.TreeViewColumn reagentCostColumn = new Gtk.TreeViewColumn ();
 
            reagentCostColumn.Title = "Cost";
 
            Gtk.CellRendererText reagentCostCell = new Gtk.CellRendererText ();
 
            reagentCostCell.Edited += OnReagentCostChanged;
 
            reagentCostCell.Editable = true;
 
            reagentCostCell.Sensitive = true;
 
            reagentCostCell.Mode = Gtk.CellRendererMode.Editable;
 
            reagentCostColumn.PackStart (reagentCostCell, true);
 
            //reagentCostColumn.AddAttribute(reagentCostCell, "text", 0);
 

	
 
            Gtk.TreeViewColumn reagentMaxColumn = new Gtk.TreeViewColumn ();
 
            reagentMaxColumn.Title = "Max";
 
            Gtk.CellRendererText reagentMaxCell = new Gtk.CellRendererText ();
 
            reagentMaxCell.Edited += OnReagentQuantityChanged;
 
            reagentMaxCell.Editable = true;
 
            reagentMaxCell.Sensitive = true;
 
            reagentCostCell.Mode = Gtk.CellRendererMode.Editable;
 
            reagentMaxColumn.PackStart (reagentMaxCell, true);
 
            //reagentMaxColumn.AddAttribute(reagentMaxCell, "text", 0);
 

	
 
            reagentListStore = new Gtk.ListStore(typeof(Reagent), typeof(string), typeof(Reagent), typeof(Reagent));
 
            foreach (string reagentName in ReagentManager.Names)
 
            {
 
                Reagent reagent = ReagentManager.GetReagent(reagentName);
 
                reagentListStore.AppendValues(reagent, reagentName); // , reagent, reagent);
 
            }
 

	
 
            reagentEnabledColumn.SetCellDataFunc (reagentEnabledCell, new Gtk.TreeCellDataFunc (RenderReagentToggle));
 
            reagentCostColumn.SetCellDataFunc (reagentCostCell, new Gtk.TreeCellDataFunc (RenderReagentCost));
 
            reagentMaxColumn.SetCellDataFunc (reagentMaxCell, new Gtk.TreeCellDataFunc (RenderReagentQuantity));
 

	
 
            // Assign the model to the TreeView
 
            reagentListView.Model = reagentListStore;
 
            reagentListView.Sensitive = true;
 

	
 
            reagentListView.AppendColumn(reagentEnabledColumn);
 
            reagentListView.AppendColumn(reagentNameColumn);
 
            reagentListView.AppendColumn(reagentCostColumn);
 
            reagentListView.AppendColumn(reagentMaxColumn);
 

	
 
            reagentListView.
 
            
 
            ShowAll();
 
        }
 

	
 
        protected void OnMaxIngredientsChanged(object sender, EventArgs e)
 
        {
 
            // TODO: save profile setting
 
            // TODO: no longer permit resume
 
        }
 

	
 
        protected void OnMaxRecipeChanged(object sender, EventArgs e)
 
        {
 
            // TODO: save profile setting
 
            // TODO: no longer permit resume
 
        }
 

	
 
        protected void OnFullQuantityDepthChanged(object sender, EventArgs e)
 
        {
 
            // TODO: save profile setting
 
            // TODO: no longer permit resume
 
        }
 

	
 
        protected void OnFullQuantityChanged(object sender, EventArgs e)
 
        {
 
            // TODO: save profile setting
 
            // TODO: no longer permit resume
 
        }
 

	
 
        protected void OnBegin(object sender, EventArgs e)
 
        {
 
            maxIngredientsSpinButton.Sensitive = false;
 
            ExportToWikiAction.Sensitive = false;
 
            IngredientsAction.Sensitive = false;
 
            maxRecipeSpinButton.Sensitive = false;
 
            beginButton.Sensitive = false; // TODO: change to "pause"?
 
            stopResumeButton.Sensitive = true;
 
            fullQuantitySpinButton.Sensitive = false;
 
            fullQuantityDepthSpinButton.Sensitive = false;
 
            reagentListView.Sensitive = false;
 

	
 
            countLabel.Text = String.Format("{0} / {1}", profile.RecipeCount, Palette.Count);
 

	
 
            // TODO: hook up event notifications
 
            // - progress
 
            // - complete
 
            // - new recipe / recipe update
 

	
 
            // Total recipe search count
 
            //int current = ReagentManager.Names.Count;
 
            //long recipePermutations = 1;
 
            //for (int i = 0; i < maxIngredientsSpinButton.ValueAsInt; ++i)
 
            //{
 
            //    recipePermutations *= current;
 
            //    --current;
 
            //}
 
            //System.Console.WriteLine("Will search {0} reagent permutations.", recipePermutations);
 

	
 
            lastProgressUpdate = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 
            lastStatusUpdate = lastProgressUpdate;
 

	
 
            lastProfileSave = lastProgressUpdate;
 
            lastCheckpoint = lastProgressUpdate;
 

	
 
            running = true;
 
            canceling = false;
 
            pauseForCheckpoint = false;
 
            stopResumeButton.Label = "Pause";
 

	
 
            generator.BeginRecipeGeneration((uint)maxRecipeSpinButton.ValueAsInt, (uint)maxIngredientsSpinButton.ValueAsInt, (uint)fullQuantityDepthSpinButton.ValueAsInt, (uint)fullQuantitySpinButton.ValueAsInt);
 
        }
 

	
 
        protected void OnStopResume(object sender, EventArgs e)
 
        {
 
            if (generator != null)
 
            {
 
                if (running)
 
                {
 
                    canceling = true;
 
                    pauseForCheckpoint = false;
 
                    generator.Stop();
 
                }
 
                else
 
                {
 
                    // Resume previous run
 
                    ExportToWikiAction.Sensitive = false;
 
                    IngredientsAction.Sensitive = false;
 
                    reagentListView.Sensitive = false;
 
                    maxIngredientsSpinButton.Sensitive = false;
 
                    maxRecipeSpinButton.Sensitive = false;
 
                    beginButton.Sensitive = false;
 
                    stopResumeButton.Sensitive = true;
 
                    fullQuantitySpinButton.Sensitive = false;
 
                    fullQuantityDepthSpinButton.Sensitive = false;
 
                    reagentListView.Sensitive = false;
 

	
 
                    lastProgressUpdate = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 
                    lastStatusUpdate = lastProgressUpdate;
 
                    lastProfileSave = lastProgressUpdate;
 
                    lastCheckpoint = lastProgressUpdate;
 

	
 
                    canceling = false;
 
                    pauseForCheckpoint = false;
 
                    running = true;
 
        
 
                    stopResumeButton.Label = "Pause";
 
                    generator.ResumeRecipeGeneration();
 
                }
 
            }
 
        }
 

	
 
        private void HandleFinished()
 
        {
 
            generator.Wait();
 
            if (pauseForCheckpoint)
 
            {
 
                pauseForCheckpoint = false;
 
                generator.SaveState(System.IO.Path.Combine(profile.Directory, STATE_FILE));
 
                generator.ResumeRecipeGeneration();
 
            }
 
            else
 
            {
 
                running = false;
 
                beginButton.Sensitive = true;
 
                ExportToWikiAction.Sensitive = true;
 
                IngredientsAction.Sensitive = true;
 
                stopResumeButton.Sensitive = false;
 
                maxIngredientsSpinButton.Sensitive = true;
 
                maxRecipeSpinButton.Sensitive = true;
 
                fullQuantitySpinButton.Sensitive = true;
 
                fullQuantityDepthSpinButton.Sensitive = true;
 
                reagentListView.Sensitive = false;
 
                reagentListView.Sensitive = true;
 
                //generator = null; // don't. Hang on to generator for resume.
 
                profile.SaveRecipes();
 
                if (canceling)
 
                {
 
                    generator.SaveState(System.IO.Path.Combine(profile.Directory, STATE_FILE));
 
                    stopResumeButton.Label = "Resume";
 
                    stopResumeButton.Sensitive = true;
 
                    beginButton.Label = "Restart";
 
                }
 
                else
 
                {
 
                    System.IO.File.Delete(System.IO.Path.Combine(profile.Directory, STATE_FILE));
 
                }
 
            }
 
        }
 

	
 
        protected void OnFinished(object sender, EventArgs args)
 
        {
 
            notifyFinished.WakeupMain();
 
            //Gtk.Application.Invoke(delegate {
 
            //    HandleFinished();
 
            //});
 
        }
 

	
 
        private void HandleNewRecipe()
 
        {
 
            progressBar.Pulse();
 
            
 
            PaintRecipe recipe = null;
 
            if (pendingNewRecipes.TryDequeue(out recipe))
 
            {
 
                string recipeColor = Palette.FindNearest(recipe.ReactedColor);
 
                // TODO: Add item to recipe list only if not already listed
 
                bool exists = false;
 
                Gtk.TreeIter iter;
 
                if (colorStore.GetIterFirst(out iter))
 
                {
 
                    do
 
                    {
 
                        string color = (string)colorStore.GetValue(iter, 0);
 
                        if (color.Equals(recipeColor))
 
                        {
 
                            exists = true;
 
                            break;
 
                        }
 
                    } while (colorStore.IterNext(ref iter));
 
                }
 
                if (!exists)
 
                {
 
                    //Console.WriteLine("Add new recipe for {0}", args.Color);
 
                    //    bool isMissingReactions = args.Recipe.CheckMissingReactions(ref missingReactions);
 
                    //    string missingReactionLabel = isMissingReactions ? "X" : "";
 
                    colorStore.AppendValues(recipeColor); // , missingReactionLabel);
 
                    countLabel.Text = String.Format("{0} / {1}", profile.RecipeCount+1, Palette.Count);
 
                }
 
                profile.SetRecipe(recipe);
 
    
 
                long progressTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 
                long delta = progressTime - lastProfileSave;
 
                if (delta >= RECIPE_SAVE_INTERVAL)
 
                {
 
                    profile.SaveRecipes();
 
                    lastProfileSave = progressTime;
 
                }
 
            }
 
        }
 

	
 
        protected void OnNewRecipe(object sender, NewRecipeEventArgs args)
 
        {
 
            PaintRecipe recipe = new PaintRecipe(args.Recipe); // copy it, so the worker thread can release
 
            lock(this) {
 
                pendingNewRecipes.Enqueue(recipe);
 
            }
 
            notifyNewRecipe.WakeupMain();
 
            //Gtk.Application.Invoke(delegate {
 
            //    HandleNewRecipe();
 
            //});
 
        }
 

	
 
        private void HandleProgress()
 
        {
 
            long progressTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 
            long delta = progressTime - lastProgressUpdate;
 
            if (delta > 30)
 
            {
 
                lastProgressUpdate = progressTime;
 
                progressBar.Pulse();
 
            }
 
            delta = progressTime - lastStatusUpdate;
 
            if (delta > 500)
 
            {
 
                lastStatusUpdate = progressTime;
 
                statusLabel.Text = String.Format("Recipes searched: {0:N00}", generator.RecipeCount);
 
            }
 
            delta = progressTime - lastCheckpoint;
 
            if (delta > CHECKPOINT_INTERVAL)
 
            {
 
                lastCheckpoint = progressTime;
 
                pauseForCheckpoint = true;
 
                generator.Stop();
 
            }
 
        }
 

	
 
        protected void OnProgress(object sender, EventArgs args)
 
        {
 
            notifyProgress.WakeupMain();
 
        }
 

	
 
        protected void OnColorSelected(object o, EventArgs args)
 
        {
 
            Gtk.TreeModel model;
 
            Gtk.TreeIter iter;
 
            Gtk.TreeSelection selection = recipeList.Selection;
 
            if ((selection != null) && selection.GetSelected(out model, out iter))
 
            {
 
                string colorName = (string)colorStore.GetValue(iter, 0);
 
                PaintRecipe recipe;
 
                if (profile.Recipes.TryGetValue(colorName, out recipe))
 
                {
 
                    Gtk.ListStore store = (Gtk.ListStore)recipeIngredientsView.Model;
 
                    store.Clear();
 
                    if (recipe.CheckMissingReactions(ref missingReactions))
 
                    {
 
                        statusLabel.Text = "WARNING: This recipe includes reactions that have not yet been recorded.";
 
                    }
 
                    foreach (PaintRecipe.RecipeIngredient ingredient in recipe.Ingredients)
 
                    {
 
                        store.AppendValues(ingredient.quantity.ToString(), ingredient.name);
 
                    }
 
                }
 
                paintSwatch.Color = recipe.ReactedColor;
 
            }
 
        }
 

	
 
        protected void OnExportToWiki(object sender, EventArgs e)
 
        {
 
            Gtk.FileChooserDialog fileDialog =
 
                new Gtk.FileChooserDialog("Select destination file.",
 
                        this, Gtk.FileChooserAction.Save,
 
                        Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
 
                        Gtk.Stock.Save, Gtk.ResponseType.Accept);
 
            Gtk.ResponseType resp = (Gtk.ResponseType)fileDialog.Run();
 
            if (resp == Gtk.ResponseType.Accept)
 
            {
 
                string fileName = fileDialog.Filename;
 
                string directory = fileDialog.CurrentFolder;
 
                profile.ExportWikiRecipes(System.IO.Path.Combine(directory, fileName));
 
            }
 
            fileDialog.Destroy();
 
        }
 

	
 
        protected void OnShowIngredients(object sender, EventArgs e)
 
        {
 
            ReagentWindow win = new ReagentWindow(profile);
 
            win.Show();
 
        }
 

	
 
        protected void OnDestroyed(object o, EventArgs args)
 
        {
 
            if (running)
 
            {
 
                // window closed while generator running: stop and save
 
                generator.Finished -= OnFinished;
 
                generator.Progress -= OnProgress;
 
                generator.NewRecipe -= OnNewRecipe;
 
                generator.Stop();
 
                generator.Wait();
 
                generator.SaveState(System.IO.Path.Combine(profile.Directory, STATE_FILE));
 
            }
 
        }
 

	
 
        // Reagent view handling
 
        private void RenderReagentToggle (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
 
        {
 
            Reagent reagent = (Reagent) model.GetValue (iter, 0);
 
            Gtk.CellRendererToggle toggle = (cell as Gtk.CellRendererToggle);
 
            toggle.Active = reagent.Enabled;
 
            toggle.Activatable = !reagent.IsCatalyst;
 
            toggle.Mode = reagent.IsCatalyst ? Gtk.CellRendererMode.Inert : Gtk.CellRendererMode.Activatable;
 
        }
 
        private void RenderReagentCost (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
 
        {
 
            Reagent reagent = (Reagent) model.GetValue (iter, 0);
 
            (cell as Gtk.CellRendererText).Text = reagent.Cost.ToString();
 
        }
 
        private void RenderReagentQuantity (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
 
        {
 
            Reagent reagent = (Reagent) model.GetValue (iter, 0);
 
            (cell as Gtk.CellRendererText).Text = reagent.RecipeMax.ToString();
 
        }
 

	
 
        private void OnReagentCostChanged(object o, Gtk.EditedArgs args)
 
        {
 
            uint newCost;
 
            if (uint.TryParse(args.NewText, out newCost))
 
            {
 
                Gtk.TreeIter iter;
 
                reagentListStore.GetIter (out iter, new Gtk.TreePath (args.Path));
 
             
 
                Reagent reagent = (Reagent) reagentListStore.GetValue (iter, 0);
 
                if (reagent.Cost != newCost)
 
                {
 
                    reagent.Cost = newCost;
 
                    SaveReagentSettings();
 
                }
 
            }
 
        }
 

	
 
        private void OnReagentQuantityChanged(object o, Gtk.EditedArgs args)
 
        {
 
            uint newMax;
 
            if (uint.TryParse(args.NewText, out newMax))
 
            {
 
                Gtk.TreeIter iter;
 
                reagentListStore.GetIter (out iter, new Gtk.TreePath (args.Path));
 
             
 
                Reagent reagent = (Reagent) reagentListStore.GetValue (iter, 0);
 
                if (reagent.RecipeMax != newMax)
 
                {
 
                    reagent.RecipeMax = newMax;
 
                    SaveReagentSettings();
 
                }
 
            }
 
        }
 

	
 
        private void OnReagentEnableToggled(object o, Gtk.ToggledArgs args)
 
        {
 
            Gtk.CellRendererToggle btn = (Gtk.CellRendererToggle)o;
 
            Gtk.TreeIter iter;
 
            reagentListStore.GetIter (out iter, new Gtk.TreePath (args.Path));
 
         
 
            Reagent reagent = (Reagent) reagentListStore.GetValue (iter, 0);
 
            if (btn.Active != reagent.Enabled)
 
            {
 
                reagent.Enabled = btn.Active;
 
                SaveReagentSettings();
 
            }
 
            reagent.Enabled = !reagent.Enabled;
 
            SaveReagentSettings();
 
        }
 

	
 
        private void SaveReagentSettings()
 
        {
 
            // save out state
 
            ReagentManager.SaveProfileReagents(profile.ReagentFile);
 
        }
 

	
 
        protected void OnCopyRecipeToClipboard(object sender, EventArgs e)
 
        {
 
            Gtk.TreeModel model;
 
            Gtk.TreeIter iter;
 
            Gtk.Clipboard clipboard = recipeIngredientsView.GetClipboard(Gdk.Selection.Clipboard);
 
            
 
            Gtk.TreeSelection selection = recipeList.Selection;
 
            if ((selection != null) && selection.GetSelected(out model, out iter))
 
            {
 
                string colorName = (string)colorStore.GetValue(iter, 0);
 
                PaintRecipe recipe;
 
                if (profile.Recipes.TryGetValue(colorName, out recipe))
 
                {
 
                    clipboard.Text = recipe.ToString();
 
                }
 
            }
 
        }
 

	
 
        protected void OnCopyRecipeListToClipboard(object sender, EventArgs e)
 
        {
 
            Gtk.Clipboard clipboard = recipeList.GetClipboard(Gdk.Selection.Clipboard);
 

	
 
            StringWriter writer = new StringWriter();
 
            profile.ExportWikiFormat(writer);
 

	
 
            clipboard.Text = writer.ToString();
 
        }
 
    }
 
}
 

	
gtk-gui/gui.stetic
Show inline comments
 
<?xml version="1.0" encoding="utf-8"?>
 
<stetic-interface>
 
  <configuration>
 
    <images-root-path>..</images-root-path>
 
    <target-gtk-version>2.12</target-gtk-version>
 
  </configuration>
 
  <import>
 
    <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
 
    <widget-library name="../bin/Debug/DesertPaintLab.exe" internal="true" />
 
    <widget-library name="../bin/Release/DesertPaintLab.exe" internal="true" />
 
  </import>
 
  <widget class="Gtk.Window" id="MainWindow" design-size="629 265">
 
    <action-group name="Default">
 
      <action id="FileAction">
 
        <property name="Type">Action</property>
 
        <property name="Accelerator">&lt;Alt&gt;f</property>
 
        <property name="Label" translatable="yes">_File</property>
 
        <property name="ShortLabel" translatable="yes">_File</property>
 
      </action>
 
      <action id="HelpAction">
 
        <property name="Type">Action</property>
 
        <property name="Accelerator">&lt;Alt&gt;a</property>
 
        <property name="Label" translatable="yes">_Help</property>
 
        <property name="ShortLabel" translatable="yes">_Help</property>
 
      </action>
 
      <action id="AboutAction">
 
        <property name="Type">Action</property>
 
        <property name="Accelerator">&lt;Alt&gt;a</property>
 
        <property name="Label" translatable="yes">_About...</property>
 
        <property name="ShortLabel" translatable="yes">_About...</property>
 
        <signal name="Activated" handler="OnAbout" />
 
      </action>
 
      <action id="NewProfileAction">
 
        <property name="Type">Action</property>
 
        <property name="Accelerator">&lt;Alt&gt;n</property>
 
        <property name="Label" translatable="yes">_New Profile...</property>
 
        <property name="ShortLabel" translatable="yes">_New Profile...</property>
 
        <signal name="Activated" handler="OnNewProfile" />
 
      </action>
 
      <action id="OpenProfileAction">
 
        <property name="Type">Action</property>
 
        <property name="Accelerator">&lt;Alt&gt;o</property>
 
        <property name="Label" translatable="yes">_Open Profile...</property>
 
        <property name="ShortLabel" translatable="yes">_Open Profile...</property>
 
        <signal name="Activated" handler="OnOpenProfile" />
 
      </action>
 
      <action id="ExitAction">
 
        <property name="Type">Action</property>
 
        <property name="Accelerator">&lt;Alt&gt;x</property>
 
        <property name="Label" translatable="yes">E_xit</property>
 
        <property name="ShortLabel" translatable="yes">E_xit</property>
 
        <signal name="Activated" handler="OnMenuExit" />
 
      </action>
 
      <action id="ExportForPracticalPaintAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Export for _PracticalPaint...</property>
 
        <property name="ShortLabel" translatable="yes">Export for _PracticalPaint...</property>
 
        <signal name="Activated" handler="OnExport" />
 
      </action>
 
      <action id="WindowAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">_Window</property>
 
        <property name="ShortLabel" translatable="yes">_Window</property>
 
      </action>
 
      <action id="RunSimulatorAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">_Run Simulator</property>
 
        <property name="ShortLabel" translatable="yes">_Run Simulator</property>
 
        <signal name="Activated" handler="RunSimulator" />
 
      </action>
 
      <action id="DebugAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Debug</property>
 
        <property name="ShortLabel" translatable="yes">Debug</property>
 
      </action>
 
      <action id="ScreenshotAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Screenshot</property>
 
        <property name="ShortLabel" translatable="yes">Screenshot</property>
 
        <signal name="Activated" handler="OnDebugScreenshot" />
 
      </action>
 
      <action id="RecipesAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Recipes</property>
 
        <property name="ShortLabel" translatable="yes">Recipe Generator</property>
 
        <signal name="Activated" handler="OnOpenRecipeGenerator" />
 
      </action>
 
      <action id="ReactionStatusAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Reaction Status</property>
 
        <property name="ShortLabel" translatable="yes">Reaction Status</property>
 
        <signal name="Activated" handler="OnShowReactionStatus" />
 
      </action>
 
      <action id="IngredientsAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Ingredients</property>
 
        <property name="ShortLabel" translatable="yes">Ingredients</property>
 
        <signal name="Activated" handler="OnShowIngredients" />
 
      </action>
 
      <action id="ExportProfileAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Export Profile</property>
 
        <property name="ShortLabel" translatable="yes">Export Profile</property>
 
        <signal name="Activated" handler="OnExportProfile" />
 
      </action>
 
      <action id="ImportProfileAction">
 
        <property name="Type">Action</property>
 
        <property name="Label" translatable="yes">Import Profile</property>
 
        <property name="ShortLabel" translatable="yes">Import Profile</property>
 
        <signal name="Activated" handler="OnImportProfile" />
 
      </action>
 
    </action-group>
 
    <property name="MemberName" />
 
    <property name="Title" translatable="yes">Desert Paint Lab</property>
 
    <property name="WindowPosition">CenterOnParent</property>
 
    <signal name="DeleteEvent" handler="OnDeleteEvent" />
 
    <child>
 
      <widget class="Gtk.VBox" id="vbox1">
 
        <property name="MemberName" />
 
        <child>
 
          <widget class="Gtk.MenuBar" id="menubar1">
 
            <property name="MemberName" />
 
            <node name="menubar1" type="Menubar">
 
              <node type="Menu" action="FileAction">
 
                <node type="Menuitem" action="NewProfileAction" />
 
                <node type="Menuitem" action="OpenProfileAction" />
 
                <node type="Menuitem" action="ExportForPracticalPaintAction" />
 
                <node type="Menuitem" action="ExportProfileAction" />
 
                <node type="Menuitem" action="ImportProfileAction" />
 
                <node type="Separator" />
 
                <node type="Menuitem" action="ExitAction" />
 
              </node>
 
              <node type="Menu" action="WindowAction">
 
                <node type="Menuitem" action="RunSimulatorAction" />
 
                <node type="Menuitem" action="RecipesAction" />
 
                <node type="Menuitem" action="IngredientsAction" />
 
              </node>
 
              <node type="Menu" action="HelpAction">
 
                <node type="Menuitem" action="AboutAction" />
 
                <node type="Menuitem" action="ReactionStatusAction" />
 
              </node>
 
              <node type="Menu" action="DebugAction">
 
                <node type="Menuitem" action="ScreenshotAction" />
 
              </node>
 
            </node>
 
          </widget>
 
          <packing>
 
            <property name="Position">0</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.HBox" id="hbox1">
 
            <property name="MemberName" />
 
            <property name="Spacing">6</property>
 
            <property name="BorderWidth">4</property>
 
            <child>
 
              <widget class="Gtk.Frame" id="frame2">
 
                <property name="MemberName" />
 
                <property name="BorderWidth">4</property>
 
                <child>
 
                  <widget class="Gtk.Alignment" id="GtkAlignment">
 
                    <property name="MemberName" />
 
                    <property name="Xalign">0</property>
 
                    <property name="Yalign">0</property>
 
                    <property name="LeftPadding">6</property>
 
                    <property name="RightPadding">6</property>
 
                    <child>
 
                      <widget class="Gtk.VBox" id="vbox3">
 
                        <property name="MemberName" />
 
                        <property name="Homogeneous">True</property>
 
                        <property name="Spacing">6</property>
 
                        <child>
 
                          <widget class="Gtk.HBox" id="hbox6">
 
                            <property name="MemberName" />
 
                            <property name="Spacing">6</property>
 
                            <child>
 
                              <widget class="Gtk.Label" id="label4">
 
                                <property name="MemberName" />
 
                                <property name="LabelProp" translatable="yes">Ingredient 1:</property>
 
                              </widget>
 
                              <packing>
 
                                <property name="Position">0</property>
 
                                <property name="AutoSize">True</property>
 
                                <property name="Expand">False</property>
 
                                <property name="Fill">False</property>
 
                              </packing>
 
                            </child>
 
                            <child>
 
                              <widget class="Gtk.ComboBox" id="ingredient1ComboBox">
 
                                <property name="MemberName" />
 
                                <property name="IsTextCombo">True</property>
 
                                <property name="Items" translatable="yes" />
 
                                <signal name="Changed" handler="OnChangedIngredient1" />
 
                              </widget>
 
                              <packing>
 
                                <property name="Position">1</property>
 
                                <property name="AutoSize">False</property>
 
                              </packing>
 
                            </child>
 
                          </widget>
 
                          <packing>
 
                            <property name="Position">0</property>
 
                            <property name="AutoSize">True</property>
 
                            <property name="Expand">False</property>
 
                            <property name="Fill">False</property>
 
                          </packing>
 
                        </child>
 
                        <child>
 
                          <widget class="Gtk.HBox" id="hbox7">
 
                            <property name="MemberName" />
 
                            <property name="Spacing">6</property>
 
                            <child>
 
                              <widget class="Gtk.Label" id="label5">
 
                                <property name="MemberName" />
 
                                <property name="LabelProp" translatable="yes">Ingredient 2:</property>
 
                              </widget>
 
                              <packing>
 
                                <property name="Position">0</property>
 
                                <property name="AutoSize">True</property>
 
                                <property name="Expand">False</property>
 
                                <property name="Fill">False</property>
 
                              </packing>
 
                            </child>
 
                            <child>
 
                              <widget class="Gtk.ComboBox" id="ingredient2ComboBox">
 
                                <property name="MemberName" />
 
                                <property name="IsTextCombo">True</property>
 
                                <property name="Items" translatable="yes" />
 
                                <signal name="Changed" handler="OnChangedIngredient2" />
 
                              </widget>
 
                              <packing>
 
                                <property name="Position">1</property>
 
                                <property name="AutoSize">False</property>
 
                              </packing>
 
                            </child>
 
                          </widget>
 
                          <packing>
 
                            <property name="Position">1</property>
 
                            <property name="AutoSize">True</property>
 
                            <property name="Expand">False</property>
 
                            <property name="Fill">False</property>
 
                          </packing>
 
                        </child>
 
                        <child>
 
                          <widget class="Gtk.HBox" id="hbox8">
 
                            <property name="MemberName" />
 
                            <property name="Spacing">6</property>
 
                            <child>
 
                              <widget class="Gtk.Label" id="label6">
 
                                <property name="MemberName" />
 
                                <property name="LabelProp" translatable="yes">Ingredient 3:</property>
 
                              </widget>
 
                              <packing>
 
                                <property name="Position">0</property>
 
                                <property name="AutoSize">True</property>
 
                                <property name="Expand">False</property>
 
                                <property name="Fill">False</property>
 
                              </packing>
 
                            </child>
 
                            <child>
 
                              <widget class="Gtk.ComboBox" id="ingredient3ComboBox">
 
                                <property name="MemberName" />
 
                                <property name="IsTextCombo">True</property>
 
                                <property name="Items" translatable="yes" />
 
                                <signal name="Changed" handler="OnChangedIngredient3" />
 
                              </widget>
 
                              <packing>
 
                                <property name="Position">1</property>
 
                                <property name="AutoSize">False</property>
 
                              </packing>
 
                            </child>
 
                          </widget>
 
                          <packing>
 
                            <property name="Position">2</property>
 
                            <property name="AutoSize">True</property>
 
                            <property name="Expand">False</property>
 
                            <property name="Fill">False</property>
 
                          </packing>
 
                        </child>
 
                      </widget>
 
                    </child>
 
                  </widget>
 
                </child>
 
                <child>
 
                  <widget class="Gtk.Label" id="GtkLabel2">
 
                    <property name="MemberName" />
 
                    <property name="LabelProp" translatable="yes">&lt;b&gt;Select Ingredients&lt;/b&gt;</property>
 
                    <property name="UseMarkup">True</property>
 
                  </widget>
 
                  <packing>
 
                    <property name="type">label_item</property>
 
                  </packing>
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">0</property>
 
                <property name="AutoSize">False</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Frame" id="frame3">
 
                <property name="MemberName" />
 
                <property name="BorderWidth">4</property>
 
                <child>
 
                  <widget class="Gtk.Alignment" id="GtkAlignment1">
 
                    <property name="MemberName" />
 
                    <property name="Xalign">0</property>
 
                    <property name="Yalign">0</property>
 
                    <property name="LeftPadding">5</property>
 
                    <property name="TopPadding">5</property>
 
                    <property name="RightPadding">5</property>
 
                    <property name="BottomPadding">6</property>
 
                    <child>
 
                      <widget class="Gtk.VBox" id="vbox4">
 
                        <property name="MemberName" />
 
                        <property name="WidthRequest">120</property>
 
                        <property name="Spacing">6</property>
 
                        <child>
 
                          <widget class="DesertPaintLab.PaintSwatch" id="unmodifiedSwatch">
 
                            <property name="MemberName" />
 
                            <property name="Events">ButtonPressMask</property>
 
                          </widget>
 
                          <packing>
 
                            <property name="Position">0</property>
 
                            <property name="AutoSize">True</property>
 
                          </packing>
 
                        </child>
 
                        <child>
 
                          <widget class="Gtk.Button" id="captureButton">
 
                            <property name="MemberName" />
 
                            <property name="WidthRequest">100</property>
 
                            <property name="CanFocus">True</property>
 
                            <property name="Type">TextOnly</property>
 
                            <property name="Label" translatable="yes">Capture</property>
 
                            <property name="UseUnderline">True</property>
 
                            <signal name="Clicked" handler="OnCaptureButton" />
 
                          </widget>
 
                          <packing>
 
                            <property name="Position">1</property>
 
                            <property name="AutoSize">True</property>
 
                            <property name="Expand">False</property>
 
                            <property name="Fill">False</property>
 
                          </packing>
 
                        </child>
 
                      </widget>
 
                    </child>
 
                  </widget>
 
                </child>
 
                <child>
 
                  <widget class="Gtk.Label" id="GtkLabel25">
 
                    <property name="MemberName" />
 
                    <property name="LabelProp" translatable="yes">&lt;b&gt;Unmodified&lt;/b&gt;</property>
 
                    <property name="UseMarkup">True</property>
 
                  </widget>
 
                  <packing>
 
                    <property name="type">label_item</property>
 
                  </packing>
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">1</property>
 
                <property name="AutoSize">True</property>
 
                <property name="Expand">False</property>
 
                <property name="Fill">False</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Frame" id="frame4">
 
                <property name="MemberName" />
 
                <property name="BorderWidth">4</property>
 
                <child>
 
                  <widget class="Gtk.Alignment" id="GtkAlignment2">
 
                    <property name="MemberName" />
 
                    <property name="WidthRequest">130</property>
 
                    <property name="Xalign">0</property>
 
                    <property name="Yalign">0</property>
 
                    <property name="LeftPadding">5</property>
 
                    <property name="TopPadding">5</property>
 
                    <property name="RightPadding">5</property>
 
                    <property name="BottomPadding">6</property>
 
                    <child>
 
                      <widget class="Gtk.VBox" id="vbox5">
 
                        <property name="MemberName" />
 
                        <property name="WidthRequest">120</property>
 
                        <property name="Spacing">6</property>
 
                        <child>
 
                          <widget class="DesertPaintLab.PaintSwatch" id="reactionSwatch">
 
                            <property name="MemberName" />
 
                            <property name="Events">ButtonPressMask</property>
 
                          </widget>
 
                          <packing>
 
                            <property name="Position">0</property>
 
                            <property name="AutoSize">True</property>
 
                          </packing>
 
                        </child>
 
                        <child>
 
                          <widget class="Gtk.Button" id="saveButton">
 
                            <property name="MemberName" />
 
                            <property name="WidthRequest">100</property>
 
                            <property name="CanFocus">True</property>
 
                            <property name="Type">TextOnly</property>
 
                            <property name="Label" translatable="yes">Record</property>
 
                            <property name="UseUnderline">True</property>
 
                            <signal name="Clicked" handler="OnSaveButton" />
 
                          </widget>
 
                          <packing>
 
                            <property name="Position">1</property>
 
                            <property name="AutoSize">True</property>
 
                            <property name="Expand">False</property>
 
                            <property name="Fill">False</property>
 
                          </packing>
 
                        </child>
 
                      </widget>
 
                    </child>
 
                  </widget>
 
                </child>
 
                <child>
 
                  <widget class="Gtk.Label" id="GtkLabel26">
 
                    <property name="MemberName" />
 
                    <property name="LabelProp" translatable="yes">&lt;b&gt;Reaction&lt;/b&gt;</property>
 
                    <property name="UseMarkup">True</property>
 
                  </widget>
 
                  <packing>
 
                    <property name="type">label_item</property>
 
                  </packing>
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">2</property>
 
                <property name="AutoSize">True</property>
 
                <property name="Expand">False</property>
 
                <property name="Fill">False</property>
 
              </packing>
 
            </child>
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="AutoSize">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Statusbar" id="statusBar">
 
            <property name="MemberName" />
 
            <property name="Spacing">6</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">2</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
  </widget>
 
  <widget class="Gtk.Dialog" id="DesertPaintLab.FirstRunDialog" design-size="416 189">
 
    <property name="MemberName" />
 
    <property name="Title" translatable="yes">Set Up Profile</property>
 
    <property name="WindowPosition">CenterOnParent</property>
 
    <property name="Modal">True</property>
 
    <property name="AllowShrink">True</property>
 
    <property name="Buttons">3</property>
 
    <property name="HelpButton">False</property>
 
    <child internal-child="VBox">
 
      <widget class="Gtk.VBox" id="dialog1_VBox">
 
        <property name="MemberName" />
 
        <property name="BorderWidth">2</property>
 
        <child>
 
          <widget class="Gtk.Label" id="label2">
 
            <property name="MemberName" />
 
            <property name="LabelProp" translatable="yes">Since this is your first time using this program, you need a new profile.
 

	
 
You can either import an existing PracticalPaint reactions.txt file, or you can start a new profile from scratch.</property>
 
            <property name="Wrap">True</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">0</property>
 
            <property name="AutoSize">False</property>
 
            <property name="Padding">5</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
    <child internal-child="ActionArea">
 
      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
 
        <property name="MemberName" />
 
        <property name="Spacing">10</property>
 
        <property name="BorderWidth">5</property>
 
        <property name="Size">3</property>
 
        <property name="LayoutStyle">End</property>
 
        <child>
 
          <widget class="Gtk.Button" id="buttonCancel">
 
            <property name="MemberName" />
 
            <property name="CanDefault">True</property>
 
            <property name="CanFocus">True</property>
 
            <property name="UseStock">True</property>
 
            <property name="Type">StockItem</property>
 
            <property name="StockId">gtk-cancel</property>
 
            <property name="ResponseId">-6</property>
 
            <property name="label">gtk-cancel</property>
 
          </widget>
 
          <packing>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Button" id="buttonImport">
 
            <property name="MemberName" />
 
            <property name="CanDefault">True</property>
 
            <property name="CanFocus">True</property>
 
            <property name="Type">TextOnly</property>
 
            <property name="Label" translatable="yes">Import reactions.txt</property>
 
            <property name="UseUnderline">True</property>
 
            <property name="ResponseId">-3</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Button" id="buttonNew">
 
            <property name="MemberName" />
 
            <property name="CanFocus">True</property>
 
            <property name="Type">TextOnly</property>
 
            <property name="Label" translatable="yes">New Profile</property>
 
            <property name="UseUnderline">True</property>
 
            <property name="ResponseId">-5</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">2</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
  </widget>
 
  <widget class="Gtk.Dialog" id="DesertPaintLab.SelectProfileDialog" design-size="400 288">
 
    <property name="MemberName" />
 
    <property name="Title" translatable="yes">Open Profile</property>
 
    <property name="WindowPosition">CenterOnParent</property>
 
    <property name="Modal">True</property>
 
    <property name="BorderWidth">5</property>
 
    <property name="Buttons">3</property>
 
    <property name="HelpButton">False</property>
 
    <child internal-child="VBox">
 
      <widget class="Gtk.VBox" id="dialog1_VBox">
 
        <property name="MemberName" />
 
        <property name="Spacing">10</property>
 
        <property name="BorderWidth">2</property>
 
        <child>
 
          <widget class="Gtk.Label" id="label3">
 
            <property name="MemberName" />
 
            <property name="LabelProp" translatable="yes">Select the profile you would like to open:</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">0</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.TreeView" id="profileListView">
 
            <property name="MemberName" />
 
            <property name="CanFocus">True</property>
 
            <property name="EnableSearch">False</property>
 
            <signal name="CursorChanged" handler="OnCursorChanged" />
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="AutoSize">True</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
    <child internal-child="ActionArea">
 
      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
 
        <property name="MemberName" />
 
        <property name="Spacing">10</property>
 
        <property name="BorderWidth">5</property>
 
        <property name="Size">3</property>
 
        <property name="LayoutStyle">End</property>
 
        <child>
 
          <widget class="Gtk.Button" id="buttonCancel">
 
            <property name="MemberName" />
 
            <property name="CanDefault">True</property>
 
            <property name="CanFocus">True</property>
 
            <property name="UseStock">True</property>
 
            <property name="Type">StockItem</property>
 
            <property name="StockId">gtk-cancel</property>
 
            <property name="ResponseId">-6</property>
 
            <property name="label">gtk-cancel</property>
 
          </widget>
 
          <packing>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Button" id="button56">
 
            <property name="MemberName" />
 
            <property name="CanFocus">True</property>
 
            <property name="Type">TextOnly</property>
 
            <property name="Label" translatable="yes">New Profile</property>
 
            <property name="UseUnderline">True</property>
 
            <property name="ResponseId">-3</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Button" id="buttonOk">
 
            <property name="MemberName" />
 
            <property name="CanDefault">True</property>
 
            <property name="CanFocus">True</property>
 
            <property name="UseStock">True</property>
 
            <property name="Type">StockItem</property>
 
            <property name="StockId">gtk-ok</property>
 
            <property name="ResponseId">-5</property>
 
            <property name="label">gtk-ok</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">2</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
  </widget>
 
  <widget class="Gtk.Dialog" id="DesertPaintLab.NewProfileDialog" design-size="318 177">
 
    <property name="MemberName" />
 
    <property name="Title" translatable="yes">New Profile</property>
 
    <property name="WindowPosition">CenterOnParent</property>
 
    <property name="BorderWidth">5</property>
 
    <property name="Buttons">2</property>
 
    <property name="HelpButton">False</property>
 
    <child internal-child="VBox">
 
      <widget class="Gtk.VBox" id="dialog1_VBox">
 
        <property name="MemberName" />
 
        <property name="Spacing">10</property>
 
        <property name="BorderWidth">9</property>
 
        <child>
 
          <widget class="Gtk.Label" id="label1">
 
            <property name="MemberName" />
 
            <property name="LabelProp" translatable="yes">Name your new profile:</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">0</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Entry" id="profileNameEntry">
 
            <property name="MemberName" />
 
            <property name="CanFocus">True</property>
 
            <property name="IsEditable">True</property>
 
            <property name="InvisibleChar">●</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
    <child internal-child="ActionArea">
 
      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
 
        <property name="MemberName" />
 
        <property name="Spacing">10</property>
 
        <property name="BorderWidth">5</property>
 
        <property name="Size">2</property>
 
        <property name="LayoutStyle">End</property>
 
        <child>
 
          <widget class="Gtk.Button" id="buttonCancel">
 
            <property name="MemberName" />
 
            <property name="CanDefault">True</property>
 
            <property name="CanFocus">True</property>
 
            <property name="UseStock">True</property>
 
            <property name="Type">StockItem</property>
 
            <property name="StockId">gtk-cancel</property>
 
            <property name="ResponseId">-6</property>
 
            <property name="label">gtk-cancel</property>
 
          </widget>
 
          <packing>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Button" id="buttonOk">
 
            <property name="MemberName" />
 
            <property name="CanDefault">True</property>
 
            <property name="CanFocus">True</property>
 
            <property name="UseStock">True</property>
 
            <property name="Type">StockItem</property>
 
            <property name="StockId">gtk-ok</property>
 
            <property name="ResponseId">-5</property>
 
            <property name="label">gtk-ok</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
  </widget>
 
  <widget class="Gtk.Bin" id="DesertPaintLab.PaintSwatch" design-size="245 235">
 
    <property name="MemberName" />
 
    <property name="Visible">False</property>
 
    <child>
 
      <widget class="Gtk.VBox" id="vbox1">
 
        <property name="MemberName" />
 
        <property name="Spacing">6</property>
 
        <child>
 
          <widget class="Gtk.Label" id="colorNameLabel">
 
            <property name="MemberName" />
 
            <property name="LabelProp" translatable="yes">Unknown</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">0</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.DrawingArea" id="colorBox">
 
            <property name="MemberName" />
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="AutoSize">True</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.Label" id="rgbLabel">
 
            <property name="MemberName" />
 
            <property name="LabelProp" translatable="yes">???, ???, ???</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">2</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
  </widget>
 
  <widget class="Gtk.Window" id="DesertPaintLab.SimulatorWindow" design-size="804 390">
 
    <property name="MemberName" />
 
    <property name="Title" translatable="yes">Simulator</property>
 
    <property name="WindowPosition">CenterOnParent</property>
 
    <child>
 
      <widget class="Gtk.HBox" id="hbox1">
 
        <property name="MemberName" />
 
        <property name="Spacing">6</property>
 
        <property name="BorderWidth">12</property>
 
        <child>
 
          <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
 
            <property name="MemberName" />
 
            <property name="ShadowType">In</property>
 
            <child>
 
              <widget class="Gtk.TreeView" id="reagentListView">
 
                <property name="MemberName" />
 
                <property name="CanFocus">True</property>
 
                <property name="ShowScrollbars">True</property>
 
              </widget>
 
            </child>
 
          </widget>
 
          <packing>
 
            <property name="Position">0</property>
 
            <property name="AutoSize">True</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.VBox" id="vbox162">
 
            <property name="MemberName" />
 
            <property name="Spacing">6</property>
 
            <child>
 
              <widget class="Gtk.Alignment" id="alignment1">
 
                <property name="MemberName" />
 
                <child>
 
                  <placeholder />
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">0</property>
 
                <property name="AutoSize">True</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Button" id="addReagentButton">
 
                <property name="MemberName" />
 
                <property name="CanFocus">True</property>
 
                <property name="Type">Custom</property>
 
                <signal name="Clicked" handler="OnAddReagent" />
 
                <child>
 
                  <widget class="Gtk.Image" id="addReagentButtonImage">
 
                    <property name="MemberName" />
 
                    <property name="Pixbuf">stock:gtk-go-forward Menu</property>
 
                  </widget>
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">1</property>
 
                <property name="AutoSize">True</property>
 
                <property name="Expand">False</property>
 
                <property name="Fill">False</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Alignment" id="alignment3">
 
                <property name="MemberName" />
 
                <child>
 
                  <placeholder />
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">2</property>
 
                <property name="AutoSize">True</property>
 
              </packing>
 
            </child>
 
          </widget>
 
          <packing>
 
            <property name="Position">1</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow1">
 
            <property name="MemberName" />
 
            <property name="ShadowType">In</property>
 
            <child>
 
              <widget class="Gtk.TreeView" id="recipeView">
 
                <property name="MemberName" />
 
                <property name="CanFocus">True</property>
 
                <property name="ShowScrollbars">True</property>
 
                <property name="EnableSearch">False</property>
 
                <property name="Reorderable">True</property>
 
              </widget>
 
            </child>
 
          </widget>
 
          <packing>
 
            <property name="Position">2</property>
 
            <property name="AutoSize">True</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="Gtk.VBox" id="vbox3">
 
            <property name="MemberName" />
 
            <property name="Spacing">6</property>
 
            <child>
 
              <widget class="Gtk.Alignment" id="alignment2">
 
                <property name="MemberName" />
 
                <child>
 
                  <placeholder />
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">0</property>
 
                <property name="AutoSize">True</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Button" id="button65">
 
                <property name="MemberName" />
 
                <property name="CanFocus">True</property>
 
                <property name="Type">Custom</property>
 
                <signal name="Clicked" handler="OnIncrementReagent" />
 
                <child>
 
                  <widget class="Gtk.Image" id="image1">
 
                    <property name="MemberName" />
 
                    <property name="Pixbuf">stock:gtk-add Menu</property>
 
                  </widget>
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">1</property>
 
                <property name="AutoSize">True</property>
 
                <property name="Expand">False</property>
 
                <property name="Fill">False</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Button" id="button66">
 
                <property name="MemberName" />
 
                <property name="CanFocus">True</property>
 
                <property name="Type">Custom</property>
 
                <signal name="Clicked" handler="OnDecrementReagent" />
 
                <child>
 
                  <widget class="Gtk.Image" id="image2">
 
                    <property name="MemberName" />
 
                    <property name="Pixbuf">stock:gtk-remove Menu</property>
 
                  </widget>
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">2</property>
 
                <property name="AutoSize">True</property>
 
                <property name="Expand">False</property>
 
                <property name="Fill">False</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Button" id="button67">
 
                <property name="MemberName" />
 
                <property name="CanFocus">True</property>
 
                <property name="Type">Custom</property>
 
                <signal name="Clicked" handler="OnFlushReagents" />
 
                <child>
 
                  <widget class="Gtk.Image" id="image3">
 
                    <property name="MemberName" />
 
                    <property name="Pixbuf">stock:gtk-goto-first Menu</property>
 
                  </widget>
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">3</property>
 
                <property name="AutoSize">True</property>
 
                <property name="Expand">False</property>
 
                <property name="Fill">False</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <widget class="Gtk.Alignment" id="alignment4">
 
                <property name="MemberName" />
 
                <child>
 
                  <placeholder />
 
                </child>
 
              </widget>
 
              <packing>
 
                <property name="Position">4</property>
 
                <property name="AutoSize">True</property>
 
              </packing>
 
            </child>
 
          </widget>
 
          <packing>
 
            <property name="Position">3</property>
 
            <property name="AutoSize">True</property>
 
            <property name="Expand">False</property>
 
            <property name="Fill">False</property>
 
          </packing>
 
        </child>
 
        <child>
 
          <widget class="DesertPaintLab.PaintSwatch" id="paintSwatch">
 
            <property name="MemberName" />
 
            <property name="WidthRequest">200</property>
 
            <property name="Events">ButtonPressMask</property>
 
          </widget>
 
          <packing>
 
            <property name="Position">4</property>
 
            <property name="AutoSize">False</property>
 
          </packing>
 
        </child>
 
      </widget>
 
    </child>
 
  </widget>
 
  <widget class="Gtk.Dialog" id="DesertPaintLab.ScreenCheckDialog" design-size="378 245">
 
    <property name="MemberName" />
 
    <property name="Title" translatable="yes">Screen Check</property>
 
    <property name="WindowPosition">CenterOnParent</property>
 
    <property name="Modal">True</property>
 
    <property name="BorderWidth">9</property>
 
    <property name="Buttons">1</property>
 
    <property name="HelpButton">False</property>
 
    <child internal-child="VBox">
 
      <widget class="Gtk.VBox" id="dialog1_VBox">
 
        <property name="MemberName" />
 
        <child>
 
          <widget class="Gtk.VBox" id="vbox2">
 
            <property name="MemberName" />
 
            <property name="Spacing">20</property>
 
            <property name="BorderWidth">20</property>
 
            <child>
 
              <widget class="Gtk.HBox" id="hbox1">
 
                <property name="MemberName" />
 
                <property name="Spacing">20</property>
 
                <property name="BorderWidth">10</property>
 
                <child>
 
                  <widget class="Gtk.Label" id="label1">
 
                    <property name="MemberName" />
 
                    <property name="LabelProp" translatable="yes">Screen Resolution</property>
 
                  </widget>
 
                  <packing>
 
                    <property name="Position">0</property>
 
                    <property name="AutoSize">True</property>
 
                    <property name="Expand">False</property>
 
                    <property name="Fill">False</property>
 
                  </packing>
 
                </child>
 
                <child>
 
                  <widget class="Gtk.Entry" id="screenWidthEntry">
 
                    <property name="MemberName" />
 
                    <property name="WidthRequest">50</property>
 
                    <property name="CanFocus">True</property>
 
                    <property name="IsEditable">True</property>
 
                    <property name="InvisibleChar">●</property>
 
                  </widget>
 
                  <packing>
 
                    <property name="Position">1</property>
 
                    <property name="AutoSize">True</property>
 
                  </packing>
 
                </child>
 
                <child>
 
                  <widget class="Gtk.Entry" id="screenHeightEntry">
 
                    <property name="MemberName" />
 
                    <property name="WidthRequest">50</property>
 
                    <property name="CanFocus">True</property>
 
                    <property name="IsEditable">True</property>
 
                    <property name="InvisibleChar">●</property>
 
                  </widget>
 
                  <packing>
 
                    <property name="Position">2</property>
 
                    <property name="AutoSize">True</property>
0 comments (0 inline, 0 general)