diff --git a/UI/CaptureView.cs b/UI/CaptureView.cs --- a/UI/CaptureView.cs +++ b/UI/CaptureView.cs @@ -80,6 +80,7 @@ namespace DesertPaintLab { recordEnabled = false; recordButton.Sensitive = false; + recordNoReactionButton.Sensitive = false; } public void EnableRecord() @@ -154,8 +155,11 @@ namespace DesertPaintLab isCaptured = false; recordButton.Sensitive = false; + recordNoReactionButton.Sensitive = false; clearReactionButton.Sensitive = false; clearReactionButton.Visible = false; + recordNoReactionButton.Sensitive = false; + recordNoReactionButton.Visible = false; recipe.Clear(); @@ -167,6 +171,8 @@ namespace DesertPaintLab unmodifiedSwatch.Clear(); reactionSwatch.Clear(); captureButton.Sensitive = false; + recordNoReactionButton.Sensitive = false; + recordNoReactionButton.Visible = false; return; } recipe.AddReagent(reagentName); @@ -176,6 +182,8 @@ namespace DesertPaintLab { ingredient3ComboBox.Sensitive = false; recordButton.Sensitive = false; + recordNoReactionButton.Sensitive = false; + recordNoReactionButton.Visible = false; reactionKnown = false; reactionSwatch.Clear(); return; @@ -185,7 +193,8 @@ namespace DesertPaintLab 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 @@ -194,10 +203,14 @@ namespace DesertPaintLab 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); @@ -248,8 +261,10 @@ namespace DesertPaintLab { 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); @@ -272,9 +287,11 @@ namespace DesertPaintLab 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); @@ -428,10 +445,12 @@ namespace DesertPaintLab md.Destroy(); // reaction clipped - don't let them record recordButton.Sensitive = false; + recordNoReactionButton.Sensitive = false; } else { recordButton.Sensitive = recordEnabled; + recordNoReactionButton.Sensitive = false; } } else @@ -558,7 +577,20 @@ 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(); @@ -600,6 +632,12 @@ namespace DesertPaintLab { // 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(); } diff --git a/gtk-gui/DesertPaintLab.CaptureView.cs b/gtk-gui/DesertPaintLab.CaptureView.cs --- a/gtk-gui/DesertPaintLab.CaptureView.cs +++ b/gtk-gui/DesertPaintLab.CaptureView.cs @@ -57,6 +57,8 @@ namespace DesertPaintLab private global::DesertPaintLab.PaintSwatch reactionSwatch; private global::Gtk.Button recordButton; + + private global::Gtk.Button recordNoReactionButton; private global::Gtk.Label reactionLabel; @@ -157,8 +159,8 @@ namespace DesertPaintLab 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"; @@ -171,7 +173,19 @@ namespace DesertPaintLab 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"; @@ -288,7 +302,7 @@ namespace DesertPaintLab 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"; @@ -315,6 +329,7 @@ namespace DesertPaintLab 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); + } + } }