Add tooltips to buttons in graphing calculator (#822)

* Add tooltips to buttons in graphing calculator

* Fix break due to bad merge

* CR Feedback
This commit is contained in:
Eric Wong 2019-11-22 15:08:23 -08:00 committed by Stephanie Anderl
parent 7ef6eaf1b6
commit 603d672015
8 changed files with 105 additions and 11 deletions

View File

@ -1669,6 +1669,7 @@
IsTabStop="False"
Visibility="Collapsed"/>
<Button x:Name="RemoveButton"
x:Uid="removeButton"
Grid.Column="3"
MinWidth="34"
Margin="{ThemeResource HelperButtonThemePadding}"
@ -1684,6 +1685,7 @@
IsTabStop="False"
Visibility="Collapsed"/>
<ToggleButton x:Name="ColorChooserButton"
x:Uid="colorChooserButton"
Grid.Column="2"
MinWidth="34"
Margin="{ThemeResource HelperButtonThemePadding}"
@ -1709,6 +1711,7 @@
</ToggleButton.Resources>
</ToggleButton>
<Button x:Name="FunctionButton"
x:Uid="functionAnalysisButton"
Grid.Column="1"
MinWidth="34"
Margin="{ThemeResource HelperButtonThemePadding}"

View File

@ -308,7 +308,9 @@
<Filter>Controls</Filter>
</ClCompile>
<ClCompile Include="Controls\MathRichEditBox.cpp" />
<ClCompile Include="Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml.cpp" />
<ClCompile Include="Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml.cpp" >
<Filter>Views\GraphingCalculator</Filter>
</ClCompile>
<ClCompile Include="TemplateSelectors\KeyGraphFeaturesTemplateSelector.cpp" />
</ItemGroup>
<ItemGroup>
@ -397,7 +399,9 @@
<Filter>Controls</Filter>
</ClInclude>
<ClInclude Include="Controls\MathRichEditBox.h" />
<ClInclude Include="Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml.h" />
<ClInclude Include="Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml.h" >
<Filter>Views\GraphingCalculator</Filter>
</ClInclude>
<ClInclude Include="TemplateSelectors\KeyGraphFeaturesTemplateSelector.h" />
</ItemGroup>
<ItemGroup>
@ -476,7 +480,9 @@
<Page Include="EquationStylePanelControl.xaml">
<Filter>Views\GraphingCalculator</Filter>
</Page>
<Page Include="Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml" />
<Page Include="Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml" >
<Filter>Views\GraphingCalculator</Filter>
</Page>
</ItemGroup>
<ItemGroup>
<PRIResource Include="Resources\en-US\CEngineStrings.resw">

View File

@ -2,6 +2,8 @@
// Licensed under the MIT License.
#include "pch.h"
#include "CalcViewModel/Common/AppResourceProvider.h"
#include "CalcViewModel/Common/LocalizationStringUtil.h"
#include "EquationTextBox.h"
using namespace std;
@ -27,6 +29,7 @@ DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, EquationButtonContentIndex);
void EquationTextBox::OnApplyTemplate()
{
m_equationButton = dynamic_cast<ToggleButton ^>(GetTemplateChild("EquationButton"));
m_kgfEquationButton = dynamic_cast<Button ^>(GetTemplateChild("KGFEquationButton"));
m_richEditBox = dynamic_cast<MathRichEditBox ^>(GetTemplateChild("EquationTextBox"));
m_deleteButton = dynamic_cast<Button ^>(GetTemplateChild("DeleteButton"));
m_removeButton = dynamic_cast<Button ^>(GetTemplateChild("RemoveButton"));
@ -44,6 +47,16 @@ void EquationTextBox::OnApplyTemplate()
if (m_equationButton != nullptr)
{
m_equationButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnEquationButtonClicked);
auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = m_equationButton->IsChecked->Value ? resProvider.GetResourceString(L"showEquationButtonToolTip") : resProvider.GetResourceString(L"hideEquationButtonToolTip");
ToolTipService::SetToolTip(m_equationButton, toolTip);
}
if (m_kgfEquationButton != nullptr)
{
m_kgfEquationButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnKGFEquationButtonClicked);
}
if (m_deleteButton != nullptr)
@ -172,6 +185,17 @@ void EquationTextBox::OnDeleteButtonClicked(Object ^ sender, RoutedEventArgs ^ e
}
void EquationTextBox::OnEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
{
EquationButtonClicked(this, ref new RoutedEventArgs());
auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = m_equationButton->IsChecked->Value ? resProvider.GetResourceString(L"showEquationButtonToolTip") : resProvider.GetResourceString(L"hideEquationButtonToolTip");
ToolTipService::SetToolTip(m_equationButton, toolTip);
}
void EquationTextBox::OnKGFEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
{
EquationButtonClicked(this, ref new RoutedEventArgs());
}

View File

@ -53,6 +53,7 @@ namespace CalculatorApp
void OnDeleteButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnEquationButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnKGFEquationButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void OnRemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnColorChooserButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnFunctionButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
@ -62,6 +63,7 @@ namespace CalculatorApp
CalculatorApp::Controls::MathRichEditBox^ m_richEditBox;
Windows::UI::Xaml::Controls::Primitives::ToggleButton^ m_equationButton;
Windows::UI::Xaml::Controls::Button^ m_kgfEquationButton;
Windows::UI::Xaml::Controls::Button^ m_deleteButton;
Windows::UI::Xaml::Controls::Button^ m_removeButton;
Windows::UI::Xaml::Controls::Button^ m_functionButton;

View File

