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:
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CalculatorApp.Controls"
|
||||
xmlns:converters="using:CalculatorApp.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -49,6 +50,8 @@
|
||||
Margin="1,0,1,0"
|
||||
Style="{StaticResource EquationTextBoxStyle}"
|
||||
EquationColor="{x:Bind LineColor, Mode=OneWay}"
|
||||
EquationButtonClicked="EquationTextBox_EquationButtonClicked"
|
||||
EquationButtonContentIndex="{x:Bind FunctionLabelIndex, Mode=OneWay}"
|
||||
EquationSubmitted="InputTextBox_Submitted"
|
||||
GotFocus="InputTextBox_GotFocus"
|
||||
Loaded="EquationTextBoxLoaded"
|
||||
|
@@ -68,7 +68,8 @@ void EquationInputArea::AddNewEquation()
|
||||
m_lastLineColorIndex = (m_lastLineColorIndex + 1) % AvailableColors->Size;
|
||||
|
||||
eq->LineColor = AvailableColors->GetAt(m_lastLineColorIndex);
|
||||
|
||||
eq->IsLineEnabled = true;
|
||||
eq->FunctionLabelIndex = ++m_lastFunctionLabelIndex;
|
||||
Equations->Append(eq);
|
||||
EquationInputList->ScrollIntoView(eq);
|
||||
}
|
||||
@@ -102,6 +103,11 @@ void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object ^ sender, Rou
|
||||
unsigned int index;
|
||||
if (Equations->IndexOf(eq, &index))
|
||||
{
|
||||
if (eq->FunctionLabelIndex == m_lastFunctionLabelIndex)
|
||||
{
|
||||
m_lastFunctionLabelIndex--;
|
||||
}
|
||||
|
||||
Equations->RemoveAt(index);
|
||||
}
|
||||
}
|
||||
@@ -116,6 +122,9 @@ void EquationInputArea::EquationTextBox_KeyGraphFeaturesButtonClicked(Object ^ s
|
||||
|
||||
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)
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
||||
#include "Controls/EquationTextBox.h"
|
||||
#include "Converters/BooleanNegationConverter.h"
|
||||
#include "Controls/MathRichEditBox.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
@@ -22,7 +23,6 @@ namespace CalculatorApp
|
||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector< ViewModel::EquationViewModel^ >^, Equations);
|
||||
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(ViewModel::EquationViewModel ^, EquationVM);
|
||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Windows::UI::Xaml::Media::SolidColorBrush ^> ^, AvailableColors);
|
||||
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesRequested;
|
||||
|
||||
private:
|
||||
@@ -42,6 +42,7 @@ namespace CalculatorApp
|
||||
private:
|
||||
Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
|
||||
int m_lastLineColorIndex;
|
||||
int m_lastFunctionLabelIndex;
|
||||
void EquationTextBox_RemoveButtonClicked(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);
|
||||
|
@@ -150,36 +150,39 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button x:Name="EquationButton"
|
||||
MinWidth="44"
|
||||
MinHeight="44"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||
BorderThickness="0">
|
||||
<Button.Content>
|
||||
<StackPanel Margin="5,0"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<ToggleButton x:Name="EquationButton"
|
||||
MinWidth="44"
|
||||
MinHeight="44"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||
BorderThickness="0">
|
||||
<ToggleButton.Content>
|
||||
<StackPanel x:Name="FunctionNumberLabel"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
Orientation="Horizontal"
|
||||
Margin="5,0">
|
||||
<FontIcon VerticalAlignment="Center"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Glyph=""/>
|
||||
<TextBlock Margin="12,-4,0,0"
|
||||
VerticalAlignment="Top"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="16"
|
||||
Text="ƒₓ"/>
|
||||
<TextBlock Text="ƒ" Margin="12,0,0,0"/>
|
||||
<TextBlock Margin="0,10,0,0"
|
||||
FontSize="9"
|
||||
Text="{TemplateBinding EquationButtonContentIndex}"/>
|
||||
</StackPanel>
|
||||
</Button.Content>
|
||||
<Button.Resources>
|
||||
|
||||
</ToggleButton.Content>
|
||||
<ToggleButton.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"/>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
</ToggleButton.Resources>
|
||||
</ToggleButton>
|
||||
|
||||
<controls:MathRichEditBox x:Name="EquationTextBox"
|
||||
Grid.Column="1"
|
||||
@@ -431,6 +434,8 @@
|
||||
BorderThickness="0"
|
||||
DataContext="{x:Bind ViewModel, Mode=OneWay}"
|
||||
EquationButtonClicked="EquationButtonClicked"
|
||||
EquationButtonContentIndex="{x:Bind ViewModel.FunctionLabelIndex, Mode=OneWay}"
|
||||
EquationColor="{x:Bind ViewModel.LineColor, Mode=OneWay}"
|
||||
Loaded="EquationInputTextBox_Loaded"/>
|
||||
<TextBlock x:Uid="KeyGraphFeaturesLabel"
|
||||
Grid.Row="1"
|
||||
|
@@ -14,9 +14,7 @@ using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
|
||||
KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()
|
||||
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -49,5 +47,4 @@ void KeyGraphFeaturesPanel::EquationInputTextBox_Loaded(Object ^ sender, RoutedE
|
||||
void KeyGraphFeaturesPanel::SetEquationTextBoxProperties()
|
||||
{
|
||||
EquationInputTextBox->SetEquationText(ViewModel->Expression);
|
||||
EquationInputTextBox->EquationColor = ViewModel->LineColor;
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@ public
|
||||
|
||||
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
|
||||
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(CalculatorApp::ViewModel::EquationViewModel ^, ViewModel);
|
||||
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesClosed;
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user