Changeset - e53fa6e66029
[Not reviewed]
T9_V7 default
0 2 0
Jason Maltzen - 5 years ago 2019-11-08 22:36:00
jason@hiddenachievement.com
Add a button for marking a reaction as 'no reaction'
2 files changed with 62 insertions and 9 deletions:
0 comments (0 inline, 0 general)
UI/CaptureView.cs
Show inline comments
...
 
@@ -79,8 +79,9 @@ namespace DesertPaintLab
 
        public void DisableRecord()
 
        {
 
            recordEnabled = false;
 
            recordButton.Sensitive = false;
 
            recordNoReactionButton.Sensitive = false;
 
        }
 

	
 
        public void EnableRecord()
 
        {
...
 
@@ -153,10 +154,13 @@ namespace DesertPaintLab
 
            bool reactionKnown = true;
 
            
 
            isCaptured = false;
 
            recordButton.Sensitive = false;
 
            recordNoReactionButton.Sensitive = false;
 
            clearReactionButton.Sensitive = false;
 
            clearReactionButton.Visible = false;
 
            recordNoReactionButton.Sensitive = false;
 
            recordNoReactionButton.Visible = false;
 
    
 
            recipe.Clear();
 
            
 
            if ((reagentName = GetSelectedReagentName(1)) == null)
...
 
@@ -166,8 +170,10 @@ namespace DesertPaintLab
 
                ingredient3ComboBox.Sensitive = false;
 
                unmodifiedSwatch.Clear();
 
                reactionSwatch.Clear();
 
                captureButton.Sensitive = false;
 
                recordNoReactionButton.Sensitive = false;
 
                recordNoReactionButton.Visible = false;
 
                return;
 
            }
 
            recipe.AddReagent(reagentName);
 
            reagents[0] = ReagentManager.GetReagent(reagentName);
...
 
@@ -175,8 +181,10 @@ namespace DesertPaintLab
 
            if ((reagentName = GetSelectedReagentName(2)) == null)
 
            {
 
                ingredient3ComboBox.Sensitive = false;
 
                recordButton.Sensitive = false;
 
                recordNoReactionButton.Sensitive = false;
 
                recordNoReactionButton.Visible = false;
 
                reactionKnown = false;
 
                reactionSwatch.Clear();
 
                return;
 
            }
...
 
@@ -184,21 +192,26 @@ namespace DesertPaintLab
 
            recipe.AddReagent(reagentName);
 
            reagents[1] = ReagentManager.GetReagent(reagentName);
 
            ingredient3ComboBox.Sensitive = true;
 
            captureButton.Sensitive = true;
 
            
 
            recordNoReactionButton.Sensitive = true;
 

	
 
            reaction1 = profile.FindReaction(reagents[0], reagents[1]);
 
            
 
            // TODO: really should handle reagent0==reagent1 better
 
            if ((reaction1 != null) || (reagents[0] == reagents[1]))
 
            {
 
                clearReactionButton.Sensitive = recordEnabled;
 
                clearReactionButton.Visible = true;
 
                ingredient3ComboBox.Sensitive = true;
 
                recordNoReactionButton.Sensitive = false;
 
                recordNoReactionButton.Visible = false;
 
                if ((reagentName = GetSelectedReagentName(3)) != null)
 
                {
 
                    clearReactionButton.Sensitive = false;
 
                    clearReactionButton.Visible = false;
 
                    recordNoReactionButton.Sensitive = false;
 
                    recordNoReactionButton.Visible = false;
 
                    recipe.AddReagent(reagentName);
 
                    reagents[2] = ReagentManager.GetReagent(reagentName);
 
            
 
                    if (!reactionKnown)
...
 
@@ -247,10 +260,12 @@ namespace DesertPaintLab
 
            else
 
            {
 
                reactionKnown = false;
 
                ingredient3ComboBox.Sensitive = false;
 
                recordNoReactionButton.Sensitive = recordEnabled;
 
                recordNoReactionButton.Visible = true;
 
            }
 
        
 

 
            expectedColor.Set(recipe.BaseColor);
 
            unmodifiedSwatch.Color = expectedColor;
 
            //SetExpectedColor(recipeColor.Red, recipeColor.Green, recipeColor.Blue);
 
            
...
 
@@ -271,11 +286,13 @@ namespace DesertPaintLab
 
            ingredient1ComboBox.Sensitive = false;
 
            ingredient2ComboBox.Sensitive = false;
 
            ingredient3ComboBox.Sensitive = false;
 
            clearReactionButton.Sensitive = false;
 
            recordNoReactionButton.Sensitive = false;
 

	
 
            progressBar.Show();
 
            recordButton.Hide();
 
            recordNoReactionButton.Hide();
 

	
 
            bool enableDebugMenu;
 
            AppSettings.Get("EnableDebugMenu", out enableDebugMenu, false);
 

	
...
 
@@ -427,12 +444,14 @@ namespace DesertPaintLab
 
                    md.Run();
 
                    md.Destroy();
 
                    // reaction clipped - don't let them record
 
                    recordButton.Sensitive = false;
 
                    recordNoReactionButton.Sensitive = false;
 
                }
 
                else
 
                {
 
                    recordButton.Sensitive = recordEnabled;
 
                    recordNoReactionButton.Sensitive = false;
 
                }
 
            }
 
            else
 
            {
...
 
@@ -557,9 +576,22 @@ namespace DesertPaintLab
 
            {
 
                recordButton.Sensitive = false;
 
            }
 
        }
 
        
 

	
 
        protected virtual void OnRecordNoReaction(object sender, System.EventArgs e)
 
        {
 
            if (ReactionRecorder.Instance.RecordReaction(profile, expectedColor, expectedColor, reagents))
 
            {
 
                recordNoReactionButton.Sensitive = false;
 
                recordNoReactionButton.Visible = false;
 
                clearReactionButton.Sensitive = true;
 
                clearReactionButton.Visible = true;
 
                this.reactionSwatch.Color = expectedColor;
 
                this.reactedColor.Set(expectedColor);
 
            }
 
        }
 

	
 
        protected virtual void OnChangedIngredient1(object sender, System.EventArgs e)
 
        {
 
            UpdateIngredients();
 
        }