@ -3698,6 +3698,50 @@
<value>Unable to calculate the range for this function.</value>
<comment>Error displayed when Range is not returned from the analyzer.</comment>
</data>
<data name="equationAnalysisBack.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Back</value>
<comment>This is the tooltip contents for the back button in the equation analysis page in the graphing calculator</comment>
</data>
<data name="functionAnalysisButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Analyze equation</value>
<comment>This is the tooltip automation name for the analyze equation button</comment>
</data>
<data name="removeButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Remove equation</value>
<comment>This is the tool tip automation name for the graphing calculator remove equation buttons</comment>
</data>
<data name="shareButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Share</value>
<comment>This is the tool tip automation name for the graphing calculator share button.</comment>
</data>
<data name="colorChooserButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Change equation style</value>
<comment>This is the tool tip automation name for the graphing calculator equation style button</comment>
</data>
<data name="showEquationButtonToolTip" xml:space="preserve">
<value>Show</value>
<comment>This is the tooltip shown when visibility is set to hidden in the graphing calculator</comment>
</data>
<data name="hideEquationButtonToolTip" xml:space="preserve">
<value>Hide</value>
<comment>This is the tooltip shown when visibility is set to visible in the graphing calculator</comment>
</data>
<data name="disableTracingButtonToolTip" xml:space="preserve">
<value>Stop tracing</value>
<comment>This is the tool tip automation name for the graphing calculator stop tracing button</comment>
</data>
<data name="enableTracingButtonToolTip" xml:space="preserve">
<value>Start tracing</value>
<comment>This is the tool tip automation name for the graphing calculator start tracing button</comment>
</data>
<data name="variablesButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Variables</value>
<comment>This is the tool tip automation name for the Calculator variables button.</comment>
</data>
<data name="sliderOptionsButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Configure slider</value>
<comment>This is the tool tip text for teh slider options button in Graphing Calculator</comment>
</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>

View File

@ -402,6 +402,7 @@
<!-- Temporary button until the final UI is created -->
<Button x:Name="VariableEditing"
x:Uid="variablesButton"
MinWidth="44"
MinHeight="44"
Margin="0,0,4,0"
@ -480,7 +481,8 @@
KeyDown="TextBoxKeyDown"
LosingFocus="TextBoxLosingFocus"
Text="{x:Bind Value, Mode=OneWay}"/>
<ToggleButton Grid.Column="2"
<ToggleButton x:Uid="sliderOptionsButton"
Grid.Column="2"
HorizontalAlignment="Right"
Background="Transparent"
FontFamily="{StaticResource SymbolThemeFontFamily}"
@ -581,6 +583,7 @@
</Button>
<Button x:Name="Share"
x:Uid="shareButton"
MinWidth="44"
MinHeight="44"
Margin="0"

View File

@ -3,9 +3,10 @@
#include "pch.h"
#include "GraphingCalculator.xaml.h"
#include "CalcViewModel/Common/AppResourceProvider.h"
#include "CalcViewModel/Common/TraceLogger.h"
#include "CalcViewModel/Common/LocalizationSettings.h"
#include "CalcViewModel/Common/AppResourceProvider.h"
#include "CalcViewModel/Common/LocalizationStringUtil.h"
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
#include "CalcViewModel/Common/Automation/NarratorAnnouncement.h"
#include "CalcViewModel/Common/Automation/NarratorNotifier.h"
@ -55,6 +56,11 @@ GraphingCalculator::GraphingCalculator()
Grapher::RegisterDependencyProperties();
InitializeComponent();
auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = ActiveTracingOn ? resProvider.GetResourceString(L"disableTracingButtonToolTip") : resProvider.GetResourceString(L"enableTracingButtonToolTip");
ToolTipService::SetToolTip(ActiveTracing, toolTip);
DataTransferManager ^ dataTransferManager = DataTransferManager::GetForCurrentView();
// Register the current control as a share source.
@ -340,6 +346,11 @@ void GraphingCalculator::OnActiveTracingClick(Object ^ sender, RoutedEventArgs ^
// The focus change to this button will have turned off the tracing if it was on
ActiveTracingOn = !ActiveTracingOn;
GraphingControl->ActiveTracing = ActiveTracingOn;
auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = ActiveTracingOn ? resProvider.GetResourceString(L"disableTracingButtonToolTip") : resProvider.GetResourceString(L"enableTracingButtonToolTip");
ToolTipService::SetToolTip(ActiveTracing, toolTip);
}
void GraphingCalculator::GraphingControl_LostFocus(Object ^ sender, RoutedEventArgs ^ e)

View File

@ -150,14 +150,15 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ToggleButton x:Name="EquationButton"
<Button x:Name="KGFEquationButton"
x:Uid="equationAnalysisBack"
MinWidth="44"
MinHeight="44"
VerticalAlignment="Stretch"
Background="{TemplateBinding EquationColor}"
Foreground="{StaticResource SystemChromeWhiteColor}"
BorderThickness="0">
<ToggleButton.Content>
<Button.Content>
<StackPanel x:Name="FunctionNumberLabel"
HorizontalAlignment="Center"
VerticalAlignment="Center"
@ -174,15 +175,15 @@
Text="{TemplateBinding EquationButtonContentIndex}"/>
</StackPanel>
</ToggleButton.Content>
<ToggleButton.Resources>
</Button.Content>
<Button.Resources>
<SolidColorBrush x:Name="ButtonBackgroundPointerOver"
Opacity="0.7"
Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
<SolidColorBrush x:Name="ButtonForegroundPointerOver" Color="{ThemeResource SystemChromeWhiteColor}"/>
<SolidColorBrush x:Name="ButtonBorderBrushPointerOver" Color="Transparent"/>
</ToggleButton.Resources>
</ToggleButton>
</Button.Resources>
</Button>
<controls:MathRichEditBox x:Name="EquationTextBox"
Grid.Column="1"