Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooltips to buttons in graphing calculator #822

Merged
merged 4 commits into from Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Calculator/App.xaml
Expand Up @@ -1669,6 +1669,7 @@
IsTabStop="False"
Visibility="Collapsed"/>
<Button x:Name="RemoveButton"
x:Uid="removeButton"
Grid.Column="3"
MinWidth="34"
Margin="{ThemeResource HelperButtonThemePadding}"
Expand All @@ -1684,6 +1685,7 @@
IsTabStop="False"
Visibility="Collapsed"/>
<ToggleButton x:Name="ColorChooserButton"
x:Uid="colorChooserButton"
Grid.Column="2"
MinWidth="34"
Margin="{ThemeResource HelperButtonThemePadding}"
Expand All @@ -1709,6 +1711,7 @@
</ToggleButton.Resources>
</ToggleButton>
<Button x:Name="FunctionButton"
x:Uid="functionAnalysisButton"
Grid.Column="1"
MinWidth="34"
Margin="{ThemeResource HelperButtonThemePadding}"
Expand Down
12 changes: 9 additions & 3 deletions src/Calculator/Calculator.vcxproj.filters
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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">
Expand Down
24 changes: 24 additions & 0 deletions src/Calculator/Controls/EquationTextBox.cpp
Expand Up @@ -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;
Expand All @@ -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"));
Expand All @@ -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)
Expand Down Expand Up @@ -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());
}
Expand Down
2 changes: 2 additions & 0 deletions src/Calculator/Controls/EquationTextBox.h
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
44 changes: 44 additions & 0 deletions src/Calculator/Resources/en-US/Resources.resw
Expand Up @@ -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>
Expand Down
Expand Up @@ -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"
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -581,6 +583,7 @@
</Button>

<Button x:Name="Share"
x:Uid="shareButton"
MinWidth="44"
MinHeight="44"
Margin="0"
Expand Down
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
Expand Up @@ -150,14 +150,15 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<ToggleButton x:Name="EquationButton"
<Button x:Name="KGFEquationButton"
x:Uid="equationAnalysisBack"
EriWong marked this conversation as resolved.
Show resolved Hide resolved
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"
Expand All @@ -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"
Expand Down