diff --git a/src/Calculator/Resources/en-US/Resources.resw b/src/Calculator/Resources/en-US/Resources.resw
index 4752336..c7e8d92 100644
--- a/src/Calculator/Resources/en-US/Resources.resw
+++ b/src/Calculator/Resources/en-US/Resources.resw
@@ -4414,6 +4414,26 @@
Graph Options
Heading for the Graph Options flyout in Graphing mode.
+
+ Line Thickness
+ Heading for the Graph Options flyout in Graphing mode.
+
+
+ Small Line Width
+ Automation name for line width setting
+
+
+ Medium Line Width
+ Automation name for line width setting
+
+
+ Large Line Width
+ Automation name for line width setting
+
+
+ Extra Large Line Width
+ Automation name for line width setting
+
Enter an expression
this is the placeholder text used by the textbox to enter an equation
diff --git a/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml b/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml
index 0897b11..474a1f9 100644
--- a/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml
+++ b/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml
@@ -183,6 +183,35 @@
Style="{StaticResource TrigUnitsRadioButtonStyle}"
IsChecked="{x:Bind ViewModel.TrigModeGradians, Mode=TwoWay}"/>
+
+
+
+ 1.0
+ 2.0
+ 3.0
+ 4.0
+
+
+
+
+
+
+
+
+
diff --git a/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.cpp b/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.cpp
index 1be3a3f..5c6464d 100644
--- a/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.cpp
+++ b/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.cpp
@@ -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");
+ }
+}
diff --git a/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.h b/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.h
index 0250787..3911f4b 100644
--- a/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.h
+++ b/src/Calculator/Views/GraphingCalculator/GraphingSettings.xaml.h
@@ -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);
diff --git a/src/GraphControl/Control/Grapher.cpp b/src/GraphControl/Control/Grapher.cpp
index 14a13fa..a0e3823 100644
--- a/src/GraphControl/Control/Grapher.cpp
+++ b/src/GraphControl/Control/Grapher.cpp
@@ -34,6 +34,7 @@ DEPENDENCY_PROPERTY_INITIALIZATION(Grapher, Variables);
DEPENDENCY_PROPERTY_INITIALIZATION(Grapher, Equations);
DEPENDENCY_PROPERTY_INITIALIZATION(Grapher, AxesColor);
DEPENDENCY_PROPERTY_INITIALIZATION(Grapher, GraphBackground);
+DEPENDENCY_PROPERTY_INITIALIZATION(Grapher, LineWidth);
namespace
{
@@ -405,7 +406,7 @@ namespace GraphControl
initResult = m_graph->TryInitialize();
if (initResult != nullopt)
{
- UpdateGraphOptions(m_graph->GetOptions(), vector());
+ UpdateGraphOptions(m_graph->GetOptions(), vector());
SetGraphArgs(m_graph);
m_renderMain->Graph = m_graph;
@@ -525,7 +526,6 @@ namespace GraphControl
Variables->Insert(variableName, ref new Variable(newValue));
}
-
if (m_graph != nullptr && m_renderMain != nullptr)
{
auto workItemHandler = ref new WorkItemHandler([this, variableName, newValue](IAsyncAction ^ action) {
@@ -558,9 +558,15 @@ namespace GraphControl
auto lineColor = eq->LineColor;
graphColors.emplace_back(lineColor.R, lineColor.G, lineColor.B, lineColor.A);
- if (eq->GraphedEquation != nullptr && !eq->HasGraphError && eq->IsSelected)
+ if (eq->GraphedEquation)
{
- eq->GraphedEquation->TrySelectEquation();
+ if (!eq->HasGraphError && eq->IsSelected)
+ {
+ eq->GraphedEquation->TrySelectEquation();
+ }
+
+ eq->GraphedEquation->GetGraphEquationOptions()->SetLineWidth(LineWidth);
+ eq->GraphedEquation->GetGraphEquationOptions()->SetSelectedEquationLineWidth(LineWidth + ((LineWidth <= 2) ? 1 : 2));
}
}
options.SetGraphColors(graphColors);
@@ -1049,6 +1055,21 @@ void Grapher::OnGraphBackgroundPropertyChanged(Windows::UI::Color /*oldValue*/,
}
}
+void Grapher::OnLineWidthPropertyChanged(double oldValue, double newValue)
+{
+ if (m_graph)
+ {
+ UpdateGraphOptions(m_graph->GetOptions(), GetGraphableEquations());
+ if (m_renderMain)
+ {
+ m_renderMain->SetPointRadius(LineWidth + 1);
+ m_renderMain->RunRenderPass();
+
+ TraceLogger::GetInstance()->LogLineWidthChanged();
+ }
+ }
+}
+
optional>> Grapher::TryInitializeGraph(bool keepCurrentView, const IExpression* graphingExp)
{
if (keepCurrentView)
diff --git a/src/GraphControl/Control/Grapher.h b/src/GraphControl/Control/Grapher.h
index a2d833f..beb752a 100644
--- a/src/GraphControl/Control/Grapher.h
+++ b/src/GraphControl/Control/Grapher.h
@@ -50,7 +50,7 @@ public
DEPENDENCY_PROPERTY_R_WITH_DEFAULT_AND_CALLBACK(GraphControl::EquationCollection ^, Equations, nullptr);
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(Windows::UI::Color, AxesColor, Windows::UI::Colors::Transparent);
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(Windows::UI::Color, GraphBackground, Windows::UI::Colors::Transparent);
-
+ DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, LineWidth, 2.0);
// Pass active tracing turned on or off down to the renderer
property bool ActiveTracing
{
@@ -276,6 +276,7 @@ public
void OnEquationsPropertyChanged(EquationCollection ^ oldValue, EquationCollection ^ newValue);
void OnAxesColorPropertyChanged(Windows::UI::Color oldValue, Windows::UI::Color newValue);
void OnGraphBackgroundPropertyChanged(Windows::UI::Color oldValue, Windows::UI::Color newValue);
+ void OnLineWidthPropertyChanged(double oldValue, double newValue);
void OnEquationChanged(Equation ^ equation);
void OnEquationStyleChanged(Equation ^ equation);
void OnEquationLineEnabledChanged(Equation ^ equation);
diff --git a/src/GraphControl/DirectX/NearestPointRenderer.cpp b/src/GraphControl/DirectX/NearestPointRenderer.cpp
index 64b114e..d820c4f 100644
--- a/src/GraphControl/DirectX/NearestPointRenderer.cpp
+++ b/src/GraphControl/DirectX/NearestPointRenderer.cpp
@@ -54,6 +54,12 @@ void NearestPointRenderer::Render(const Point& location)
}
}
+void NearestPointRenderer::SetRadius(float radius)
+{
+ m_ellipse.radiusX = radius;
+ m_ellipse.radiusY = radius;
+}
+
void NearestPointRenderer::SetColor(const ColorF& color)
{
m_color = color;
@@ -63,7 +69,5 @@ void NearestPointRenderer::SetColor(const ColorF& color)
void NearestPointRenderer::CreateBrush()
{
m_brush.Reset();
- ThrowIfFailed(
- m_deviceResources->GetD2DDeviceContext()->CreateSolidColorBrush(m_color, &m_brush)
- );
+ ThrowIfFailed(m_deviceResources->GetD2DDeviceContext()->CreateSolidColorBrush(m_color, &m_brush));
}
diff --git a/src/GraphControl/DirectX/NearestPointRenderer.h b/src/GraphControl/DirectX/NearestPointRenderer.h
index 7914965..541eaba 100644
--- a/src/GraphControl/DirectX/NearestPointRenderer.h
+++ b/src/GraphControl/DirectX/NearestPointRenderer.h
@@ -17,6 +17,7 @@ namespace GraphControl::DX
void Render(const Windows::Foundation::Point& location);
void SetColor(const D2D1::ColorF& color);
+ void SetRadius(float radius);
private:
void CreateBrush();
diff --git a/src/GraphControl/DirectX/RenderMain.cpp b/src/GraphControl/DirectX/RenderMain.cpp
index e07cb0b..ad38c20 100644
--- a/src/GraphControl/DirectX/RenderMain.cpp
+++ b/src/GraphControl/DirectX/RenderMain.cpp
@@ -187,6 +187,11 @@ namespace GraphControl::DX
return m_Tracing;
}
+ void RenderMain::SetPointRadius(float radius)
+ {
+ m_nearestPointRenderer.SetRadius(radius);
+ }
+
bool RenderMain::RunRenderPass()
{
// Non async render passes cancel if they can't obtain the lock immediatly
diff --git a/src/GraphControl/DirectX/RenderMain.h b/src/GraphControl/DirectX/RenderMain.h
index 31accf8..b9b6e01 100644
--- a/src/GraphControl/DirectX/RenderMain.h
+++ b/src/GraphControl/DirectX/RenderMain.h
@@ -47,6 +47,8 @@ namespace GraphControl::DX
bool RenderMain::CanRenderPoint();
+ void SetPointRadius(float radius);
+
bool RunRenderPass();
Windows::Foundation::IAsyncAction ^ RunRenderPassAsync(bool allowCancel = true);
diff --git a/src/GraphControl/Logger/TraceLogger.cpp b/src/GraphControl/Logger/TraceLogger.cpp
index 8654f2e..82a8a98 100644
--- a/src/GraphControl/Logger/TraceLogger.cpp
+++ b/src/GraphControl/Logger/TraceLogger.cpp
@@ -23,6 +23,7 @@ namespace GraphControl
constexpr auto EVENT_NAME_EQUATION_COUNT_CHANGED = L"EquationCountChanged";
constexpr auto EVENT_NAME_FUNCTION_ANALYSIS_PERFORMED = L"FunctionAnalysisPerformed";
constexpr auto EVENT_NAME_VARIABLES_COUNT_CHANGED = L"VariablesCountChanged";
+ constexpr auto EVENT_NAME_LINE_WIDTH_CHANGED = L"LineWidthChanged";
TraceLogger ^ TraceLogger::GetInstance()
{
@@ -86,4 +87,11 @@ namespace GraphControl
fields->AddInt64(StringReference(L"VariableCount"), variablesCount);
TraceLoggingCommon::GetInstance()->LogLevel2Event(StringReference(EVENT_NAME_VARIABLES_COUNT_CHANGED), fields);
}
+
+ void TraceLogger::LogLineWidthChanged()
+ {
+ auto fields = ref new LoggingFields();
+ fields->AddString(StringReference(CALC_MODE), StringReference(GRAPHING_MODE));
+ TraceLoggingCommon::GetInstance()->LogLevel2Event(StringReference(EVENT_NAME_LINE_WIDTH_CHANGED), fields);
+ }
}
diff --git a/src/GraphControl/Logger/TraceLogger.h b/src/GraphControl/Logger/TraceLogger.h
index 682c668..5ae60e0 100644
--- a/src/GraphControl/Logger/TraceLogger.h
+++ b/src/GraphControl/Logger/TraceLogger.h
@@ -18,6 +18,7 @@ namespace GraphControl
void LogEquationCountChanged(int currentValidEquations, int currentInvalidEquations);
void LogFunctionAnalysisPerformed(int analysisErrorType, uint32 tooComplexFlag);
void LogVariableCountChanged(int variablesCount);
+ void LogLineWidthChanged();
private:
TraceLogger()