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
This commit is contained in:
parent
288a90e0fe
commit
a33c1a4494
@ -34,6 +34,7 @@ namespace CalculatorApp::ViewModel
|
|||||||
|
|
||||||
EquationViewModel::EquationViewModel(GraphControl::Equation ^ equation)
|
EquationViewModel::EquationViewModel(GraphControl::Equation ^ equation)
|
||||||
: m_AnalysisErrorVisible{ false }
|
: m_AnalysisErrorVisible{ false }
|
||||||
|
, m_FunctionLabelIndex{ 0 }
|
||||||
, m_KeyGraphFeaturesItems{ ref new Vector<KeyGraphFeaturesItem ^>() }
|
, m_KeyGraphFeaturesItems{ ref new Vector<KeyGraphFeaturesItem ^>() }
|
||||||
, m_resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() }
|
, m_resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() }
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,7 @@ public
|
|||||||
|
|
||||||
OBSERVABLE_OBJECT();
|
OBSERVABLE_OBJECT();
|
||||||
OBSERVABLE_PROPERTY_R(GraphControl::Equation ^, GraphEquation);
|
OBSERVABLE_PROPERTY_R(GraphControl::Equation ^, GraphEquation);
|
||||||
|
OBSERVABLE_PROPERTY_RW(int, FunctionLabelIndex);
|
||||||
|
|
||||||
property Platform::String ^ Expression
|
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
|
// Key Graph Features
|
||||||
OBSERVABLE_PROPERTY_R(Platform::String ^, AnalysisErrorString);
|
OBSERVABLE_PROPERTY_R(Platform::String ^, AnalysisErrorString);
|
||||||
OBSERVABLE_PROPERTY_R(bool, AnalysisErrorVisible);
|
OBSERVABLE_PROPERTY_R(bool, AnalysisErrorVisible);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:Controls="using:CalculatorApp.Controls"
|
xmlns:Controls="using:CalculatorApp.Controls"
|
||||||
xmlns:common="using:CalculatorApp.Common"
|
xmlns:common="using:CalculatorApp.Common"
|
||||||
xmlns:converters="using:CalculatorApp.Converters"
|
|
||||||
xmlns:local="using:CalculatorApp">
|
xmlns:local="using:CalculatorApp">
|
||||||
|
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
@ -15,6 +14,8 @@
|
|||||||
<ResourceDictionary x:Key="Default">
|
<ResourceDictionary x:Key="Default">
|
||||||
<Thickness x:Key="HighContrastThicknessTop">0,0,0,0</Thickness>
|
<Thickness x:Key="HighContrastThicknessTop">0,0,0,0</Thickness>
|
||||||
<x:Double x:Key="HighContrastStrokeThickness">0</x:Double>
|
<x:Double x:Key="HighContrastStrokeThickness">0</x:Double>
|
||||||
|
<x:Double x:Key="EquationButtonOverlayPointerOverOpacity">0.3</x:Double>
|
||||||
|
<x:Double x:Key="EquationButtonOverlayPressedOpacity">0.5</x:Double>
|
||||||
<Color x:Key="AltHighColor">#FF000000</Color>
|
<Color x:Key="AltHighColor">#FF000000</Color>
|
||||||
<Color x:Key="ChromeMediumLowColor">#FF2B2B2B</Color>
|
<Color x:Key="ChromeMediumLowColor">#FF2B2B2B</Color>
|
||||||
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{StaticResource AltHighColor}"/>
|
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{StaticResource AltHighColor}"/>
|
||||||
@ -51,6 +52,13 @@
|
|||||||
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemControlBackgroundAltMediumBrush}"/>
|
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemControlBackgroundAltMediumBrush}"/>
|
||||||
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemBaseHighColor}"/>
|
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemBaseHighColor}"/>
|
||||||
<SolidColorBrush x:Key="EquationBoxBorderBrush" Color="{ThemeResource TextControlBackground}"/>
|
<SolidColorBrush x:Key="EquationBoxBorderBrush" Color="{ThemeResource TextControlBackground}"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonOverlayBackgroundBrush" Color="White"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonHideLineBackgroundBrush"
|
||||||
|
Opacity="0.4"
|
||||||
|
Color="#FFFFFF"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonHideLineForegroundBrush"
|
||||||
|
Opacity="0.6"
|
||||||
|
Color="{StaticResource SystemChromeWhiteColor}"/>
|
||||||
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="Transparent"/>
|
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="Transparent"/>
|
||||||
|
|
||||||
<SolidColorBrush x:Key="EquationBrush1" Color="#FF0078D7"/>
|
<SolidColorBrush x:Key="EquationBrush1" Color="#FF0078D7"/>
|
||||||
@ -75,6 +83,8 @@
|
|||||||
<x:Double x:Key="HighContrastStrokeThickness">0</x:Double>
|
<x:Double x:Key="HighContrastStrokeThickness">0</x:Double>
|
||||||
<Color x:Key="AltHighColor">#FFF2F2F2</Color>
|
<Color x:Key="AltHighColor">#FFF2F2F2</Color>
|
||||||
<Color x:Key="ChromeMediumLowColor">#FFE0E0E0</Color>
|
<Color x:Key="ChromeMediumLowColor">#FFE0E0E0</Color>
|
||||||
|
<x:Double x:Key="EquationButtonOverlayPointerOverOpacity">0.2</x:Double>
|
||||||
|
<x:Double x:Key="EquationButtonOverlayPressedOpacity">0.4</x:Double>
|
||||||
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{StaticResource SystemAltHighColor}"/>
|
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{StaticResource SystemAltHighColor}"/>
|
||||||
<SolidColorBrush x:Key="SystemControlBackgroundChromeMediumLowBrush" Color="{StaticResource ChromeMediumLowColor}"/>
|
<SolidColorBrush x:Key="SystemControlBackgroundChromeMediumLowBrush" Color="{StaticResource ChromeMediumLowColor}"/>
|
||||||
<SolidColorBrush x:Key="TitleBarForegroundBaseHighBrush" Color="{StaticResource SystemBaseHighColor}"/>
|
<SolidColorBrush x:Key="TitleBarForegroundBaseHighBrush" Color="{StaticResource SystemBaseHighColor}"/>
|
||||||
@ -108,6 +118,11 @@
|
|||||||
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemControlBackgroundAltMediumBrush}"/>
|
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemControlBackgroundAltMediumBrush}"/>
|
||||||
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemBaseHighColor}"/>
|
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemBaseHighColor}"/>
|
||||||
<SolidColorBrush x:Key="EquationBoxBorderBrush" Color="{ThemeResource TextControlBackground}"/>
|
<SolidColorBrush x:Key="EquationBoxBorderBrush" Color="{ThemeResource TextControlBackground}"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonOverlayBackgroundBrush" Color="Black"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonHideLineBackgroundBrush"
|
||||||
|
Opacity="0.4"
|
||||||
|
Color="#000000"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonHideLineForegroundBrush" Color="{StaticResource SystemChromeWhiteColor}"/>
|
||||||
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="Transparent"/>
|
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="Transparent"/>
|
||||||
|
|
||||||
<SolidColorBrush x:Key="EquationBrush1" Color="#FF0078D7"/>
|
<SolidColorBrush x:Key="EquationBrush1" Color="#FF0078D7"/>
|
||||||
@ -130,6 +145,8 @@
|
|||||||
<ResourceDictionary x:Key="HighContrast">
|
<ResourceDictionary x:Key="HighContrast">
|
||||||
<Thickness x:Key="HighContrastThicknessTop">0,1,0,0</Thickness>
|
<Thickness x:Key="HighContrastThicknessTop">0,1,0,0</Thickness>
|
||||||
<x:Double x:Key="HighContrastStrokeThickness">2</x:Double>
|
<x:Double x:Key="HighContrastStrokeThickness">2</x:Double>
|
||||||
|
<x:Double x:Key="EquationButtonOverlayPointerOverOpacity">1.0</x:Double>
|
||||||
|
<x:Double x:Key="EquationButtonOverlayPressedOpacity">1.0</x:Double>
|
||||||
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
||||||
<SolidColorBrush x:Key="SystemControlBackgroundChromeMediumLowBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
<SolidColorBrush x:Key="SystemControlBackgroundChromeMediumLowBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
||||||
<SolidColorBrush x:Key="TitleBarForegroundBaseHighBrush" Color="{ThemeResource SystemColorCaptionTextColor}"/>
|
<SolidColorBrush x:Key="TitleBarForegroundBaseHighBrush" Color="{ThemeResource SystemColorCaptionTextColor}"/>
|
||||||
@ -152,7 +169,9 @@
|
|||||||
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemColorHighlightColor}"/>
|
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||||
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemColorButtonTextColor}"/>
|
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemColorButtonTextColor}"/>
|
||||||
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonHideLineBackgroundBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonOverlayBackgroundBrush" Color="Transparent"/>
|
||||||
|
<SolidColorBrush x:Key="EquationButtonHideLineForegroundBrush" Color="{StaticResource SystemColorGrayTextColor}"/>
|
||||||
<!-- TODO: Figure out what colors we can use in high contrast -->
|
<!-- TODO: Figure out what colors we can use in high contrast -->
|
||||||
<SolidColorBrush x:Key="EquationBrush1" Color="{ThemeResource SystemColorGrayTextColor}"/>
|
<SolidColorBrush x:Key="EquationBrush1" Color="{ThemeResource SystemColorGrayTextColor}"/>
|
||||||
<SolidColorBrush x:Key="EquationBrush2" Color="{ThemeResource SystemColorHighlightColor}"/>
|
<SolidColorBrush x:Key="EquationBrush2" Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||||
@ -1477,6 +1496,7 @@
|
|||||||
</ObjectAnimationUsingKeyFrames>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
|
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
|
|
||||||
<VisualStateGroup x:Name="ButtonStates">
|
<VisualStateGroup x:Name="ButtonStates">
|
||||||
@ -1496,19 +1516,116 @@
|
|||||||
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
<Button x:Name="EquationButton"
|
<ToggleButton x:Name="EquationButton"
|
||||||
MinWidth="44"
|
MinWidth="44"
|
||||||
MinHeight="44"
|
MinHeight="44"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Background="{TemplateBinding EquationColor}"
|
Background="{TemplateBinding EquationColor}"
|
||||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||||
Content="ƒₓ">
|
BorderBrush="{TemplateBinding EquationColor}">
|
||||||
<Button.Resources>
|
<ToggleButton.Content>
|
||||||
<SolidColorBrush x:Name="ButtonBackgroundPointerOver" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
<StackPanel x:Name="FunctionNumberLabel"
|
||||||
<SolidColorBrush x:Name="ButtonForegroundPointerOver" Color="{ThemeResource SystemChromeWhiteColor}"/>
|
HorizontalAlignment="Center"
|
||||||
<SolidColorBrush x:Name="ButtonBorderBrushPointerOver" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
VerticalAlignment="Center"
|
||||||
</Button.Resources>
|
Background="Transparent"
|
||||||
</Button>
|
Orientation="Horizontal">
|
||||||
|
<TextBlock Text="ƒ"/>
|
||||||
|
<TextBlock Margin="0,10,0,0"
|
||||||
|
FontSize="9"
|
||||||
|
Text="{TemplateBinding EquationButtonContentIndex}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ToggleButton.Content>
|
||||||
|
<ToggleButton.Resources>
|
||||||
|
<SolidColorBrush x:Name="ButtonBackgroundBrush" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||||
|
<SolidColorBrush x:Name="ButtonBorderBrush" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||||
|
</ToggleButton.Resources>
|
||||||
|
<ToggleButton.Style>
|
||||||
|
<Style TargetType="ToggleButton">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
|
<Grid x:Name="RootGrid"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderBrush="Transparent">
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonBackgroundBrush}"/>
|
||||||
|
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
|
||||||
|
<Setter Target="Overlay.Opacity" Value="0.0"/>
|
||||||
|
<Setter Target="ContentPresenter.Visibility" Value="Visible"/>
|
||||||
|
<Setter Target="ShowHideIcon.Visibility" Value="Collapsed"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonBackgroundBrush}"/>
|
||||||
|
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
|
||||||
|
<Setter Target="Overlay.Opacity" Value="{StaticResource EquationButtonOverlayPointerOverOpacity}"/>
|
||||||
|
<Setter Target="ContentPresenter.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ShowHideIcon.Visibility" Value="Visible"/>
|
||||||
|
<Setter Target="ShowHideIcon.Glyph" Value=""/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Pressed">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonBackgroundBrush}"/>
|
||||||
|
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
|
||||||
|
<Setter Target="Overlay.Opacity" Value="{StaticResource EquationButtonOverlayPressedOpacity}"/>
|
||||||
|
<Setter Target="ContentPresenter.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ShowHideIcon.Visibility" Value="Visible"/>
|
||||||
|
<Setter Target="ShowHideIcon.Glyph" Value=""/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Checked">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="RootGrid.Background" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
|
||||||
|
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
|
||||||
|
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource EquationButtonHideLineForegroundBrush}"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="CheckedPointerOver">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="RootGrid.Background" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
|
||||||
|
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
|
||||||
|
<Setter Target="ShowHideIcon.Foreground" Value="{ThemeResource EquationButtonHideLineForegroundBrush}"/>
|
||||||
|
<Setter Target="Overlay.Opacity" Value="{StaticResource EquationButtonOverlayPointerOverOpacity}"/>
|
||||||
|
<Setter Target="ContentPresenter.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ShowHideIcon.Visibility" Value="Visible"/>
|
||||||
|
<Setter Target="ShowHideIcon.Glyph" Value=""/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="CheckedPressed">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="RootGrid.Background" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
|
||||||
|
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
|
||||||
|
<Setter Target="ShowHideIcon.Foreground" Value="{ThemeResource EquationButtonHideLineForegroundBrush}"/>
|
||||||
|
<Setter Target="Overlay.Opacity" Value="{StaticResource EquationButtonOverlayPressedOpacity}"/>
|
||||||
|
<Setter Target="ContentPresenter.Visibility" Value="Collapsed"/>
|
||||||
|
<Setter Target="ShowHideIcon.Visibility" Value="Visible"/>
|
||||||
|
<Setter Target="ShowHideIcon.Glyph" Value=""/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
<Rectangle x:Name="Overlay"
|
||||||
|
Fill="{ThemeResource EquationButtonOverlayBackgroundBrush}"
|
||||||
|
Opacity="0"
|
||||||
|
IsHitTestVisible="False"/>
|
||||||
|
<ContentPresenter x:Name="ContentPresenter"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
IsHitTestVisible="False"/>
|
||||||
|
<FontIcon x:Name="ShowHideIcon"
|
||||||
|
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||||
|
Visibility="Collapsed"/>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ToggleButton.Style>
|
||||||
|
</ToggleButton>
|
||||||
<Border x:Name="EquationBoxBorder"
|
<Border x:Name="EquationBoxBorder"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Background="{ThemeResource TextControlBackground}"
|
Background="{ThemeResource TextControlBackground}"
|
||||||
|
@ -1489,5 +1489,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CopyFileToFolders Include="$(GraphingImplDll)" />
|
<CopyFileToFolders Include="$(GraphingImplDll)" />
|
||||||
<CopyFileToFolders Include="$(GraphingEngineDll)" />
|
<CopyFileToFolders Include="$(GraphingEngineDll)" />
|
||||||
|
<CopyFileToFolders Include="$(GraphingImplDll)" />
|
||||||
|
<CopyFileToFolders Include="$(GraphingEngineDll)" />
|
||||||
|
<CopyFileToFolders Include="$(GraphingImplDll)" />
|
||||||
|
<CopyFileToFolders Include="$(GraphingEngineDll)" />
|
||||||
|
<CopyFileToFolders Include="$(GraphingImplDll)" />
|
||||||
|
<CopyFileToFolders Include="$(GraphingEngineDll)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -21,10 +21,12 @@ using namespace Windows::UI::Xaml::Controls::Primitives;
|
|||||||
|
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, EquationColor);
|
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, EquationColor);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, ColorChooserFlyout);
|
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, ColorChooserFlyout);
|
||||||
|
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, EquationButtonContentIndex);
|
||||||
|
|
||||||
|
|
||||||
void EquationTextBox::OnApplyTemplate()
|
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_richEditBox = dynamic_cast<MathRichEditBox ^>(GetTemplateChild("EquationTextBox"));
|
||||||
m_deleteButton = dynamic_cast<Button ^>(GetTemplateChild("DeleteButton"));
|
m_deleteButton = dynamic_cast<Button ^>(GetTemplateChild("DeleteButton"));
|
||||||
m_removeButton = dynamic_cast<Button ^>(GetTemplateChild("RemoveButton"));
|
m_removeButton = dynamic_cast<Button ^>(GetTemplateChild("RemoveButton"));
|
||||||
@ -187,6 +189,13 @@ void EquationTextBox::OnRemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e
|
|||||||
{
|
{
|
||||||
m_functionButton->IsEnabled = false;
|
m_functionButton->IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_equationButton)
|
||||||
|
{
|
||||||
|
m_equationButton->IsChecked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
VisualStateManager::GoToState(this, "Normal", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EquationTextBox::OnColorChooserButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
void EquationTextBox::OnColorChooserButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||||
|
@ -21,6 +21,7 @@ namespace CalculatorApp
|
|||||||
DEPENDENCY_PROPERTY_OWNER(EquationTextBox);
|
DEPENDENCY_PROPERTY_OWNER(EquationTextBox);
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush^, EquationColor);
|
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush^, EquationColor);
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::Flyout^, ColorChooserFlyout);
|
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::Flyout^, ColorChooserFlyout);
|
||||||
|
DEPENDENCY_PROPERTY(Platform::String ^, EquationButtonContentIndex);
|
||||||
|
|
||||||
PROPERTY_R(bool, HasFocus);
|
PROPERTY_R(bool, HasFocus);
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ namespace CalculatorApp
|
|||||||
void OnColorFlyoutClosed(Platform::Object^ sender, Platform::Object^ e);
|
void OnColorFlyoutClosed(Platform::Object^ sender, Platform::Object^ e);
|
||||||
|
|
||||||
CalculatorApp::Controls::MathRichEditBox^ m_richEditBox;
|
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_deleteButton;
|
||||||
Windows::UI::Xaml::Controls::Button^ m_removeButton;
|
Windows::UI::Xaml::Controls::Button^ m_removeButton;
|
||||||
Windows::UI::Xaml::Controls::Button^ m_functionButton;
|
Windows::UI::Xaml::Controls::Button^ m_functionButton;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="using:CalculatorApp.Controls"
|
xmlns:controls="using:CalculatorApp.Controls"
|
||||||
|
xmlns:converters="using:CalculatorApp.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="using:CalculatorApp"
|
xmlns:local="using:CalculatorApp"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
@ -49,6 +50,8 @@
|
|||||||
Margin="1,0,1,0"
|
Margin="1,0,1,0"
|
||||||
Style="{StaticResource EquationTextBoxStyle}"
|
Style="{StaticResource EquationTextBoxStyle}"
|
||||||
EquationColor="{x:Bind LineColor, Mode=OneWay}"
|
EquationColor="{x:Bind LineColor, Mode=OneWay}"
|
||||||
|
EquationButtonClicked="EquationTextBox_EquationButtonClicked"
|
||||||
|
EquationButtonContentIndex="{x:Bind FunctionLabelIndex, Mode=OneWay}"
|
||||||
EquationSubmitted="InputTextBox_Submitted"
|
EquationSubmitted="InputTextBox_Submitted"
|
||||||
GotFocus="InputTextBox_GotFocus"
|
GotFocus="InputTextBox_GotFocus"
|
||||||
Loaded="EquationTextBoxLoaded"
|
Loaded="EquationTextBoxLoaded"
|
||||||
|
@ -68,7 +68,8 @@ void EquationInputArea::AddNewEquation()
|
|||||||
m_lastLineColorIndex = (m_lastLineColorIndex + 1) % AvailableColors->Size;
|
m_lastLineColorIndex = (m_lastLineColorIndex + 1) % AvailableColors->Size;
|
||||||
|
|
||||||
eq->LineColor = AvailableColors->GetAt(m_lastLineColorIndex);
|
eq->LineColor = AvailableColors->GetAt(m_lastLineColorIndex);
|
||||||
|
eq->IsLineEnabled = true;
|
||||||
|
eq->FunctionLabelIndex = ++m_lastFunctionLabelIndex;
|
||||||
Equations->Append(eq);
|
Equations->Append(eq);
|
||||||
EquationInputList->ScrollIntoView(eq);
|
EquationInputList->ScrollIntoView(eq);
|
||||||
}
|
}
|
||||||
@ -102,6 +103,11 @@ void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object ^ sender, Rou
|
|||||||
unsigned int index;
|
unsigned int index;
|
||||||
if (Equations->IndexOf(eq, &index))
|
if (Equations->IndexOf(eq, &index))
|
||||||
{
|
{
|
||||||
|
if (eq->FunctionLabelIndex == m_lastFunctionLabelIndex)
|
||||||
|
{
|
||||||
|
m_lastFunctionLabelIndex--;
|
||||||
|
}
|
||||||
|
|
||||||
Equations->RemoveAt(index);
|
Equations->RemoveAt(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,6 +122,9 @@ void EquationInputArea::EquationTextBox_KeyGraphFeaturesButtonClicked(Object ^ s
|
|||||||
|
|
||||||
void EquationInputArea::EquationTextBox_EquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
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)
|
void EquationInputArea::EquationTextBoxLoaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
||||||
#include "Controls/EquationTextBox.h"
|
#include "Controls/EquationTextBox.h"
|
||||||
#include "Converters/BooleanNegationConverter.h"
|
#include "Converters/BooleanNegationConverter.h"
|
||||||
|
#include "Controls/MathRichEditBox.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
@ -22,7 +23,6 @@ namespace CalculatorApp
|
|||||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector< ViewModel::EquationViewModel^ >^, Equations);
|
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector< ViewModel::EquationViewModel^ >^, Equations);
|
||||||
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(ViewModel::EquationViewModel ^, EquationVM);
|
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(ViewModel::EquationViewModel ^, EquationVM);
|
||||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Windows::UI::Xaml::Media::SolidColorBrush ^> ^, AvailableColors);
|
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Windows::UI::Xaml::Media::SolidColorBrush ^> ^, AvailableColors);
|
||||||
|
|
||||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesRequested;
|
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesRequested;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -42,6 +42,7 @@ namespace CalculatorApp
|
|||||||
private:
|
private:
|
||||||
Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
|
Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
|
||||||
int m_lastLineColorIndex;
|
int m_lastLineColorIndex;
|
||||||
|
int m_lastFunctionLabelIndex;
|
||||||
void EquationTextBox_RemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
void EquationTextBox_RemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void EquationTextBox_KeyGraphFeaturesButtonClicked(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);
|
void EquationTextBox_EquationButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
|
@ -150,36 +150,39 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Button x:Name="EquationButton"
|
<ToggleButton x:Name="EquationButton"
|
||||||
MinWidth="44"
|
MinWidth="44"
|
||||||
MinHeight="44"
|
MinHeight="44"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Background="{TemplateBinding EquationColor}"
|
Background="{TemplateBinding EquationColor}"
|
||||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||||
BorderThickness="0">
|
BorderThickness="0">
|
||||||
<Button.Content>
|
<ToggleButton.Content>
|
||||||
<StackPanel Margin="5,0"
|
<StackPanel x:Name="FunctionNumberLabel"
|
||||||
VerticalAlignment="Top"
|
HorizontalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
VerticalAlignment="Center"
|
||||||
|
Background="Transparent"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Margin="5,0">
|
||||||
<FontIcon VerticalAlignment="Center"
|
<FontIcon VerticalAlignment="Center"
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Glyph=""/>
|
Glyph=""/>
|
||||||
<TextBlock Margin="12,-4,0,0"
|
<TextBlock Text="ƒ" Margin="12,0,0,0"/>
|
||||||
VerticalAlignment="Top"
|
<TextBlock Margin="0,10,0,0"
|
||||||
FontFamily="{TemplateBinding FontFamily}"
|
FontSize="9"
|
||||||
FontSize="16"
|
Text="{TemplateBinding EquationButtonContentIndex}"/>
|
||||||
Text="ƒₓ"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button.Content>
|
|
||||||
<Button.Resources>
|
</ToggleButton.Content>
|
||||||
|
<ToggleButton.Resources>
|
||||||
<SolidColorBrush x:Name="ButtonBackgroundPointerOver"
|
<SolidColorBrush x:Name="ButtonBackgroundPointerOver"
|
||||||
Opacity="0.7"
|
Opacity="0.7"
|
||||||
Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||||
<SolidColorBrush x:Name="ButtonForegroundPointerOver" Color="{ThemeResource SystemChromeWhiteColor}"/>
|
<SolidColorBrush x:Name="ButtonForegroundPointerOver" Color="{ThemeResource SystemChromeWhiteColor}"/>
|
||||||
<SolidColorBrush x:Name="ButtonBorderBrushPointerOver" Color="Transparent"/>
|
<SolidColorBrush x:Name="ButtonBorderBrushPointerOver" Color="Transparent"/>
|
||||||
</Button.Resources>
|
</ToggleButton.Resources>
|
||||||
</Button>
|
</ToggleButton>
|
||||||
|
|
||||||
<controls:MathRichEditBox x:Name="EquationTextBox"
|
<controls:MathRichEditBox x:Name="EquationTextBox"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
@ -431,6 +434,8 @@
|
|||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
DataContext="{x:Bind ViewModel, Mode=OneWay}"
|
DataContext="{x:Bind ViewModel, Mode=OneWay}"
|
||||||
EquationButtonClicked="EquationButtonClicked"
|
EquationButtonClicked="EquationButtonClicked"
|
||||||
|
EquationButtonContentIndex="{x:Bind ViewModel.FunctionLabelIndex, Mode=OneWay}"
|
||||||
|
EquationColor="{x:Bind ViewModel.LineColor, Mode=OneWay}"
|
||||||
Loaded="EquationInputTextBox_Loaded"/>
|
Loaded="EquationInputTextBox_Loaded"/>
|
||||||
<TextBlock x:Uid="KeyGraphFeaturesLabel"
|
<TextBlock x:Uid="KeyGraphFeaturesLabel"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
|
@ -14,9 +14,7 @@ using namespace Windows::UI::Xaml;
|
|||||||
using namespace Windows::UI::Xaml::Controls;
|
using namespace Windows::UI::Xaml::Controls;
|
||||||
|
|
||||||
KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()
|
KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,5 +47,4 @@ void KeyGraphFeaturesPanel::EquationInputTextBox_Loaded(Object ^ sender, RoutedE
|
|||||||
void KeyGraphFeaturesPanel::SetEquationTextBoxProperties()
|
void KeyGraphFeaturesPanel::SetEquationTextBoxProperties()
|
||||||
{
|
{
|
||||||
EquationInputTextBox->SetEquationText(ViewModel->Expression);
|
EquationInputTextBox->SetEquationText(ViewModel->Expression);
|
||||||
EquationInputTextBox->EquationColor = ViewModel->LineColor;
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ public
|
|||||||
|
|
||||||
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
|
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
|
||||||
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(CalculatorApp::ViewModel::EquationViewModel ^, ViewModel);
|
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(CalculatorApp::ViewModel::EquationViewModel ^, ViewModel);
|
||||||
|
|
||||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesClosed;
|
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesClosed;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -23,6 +23,9 @@ namespace GraphControl
|
|||||||
DependencyProperty ^ Equation::s_lineColorProperty;
|
DependencyProperty ^ Equation::s_lineColorProperty;
|
||||||
static constexpr auto s_propertyName_LineColor = L"LineColor";
|
static constexpr auto s_propertyName_LineColor = L"LineColor";
|
||||||
|
|
||||||
|
DependencyProperty ^ Equation::s_isLineEnabledProperty;
|
||||||
|
static constexpr auto s_propertyName_IsLineEnabled = L"IsLineEnabled";
|
||||||
|
|
||||||
DependencyProperty ^ Equation::s_xInterceptProperty;
|
DependencyProperty ^ Equation::s_xInterceptProperty;
|
||||||
static constexpr auto s_propertyName_XIntercept = L"XIntercept";
|
static constexpr auto s_propertyName_XIntercept = L"XIntercept";
|
||||||
|
|
||||||
@ -75,6 +78,7 @@ namespace GraphControl
|
|||||||
{
|
{
|
||||||
String ^ Expression = StringReference(s_propertyName_Expression);
|
String ^ Expression = StringReference(s_propertyName_Expression);
|
||||||
String ^ LineColor = StringReference(s_propertyName_LineColor);
|
String ^ LineColor = StringReference(s_propertyName_LineColor);
|
||||||
|
String ^ IsLineEnabled = StringReference(s_propertyName_IsLineEnabled);
|
||||||
String ^ XIntercept = StringReference(s_propertyName_XIntercept);
|
String ^ XIntercept = StringReference(s_propertyName_XIntercept);
|
||||||
String ^ YIntercept = StringReference(s_propertyName_YIntercept);
|
String ^ YIntercept = StringReference(s_propertyName_YIntercept);
|
||||||
String ^ Parity = StringReference(s_propertyName_Parity);
|
String ^ Parity = StringReference(s_propertyName_Parity);
|
||||||
@ -116,6 +120,15 @@ namespace GraphControl
|
|||||||
ref new PropertyMetadata(nullptr, ref new PropertyChangedCallback(&Equation::OnCustomDependencyPropertyChanged)));
|
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)
|
if (!s_xInterceptProperty)
|
||||||
{
|
{
|
||||||
s_xInterceptProperty = DependencyProperty::Register(
|
s_xInterceptProperty = DependencyProperty::Register(
|
||||||
@ -273,6 +286,10 @@ namespace GraphControl
|
|||||||
{
|
{
|
||||||
propertyName = EquationProperties::LineColor;
|
propertyName = EquationProperties::LineColor;
|
||||||
}
|
}
|
||||||
|
else if (args->Property == s_isLineEnabledProperty)
|
||||||
|
{
|
||||||
|
propertyName = EquationProperties::IsLineEnabled;
|
||||||
|
}
|
||||||
else if (args->Property == s_xInterceptProperty)
|
else if (args->Property == s_xInterceptProperty)
|
||||||
{
|
{
|
||||||
propertyName = EquationProperties::XIntercept;
|
propertyName = EquationProperties::XIntercept;
|
||||||
|
@ -9,6 +9,7 @@ namespace GraphControl
|
|||||||
{
|
{
|
||||||
extern Platform::String ^ Expression;
|
extern Platform::String ^ Expression;
|
||||||
extern Platform::String ^ LineColor;
|
extern Platform::String ^ LineColor;
|
||||||
|
extern Platform::String ^ IsLineEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref class Equation;
|
ref class Equation;
|
||||||
@ -68,6 +69,28 @@ namespace GraphControl
|
|||||||
}
|
}
|
||||||
#pragma endregion
|
#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
|
#pragma region Key Graph Features
|
||||||
|
|
||||||
|
|
||||||
@ -422,6 +445,7 @@ namespace GraphControl
|
|||||||
private:
|
private:
|
||||||
static Windows::UI::Xaml::DependencyProperty ^ s_expressionProperty;
|
static Windows::UI::Xaml::DependencyProperty ^ s_expressionProperty;
|
||||||
static Windows::UI::Xaml::DependencyProperty ^ s_lineColorProperty;
|
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_xInterceptProperty;
|
||||||
static Windows::UI::Xaml::DependencyProperty ^ s_yInterceptProperty;
|
static Windows::UI::Xaml::DependencyProperty ^ s_yInterceptProperty;
|
||||||
static Windows::UI::Xaml::DependencyProperty ^ s_parityProperty;
|
static Windows::UI::Xaml::DependencyProperty ^ s_parityProperty;
|
||||||
|
@ -148,6 +148,7 @@ public
|
|||||||
|
|
||||||
event EquationChangedEventHandler ^ EquationChanged;
|
event EquationChangedEventHandler ^ EquationChanged;
|
||||||
event EquationChangedEventHandler ^ EquationStyleChanged;
|
event EquationChangedEventHandler ^ EquationStyleChanged;
|
||||||
|
event EquationChangedEventHandler ^ EquationLineEnabledChanged;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnEquationPropertyChanged(GraphControl::Equation ^, Platform::String ^ propertyName)
|
void OnEquationPropertyChanged(GraphControl::Equation ^, Platform::String ^ propertyName)
|
||||||
@ -160,6 +161,10 @@ public
|
|||||||
{
|
{
|
||||||
EquationChanged();
|
EquationChanged();
|
||||||
}
|
}
|
||||||
|
else if (propertyName == EquationProperties::IsLineEnabled)
|
||||||
|
{
|
||||||
|
EquationLineEnabledChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -79,6 +79,8 @@ namespace GraphControl
|
|||||||
auto cw = CoreWindow::GetForCurrentThread();
|
auto cw = CoreWindow::GetForCurrentThread();
|
||||||
cw->KeyDown += ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &Grapher::OnCoreKeyDown);
|
cw->KeyDown += ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &Grapher::OnCoreKeyDown);
|
||||||
cw->KeyUp += ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &Grapher::OnCoreKeyUp);
|
cw->KeyUp += ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &Grapher::OnCoreKeyUp);
|
||||||
|
|
||||||
|
auto& formatOptions = m_solver->FormatOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Grapher::OnLoaded(Object ^ sender, RoutedEventArgs ^ args)
|
void Grapher::OnLoaded(Object ^ sender, RoutedEventArgs ^ args)
|
||||||
@ -222,6 +224,9 @@ namespace GraphControl
|
|||||||
m_tokenEquationChanged = newer->EquationChanged += ref new EquationChangedEventHandler(this, &Grapher::OnEquationChanged);
|
m_tokenEquationChanged = newer->EquationChanged += ref new EquationChangedEventHandler(this, &Grapher::OnEquationChanged);
|
||||||
|
|
||||||
m_tokenEquationStyleChanged = newer->EquationStyleChanged += ref new EquationChangedEventHandler(this, &Grapher::OnEquationStyleChanged);
|
m_tokenEquationStyleChanged = newer->EquationStyleChanged += ref new EquationChangedEventHandler(this, &Grapher::OnEquationStyleChanged);
|
||||||
|
|
||||||
|
m_tokenEquationLineEnabledChanged = newer->EquationLineEnabledChanged +=
|
||||||
|
ref new EquationChangedEventHandler(this, &Grapher::OnEquationLineEnabledChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateGraph();
|
UpdateGraph();
|
||||||
@ -245,6 +250,11 @@ namespace GraphControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Grapher::OnEquationLineEnabledChanged()
|
||||||
|
{
|
||||||
|
UpdateGraph();
|
||||||
|
}
|
||||||
|
|
||||||
void Grapher::PlotGraph()
|
void Grapher::PlotGraph()
|
||||||
{
|
{
|
||||||
UpdateGraph();
|
UpdateGraph();
|
||||||
@ -258,7 +268,9 @@ namespace GraphControl
|
|||||||
{
|
{
|
||||||
if (analyzer->CanFunctionAnalysisBePerformed())
|
if (analyzer->CanFunctionAnalysisBePerformed())
|
||||||
{
|
{
|
||||||
if (S_OK == analyzer->PerformFunctionAnalysis((Graphing::Analyzer::NativeAnalysisType)Graphing::Analyzer::PerformAnalysisType::PerformAnalysisType_All))
|
if (S_OK
|
||||||
|
== analyzer->PerformFunctionAnalysis(
|
||||||
|
(Graphing::Analyzer::NativeAnalysisType)Graphing::Analyzer::PerformAnalysisType::PerformAnalysisType_All))
|
||||||
{
|
{
|
||||||
Graphing::IGraphFunctionAnalysisData functionAnalysisData = m_solver->Analyze(analyzer.get());
|
Graphing::IGraphFunctionAnalysisData functionAnalysisData = m_solver->Analyze(analyzer.get());
|
||||||
{
|
{
|
||||||
@ -297,6 +309,8 @@ namespace GraphControl
|
|||||||
|
|
||||||
void Grapher::UpdateGraph()
|
void Grapher::UpdateGraph()
|
||||||
{
|
{
|
||||||
|
optional<vector<shared_ptr<IEquation>>> initResult = nullopt;
|
||||||
|
|
||||||
if (m_renderMain && m_graph != nullptr)
|
if (m_renderMain && m_graph != nullptr)
|
||||||
{
|
{
|
||||||
auto validEqs = GetValidEquations();
|
auto validEqs = GetValidEquations();
|
||||||
@ -323,28 +337,22 @@ namespace GraphControl
|
|||||||
unique_ptr<IExpression> graphExpression;
|
unique_ptr<IExpression> graphExpression;
|
||||||
if (graphExpression = m_solver->ParseInput(request))
|
if (graphExpression = m_solver->ParseInput(request))
|
||||||
{
|
{
|
||||||
if (m_graph->TryInitialize(graphExpression.get()))
|
initResult = m_graph->TryInitialize(graphExpression.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initResult == nullopt)
|
||||||
|
{
|
||||||
|
initResult = m_graph->TryInitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initResult != nullopt)
|
||||||
{
|
{
|
||||||
UpdateGraphOptions(m_graph->GetOptions(), validEqs);
|
UpdateGraphOptions(m_graph->GetOptions(), validEqs);
|
||||||
SetGraphArgs();
|
SetGraphArgs();
|
||||||
|
|
||||||
m_renderMain->Graph = m_graph;
|
|
||||||
|
|
||||||
UpdateVariables();
|
UpdateVariables();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_graph->TryInitialize())
|
|
||||||
{
|
|
||||||
UpdateGraphOptions(m_graph->GetOptions(), validEqs);
|
|
||||||
SetGraphArgs();
|
|
||||||
|
|
||||||
m_renderMain->Graph = m_graph;
|
m_renderMain->Graph = m_graph;
|
||||||
|
|
||||||
UpdateVariables();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,7 +490,7 @@ namespace GraphControl
|
|||||||
|
|
||||||
for (Equation ^ eq : Equations)
|
for (Equation ^ eq : Equations)
|
||||||
{
|
{
|
||||||
if (!eq->Expression->IsEmpty())
|
if (!eq->Expression->IsEmpty() && eq->IsLineEnabled)
|
||||||
{
|
{
|
||||||
validEqs.push_back(eq);
|
validEqs.push_back(eq);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ public
|
|||||||
void OnEquationsChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ args);
|
void OnEquationsChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ args);
|
||||||
void OnEquationChanged();
|
void OnEquationChanged();
|
||||||
void OnEquationStyleChanged();
|
void OnEquationStyleChanged();
|
||||||
|
void OnEquationLineEnabledChanged();
|
||||||
void UpdateGraph();
|
void UpdateGraph();
|
||||||
void UpdateGraphOptions(Graphing::IGraphingOptions& options, const std::vector<Equation ^>& validEqs);
|
void UpdateGraphOptions(Graphing::IGraphingOptions& options, const std::vector<Equation ^>& validEqs);
|
||||||
std::vector<Equation ^> GetValidEquations();
|
std::vector<Equation ^> GetValidEquations();
|
||||||
@ -210,6 +210,7 @@ public
|
|||||||
Windows::Foundation::EventRegistrationToken m_tokenEquationsChanged;
|
Windows::Foundation::EventRegistrationToken m_tokenEquationsChanged;
|
||||||
Windows::Foundation::EventRegistrationToken m_tokenEquationStyleChanged;
|
Windows::Foundation::EventRegistrationToken m_tokenEquationStyleChanged;
|
||||||
Windows::Foundation::EventRegistrationToken m_tokenEquationChanged;
|
Windows::Foundation::EventRegistrationToken m_tokenEquationChanged;
|
||||||
|
Windows::Foundation::EventRegistrationToken m_tokenEquationLineEnabledChanged;
|
||||||
|
|
||||||
static Windows::UI::Xaml::DependencyProperty ^ s_forceProportionalAxesTemplateProperty;
|
static Windows::UI::Xaml::DependencyProperty ^ s_forceProportionalAxesTemplateProperty;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user