Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a5389f5
Added IGraphAnalyzer
sanderl Jul 17, 2019
5d258b4
Key Graph Features called and getting returned to the client. To do p…
sanderl Aug 9, 2019
6230505
Update KGF when variables are updated
sanderl Sep 9, 2019
626d816
Key graph features ui started
sanderl Sep 10, 2019
1f56376
Added MathRichEditBox and started hooking up key graph features to th…
sanderl Sep 11, 2019
9ac3b73
updated key graph features to display more values
sanderl Sep 27, 2019
7611d11
Key graph features populating uing MathRichEdit mode
sanderl Oct 4, 2019
bcde84e
Use MathML formatting instead of MathRichEdit for strings passed back…
sanderl Oct 7, 2019
201e724
cleaned up project targeting and equation.h comments
sanderl Oct 7, 2019
1d1a214
Updated equation edit box to populate for KeyGraphFeatures
sanderl Oct 9, 2019
475fd68
KGF control UI adjustments and error handling
sanderl Oct 11, 2019
95c8575
Error handling added when analysis fails
sanderl Oct 16, 2019
59023f8
updated logic for setting error strings to be in the viewmodel
sanderl Oct 18, 2019
be4ed2a
Updated KeyGraphFeatures to populate dynamically using a ListView and…
sanderl Oct 28, 2019
908300f
Update periodicity to not show if it isn't supported
sanderl Oct 29, 2019
bb543b3
Updated per pr feedback. Fixed bug where analysis error would not reset
sanderl Nov 5, 2019
1e6b694
Update MathRichEdit box to remove selection when focus is lost
sanderl Nov 6, 2019
fe53153
Remove OnLostFocus in MathRichEdit, Change KGF ItemsControl back to L…
sanderl Nov 7, 2019
885871a
Moved formatoptions logic to the Grapher constructor and reverted Lin…
sanderl Nov 8, 2019
5b78a0d
Added enable/disable line functionality
sanderl Oct 17, 2019
1b37f47
Update EquationTextBox to change the opacity of functions have are no…
sanderl Nov 4, 2019
44f9f42
rebase key-graph-features and fix issue where removing an equation bo…
sanderl Nov 11, 2019
a2c418f
Added visibility icon for the equation button hover
sanderl Nov 15, 2019
1f1da90
updated EquationButton to be a toggle button to better handle the Lin…
sanderl Nov 19, 2019
dfb2e00
Updated EquationButton style to use a toggle button and to have place…
sanderl Nov 20, 2019
4abc8a7
Updated equation button after pulling the refactor work into the bran…
sanderl Nov 21, 2019
05e4a60
Fixed Pepe's bugs
sanderl Nov 21, 2019
8c0b5bd
Uncomment temporary.pfx in calculator.vcxproj
sanderl Nov 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CalcViewModel/CalcViewModel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,4 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.UI.Xaml.2.0.181018003.1\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.UI.Xaml.2.0.181018003.1\build\native\Microsoft.UI.Xaml.targets'))" />
</Target>
</Project>
</Project>
1 change: 1 addition & 0 deletions src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace CalculatorApp::ViewModel

EquationViewModel::EquationViewModel(GraphControl::Equation ^ equation)
: m_AnalysisErrorVisible{ false }
, m_FunctionLabelIndex{ 0 }
, m_KeyGraphFeaturesItems{ ref new Vector<KeyGraphFeaturesItem ^>() }
, m_resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() }
{
Expand Down
17 changes: 17 additions & 0 deletions src/CalcViewModel/GraphingCalculator/EquationViewModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public

OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_R(GraphControl::Equation ^, GraphEquation);
OBSERVABLE_PROPERTY_RW(int, FunctionLabelIndex);

property Platform::String ^ Expression
{
Expand Down Expand Up @@ -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);
Expand Down
147 changes: 132 additions & 15 deletions src/Calculator/App.xaml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/Calculator/Calculator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1489,5 +1489,11 @@
<ItemGroup>
<CopyFileToFolders Include="$(GraphingImplDll)" />
<CopyFileToFolders Include="$(GraphingEngineDll)" />
<CopyFileToFolders Include="$(GraphingImplDll)" />
<CopyFileToFolders Include="$(GraphingEngineDll)" />
<CopyFileToFolders Include="$(GraphingImplDll)" />
<CopyFileToFolders Include="$(GraphingEngineDll)" />
<CopyFileToFolders Include="$(GraphingImplDll)" />
<CopyFileToFolders Include="$(GraphingEngineDll)" />
</ItemGroup>
</Project>
11 changes: 10 additions & 1 deletion src/Calculator/Controls/EquationTextBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Button ^>(GetTemplateChild("EquationButton"));
m_equationButton = dynamic_cast<ToggleButton ^>(GetTemplateChild("EquationButton"));
m_richEditBox = dynamic_cast<MathRichEditBox ^>(GetTemplateChild("EquationTextBox"));
m_deleteButton = dynamic_cast<Button ^>(GetTemplateChild("DeleteButton"));
m_removeButton = dynamic_cast<Button ^>(GetTemplateChild("RemoveButton"));
Expand Down Expand Up @@ -187,6 +189,13 @@ void EquationTextBox::OnRemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e
{
m_functionButton->IsEnabled = false;
}

if (m_equationButton)
{
m_equationButton->IsChecked = false;
}

VisualStateManager::GoToState(this, "Normal", true);
}

void EquationTextBox::OnColorChooserButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
Expand Down
3 changes: 2 additions & 1 deletion src/Calculator/Controls/EquationTextBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace CalculatorApp
DEPENDENCY_PROPERTY_OWNER(EquationTextBox);
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush^, EquationColor);
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::Flyout^, ColorChooserFlyout);
DEPENDENCY_PROPERTY(Platform::String ^, EquationButtonContentIndex);

PROPERTY_R(bool, HasFocus);

Expand Down Expand Up @@ -60,7 +61,7 @@ namespace CalculatorApp
void OnColorFlyoutClosed(Platform::Object^ sender, Platform::Object^ e);

CalculatorApp::Controls::MathRichEditBox^ m_richEditBox;
Windows::UI::Xaml::Controls::Button^ m_equationButton;
Windows::UI::Xaml::Controls::Primitives::ToggleButton^ m_equationButton;
Windows::UI::Xaml::Controls::Button^ m_deleteButton;
Windows::UI::Xaml::Controls::Button^ m_removeButton;
Windows::UI::Xaml::Controls::Button^ m_functionButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CalculatorApp.Controls"
xmlns:converters="using:CalculatorApp.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:CalculatorApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand Down Expand Up @@ -49,6 +50,8 @@
Margin="1,0,1,0"
Style="{StaticResource EquationTextBoxStyle}"
EquationColor="{x:Bind LineColor, Mode=OneWay}"
EquationButtonClicked="EquationTextBox_EquationButtonClicked"
EquationButtonContentIndex="{x:Bind FunctionLabelIndex, Mode=OneWay}"
EquationSubmitted="InputTextBox_Submitted"
GotFocus="InputTextBox_GotFocus"
Loaded="EquationTextBoxLoaded"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ void EquationInputArea::AddNewEquation()
m_lastLineColorIndex = (m_lastLineColorIndex + 1) % AvailableColors->Size;

eq->LineColor = AvailableColors->GetAt(m_lastLineColorIndex);

