Add line width option (#1098)

* add line thickness

* clean up

* Fix pr comments
This commit is contained in:
Pepe Rivera
2020-03-26 14:15:44 -07:00
committed by GitHub
parent fc19ddcbcb
commit 7dcfe0439c
12 changed files with 124 additions and 8 deletions

View File

@@ -4414,6 +4414,26 @@
<value>Graph Options</value>
<comment>Heading for the Graph Options flyout in Graphing mode.</comment>
</data>
<data name="LineThicknessBox.Header" xml:space="preserve">
<value>Line Thickness</value>
<comment>Heading for the Graph Options flyout in Graphing mode.</comment>
</data>
<data name="SmallLineWidthAutomationName" xml:space="preserve">
<value>Small Line Width</value>
<comment>Automation name for line width setting</comment>
</data>
<data name="MediumLineWidthAutomationName" xml:space="preserve">
<value>Medium Line Width</value>
<comment>Automation name for line width setting</comment>
</data>
<data name="LargeLineWidthAutomationName" xml:space="preserve">
<value>Large Line Width</value>
<comment>Automation name for line width setting</comment>
</data>
<data name="ExtraLargeLineWidthAutomationName" xml:space="preserve">
<value>Extra Large Line Width</value>
<comment>Automation name for line width setting</comment>
</data>
<data name="mathRichEditBox.PlaceholderText" xml:space="preserve">
<value>Enter an expression</value>
<comment>this is the placeholder text used by the textbox to enter an equation</comment>

View File

@@ -183,6 +183,35 @@
Style="{StaticResource TrigUnitsRadioButtonStyle}"
IsChecked="{x:Bind ViewModel.TrigModeGradians, Mode=TwoWay}"/>
</StackPanel>
<ComboBox x:Name="LineThicknessBox"
x:Uid="LineThicknessBox"
MinWidth="200"
Margin="0,12,0,0"
SelectedItem="{x:Bind ViewModel.Graph.LineWidth, Mode=TwoWay}">
<ComboBox.Items>
<x:Double>1.0</x:Double>
<x:Double>2.0</x:Double>
<x:Double>3.0</x:Double>
<x:Double>4.0</x:Double>
</ComboBox.Items>
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="x:Double">
<Grid x:Name="LineGrid"
Height="20"
MaxWidth="200"
AutomationProperties.Name="{x:Bind local:GraphingSettings.GetLineWidthAutomationName((x:Double))}">
<Line VerticalAlignment="Center"
Stroke="{ThemeResource AppControlPageTextBaseHighColorBrush}"
StrokeThickness="{x:Bind}"
X1="0"
X2="200"
Y1="4"
Y2="4"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</Grid>
</UserControl>

View File

@@ -66,3 +66,25 @@ void GraphingSettings::ResetViewButton_Clicked(Object ^ sender, RoutedEventArgs
{
ViewModel->ResetView();
}
String ^ GraphingSettings::GetLineWidthAutomationName(double width)
{
auto resourceLoader = AppResourceProvider::GetInstance();
if (width == 1.0)
{
return resourceLoader->GetResourceString("SmallLineWidthAutomationName");
}
else if(width == 2.0)
{
return resourceLoader->GetResourceString("MediumLineWidthAutomationName");
}
else if (width == 3.0)
{
return resourceLoader->GetResourceString("LargeLineWidthAutomationName");
}
else
{
return resourceLoader->GetResourceString("ExtraLargeLineWidthAutomationName");
}
}

View File

@@ -21,6 +21,8 @@ namespace CalculatorApp
Windows::UI::Xaml::Style ^ SelectTextBoxStyle(bool incorrectRange, bool error);
void SetGrapher(GraphControl::Grapher ^ grapher);
void RefreshRanges();
static Platform::String ^ GetLineWidthAutomationName(double width);
private:
void GridSettingsTextBox_PreviewKeyDown(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e);
void ResetViewButton_Clicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);