mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-24 06:55:19 -07:00
- merge the 3 CalculationResultStyle(S|M|L) in App.xaml
- Create a new MaxFontSize property in order to be able to update it without being forced to fully update the Style (because m_startingFontSize was set in OnApplyTemplate) - Modify how DisplayMargin to prevent the Margin to shift when we change its value withouth fully updating the Style
This commit is contained in:
parent
c6b770eec8
commit
9e63b2c47b
6 changed files with 51 additions and 258 deletions
|
@ -351,7 +351,7 @@
|
||||||
<Setter Property="ZoomMode" Value="Disabled"/>
|
<Setter Property="ZoomMode" Value="Disabled"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="CalculationResultStyleL" TargetType="Controls:CalculationResult">
|
<Style x:Key="CalculationResultStyle" TargetType="Controls:CalculationResult">
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlPageTextBaseHighBrush}"/>
|
<Setter Property="Foreground" Value="{ThemeResource SystemControlPageTextBaseHighBrush}"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
@ -437,179 +437,6 @@
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="CalculationResultStyleM" TargetType="Controls:CalculationResult">
|
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlPageTextBaseHighBrush}"/>
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
|
||||||
<Setter Property="IsTextScaleFactorEnabled" Value="False"/>
|
|
||||||
<Setter Property="UseSystemFocusVisuals" Value="True"/>
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="Controls:CalculationResult">
|
|
||||||
<Grid x:Name="border" Background="{TemplateBinding Background}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="12"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="12"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="ActiveStates">
|
|
||||||
<VisualState x:Name="Active"/>
|
|
||||||
<VisualState x:Name="Normal">
|
|
||||||
<VisualState.Setters>
|
|
||||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
|
||||||
</VisualState.Setters>
|
|
||||||
</VisualState>
|
|
||||||
</VisualStateGroup>
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
<ScrollViewer x:Name="textContainer"
|
|
||||||
Grid.Column="1"
|
|
||||||
Padding="0,0,0,0"
|
|
||||||
Style="{ThemeResource ResultsScrollerSnapped}"
|
|
||||||
AutomationProperties.AccessibilityView="Raw">
|
|
||||||
<TextBlock x:Name="normalOutput"
|
|
||||||
Margin="{TemplateBinding DisplayMargin}"
|
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
||||||
Foreground="{TemplateBinding Foreground}"
|
|
||||||
FontSize="{TemplateBinding FontSize}"
|
|
||||||
FontWeight="SemiBold"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
Text="{TemplateBinding DisplayValue}"
|
|
||||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
TextWrapping="NoWrap"/>
|
|
||||||
</ScrollViewer>
|
|
||||||
<HyperlinkButton x:Name="scrollLeft"
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="20"
|
|
||||||
MinWidth="20"
|
|
||||||
MinHeight="24"
|
|
||||||
Margin="-4,0,-4,0"
|
|
||||||
Padding="0,-3,0,4"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalContentAlignment="Center"
|
|
||||||
VerticalContentAlignment="Center"
|
|
||||||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
|
||||||
BorderThickness="0"
|
|
||||||
Visibility="Collapsed">
|
|
||||||
<FontIcon x:Name="scrollLeftText"
|
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="12"
|
|
||||||
Glyph=""/>
|
|
||||||
</HyperlinkButton>
|
|
||||||
<HyperlinkButton x:Name="scrollRight"
|
|
||||||
Grid.Column="2"
|
|
||||||
Width="20"
|
|
||||||
MinWidth="20"
|
|
||||||
MinHeight="24"
|
|
||||||
Margin="-4,0,-4,0"
|
|
||||||
Padding="0,-3,0,4"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalContentAlignment="Center"
|
|
||||||
VerticalContentAlignment="Center"
|
|
||||||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
|
||||||
BorderThickness="0"
|
|
||||||
Visibility="Collapsed">
|
|
||||||
<FontIcon x:Name="scrollRightText"
|
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="12"
|
|
||||||
Glyph=""/>
|
|
||||||
</HyperlinkButton>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
<Style x:Key="CalculationResultStyleS" TargetType="Controls:CalculationResult">
|
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlPageTextBaseHighBrush}"/>
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
|
||||||
<Setter Property="MinHeight" Value="12"/>
|
|
||||||
<Setter Property="IsTextScaleFactorEnabled" Value="False"/>
|
|
||||||
<Setter Property="UseSystemFocusVisuals" Value="True"/>
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="Controls:CalculationResult">
|
|
||||||
<Grid x:Name="border" Background="{TemplateBinding Background}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="12"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="12"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="ActiveStates">
|
|
||||||
<VisualState x:Name="Active"/>
|
|
||||||
<VisualState x:Name="Normal">
|
|
||||||
<VisualState.Setters>
|
|
||||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
|
||||||
</VisualState.Setters>
|
|
||||||
</VisualState>
|
|
||||||
</VisualStateGroup>
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
<ScrollViewer x:Name="textContainer"
|
|
||||||
Grid.Column="1"
|
|
||||||
Padding="0,0,0,0"
|
|
||||||
Style="{ThemeResource ResultsScrollerSnapped}"
|
|
||||||
AutomationProperties.AccessibilityView="Raw">
|
|
||||||
<TextBlock x:Name="normalOutput"
|
|
||||||
Margin="{TemplateBinding DisplayMargin}"
|
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
||||||
Foreground="{TemplateBinding Foreground}"
|
|
||||||
FontSize="{TemplateBinding FontSize}"
|
|
||||||
FontWeight="SemiBold"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
Text="{TemplateBinding DisplayValue}"
|
|
||||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
TextWrapping="NoWrap"/>
|
|
||||||
</ScrollViewer>
|
|
||||||
<HyperlinkButton x:Name="scrollLeft"
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="20"
|
|
||||||
MinWidth="20"
|
|
||||||
MinHeight="24"
|
|
||||||
Margin="-4,0,-4,0"
|
|
||||||
Padding="0,-3,0,4"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalContentAlignment="Center"
|
|
||||||
VerticalContentAlignment="Center"
|
|
||||||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
|
||||||
BorderThickness="0"
|
|
||||||
Visibility="Collapsed">
|
|
||||||
<FontIcon x:Name="scrollLeftText"
|
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="12"
|
|
||||||
Glyph=""/>
|
|
||||||
</HyperlinkButton>
|
|
||||||
<HyperlinkButton x:Name="scrollRight"
|
|
||||||
Grid.Column="2"
|
|
||||||
Width="20"
|
|
||||||
MinWidth="20"
|
|
||||||
MinHeight="24"
|
|
||||||
Margin="-4,0,-4,0"
|
|
||||||
Padding="0,-3,0,4"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalContentAlignment="Center"
|
|
||||||
VerticalContentAlignment="Center"
|
|
||||||
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
|
|
||||||
BorderThickness="0"
|
|
||||||
Visibility="Collapsed">
|
|
||||||
<FontIcon x:Name="scrollRightText"
|
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="12"
|
|
||||||
Glyph=""/>
|
|
||||||
</HyperlinkButton>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style x:Key="CaptionButtonStyle" TargetType="Button">
|
<Style x:Key="CaptionButtonStyle" TargetType="Button">
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
||||||
|
|
|
@ -28,6 +28,7 @@ using namespace std;
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsActive);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsActive);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, AccentColor);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, AccentColor);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MinFontSize);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MinFontSize);
|
||||||
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MaxFontSize);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayMargin);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayMargin);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MaxExpressionHistoryCharacters);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MaxExpressionHistoryCharacters);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, ExpressionVisibility);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, ExpressionVisibility);
|
||||||
|
@ -50,7 +51,6 @@ StringReference CalculationResult::s_FocusedState(L"Focused");
|
||||||
StringReference CalculationResult::s_UnfocusedState(L"Unfocused");
|
StringReference CalculationResult::s_UnfocusedState(L"Unfocused");
|
||||||
|
|
||||||
CalculationResult::CalculationResult():
|
CalculationResult::CalculationResult():
|
||||||
m_startingFontSize(0.0),
|
|
||||||
m_isScalingText(false),
|
m_isScalingText(false),
|
||||||
m_haveCalculatedMax(false)
|
m_haveCalculatedMax(false)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,6 @@ void CalculationResult::OnApplyTemplate()
|
||||||
if (m_textBlock)
|
if (m_textBlock)
|
||||||
{
|
{
|
||||||
m_textBlock->Visibility = ::Visibility::Visible;
|
m_textBlock->Visibility = ::Visibility::Visible;
|
||||||
m_startingFontSize = m_textBlock->FontSize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateAllState();
|
UpdateAllState();
|
||||||
|
@ -143,6 +142,16 @@ void CalculationResult::OnDisplayValuePropertyChanged(String^ /*oldValue*/, Stri
|
||||||
UpdateTextState();
|
UpdateTextState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalculationResult::OnMinFontSizePropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||||
|
{
|
||||||
|
UpdateTextState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalculationResult::OnMaxFontSizePropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||||
|
{
|
||||||
|
UpdateTextState();
|
||||||
|
}
|
||||||
|
|
||||||
void CalculationResult::OnIsInErrorPropertyChanged(bool /*oldValue*/, bool newValue)
|
void CalculationResult::OnIsInErrorPropertyChanged(bool /*oldValue*/, bool newValue)
|
||||||
{
|
{
|
||||||
// We need to have a good template for this to work
|
// We need to have a good template for this to work
|
||||||
|
@ -212,7 +221,7 @@ void CalculationResult::UpdateTextState()
|
||||||
{
|
{
|
||||||
fontSizeChange = min(max(floor(WIDTHTOFONTSCALAR * widthDiff) - WIDTHTOFONTOFFSET, INCREMENTOFFSET), MAXFONTINCREMENT);
|
fontSizeChange = min(max(floor(WIDTHTOFONTSCALAR * widthDiff) - WIDTHTOFONTOFFSET, INCREMENTOFFSET), MAXFONTINCREMENT);
|
||||||
}
|
}
|
||||||
if (m_textBlock->ActualWidth < containerSize && abs(m_textBlock->FontSize - m_startingFontSize) > FONTTOLERANCE && !m_haveCalculatedMax)
|
if (m_textBlock->ActualWidth < containerSize && abs(m_textBlock->FontSize - MaxFontSize) > FONTTOLERANCE && !m_haveCalculatedMax)
|
||||||
{
|
{
|
||||||
ModifyFontAndMargin(m_textBlock, fontSizeChange);
|
ModifyFontAndMargin(m_textBlock, fontSizeChange);
|
||||||
m_textBlock->InvalidateArrange();
|
m_textBlock->InvalidateArrange();
|
||||||
|
@ -228,7 +237,7 @@ void CalculationResult::UpdateTextState()
|
||||||
m_textBlock->InvalidateArrange();
|
m_textBlock->InvalidateArrange();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(m_textBlock->FontSize >= MinFontSize && m_textBlock->FontSize <= m_startingFontSize);
|
assert(m_textBlock->FontSize >= MinFontSize && m_textBlock->FontSize <= MaxFontSize);
|
||||||
m_isScalingText = false;
|
m_isScalingText = false;
|
||||||
if (IsOperatorCommand)
|
if (IsOperatorCommand)
|
||||||
{
|
{
|
||||||
|
@ -361,7 +370,6 @@ void CalculationResult::ModifyFontAndMargin(TextBlock^ textBox, double fontChang
|
||||||
{
|
{
|
||||||
double cur = textBox->FontSize;
|
double cur = textBox->FontSize;
|
||||||
double newFontSize = 0.0;
|
double newFontSize = 0.0;
|
||||||
Thickness t = textBox->Margin;
|
|
||||||
double scaleFactor = SCALEFACTOR;
|
double scaleFactor = SCALEFACTOR;
|
||||||
if (m_textContainer->ActualHeight <= HEIGHTCUTOFF)
|
if (m_textContainer->ActualHeight <= HEIGHTCUTOFF)
|
||||||
{
|
{
|
||||||
|
@ -370,15 +378,14 @@ void CalculationResult::ModifyFontAndMargin(TextBlock^ textBox, double fontChang
|
||||||
if (fontChange < 0)
|
if (fontChange < 0)
|
||||||
{
|
{
|
||||||
newFontSize = max(cur + fontChange, MinFontSize);
|
newFontSize = max(cur + fontChange, MinFontSize);
|
||||||
t.Bottom += scaleFactor * abs(cur - newFontSize);
|
m_textContainer->Padding = Thickness(0, 0, 0, scaleFactor * abs(cur - newFontSize));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newFontSize = min(cur + fontChange, m_startingFontSize);
|
newFontSize = min(cur + fontChange, MaxFontSize);
|
||||||
t.Bottom -= scaleFactor * abs(cur - newFontSize);
|
m_textContainer->Padding = Thickness(0, 0, 0, scaleFactor * abs(cur - newFontSize));
|
||||||
}
|
}
|
||||||
textBox->FontSize = newFontSize;
|
textBox->FontSize = newFontSize;
|
||||||
textBox->Margin = t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculationResult::UpdateAllState()
|
void CalculationResult::UpdateAllState()
|
||||||
|
|
|
@ -19,7 +19,8 @@ namespace CalculatorApp
|
||||||
DEPENDENCY_PROPERTY_OWNER(CalculationResult);
|
DEPENDENCY_PROPERTY_OWNER(CalculationResult);
|
||||||
|
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Visibility, ExpressionVisibility);
|
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Visibility, ExpressionVisibility);
|
||||||
DEPENDENCY_PROPERTY(double, MinFontSize);
|
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MinFontSize, 0.0);
|
||||||
|
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MaxFontSize, 30.0);
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Thickness, DisplayMargin);
|
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Thickness, DisplayMargin);
|
||||||
DEPENDENCY_PROPERTY(int, MaxExpressionHistoryCharacters);
|
DEPENDENCY_PROPERTY(int, MaxExpressionHistoryCharacters);
|
||||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsActive);
|
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsActive);
|
||||||
|
@ -52,6 +53,8 @@ namespace CalculatorApp
|
||||||
void OnAccentColorPropertyChanged(Windows::UI::Xaml::Media::Brush^ oldValue, Windows::UI::Xaml::Media::Brush^ newValue);
|
void OnAccentColorPropertyChanged(Windows::UI::Xaml::Media::Brush^ oldValue, Windows::UI::Xaml::Media::Brush^ newValue);
|
||||||
void OnDisplayValuePropertyChanged(Platform::String^ oldValue, Platform::String^ newValue);
|
void OnDisplayValuePropertyChanged(Platform::String^ oldValue, Platform::String^ newValue);
|
||||||
void OnIsInErrorPropertyChanged(bool oldValue, bool newValue);
|
void OnIsInErrorPropertyChanged(bool oldValue, bool newValue);
|
||||||
|
void OnMinFontSizePropertyChanged(double oldValue, double newValue);
|
||||||
|
void OnMaxFontSizePropertyChanged(double oldValue, double newValue);
|
||||||
void TextContainerSizeChanged(Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
|
void TextContainerSizeChanged(Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
|
||||||
void OnTextContainerLayoutUpdated(Object^ sender, Object^ e);
|
void OnTextContainerLayoutUpdated(Object^ sender, Object^ e);
|
||||||
void UpdateVisualState();
|
void UpdateVisualState();
|
||||||
|
@ -74,7 +77,6 @@ namespace CalculatorApp
|
||||||
Windows::UI::Xaml::Controls::TextBlock^ m_textBlock;
|
Windows::UI::Xaml::Controls::TextBlock^ m_textBlock;
|
||||||
Windows::UI::Xaml::Controls::HyperlinkButton^ m_scrollLeft;
|
Windows::UI::Xaml::Controls::HyperlinkButton^ m_scrollLeft;
|
||||||
Windows::UI::Xaml::Controls::HyperlinkButton^ m_scrollRight;
|
Windows::UI::Xaml::Controls::HyperlinkButton^ m_scrollRight;
|
||||||
double m_startingFontSize;
|
|
||||||
double scrollRatio = 0.7;
|
double scrollRatio = 0.7;
|
||||||
bool m_isScalingText;
|
bool m_isScalingText;
|
||||||
bool m_haveCalculatedMax;
|
bool m_haveCalculatedMax;
|
||||||
|
|
|
@ -255,48 +255,17 @@
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Calculation Result Styles -->
|
<!-- Calculation Result Styles -->
|
||||||
|
<Style x:Key="ResultsStyle"
|
||||||
<Style x:Key="ResultsStyleL"
|
BasedOn="{StaticResource CalculationResultStyle}"
|
||||||
x:Name="ResultsStyleL"
|
|
||||||
BasedOn="{StaticResource CalculationResultStyleL}"
|
|
||||||
TargetType="controls:CalculationResult">
|
TargetType="controls:CalculationResult">
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
||||||
<Setter Property="FontSize" Value="{StaticResource CalcResultFontSizeL}"/>
|
|
||||||
<Setter Property="MinFontSize" Value="12"/>
|
|
||||||
<Setter Property="IsActive" Value="True"/>
|
|
||||||
<Setter Property="DisplayMargin" Value="0,0,0,0"/>
|
<Setter Property="DisplayMargin" Value="0,0,0,0"/>
|
||||||
<Setter Property="MaxExpressionHistoryCharacters" Value="51"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style x:Key="ResultsStyleM"
|
|
||||||
x:Name="ResultsStyleM"
|
|
||||||
BasedOn="{StaticResource CalculationResultStyleM}"
|
|
||||||
TargetType="controls:CalculationResult">
|
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
|
||||||
<Setter Property="FontSize" Value="{StaticResource CalcResultFontSizeM}"/>
|
|
||||||
<Setter Property="MinFontSize" Value="12"/>
|
|
||||||
<Setter Property="IsActive" Value="True"/>
|
<Setter Property="IsActive" Value="True"/>
|
||||||
<Setter Property="DisplayMargin" Value="0,0,0,0"/>
|
|
||||||
<Setter Property="MaxExpressionHistoryCharacters" Value="30"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style x:Key="ResultsStyleS"
|
|
||||||
x:Name="ResultsStyleS"
|
|
||||||
BasedOn="{StaticResource CalculationResultStyleS}"
|
|
||||||
TargetType="controls:CalculationResult">
|
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
|
||||||
<Setter Property="FontSize" Value="{StaticResource CalcResultFontSizeS}"/>
|
|
||||||
<Setter Property="MinFontSize" Value="12"/>
|
<Setter Property="MinFontSize" Value="12"/>
|
||||||
<Setter Property="IsActive" Value="True"/>
|
|
||||||
<Setter Property="DisplayMargin" Value="0,0,0,0"/>
|
|
||||||
<Setter Property="MaxExpressionHistoryCharacters" Value="30"/>
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Button Styles -->
|
<!-- Button Styles -->
|
||||||
|
|
||||||
<Style x:Key="ScrollButtonStyle" TargetType="Button">
|
<Style x:Key="ScrollButtonStyle" TargetType="Button">
|
||||||
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
<Setter Property="Padding" Value="0,0,0,0"/>
|
<Setter Property="Padding" Value="0,0,0,0"/>
|
||||||
|
@ -629,7 +598,7 @@
|
||||||
x:Uid="CalculatorResults"
|
x:Uid="CalculatorResults"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Margin="0,0,0,0"
|
Margin="0,0,0,0"
|
||||||
Style="{ThemeResource ResultsStyleM}"
|
Style="{ThemeResource ResultsStyle}"
|
||||||
AutomationProperties.AutomationId="CalculatorResults"
|
AutomationProperties.AutomationId="CalculatorResults"
|
||||||
AutomationProperties.HeadingLevel="Level1"
|
AutomationProperties.HeadingLevel="Level1"
|
||||||
AutomationProperties.Name="{x:Bind Model.CalculationResultAutomationName, Mode=OneWay}"
|
AutomationProperties.Name="{x:Bind Model.CalculationResultAutomationName, Mode=OneWay}"
|
||||||
|
|
|
@ -211,19 +211,22 @@ void Calculator::SetResultStyles()
|
||||||
float curHeight = window->Bounds.Height;
|
float curHeight = window->Bounds.Height;
|
||||||
if (curHeight >= 800)
|
if (curHeight >= 800)
|
||||||
{
|
{
|
||||||
Results->Style = ResultsStyleL;
|
Results->MaxFontSize = (double)Application::Current->Resources->Lookup("CalcResultFontSizeL");
|
||||||
|
Results->MaxExpressionHistoryCharacters = 51;
|
||||||
RowResult->MinHeight = 108;
|
RowResult->MinHeight = 108;
|
||||||
RowResult->Height = GridLength(72, GridUnitType::Star);
|
RowResult->Height = GridLength(72, GridUnitType::Star);
|
||||||
}
|
}
|
||||||
else if ((IsProgrammer && curHeight >= 640) || (IsScientific && curHeight >= 544) || IsStandard)
|
else if ((IsProgrammer && curHeight >= 640) || (IsScientific && curHeight >= 544) || IsStandard)
|
||||||
{
|
{
|
||||||
Results->Style = ResultsStyleM;
|
Results->MaxExpressionHistoryCharacters = 30;
|
||||||
|
Results->MaxFontSize = (double)Application::Current->Resources->Lookup("CalcResultFontSizeM");
|
||||||
RowResult->MinHeight = 72;
|
RowResult->MinHeight = 72;
|
||||||
RowResult->Height = GridLength(72, GridUnitType::Star);
|
RowResult->Height = GridLength(72, GridUnitType::Star);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Results->Style = ResultsStyleS;
|
Results->MaxFontSize = (double)Application::Current->Resources->Lookup("CalcResultFontSizeS");
|
||||||
|
Results->MaxExpressionHistoryCharacters = 30;
|
||||||
RowResult->MinHeight = 42;
|
RowResult->MinHeight = 42;
|
||||||
RowResult->Height = GridLength(42, GridUnitType::Star);
|
RowResult->Height = GridLength(42, GridUnitType::Star);
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,42 +180,27 @@
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ValueLargeStyle"
|
<Style x:Key="ValueBaseStyle"
|
||||||
BasedOn="{StaticResource CalculationResultStyleL}"
|
BasedOn="{StaticResource CalculationResultStyle}"
|
||||||
TargetType="controls:CalculationResult">
|
TargetType="controls:CalculationResult">
|
||||||
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
|
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Bottom"/>
|
<Setter Property="VerticalContentAlignment" Value="Bottom"/>
|
||||||
<Setter Property="FontSize" Value="46"/>
|
|
||||||
<Setter Property="MinFontSize" Value="{ThemeResource BodyFontSize}"/>
|
|
||||||
<Setter Property="FontWeight" Value="Light"/>
|
<Setter Property="FontWeight" Value="Light"/>
|
||||||
|
<Setter Property="MinFontSize" Value="{ThemeResource BodyFontSize}"/>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ValueLargeStyle"
|
||||||
|
BasedOn="{StaticResource ValueBaseStyle}"
|
||||||
|
TargetType="controls:CalculationResult">
|
||||||
|
<Setter Property="MaxFontSize" Value="46"/>
|
||||||
<Setter Property="Margin" Value="-2,0,0,0"/>
|
<Setter Property="Margin" Value="-2,0,0,0"/>
|
||||||
<Setter Property="DisplayMargin" Value="0,0,0,12"/>
|
<Setter Property="DisplayMargin" Value="0,0,0,12"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ValueMediumStyle"
|
<Style x:Key="ValueMediumStyle"
|
||||||
BasedOn="{StaticResource CalculationResultStyleM}"
|
BasedOn="{StaticResource ValueBaseStyle}"
|
||||||
TargetType="controls:CalculationResult">
|
TargetType="controls:CalculationResult">
|
||||||
<Setter Property="FontSize" Value="34"/>
|
<Setter Property="MaxFontSize" Value="34"/>
|
||||||
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
|
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
|
||||||
<Setter Property="MinFontSize" Value="{ThemeResource BodyFontSize}"/>
|
|
||||||
<Setter Property="FontWeight" Value="Light"/>
|
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalContentAlignment" Value="Bottom"/>
|
|
||||||
<Setter Property="Margin" Value="0,0,0,0"/>
|
|
||||||
<Setter Property="DisplayMargin" Value="0,0,0,4"/>
|
|
||||||
</Style>
|
|
||||||
<Style x:Key="ValueSmallStyle"
|
|
||||||
BasedOn="{StaticResource CalculationResultStyleS}"
|
|
||||||
TargetType="controls:CalculationResult">
|
|
||||||
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
|
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
|
||||||
<Setter Property="FontSize" Value="24"/>
|
|
||||||
<Setter Property="MinFontSize" Value="{ThemeResource BodyFontSize}"/>
|
|
||||||
<Setter Property="FontWeight" Value="Light"/>
|
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalContentAlignment" Value="Bottom"/>
|
|
||||||
<Setter Property="Margin" Value="0,0,0,0"/>
|
<Setter Property="Margin" Value="0,0,0,0"/>
|
||||||
<Setter Property="DisplayMargin" Value="0,0,0,4"/>
|
<Setter Property="DisplayMargin" Value="0,0,0,4"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
@ -616,10 +601,10 @@
|
||||||
Visibility="Collapsed">
|
Visibility="Collapsed">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<HyperlinkButton x:Name="CurrencyRefreshBlock"
|
<HyperlinkButton x:Name="CurrencyRefreshBlock"
|
||||||
|
x:Uid="RefreshButtonText"
|
||||||
Foreground="{ThemeResource SystemControlHyperlinkBaseHighBrush}"
|
Foreground="{ThemeResource SystemControlHyperlinkBaseHighBrush}"
|
||||||
Click="CurrencyRefreshButton_Click"
|
Click="CurrencyRefreshButton_Click"/>
|
||||||
x:Uid="RefreshButtonText"/>
|
<TextBlock Margin="0,7,0,0" Style="{ThemeResource CaptionTextBlockStyle}">
|
||||||
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" Margin="0, 7, 0, 0">
|
|
||||||
<Run x:Name="Spacing" Text=" "/>
|
<Run x:Name="Spacing" Text=" "/>
|
||||||
<Run x:Name="CurrencySecondaryStatus"
|
<Run x:Name="CurrencySecondaryStatus"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue