From a33c1a44941753d0968b0dde3e4d9eac51653e6e Mon Sep 17 00:00:00 2001
From: Stephanie Anderl <46726333+sanderl@users.noreply.github.com>
Date: Thu, 21 Nov 2019 15:07:45 -0800
Subject: [PATCH] Equation button updates: Enable/Disable on click, button
content f1, f2, f3..., visibility icon on hover (#804)
* Added enable/disable line functionality
* Update EquationTextBox to change the opacity of functions have are not visible. Update the function label for the EquationTextBox to increment the label to show f1, f2, f3, etc
* rebase key-graph-features and fix issue where removing an equation box and adding a new one repopulates the previous equation
* Added visibility icon for the equation button hover
* updated EquationButton to be a toggle button to better handle the LineHidden state and other PR comment fixes.
* Updated EquationButton style to use a toggle button and to have placeholder icons for the show/hide states
* Updated equation button after pulling the refactor work into the branch. Fixed the Equation Button in KGF UI
* Fixed Pepe's bugs
* Uncomment temporary.pfx in calculator.vcxproj
---
src/CalcViewModel/CalcViewModel.vcxproj | 2 +-
.../GraphingCalculator/EquationViewModel.cpp | 1 +
.../GraphingCalculator/EquationViewModel.h | 17 ++
src/Calculator/App.xaml | 147 ++++++++++++++++--
src/Calculator/Calculator.vcxproj.filters | 6 +
src/Calculator/Controls/EquationTextBox.cpp | 11 +-
src/Calculator/Controls/EquationTextBox.h | 3 +-
.../GraphingCalculator/EquationInputArea.xaml | 3 +
.../EquationInputArea.xaml.cpp | 11 +-
.../EquationInputArea.xaml.h | 3 +-
.../KeyGraphFeaturesPanel.xaml | 45 +++---
.../KeyGraphFeaturesPanel.xaml.cpp | 3 -
.../KeyGraphFeaturesPanel.xaml.h | 1 -
src/GraphControl/Control/Equation.cpp | 19 ++-
src/GraphControl/Control/Equation.h | 24 +++
src/GraphControl/Control/EquationCollection.h | 7 +-
src/GraphControl/Control/Grapher.cpp | 48 +++---
src/GraphControl/Control/Grapher.h | 3 +-
src/MockGraphingImpl/MockGraphingImpl.vcxproj | 2 +-
19 files changed, 288 insertions(+), 68 deletions(-)
diff --git a/src/CalcViewModel/CalcViewModel.vcxproj b/src/CalcViewModel/CalcViewModel.vcxproj
index e1cc190..e7b661d 100644
--- a/src/CalcViewModel/CalcViewModel.vcxproj
+++ b/src/CalcViewModel/CalcViewModel.vcxproj
@@ -448,4 +448,4 @@
-
\ No newline at end of file
+
diff --git a/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp b/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp
index f52302f..b2eca55 100644
--- a/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp
+++ b/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp
@@ -34,6 +34,7 @@ namespace CalculatorApp::ViewModel
EquationViewModel::EquationViewModel(GraphControl::Equation ^ equation)
: m_AnalysisErrorVisible{ false }
+ , m_FunctionLabelIndex{ 0 }
, m_KeyGraphFeaturesItems{ ref new Vector() }
, m_resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() }
{
diff --git a/src/CalcViewModel/GraphingCalculator/EquationViewModel.h b/src/CalcViewModel/GraphingCalculator/EquationViewModel.h
index 82c3144..cf435e6 100644
--- a/src/CalcViewModel/GraphingCalculator/EquationViewModel.h
+++ b/src/CalcViewModel/GraphingCalculator/EquationViewModel.h
@@ -40,6 +40,7 @@ public
OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_R(GraphControl::Equation ^, GraphEquation);
+ OBSERVABLE_PROPERTY_RW(int, FunctionLabelIndex);
property Platform::String ^ Expression
{
@@ -73,6 +74,22 @@ public
}
}
+ property bool IsLineEnabled
+ {
+ bool get()
+ {
+ return GraphEquation->IsLineEnabled;
+ }
+ void set(bool value)
+ {
+ if (GraphEquation->IsLineEnabled != value)
+ {
+ GraphEquation->IsLineEnabled = value;
+ RaisePropertyChanged("IsLineEnabled");
+ }
+ }
+ }
+
// Key Graph Features
OBSERVABLE_PROPERTY_R(Platform::String ^, AnalysisErrorString);
OBSERVABLE_PROPERTY_R(bool, AnalysisErrorVisible);
diff --git a/src/Calculator/App.xaml b/src/Calculator/App.xaml
index 1d38b5f..7120ab1 100644
--- a/src/Calculator/App.xaml
+++ b/src/Calculator/App.xaml
@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="using:CalculatorApp.Controls"
xmlns:common="using:CalculatorApp.Common"
- xmlns:converters="using:CalculatorApp.Converters"
xmlns:local="using:CalculatorApp">
@@ -15,6 +14,8 @@
0,0,0,0
0
+ 0.3
+ 0.5
#FF000000
#FF2B2B2B
@@ -51,6 +52,13 @@
+
+
+
@@ -75,6 +83,8 @@
0
#FFF2F2F2
#FFE0E0E0
+ 0.2
+ 0.4
@@ -108,6 +118,11 @@
+
+
+
@@ -130,6 +145,8 @@
0,1,0,0
2
+ 1.0
+ 1.0
@@ -152,7 +169,9 @@
-
+
+
+
@@ -1477,6 +1496,7 @@
+
@@ -1496,19 +1516,116 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Calculator/Controls/EquationTextBox.cpp b/src/Calculator/Controls/EquationTextBox.cpp
index d4b70f6..b066175 100644
--- a/src/Calculator/Controls/EquationTextBox.cpp
+++ b/src/Calculator/Controls/EquationTextBox.cpp
@@ -21,10 +21,12 @@ using namespace Windows::UI::Xaml::Controls::Primitives;
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, EquationColor);
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, ColorChooserFlyout);
+DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, EquationButtonContentIndex);
+
void EquationTextBox::OnApplyTemplate()
{
- m_equationButton = dynamic_cast