eq->IsLineEnabled = true;
eq->FunctionLabelIndex = ++m_lastFunctionLabelIndex;
Equations->Append(eq);
EquationInputList->ScrollIntoView(eq);
}
Expand Down Expand Up @@ -102,6 +103,11 @@ void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object ^ sender, Rou
unsigned int index;
if (Equations->IndexOf(eq, &index))
{
if (eq->FunctionLabelIndex == m_lastFunctionLabelIndex)
{
m_lastFunctionLabelIndex--;
}

Equations->RemoveAt(index);
}
}
Expand All @@ -116,6 +122,9 @@ void EquationInputArea::EquationTextBox_KeyGraphFeaturesButtonClicked(Object ^ s

void EquationInputArea::EquationTextBox_EquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
{
auto tb = static_cast<EquationTextBox ^>(sender);
auto eq = static_cast<EquationViewModel ^>(tb->DataContext);
eq->IsLineEnabled = !eq->IsLineEnabled;
}

void EquationInputArea::EquationTextBoxLoaded(Object ^ sender, RoutedEventArgs ^ e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
#include "Controls/EquationTextBox.h"
#include "Converters/BooleanNegationConverter.h"
#include "Controls/MathRichEditBox.h"

namespace CalculatorApp
{
Expand All @@ -22,7 +23,6 @@ namespace CalculatorApp
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector< ViewModel::EquationViewModel^ >^, Equations);
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(ViewModel::EquationViewModel ^, EquationVM);
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Windows::UI::Xaml::Media::SolidColorBrush ^> ^, AvailableColors);

event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesRequested;

private:
Expand All @@ -42,6 +42,7 @@ namespace CalculatorApp
private:
Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
int m_lastLineColorIndex;
int m_lastFunctionLabelIndex;
void EquationTextBox_RemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void EquationTextBox_KeyGraphFeaturesButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void EquationTextBox_EquationButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
Expand Down
45 changes: 25 additions & 20 deletions src/Calculator/Views/GraphingCalculator/KeyGraphFeaturesPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,36 +150,39 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<Button x:Name="EquationButton"
MinWidth="44"
MinHeight="44"
VerticalAlignment="Stretch"
Background="{TemplateBinding EquationColor}"
Foreground="{StaticResource SystemChromeWhiteColor}"
BorderThickness="0">
<Button.Content>
<StackPanel Margin="5,0"
VerticalAlignment="Top"
Orientation="Horizontal">
<ToggleButton x:Name="EquationButton"
MinWidth="44"
MinHeight="44"
VerticalAlignment="Stretch"
Background="{TemplateBinding EquationColor}"
Foreground="{StaticResource SystemChromeWhiteColor}"
BorderThickness="0">
<ToggleButton.Content>
<StackPanel x:Name="FunctionNumberLabel"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
Orientation="Horizontal"
Margin="5,0">
<FontIcon VerticalAlignment="Center"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Glyph="&#xE72B;"/>
<TextBlock Margin="12,-4,0,0"
VerticalAlignment="Top"
FontFamily="{TemplateBinding FontFamily}"
FontSize="16"
Text="ƒₓ"/>
<TextBlock Text="ƒ" Margin="12,0,0,0"/>
<TextBlock Margin="0,10,0,0"
FontSize="9"
Text="{TemplateBinding EquationButtonContentIndex}"/>
</StackPanel>
</Button.Content>
<Button.Resources>

</ToggleButton.Content>
<ToggleButton.Resources>
<SolidColorBrush x:Name="ButtonBackgroundPointerOver"
Opacity="0.7"
Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
<SolidColorBrush x:Name="ButtonForegroundPointerOver" Color="{ThemeResource SystemChromeWhiteColor}"/>
<SolidColorBrush x:Name="ButtonBorderBrushPointerOver" Color="Transparent"/>
</Button.Resources>
</Button>
</ToggleButton.Resources>
</ToggleButton>

<controls:MathRichEditBox x:Name="EquationTextBox"
Grid.Column="1"
Expand Down Expand Up @@ -431,6 +434,8 @@
BorderThickness="0"
DataContext="{x:Bind ViewModel, Mode=OneWay}"
EquationButtonClicked="EquationButtonClicked"
EquationButtonContentIndex="{x:Bind ViewModel.FunctionLabelIndex, Mode=OneWay}"
EquationColor="{x:Bind ViewModel.LineColor, Mode=OneWay}"
Loaded="EquationInputTextBox_Loaded"/>
<TextBlock x:Uid="KeyGraphFeaturesLabel"
Grid.Row="1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;

KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()

{

InitializeComponent();
}

Expand Down Expand Up @@ -49,5 +47,4 @@ void KeyGraphFeaturesPanel::EquationInputTextBox_Loaded(Object ^ sender, RoutedE
void KeyGraphFeaturesPanel::SetEquationTextBoxProperties()
{
EquationInputTextBox->SetEquationText(ViewModel->Expression);
EquationInputTextBox->EquationColor = ViewModel->LineColor;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public

OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(CalculatorApp::ViewModel::EquationViewModel ^, ViewModel);

event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesClosed;

private:
Expand Down
19 changes: 18 additions & 1 deletion src/GraphControl/Control/Equation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ namespace GraphControl
DependencyProperty ^ Equation::s_lineColorProperty;
static constexpr auto s_propertyName_LineColor = L"LineColor";

DependencyProperty ^ Equation::s_xInterceptProperty;
DependencyProperty ^ Equation::s_isLineEnabledProperty;
static constexpr auto s_propertyName_IsLineEnabled = L"IsLineEnabled";

DependencyProperty ^ Equation::s_xInterceptProperty;
static constexpr auto s_propertyName_XIntercept = L"XIntercept";

DependencyProperty ^ Equation::s_yInterceptProperty;
Expand Down Expand Up @@ -75,6 +78,7 @@ namespace GraphControl
{
String ^ Expression = StringReference(s_propertyName_Expression);
String ^ LineColor = StringReference(s_propertyName_LineColor);
String ^ IsLineEnabled = StringReference(s_propertyName_IsLineEnabled);
String ^ XIntercept = StringReference(s_propertyName_XIntercept);
String ^ YIntercept = StringReference(s_propertyName_YIntercept);
String ^ Parity = StringReference(s_propertyName_Parity);
Expand Down Expand Up @@ -116,6 +120,15 @@ namespace GraphControl
ref new PropertyMetadata(nullptr, ref new PropertyChangedCallback(&Equation::OnCustomDependencyPropertyChanged)));
}

if (!s_isLineEnabledProperty)
{
s_isLineEnabledProperty = DependencyProperty::Register(
EquationProperties::IsLineEnabled,
bool ::typeid,
Equation::typeid,
ref new PropertyMetadata(nullptr, ref new PropertyChangedCallback(&Equation::OnCustomDependencyPropertyChanged)));
}

if (!s_xInterceptProperty)
{
s_xInterceptProperty = DependencyProperty::Register(
Expand Down Expand Up @@ -273,6 +286,10 @@ namespace GraphControl
{
propertyName = EquationProperties::LineColor;
}
else if (args->Property == s_isLineEnabledProperty)
{
propertyName = EquationProperties::IsLineEnabled;
}
else if (args->Property == s_xInterceptProperty)
{
propertyName = EquationProperties::XIntercept;
Expand Down
24 changes: 24 additions & 0 deletions src/GraphControl/Control/Equation.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace GraphControl
{
extern Platform::String ^ Expression;
extern Platform::String ^ LineColor;
extern Platform::String ^ IsLineEnabled;
}

ref class Equation;
Expand Down Expand Up @@ -68,6 +69,28 @@ namespace GraphControl
}
#pragma endregion

#pragma region bool IsLineEnabled DependencyProperty
static property Windows::UI::Xaml::DependencyProperty ^ IsLineEnabledProperty
{
Windows::UI::Xaml::DependencyProperty ^ get()
{
return s_isLineEnabledProperty;
}
}
property bool IsLineEnabled
{
bool get()
{
return static_cast<bool>(GetValue(s_isLineEnabledProperty));
}
void set(bool value)
{
SetValue(s_isLineEnabledProperty, value);
}
}

#pragma endregion

#pragma region Key Graph Features


Expand Down Expand Up @@ -422,6 +445,7 @@ namespace GraphControl
private:
static Windows::UI::Xaml::DependencyProperty ^ s_expressionProperty;
static Windows::UI::Xaml::DependencyProperty ^ s_lineColorProperty;
static Windows::UI::Xaml::DependencyProperty ^ s_isLineEnabledProperty;
static Windows::UI::Xaml::DependencyProperty ^ s_xInterceptProperty;
static Windows::UI::Xaml::DependencyProperty ^ s_yInterceptProperty;
static Windows::UI::Xaml::DependencyProperty ^ s_parityProperty;
Expand Down
7 changes: 6 additions & 1 deletion src/GraphControl/Control/EquationCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public

event EquationChangedEventHandler ^ EquationChanged;
event EquationChangedEventHandler ^ EquationStyleChanged;
event EquationChangedEventHandler ^ EquationLineEnabledChanged;

private:
void OnEquationPropertyChanged(GraphControl::Equation ^, Platform::String ^ propertyName)
Expand All @@ -160,8 +161,12 @@ public
{
EquationChanged();
}
else if (propertyName == EquationProperties::IsLineEnabled)
{
EquationLineEnabledChanged();
}
}

private:
Platform::Collections::Vector<GraphControl::Equation ^> ^ m_vector;
std::vector<Windows::Foundation::EventRegistrationToken> m_tokens;
Expand Down
Loading