...
 
@@ -599,8 +631,14 @@ namespace DesertPaintLab
 
                    if (response == Gtk.ResponseType.Ok)
 
                    {
 
                        // really delete it
 
                        profile.ClearReaction(reagent1, reagent2);
 
                        reactionSwatch.Clear();
 
                        reactedColor.Clear();
 
                        clearReactionButton.Sensitive = false;
 
                        clearReactionButton.Visible = false;
 
                        recordNoReactionButton.Sensitive = true;
 
                        recordNoReactionButton.Visible = true;
 
                    }
 
                    md.Destroy();
 
                }
 
            }
gtk-gui/DesertPaintLab.CaptureView.cs
Show inline comments
...
 
@@ -56,8 +56,10 @@ namespace DesertPaintLab
 
		
 
		private global::DesertPaintLab.PaintSwatch reactionSwatch;
 
		
 
		private global::Gtk.Button recordButton;
 

	
 
        private global::Gtk.Button recordNoReactionButton;
 
		
 
		private global::Gtk.Label reactionLabel;
 

	
 
        private global::Gtk.ProgressBar progressBar;
...
 
@@ -156,10 +158,10 @@ namespace DesertPaintLab
 
			global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox4]));
 
			w9.Position = 2;
 
			w9.Expand = false;
 
			w9.Fill = false;
 
			// Container child vbox2.Gtk.Box+BoxChild
 
			this.clearReactionButton = new global::Gtk.Button ();
 
            // Container child vbox2.Gtk.Box+BoxChild
 
            this.clearReactionButton = new global::Gtk.Button ();
 
			this.clearReactionButton.Sensitive = false;
 
			this.clearReactionButton.CanFocus = true;
 
			this.clearReactionButton.Name = "clearReactionButton";
 
			this.clearReactionButton.UseUnderline = true;
...
 
@@ -170,9 +172,21 @@ namespace DesertPaintLab
 
			w10.Position = 3;
 
			w10.Expand = false;
 
			w10.Fill = false;
 
			w10.Padding = ((uint)(6));
 
			this.GtkAlignment.Add (this.vbox2);
 
            this.recordNoReactionButton = new global::Gtk.Button();
 
            this.recordNoReactionButton.CanFocus = true;
 
            this.recordNoReactionButton.Name = "recordNoReactionButton";
 
            this.recordNoReactionButton.UseUnderline = true;
 
            this.recordNoReactionButton.Label = "No Reaction";
 
            this.vbox2.Add(this.recordNoReactionButton);
 
            global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.recordNoReactionButton]));
 
            w21.PackType = ((global::Gtk.PackType)(1));
 
            w21.Position = 4;
 
            w21.Expand = false;
 
            w21.Fill = false;
 
            w21.Padding = ((uint)(6));
 
            this.GtkAlignment.Add (this.vbox2);
 
			this.selectIngredientsFrame.Add (this.GtkAlignment);
 
			this.selectIngredientsLabel = new global::Gtk.Label ();
 
			this.selectIngredientsLabel.Name = "selectIngredientsLabel";
 
			this.selectIngredientsLabel.LabelProp = "<b>Select Ingredients</b>";
...
 
@@ -287,9 +301,9 @@ namespace DesertPaintLab
 
			global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.recordButton]));
 
			w20.Position = 2;
 
			w20.Expand = false;
 
			w20.Fill = false;
 
			this.GtkAlignment2.Add (this.vbox4);
 
            this.GtkAlignment2.Add (this.vbox4);
 
			this.reactedColorFrame.Add (this.GtkAlignment2);
 
			this.reactionLabel = new global::Gtk.Label ();
 
			this.reactionLabel.Name = "reactionLabel";
 
			this.reactionLabel.LabelProp = "<b>Reacted</b>";
...
 
@@ -314,7 +328,8 @@ namespace DesertPaintLab
 
			this.clearReactionButton.Clicked += new global::System.EventHandler (this.OnClearReaction);
 
			this.captureButton.Clicked += new global::System.EventHandler (this.OnCapture);
 
            this.captureFromFileButton.Clicked += new global::System.EventHandler(this.OnCaptureFromFile);
 
            this.recordButton.Clicked += new global::System.EventHandler (this.OnRecord);
 
		}
 
	}
 
            this.recordNoReactionButton.Clicked += new global::System.EventHandler(this.OnRecordNoReaction);
 
        }
 
    }
 
}
0 comments (0 inline, 0 general)