diff --git a/src/Calculator/Controls/EquationTextBox.cpp b/src/Calculator/Controls/EquationTextBox.cpp index 3984b8e7..5d61c87e 100644 --- a/src/Calculator/Controls/EquationTextBox.cpp +++ b/src/Calculator/Controls/EquationTextBox.cpp @@ -69,16 +69,6 @@ void EquationTextBox::OnApplyTemplate() if (m_equationButton != nullptr) { m_equationButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnEquationButtonClicked); - - auto toolTip = ref new ToolTip(); - - auto equationButtonMessage = LocalizationStringUtil::GetLocalizedString( - IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonToolTip") - : resProvider->GetResourceString(L"hideEquationButtonToolTip"), EquationButtonContentIndex); - - toolTip->Content = equationButtonMessage; - ToolTipService::SetToolTip(m_equationButton, toolTip); - AutomationProperties::SetName(m_equationButton, equationButtonMessage); } if (m_richEditContextMenu != nullptr) @@ -237,16 +227,7 @@ void EquationTextBox::OnEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ { EquationButtonClicked(this, ref new RoutedEventArgs()); - auto toolTip = ref new ToolTip(); - auto resProvider = AppResourceProvider::GetInstance(); - - auto equationButtonMessage = LocalizationStringUtil::GetLocalizedString( - IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonToolTip") - : resProvider->GetResourceString(L"hideEquationButtonToolTip"), EquationButtonContentIndex); - - toolTip->Content = equationButtonMessage; - ToolTipService::SetToolTip(m_equationButton, toolTip); - AutomationProperties::SetName(m_equationButton, equationButtonMessage); + SetEquationButtonTooltipAndAutomationName(); } void EquationTextBox::OnRemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e) @@ -485,3 +466,26 @@ void EquationTextBox::OnEquationFormatRequested(Object ^ sender, MathRichEditBox { EquationFormatRequested(this, args); } + +void EquationTextBox::SetEquationButtonTooltipAndAutomationName() +{ + auto toolTip = ref new ToolTip(); + auto resProvider = AppResourceProvider::GetInstance(); + + auto equationButtonMessage = LocalizationStringUtil::GetLocalizedString( + IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonAutomationName") + : resProvider->GetResourceString(L"hideEquationButtonAutomationName"), + EquationButtonContentIndex); + + auto equationButtonTooltip = LocalizationStringUtil::GetLocalizedString( + IsEquationLineDisabled ? resProvider->GetResourceString(L"showEquationButtonToolTip") : resProvider->GetResourceString(L"hideEquationButtonToolTip")); + + toolTip->Content = equationButtonTooltip; + ToolTipService::SetToolTip(m_equationButton, toolTip); + AutomationProperties::SetName(m_equationButton, equationButtonMessage); +} + +void EquationTextBox::OnEquationButtonContentIndexPropertyChanged(String ^ /*oldValue*/, String ^ newValue) +{ + SetEquationButtonTooltipAndAutomationName(); +} diff --git a/src/Calculator/Controls/EquationTextBox.h b/src/Calculator/Controls/EquationTextBox.h index 10d0f44b..bb06bdce 100644 --- a/src/Calculator/Controls/EquationTextBox.h +++ b/src/Calculator/Controls/EquationTextBox.h @@ -22,7 +22,7 @@ namespace CalculatorApp DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush ^, EquationColor); DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::SolidColorBrush ^, EquationButtonForegroundColor); DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::Flyout ^, ColorChooserFlyout); - DEPENDENCY_PROPERTY(Platform::String ^, EquationButtonContentIndex); + DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String ^, EquationButtonContentIndex); DEPENDENCY_PROPERTY(Platform::String ^, MathEquation); DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, HasError); DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsAddEquationMode); @@ -74,6 +74,9 @@ namespace CalculatorApp void OnColorFlyoutClosed(Platform::Object ^ sender, Platform::Object ^ e); void OnHasErrorPropertyChanged(bool oldValue, bool newValue); + void OnEquationButtonContentIndexPropertyChanged(Platform::String ^ /*oldValue*/, Platform::String ^ newValue); + + void SetEquationButtonTooltipAndAutomationName(); CalculatorApp::Controls::MathRichEditBox ^ m_richEditBox; Windows::UI::Xaml::Controls::Primitives::ToggleButton ^ m_equationButton; diff --git a/src/Calculator/EquationStylePanelControl.xaml b/src/Calculator/EquationStylePanelControl.xaml index c9112cff..2faf8ed7 100644 --- a/src/Calculator/EquationStylePanelControl.xaml +++ b/src/Calculator/EquationStylePanelControl.xaml @@ -80,6 +80,7 @@ Fill="{x:Bind}" StrokeThickness="0" AutomationProperties.Name="{x:Bind local:EquationStylePanelControl.GetColorAutomationName((Brush))}" + ToolTipService.ToolTip="{x:Bind local:EquationStylePanelControl.GetColorAutomationName((Brush))}" UseLayoutRounding="false"/> diff --git a/src/Calculator/EquationStylePanelControl.xaml.cpp b/src/Calculator/EquationStylePanelControl.xaml.cpp index 9f13533e..5e980258 100644 --- a/src/Calculator/EquationStylePanelControl.xaml.cpp +++ b/src/Calculator/EquationStylePanelControl.xaml.cpp @@ -145,62 +145,100 @@ String ^ EquationStylePanelControl::GetColorAutomationName(Brush ^ brush) auto resourceLoader = AppResourceProvider::GetInstance(); auto color = static_cast(brush); - if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush1"))) + auto lightDictionary = static_cast(Application::Current->Resources->ThemeDictionaries->Lookup(L"Light")); + auto darkDictionary = static_cast(Application::Current->Resources->ThemeDictionaries->Lookup(L"Default")); + auto highContrast = static_cast(Application::Current->Resources->ThemeDictionaries->Lookup(L"HighContrast")); + + if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush1")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush1"))) { return resourceLoader->GetResourceString("equationColor1AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush2"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush2")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush2"))) { return resourceLoader->GetResourceString("equationColor2AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush3"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush3")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush3"))) { return resourceLoader->GetResourceString("equationColor3AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush4"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush4")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush4"))) { return resourceLoader->GetResourceString("equationColor4AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush5"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush5")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush5"))) { return resourceLoader->GetResourceString("equationColor5AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush6"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush6")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush6"))) { return resourceLoader->GetResourceString("equationColor6AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush7"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush7")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush7"))) { return resourceLoader->GetResourceString("equationColor7AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush8"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush8")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush8"))) { return resourceLoader->GetResourceString("equationColor8AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush9"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush9")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush9"))) { return resourceLoader->GetResourceString("equationColor9AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush10"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush10")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush10"))) { return resourceLoader->GetResourceString("equationColor10AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush11"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush11")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush11"))) { return resourceLoader->GetResourceString("equationColor11AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush12"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush12")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush12"))) { return resourceLoader->GetResourceString("equationColor12AutomationName"); } - else if (color == safe_cast(Application::Current->Resources->Lookup(L"EquationBrush13"))) + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush13")) + || color == safe_cast(darkDictionary->Lookup(L"EquationBrush13"))) { return resourceLoader->GetResourceString("equationColor13AutomationName"); } + else if (color == safe_cast(darkDictionary->Lookup(L"EquationBrush14"))) + { + return resourceLoader->GetResourceString("equationColor14WhiteAutomationName"); + } + else if (color == safe_cast(lightDictionary->Lookup(L"EquationBrush14"))) + { + return resourceLoader->GetResourceString("equationColor14BlackAutomationName"); + } + else if (color == safe_cast(highContrast->Lookup(L"EquationBrush1"))) + { + return resourceLoader->GetResourceString("equationHighContrastColor1AutomationName"); + } + else if (color == safe_cast(highContrast->Lookup(L"EquationBrush2"))) + { + return resourceLoader->GetResourceString("equationHighContrastColor2AutomationName"); + } + else if (color == safe_cast(highContrast->Lookup(L"EquationBrush3"))) + { + return resourceLoader->GetResourceString("equationHighContrastColor3AutomationName"); + } else { - return resourceLoader->GetResourceString("equationColor14AutomationName"); + return resourceLoader->GetResourceString("equationHighContrastColor4AutomationName"); } + } String ^ EquationStylePanelControl::GetLineAutomationName(Object ^ line) diff --git a/src/Calculator/Resources/en-US/Resources.resw b/src/Calculator/Resources/en-US/Resources.resw index b8ddffcb..4d0d880b 100644 --- a/src/Calculator/Resources/en-US/Resources.resw +++ b/src/Calculator/Resources/en-US/Resources.resw @@ -4323,13 +4323,22 @@ This is the text for the for the equation style context menu command + Show equation + This is the tooltip/automation name shown when visibility is set to hidden in the graphing calculator. + + + Hide equation + This is the tooltip/automation name shown when visibility is set to visible in the graphing calculator. + + Show equation %1 {Locked="%1"}, This is the tooltip/automation name shown when visibility is set to hidden in the graphing calculator. %1 is the equation number. - + Hide equation %1 {Locked="%1"}, This is the tooltip/automation name shown when visibility is set to visible in the graphing calculator. %1 is the equation number. + Stop tracing This is the tooltip/automation name for the graphing calculator stop tracing button @@ -4538,54 +4547,74 @@ Seafoam Name of color in the color picker - + Violet Name of color in the color picker - + Green Name of color in the color picker - + Mint Green Name of color in the color picker - + Dark Green Name of color in the color picker - + Charcoal Name of color in the color picker - + Red Name of color in the color picker - + Plum Light Name of color in the color picker - + Magenta Name of color in the color picker - + Yellow Gold Name of color in the color picker - + Orange Bright Name of color in the color picker - + Brown Name of color in the color picker - + Black Name of color in the color picker + + White + Name of color in the color picker + + + Color 1 + Name of color in the color picker + + + Color 2 + Name of color in the color picker + + + Color 3 + Name of color in the color picker + + + Color 4 + Name of color in the color picker + Theme Graph settings heading for the theme options @@ -4602,7 +4631,7 @@ Theme This is the automation name text for the Graph settings heading for the theme options - + Always light This is the automation name text for the Graph settings option to set graph to light theme @@ -4616,7 +4645,43 @@ Function Analysis Equation Box - This is the automation name text for the equation box in the function analsis panel + This is the automation name text for the equation box in the function analysis panel + + + Less than + Screen reader prompt for the Less than button + + + Less than or equal + Screen reader prompt for the Less than or equal button + + + Equal + Screen reader prompt for the Equal button + + + Greater than or equal + Screen reader prompt for the Greater than or equal button + + + Greater than + Screen reader prompt for the Greater than button + + + Equals + Screen reader prompt for the equal button on the graphing calculator operator keypad + + + X + Screen reader prompt for the X button on the graphing calculator operator keypad + + + Y + Screen reader prompt for the Y button on the graphing calculator operator keypad + + + Submit + Screen reader prompt for the submit button on the graphing calculator operator keypad Less than