Added support for small windows in the graphing calculator (#803)

* Add support of small windows

* remove extra space

* Modify how we manage the tooltip

* Fix merge issues
This commit is contained in:
Rudy Huyn 2019-11-22 10:36:36 -08:00 committed by Pepe Rivera
parent a33c1a4494
commit 7ef6eaf1b6
8 changed files with 504 additions and 205 deletions

View File

@ -22,6 +22,7 @@ namespace CalculatorApp::Common::Automation
StringReference DisplayCopied(L"DisplayCopied"); StringReference DisplayCopied(L"DisplayCopied");
StringReference OpenParenthesisCountChanged(L"OpenParenthesisCountChanged"); StringReference OpenParenthesisCountChanged(L"OpenParenthesisCountChanged");
StringReference NoParenthesisAdded(L"NoParenthesisAdded"); StringReference NoParenthesisAdded(L"NoParenthesisAdded");
StringReference GraphModeChanged(L"GraphModeChanged");
} }
} }
@ -139,3 +140,12 @@ NarratorAnnouncement ^ CalculatorAnnouncement::GetNoRightParenthesisAddedAnnounc
AutomationNotificationKind::ActionCompleted, AutomationNotificationKind::ActionCompleted,
AutomationNotificationProcessing::ImportantMostRecent); AutomationNotificationProcessing::ImportantMostRecent);
} }
NarratorAnnouncement ^ CalculatorAnnouncement::GetGraphModeChangedAnnouncement(Platform::String ^ announcement)
{
return ref new NarratorAnnouncement(
announcement,
CalculatorActivityIds::GraphModeChanged,
AutomationNotificationKind::ActionCompleted,
AutomationNotificationProcessing::ImportantMostRecent);
}

View File

@ -92,5 +92,8 @@ public
static NarratorAnnouncement ^ GetOpenParenthesisCountChangedAnnouncement(Platform::String ^ announcement); static NarratorAnnouncement ^ GetOpenParenthesisCountChangedAnnouncement(Platform::String ^ announcement);
static NarratorAnnouncement ^ GetNoRightParenthesisAddedAnnouncement(Platform::String ^ announcement); static NarratorAnnouncement ^ GetNoRightParenthesisAddedAnnouncement(Platform::String ^ announcement);
static NarratorAnnouncement ^ GetGraphModeChangedAnnouncement(Platform::String ^ announcement);
}; };
} }

View File

@ -1489,11 +1489,5 @@
<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>

View File

@ -3698,4 +3698,24 @@
<value>Unable to calculate the range for this function.</value> <value>Unable to calculate the range for this function.</value>
<comment>Error displayed when Range is not returned from the analyzer.</comment> <comment>Error displayed when Range is not returned from the analyzer.</comment>
</data> </data>
<data name="GraphSwitchToEquationMode" xml:space="preserve">
<value>Switch to equation mode</value>
<comment>Used in Graphing Calculator to switch the view to the equation mode</comment>
</data>
<data name="GraphSwitchToGraphMode" xml:space="preserve">
<value>Switch to graph mode</value>
<comment>Used in Graphing Calculator to switch the view to the graph mode</comment>
</data>
<data name="SwitchModeToggleButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Switch to equation mode</value>
<comment>Used in Graphing Calculator to switch the view to the equation mode</comment>
</data>
<data name="GraphSwitchedToEquationModeAnnouncement" xml:space="preserve">
<value>Current mode is equation mode</value>
<comment>Announcement used in Graphing Calculator when switching to the equation mode</comment>
</data>
<data name="GraphSwitchedToGraphModeAnnouncement" xml:space="preserve">
<value>Current mode is graph mode</value>
<comment>Announcement used in Graphing Calculator when switching to the graph mode</comment>
</data>
</root> </root>

View File

@ -1,6 +1,7 @@
<UserControl x:Class="CalculatorApp.GraphingCalculator" <UserControl x:Class="CalculatorApp.GraphingCalculator"
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:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:controls="using:CalculatorApp.Controls" xmlns:controls="using:CalculatorApp.Controls"
xmlns:converters="using:CalculatorApp.Converters" xmlns:converters="using:CalculatorApp.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -8,162 +9,326 @@
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"
xmlns:vm="using:CalculatorApp.ViewModel" xmlns:vm="using:CalculatorApp.ViewModel"
x:Name="Control"
DataContextChanged="GraphingCalculator_DataContextChanged" DataContextChanged="GraphingCalculator_DataContextChanged"
mc:Ignorable="d"> mc:Ignorable="d">
<UserControl.Resources> <UserControl.Resources>
<Style x:Key="GraphButtonStyle" TargetType="Button"> <ResourceDictionary>
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/> <Style x:Key="GraphButtonStyle" TargetType="Button">
<Setter Property="Background" Value="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="Background" Value="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/>
<Setter Property="Margin" Value="0"/> <Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8"/> <Setter Property="Margin" Value="0"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="Padding" Value="8"/>
<Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="{StaticResource CaptionFontSize}"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template"> <Setter Property="FontSize" Value="{StaticResource CaptionFontSize}"/>
<Setter.Value> <Setter Property="Template">
<ControlTemplate TargetType="Button"> <Setter.Value>
<ContentPresenter x:Name="ContentPresenter" <ControlTemplate TargetType="Button">
Padding="{TemplateBinding Padding}" <ContentPresenter x:Name="ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Padding="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Background="{TemplateBinding Background}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
BorderBrush="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}" Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"
FontSize="{TemplateBinding FontSize}" BorderThickness="{TemplateBinding BorderThickness}"
FontWeight="SemiBold" FontSize="{TemplateBinding FontSize}"
AutomationProperties.AccessibilityView="Raw" FontWeight="SemiBold"
Content="{TemplateBinding Content}" AutomationProperties.AccessibilityView="Raw"
ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"> ContentTemplate="{TemplateBinding ContentTemplate}"
<VisualStateManager.VisualStateGroups> ContentTransitions="{TemplateBinding ContentTransitions}">
<VisualStateGroup x:Name="CommonStates"> <VisualStateManager.VisualStateGroups>
<VisualState x:Name="Normal"/> <VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="PointerOver"> <VisualState x:Name="Normal"/>
<VisualState.Setters> <VisualState x:Name="PointerOver">
<Setter Target="ContentPresenter.Background" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/> <VisualState.Setters>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource AppControlForegroundAccentBrush}"/> <Setter Target="ContentPresenter.Background" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/>
</VisualState.Setters> <Setter Target="ContentPresenter.Foreground" Value="{ThemeResource AppControlForegroundAccentBrush}"/>
</VisualState> </VisualState.Setters>
<VisualState x:Name="Pressed"> </VisualState>
<VisualState.Setters> <VisualState x:Name="Pressed">
<Setter Target="ContentPresenter.Background" Value="{ThemeResource AppControlPressedButtonFaceBrush}"/> <VisualState.Setters>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource AppControlForegroundAccentBrush}"/> <Setter Target="ContentPresenter.Background" Value="{ThemeResource AppControlPressedButtonFaceBrush}"/>
</VisualState.Setters> <Setter Target="ContentPresenter.Foreground" Value="{ThemeResource AppControlForegroundAccentBrush}"/>
</VisualState> </VisualState.Setters>
<VisualState x:Name="Disabled"> </VisualState>
<VisualState.Setters> <VisualState x:Name="Disabled">
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/> <VisualState.Setters>
</VisualState.Setters> <Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/>
</VisualState> </VisualState.Setters>
</VisualStateGroup> </VisualState>
</VisualStateManager.VisualStateGroups> </VisualStateGroup>
</ContentPresenter> </VisualStateManager.VisualStateGroups>
</ControlTemplate> </ContentPresenter>
</Setter.Value> </ControlTemplate>
</Setter> </Setter.Value>
</Style> </Setter>
</Style>
<Style x:Key="GraphRepeatButtonStyle" TargetType="RepeatButton"> <Style x:Key="GraphRepeatButtonStyle" TargetType="RepeatButton">
<Setter Property="Background" Value="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/> <Setter Property="Background" Value="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/>
<Setter Property="Foreground" Value="{ThemeResource RepeatButtonForeground}"/> <Setter Property="Foreground" Value="{ThemeResource RepeatButtonForeground}"/>
<Setter Property="BorderBrush" Value="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"/> <Setter Property="BorderBrush" Value="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="0"/> <Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/> <Setter Property="Padding" Value="0"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Delay" Value="500"/> <Setter Property="Delay" Value="500"/>
<Setter Property="Interval" Value="40"/> <Setter Property="Interval" Value="40"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/> <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontWeight" Value="Normal"/> <Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/> <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/> <Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/>
<Setter Property="FocusVisualMargin" Value="-3"/> <Setter Property="FocusVisualMargin" Value="-3"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="RepeatButton"> <ControlTemplate TargetType="RepeatButton">
<ContentPresenter x:Name="ContentPresenter" <ContentPresenter x:Name="ContentPresenter"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
AutomationProperties.AccessibilityView="Raw" AutomationProperties.AccessibilityView="Raw"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}" ContentTransitions="{TemplateBinding ContentTransitions}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualStateManager.VisualStateGroups> <VisualState x:Name="PointerOver">
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver"> <Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundAccentBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<Storyboard> <VisualState x:Name="Pressed">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundAccentBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed"> <Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundAccentBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<Storyboard> <VisualState x:Name="Disabled">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlForegroundAccentBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled"> <Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource RepeatButtonBorderBrushDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource RepeatButtonForegroundDisabled}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<Storyboard> </VisualStateGroup>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource RepeatButtonBorderBrushDisabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource RepeatButtonForegroundDisabled}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup> </VisualStateManager.VisualStateGroups>
</ContentPresenter>
</VisualStateManager.VisualStateGroups> </ControlTemplate>
</ContentPresenter> </Setter.Value>
</Setter>
</Style>
</ControlTemplate> <Style x:Key="SwitchModeToggleButtonStyle" TargetType="ToggleButton">
</Setter.Value> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
</Setter> <Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
</Style> <Setter Property="BorderBrush" Value="{ThemeResource AppControlForegroundTransparentRevealBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="{ThemeResource ButtonPadding}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/>
<Setter Property="FocusVisualMargin" Value="-3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid x:Name="RootGrid"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="RootGrid.(RevealBrush.State)" Value="PointerOver"/>
<Setter Target="RootGrid.Background" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/>
</VisualState.Setters>
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="RootGrid.(RevealBrush.State)" Value="Pressed"/>
<Setter Target="RootGrid.Background" Value="{ThemeResource AppControlPressedButtonFaceBrush}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/>
</VisualState.Setters>
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="{ThemeResource ToggleButtonRevealBackgroundDisabled}"/>
<Setter Target="ContentPresenter.Opacity" Value="0.5"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Checked">
<VisualState.Setters>
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ToggleButtonRevealBorderBrushChecked}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemAccentColor}"/>
</VisualState.Setters>
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="CheckedPointerOver">
<VisualState.Setters>
<Setter Target="RootGrid.(RevealBrush.State)" Value="PointerOver"/>
<Setter Target="RootGrid.Background" Value="{ThemeResource AppControlHoverButtonFaceBrush}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemAccentColor}"/>
</VisualState.Setters>
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="CheckedPressed">
<VisualState.Setters>
<Setter Target="RootGrid.(RevealBrush.State)" Value="Pressed"/>
<Setter Target="RootGrid.Background" Value="{ThemeResource AppControlPressedButtonFaceBrush}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemAccentColor}"/>
</VisualState.Setters>
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="CheckedDisabled">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="{ThemeResource ToggleButtonRevealBackgroundDisabled}"/>
<Setter Target="ContentPresenter.Opacity" Value="0.5"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SystemAccentColor}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Indeterminate">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="{ThemeResource ToggleButtonRevealBackgroundIndeterminate}"/>
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ToggleButtonRevealBorderBrushIndeterminate}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ToggleButtonForegroundIndeterminate}"/>
</VisualState.Setters>
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="IndeterminatePointerOver">
<VisualState.Setters>
<Setter Target="RootGrid.(RevealBrush.State)" Value="PointerOver"/>
<Setter Target="RootGrid.Background" Value="{ThemeResource ToggleButtonRevealBackgroundIndeterminatePointerOver}"/>
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ToggleButtonRevealBorderBrushIndeterminatePointerOver}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ToggleButtonForegroundIndeterminatePointerOver}"/>
</VisualState.Setters>
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="IndeterminatePressed">
<VisualState.Setters>
<Setter Target="RootGrid.(RevealBrush.State)" Value="Pressed"/>
<Setter Target="RootGrid.Background" Value="{ThemeResource ToggleButtonRevealBackgroundIndeterminatePressed}"/>
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ToggleButtonRevealBorderBrushIndeterminatePressed}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ToggleButtonForegroundIndeterminatePressed}"/>
</VisualState.Setters>
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="IndeterminateDisabled">
<VisualState.Setters>
<Setter Target="RootGrid.Background" Value="{ThemeResource ToggleButtonRevealBackgroundIndeterminateDisabled}"/>
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ToggleButtonRevealBorderBrushIndeterminateDisabled}"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ToggleButtonForegroundIndeterminateDisabled}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
AutomationProperties.AccessibilityView="Raw"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
CornerRadius="{TemplateBinding CornerRadius}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<converters:BooleanToVisibilityConverter x:Name="BooleanToVisibilityConverter"/> <converters:BooleanToVisibilityConverter x:Name="BooleanToVisibilityConverter"/>
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/> <converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<Style x:Key="ThemedSwitchModeToggleButtonStyle"
BasedOn="{StaticResource SwitchModeToggleButtonStyle}"
TargetType="ToggleButton"/>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<Style x:Key="ThemedSwitchModeToggleButtonStyle"
BasedOn="{StaticResource SwitchModeToggleButtonStyle}"
TargetType="ToggleButton"/>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<Style x:Key="ThemedSwitchModeToggleButtonStyle" TargetType="ToggleButton"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
<Grid x:Name="RootGrid"> <Grid x:Name="RootGrid">
@ -175,11 +340,49 @@
<ColumnDefinition Width="2*"/> <ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="ColumnsState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="800"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="SmallState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="Control.IsSmallState" Value="True"/>
<Setter Target="LeftGrid.(Grid.ColumnSpan)" Value="2"/>
<Setter Target="RightGrid.(Grid.ColumnSpan)" Value="2"/>
<Setter Target="RightGrid.(Grid.Column)" Value="0"/>
<Setter Target="SwitchModeToggleButton.Visibility" Value="Visible"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- Top panel -->
<Grid Grid.ColumnSpan="2">
<ToggleButton x:Name="SwitchModeToggleButton"
x:Uid="SwitchModeToggleButton"
Margin="0,2,4,2"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
Style="{ThemeResource ThemedSwitchModeToggleButtonStyle}"
AutomationProperties.AutomationId="SwitchModeToggleButton"
AutomationProperties.Name="{x:Bind GetInfoForSwitchModeToggleButton(SwitchModeToggleButton.IsChecked.Value), Mode=OneWay}"
Checked="SwitchModeToggleButton_Checked"
ToolTipService.ToolTip="{x:Bind GetInfoForSwitchModeToggleButton(SwitchModeToggleButton.IsChecked.Value), Mode=OneWay}"
Unchecked="SwitchModeToggleButton_Checked"
Visibility="Collapsed">
<!-- TODO: update this icon -->
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph=""/>
</ToggleButton>
</Grid>
<!-- Left portion of the screen --> <!-- Left portion of the screen -->
<Grid x:Name="LeftGrid" <Grid x:Name="LeftGrid"
Grid.Row="1" Grid.Row="1"
Grid.Column="0"> Visibility="{x:Bind ShouldDisplayPanel(IsSmallState, SwitchModeToggleButton.IsChecked.Value, x:True), Mode=OneWay}">
<Grid Grid.Row="0" Margin="0,4,0,0"> <Grid Grid.Row="0" Margin="0,4,0,0">
<graphControl:Grapher Name="GraphingControl" <graphControl:Grapher Name="GraphingControl"
ForceProportionalAxes="True" ForceProportionalAxes="True"
@ -192,17 +395,16 @@
</graphControl:Grapher.Background> </graphControl:Grapher.Background>
</graphControl:Grapher> </graphControl:Grapher>
<StackPanel Grid.Row="0" <StackPanel Margin="0,12,12,0"
Margin="0,12,12,0"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
Orientation="Horizontal"> Orientation="Horizontal">
<!-- Temporary button until the final UI is created --> <!-- Temporary button until the final UI is created -->
<Button x:Name="VariableEditing" <Button x:Name="VariableEditing"
Margin="0,0,4,0"
MinHeight="44"
MinWidth="44" MinWidth="44"
MinHeight="44"
Margin="0,0,4,0"
Style="{StaticResource GraphButtonStyle}" Style="{StaticResource GraphButtonStyle}"
RequestedTheme="Light"> RequestedTheme="Light">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE70F;"/> <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE70F;"/>
@ -369,9 +571,9 @@
</Button> </Button>
<Button x:Name="ActiveTracing" <Button x:Name="ActiveTracing"
Margin="0,0,4,0"
MinHeight="44"
MinWidth="44" MinWidth="44"
MinHeight="44"
Margin="0,0,4,0"
Style="{StaticResource GraphButtonStyle}" Style="{StaticResource GraphButtonStyle}"
Click="OnActiveTracingClick" Click="OnActiveTracingClick"
RequestedTheme="Light"> RequestedTheme="Light">
@ -379,9 +581,9 @@
</Button> </Button>
<Button x:Name="Share" <Button x:Name="Share"
Margin="0"
MinHeight="44"
MinWidth="44" MinWidth="44"
MinHeight="44"
Margin="0"
Style="{StaticResource GraphButtonStyle}" Style="{StaticResource GraphButtonStyle}"
Click="OnShareClick" Click="OnShareClick"
RequestedTheme="Light"> RequestedTheme="Light">
@ -396,9 +598,9 @@
Orientation="Vertical"> Orientation="Vertical">
<RepeatButton x:Uid="zoomInButton" <RepeatButton x:Uid="zoomInButton"
Margin="0,0,0,4"
MinHeight="44"
MinWidth="44" MinWidth="44"
MinHeight="44"
Margin="0,0,0,4"
Style="{ThemeResource GraphRepeatButtonStyle}" Style="{ThemeResource GraphRepeatButtonStyle}"
FontFamily="{StaticResource SymbolThemeFontFamily}" FontFamily="{StaticResource SymbolThemeFontFamily}"
AutomationProperties.AutomationId="zoomInButton" AutomationProperties.AutomationId="zoomInButton"
@ -416,9 +618,9 @@
</RepeatButton> </RepeatButton>
<RepeatButton x:Uid="zoomOutButton" <RepeatButton x:Uid="zoomOutButton"
Margin="0,0,0,4"
MinHeight="44"
MinWidth="44" MinWidth="44"
MinHeight="44"
Margin="0,0,0,4"
Style="{ThemeResource GraphRepeatButtonStyle}" Style="{ThemeResource GraphRepeatButtonStyle}"
FontFamily="{StaticResource SymbolThemeFontFamily}" FontFamily="{StaticResource SymbolThemeFontFamily}"
AutomationProperties.AutomationId="zoomOutButton" AutomationProperties.AutomationId="zoomOutButton"
@ -436,9 +638,9 @@
</RepeatButton> </RepeatButton>
<Button x:Uid="zoomResetButton" <Button x:Uid="zoomResetButton"
Margin="0,0,0,0"
MinHeight="44"
MinWidth="44" MinWidth="44"
MinHeight="44"
Margin="0,0,0,0"
Style="{ThemeResource GraphButtonStyle}" Style="{ThemeResource GraphButtonStyle}"
AutomationProperties.AutomationId="zoomResetButton" AutomationProperties.AutomationId="zoomResetButton"
Command="{x:Bind ZoomResetButtonPressed, Mode=OneTime}" Command="{x:Bind ZoomResetButtonPressed, Mode=OneTime}"
@ -456,22 +658,24 @@
</Button> </Button>
</StackPanel> </StackPanel>
<Popup x:Name="TraceValuePopup" <Border x:Name="TraceValuePopup"
Grid.Row="0" Padding="{ThemeResource ToolTipBorderThemePadding}"
RenderTransformOrigin="0,1"> HorizontalAlignment="Left"
<Popup.RenderTransform> VerticalAlignment="Top"
<TranslateTransform x:Name="TraceValuePopupTransform" X="50" Y="150"/> Background="{ThemeResource ToolTipBackground}"
</Popup.RenderTransform> BorderBrush="{ThemeResource ToolTipBorderBrush}"
<Grid Background="{StaticResource ToolTipBackground}" BorderThickness="{ThemeResource ToolTipBorderThemeThickness}"
BorderBrush="{StaticResource ToolTipBorderBrush}" contract7Present:BackgroundSizing="OuterBorderEdge"
BorderThickness="3,3,3,3"> IsHitTestVisible="False"
<TextBlock x:Name="TraceValue" SizeChanged="TraceValuePopup_SizeChanged"
Margin="5,5,5,5" Visibility="Collapsed">
Foreground="{StaticResource ToolTipForeground}" <Border.RenderTransform>
Text="x=0,y=0"/> <TranslateTransform x:Name="TraceValuePopupTransform"/>
</Grid> </Border.RenderTransform>
</Popup> <TextBlock x:Name="TraceValue"
Foreground="{ThemeResource ToolTipForeground}"
Text="x=0,y=0"/>
</Border>
</Grid> </Grid>
</Grid> </Grid>
@ -481,7 +685,7 @@
Grid.Row="1" Grid.Row="1"
Grid.RowSpan="2" Grid.RowSpan="2"
Grid.Column="1" Grid.Column="1"
Margin="0,0,0,0"> Visibility="{x:Bind ShouldDisplayPanel(IsSmallState, SwitchModeToggleButton.IsChecked.Value, x:False), Mode=OneWay}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="5*"/> <RowDefinition Height="5*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
@ -498,9 +702,9 @@
<!-- This control should be within a grid that limits the hight to keep the sticky footer functionality from breaking --> <!-- This control should be within a grid that limits the hight to keep the sticky footer functionality from breaking -->
<local:EquationInputArea x:Name="EquationInputAreaControl" <local:EquationInputArea x:Name="EquationInputAreaControl"
Margin="0,4,0,0" Margin="0,4,0,0"
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"
Equations="{x:Bind ViewModel.Equations}" Equations="{x:Bind ViewModel.Equations}"
KeyGraphFeaturesRequested="OnEquationKeyGraphFeaturesRequested"/> KeyGraphFeaturesRequested="OnEquationKeyGraphFeaturesRequested"
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
<Grid x:Name="ButtonContainerGrid" <Grid x:Name="ButtonContainerGrid"
Grid.Row="1" Grid.Row="1"

View File

@ -5,7 +5,10 @@
#include "GraphingCalculator.xaml.h" #include "GraphingCalculator.xaml.h"
#include "CalcViewModel/Common/TraceLogger.h" #include "CalcViewModel/Common/TraceLogger.h"
#include "CalcViewModel/Common/LocalizationSettings.h" #include "CalcViewModel/Common/LocalizationSettings.h"
#include "CalcViewModel/Common/AppResourceProvider.h"
#include "CalcViewModel/Common/KeyboardShortcutManager.h" #include "CalcViewModel/Common/KeyboardShortcutManager.h"
#include "CalcViewModel/Common/Automation/NarratorAnnouncement.h"
#include "CalcViewModel/Common/Automation/NarratorNotifier.h"
#include "Controls/CalculationResult.h" #include "Controls/CalculationResult.h"
#include "CalcManager/NumberFormattingUtils.h" #include "CalcManager/NumberFormattingUtils.h"
#include "Calculator/Controls/EquationTextBox.h" #include "Calculator/Controls/EquationTextBox.h"
@ -14,6 +17,7 @@
using namespace CalculatorApp; using namespace CalculatorApp;
using namespace CalculatorApp::Common; using namespace CalculatorApp::Common;
using namespace CalculatorApp::Common::Automation;
using namespace CalculatorApp::Controls; using namespace CalculatorApp::Controls;
using namespace CalculatorApp::ViewModel; using namespace CalculatorApp::ViewModel;
using namespace CalcManager::NumberFormattingUtils; using namespace CalcManager::NumberFormattingUtils;
@ -42,6 +46,8 @@ using namespace Windows::UI::Popups;
constexpr auto sc_ViewModelPropertyName = L"ViewModel"; constexpr auto sc_ViewModelPropertyName = L"ViewModel";
DEPENDENCY_PROPERTY_INITIALIZATION(GraphingCalculator, IsSmallState);
GraphingCalculator::GraphingCalculator() GraphingCalculator::GraphingCalculator()
: ActiveTracingOn(false) : ActiveTracingOn(false)
{ {
@ -64,14 +70,9 @@ GraphingCalculator::GraphingCalculator()
void GraphingCalculator::OnShowTracePopupChanged(bool newValue) void GraphingCalculator::OnShowTracePopupChanged(bool newValue)
{ {
if (TraceValuePopup->IsOpen != newValue) if ((TraceValuePopup->Visibility == ::Visibility::Visible) != newValue)
{ {
TraceValuePopup->IsOpen = newValue; TraceValuePopup->Visibility = newValue ? ::Visibility::Visible : ::Visibility::Collapsed;
if (TraceValuePopup->IsOpen)
{
// Set the keyboard focus to the graph control so we can use the arrow keys safely.
GraphingControl->Focus(::FocusState::Programmatic);
}
} }
} }
@ -118,10 +119,8 @@ void GraphingCalculator::OnEquationsVectorChanged(IObservableVector<EquationView
void GraphingCalculator::OnTracePointChanged(Windows::Foundation::Point newPoint) void GraphingCalculator::OnTracePointChanged(Windows::Foundation::Point newPoint)
{ {
TraceValuePopupTransform->X = (int)GraphingControl->TraceLocation.X + 15;
TraceValuePopupTransform->Y = (int)GraphingControl->TraceLocation.Y - 30;
TraceValue->Text = "(" + newPoint.X.ToString() + ", " + newPoint.Y.ToString() + ")"; TraceValue->Text = "(" + newPoint.X.ToString() + ", " + newPoint.Y.ToString() + ")";
PositionGraphPopup();
} }
GraphingCalculatorViewModel ^ GraphingCalculator::ViewModel::get() GraphingCalculatorViewModel ^ GraphingCalculator::ViewModel::get()
@ -377,3 +376,63 @@ void GraphingCalculator::OnKeyGraphFeaturesClosed(Object ^ sender, RoutedEventAr
{ {
IsKeyGraphFeaturesVisible = false; IsKeyGraphFeaturesVisible = false;
} }
Visibility GraphingCalculator::ShouldDisplayPanel(bool isSmallState, bool isEquationModeActivated, bool isGraphPanel)
{
return (!isSmallState || isEquationModeActivated ^ isGraphPanel) ? ::Visibility::Visible : ::Visibility::Collapsed;
}
Platform::String ^ GraphingCalculator::GetInfoForSwitchModeToggleButton(bool isChecked)
{
if (isChecked)
{
return AppResourceProvider::GetInstance().GetResourceString(L"GraphSwitchToGraphMode");
}
else
{
return AppResourceProvider::GetInstance().GetResourceString(L"GraphSwitchToEquationMode");
}
}
void GraphingCalculator::SwitchModeToggleButton_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
{
auto narratorNotifier = ref new NarratorNotifier();
String ^ announcementText;
if (SwitchModeToggleButton->IsChecked->Value)
{
announcementText = AppResourceProvider::GetInstance().GetResourceString(L"GraphSwitchedToEquationModeAnnouncement");
}
else
{
announcementText = AppResourceProvider::GetInstance().GetResourceString(L"GraphSwitchedToGraphModeAnnouncement");
}
auto announcement = CalculatorAnnouncement::GetGraphModeChangedAnnouncement(announcementText);
narratorNotifier->Announce(announcement);
}
void GraphingCalculator::PositionGraphPopup()
{
if (GraphingControl->TraceLocation.X + 15 + TraceValuePopup->ActualWidth >= GraphingControl->ActualWidth)
{
TraceValuePopupTransform->X = (int)GraphingControl->TraceLocation.X - 15 - TraceValuePopup->ActualWidth;
}
else
{
TraceValuePopupTransform->X = (int)GraphingControl->TraceLocation.X + 15;
}
if (GraphingControl->TraceLocation.Y >= 30)
{
TraceValuePopupTransform->Y = (int)GraphingControl->TraceLocation.Y - 30;
}
else
{
TraceValuePopupTransform->Y = (int)GraphingControl->TraceLocation.Y;
}
}
void GraphingCalculator::TraceValuePopup_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e)
{
PositionGraphPopup();
}

View File

@ -13,16 +13,18 @@ namespace CalculatorApp
constexpr double zoomInScale = 1 / 1.0625; constexpr double zoomInScale = 1 / 1.0625;
constexpr double zoomOutScale = 1.0625; constexpr double zoomOutScale = 1.0625;
public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
{ {
public: public:
GraphingCalculator(); GraphingCalculator();
OBSERVABLE_OBJECT(); OBSERVABLE_OBJECT();
DEPENDENCY_PROPERTY_OWNER(GraphingCalculator);
COMMAND_FOR_METHOD(ZoomOutButtonPressed, GraphingCalculator::OnZoomOutCommand); COMMAND_FOR_METHOD(ZoomOutButtonPressed, GraphingCalculator::OnZoomOutCommand);
COMMAND_FOR_METHOD(ZoomInButtonPressed, GraphingCalculator::OnZoomInCommand); COMMAND_FOR_METHOD(ZoomInButtonPressed, GraphingCalculator::OnZoomInCommand);
COMMAND_FOR_METHOD(ZoomResetButtonPressed, GraphingCalculator::OnZoomResetCommand); COMMAND_FOR_METHOD(ZoomResetButtonPressed, GraphingCalculator::OnZoomResetCommand);
OBSERVABLE_PROPERTY_RW(bool, IsKeyGraphFeaturesVisible); OBSERVABLE_PROPERTY_RW(bool, IsKeyGraphFeaturesVisible);
DEPENDENCY_PROPERTY(bool, IsSmallState);
property CalculatorApp::ViewModel::GraphingCalculatorViewModel^ ViewModel property CalculatorApp::ViewModel::GraphingCalculatorViewModel^ ViewModel
{ {
@ -30,39 +32,43 @@ namespace CalculatorApp
void set(CalculatorApp::ViewModel::GraphingCalculatorViewModel^ vm); void set(CalculatorApp::ViewModel::GraphingCalculatorViewModel^ vm);
} }
Windows::UI::Xaml::Visibility ShouldDisplayPanel(bool isSmallState, bool isEquationModeActivated, bool isGraphPanel);
Platform::String ^ GetInfoForSwitchModeToggleButton(bool isChecked);
private: private:
void GraphingCalculator_DataContextChanged(Windows::UI::Xaml::FrameworkElement^ sender, Windows::UI::Xaml::DataContextChangedEventArgs^ args); void GraphingCalculator_DataContextChanged(Windows::UI::Xaml::FrameworkElement ^ sender, Windows::UI::Xaml::DataContextChangedEventArgs ^ args);
void OnVariableChanged(Platform::Object^ sender, CalculatorApp::ViewModel::VariableChangedEventArgs args); void GraphVariablesUpdated(Platform::Object ^ sender, Object ^ args);
void OnVariableChanged(Platform::Object ^ sender, CalculatorApp::ViewModel::VariableChangedEventArgs args);
void OnEquationsVectorChanged( void OnEquationsVectorChanged(
Windows::Foundation::Collections::IObservableVector<CalculatorApp::ViewModel::EquationViewModel ^> ^ sender, Windows::Foundation::Collections::IObservableVector<CalculatorApp::ViewModel::EquationViewModel ^> ^ sender,
Windows::Foundation::Collections::IVectorChangedEventArgs ^ event); Windows::Foundation::Collections::IVectorChangedEventArgs ^ event);
void TextBoxLosingFocus(Windows::UI::Xaml::Controls::TextBox^ textbox, Windows::UI::Xaml::Input::LosingFocusEventArgs^ args); void TextBoxLosingFocus(Windows::UI::Xaml::Controls::TextBox ^ textbox, Windows::UI::Xaml::Input::LosingFocusEventArgs ^ args);
void TextBoxKeyDown(Windows::UI::Xaml::Controls::TextBox^ textbox, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e); void TextBoxKeyDown(Windows::UI::Xaml::Controls::TextBox ^ textbox, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e);
void SubmitTextbox(Windows::UI::Xaml::Controls::TextBox^ textbox); void SubmitTextbox(Windows::UI::Xaml::Controls::TextBox ^ textbox);
void OnZoomInCommand(Object ^ parameter); void OnZoomInCommand(Object ^ parameter);
void OnZoomOutCommand(Object ^ parameter); void OnZoomOutCommand(Object ^ parameter);
void OnZoomResetCommand(Object ^ parameter); void OnZoomResetCommand(Object ^ parameter);
double validateDouble(Platform::String^ value, double defaultValue); double validateDouble(Platform::String ^ value, double defaultValue);
CalculatorApp::ViewModel::GraphingCalculatorViewModel^ m_viewModel; CalculatorApp::ViewModel::GraphingCalculatorViewModel ^ m_viewModel;
void OnShareClick(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void OnShareClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void OnShowTracePopupChanged(bool newValue); void OnShowTracePopupChanged(bool newValue);
void OnTracePointChanged(Windows::Foundation::Point newPoint); void OnTracePointChanged(Windows::Foundation::Point newPoint);
private: private:
Windows::Foundation::EventRegistrationToken m_dataRequestedToken; Windows::Foundation::EventRegistrationToken m_dataRequestedToken;
Windows::Foundation::EventRegistrationToken m_vectorChangedToken; Windows::Foundation::EventRegistrationToken m_vectorChangedToken;
Windows::Foundation::EventRegistrationToken m_variableUpdatedToken; Windows::Foundation::EventRegistrationToken m_variableUpdatedToken;
void OnDataRequested(Windows::ApplicationModel::DataTransfer::DataTransferManager^ sender, Windows::ApplicationModel::DataTransfer::DataRequestedEventArgs^ e); void OnDataRequested(
Windows::ApplicationModel::DataTransfer::DataTransferManager ^ sender,
Windows::ApplicationModel::DataTransfer::DataRequestedEventArgs ^ e);
void TextBoxGotFocus(Windows::UI::Xaml::Controls::TextBox^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void TextBoxGotFocus(Windows::UI::Xaml::Controls::TextBox ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void OnActiveTracingClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); void OnActiveTracingClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void GraphingControl_LostFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); void GraphingControl_LostFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void GraphingControl_LosingFocus(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::LosingFocusEventArgs ^ args); void GraphingControl_LosingFocus(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::LosingFocusEventArgs ^ args);
@ -70,6 +76,9 @@ namespace CalculatorApp
void OnEquationKeyGraphFeaturesRequested(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); void OnEquationKeyGraphFeaturesRequested(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void OnKeyGraphFeaturesClosed(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); void OnKeyGraphFeaturesClosed(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
bool ActiveTracingOn; bool ActiveTracingOn;
void SwitchModeToggleButton_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void TraceValuePopup_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
void PositionGraphPopup();
}; };
} }

View File

@ -96,7 +96,7 @@
<Border x:Name="DateCalcHolder"> <Border x:Name="DateCalcHolder">
<!-- PLACEHOLDER!!!! This is where the date calculator goes when it is delay loaded --> <!-- PLACEHOLDER!!!! This is where the date calculator goes when it is delay loaded -->
</Border> </Border>
<Border x:Name="GraphingCalcHolder" Grid.Row="1"> <Border x:Name="GraphingCalcHolder">
<!-- PLACEHOLDER!!!! This is where the graphing calculator goes when it is delay loaded --> <!-- PLACEHOLDER!!!! This is where the graphing calculator goes when it is delay loaded -->
</Border> </Border>
<Border x:Name="ConverterHolder"> <Border x:Name="ConverterHolder">