mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-31 12:00:01 -07:00
Passive & Active tracing (#638)
* Plumebd with data transfer * Getting mainpage to talk to getbitmap. moving share callbacks from mainpage to graphingcalculator * Trying to get bitmap from renderer. * work * Share worked * cleanups * Cleanups progressing * Share working, need loc for title string and user notification incase of a failure. Then add the equations key. * More cleanup, now using share icon image and resources for strings. Still need to do the graph equation key. * Change share to html based start. * Key working, with UL but going to try changing to table. * Fix a html formating error, generating a new UL for each equation. * Switched over to a table for equation key and have color block formating * Updates from PR feedback, using Graphing::IBitmap abstraction. * Update src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h Fixed Co-Authored-By: Pepe Rivera <joseartrivera@gmail.com> * PR Updates. * Add variables to the graph key. * eod * Passive graph value tracing working. * Basic active tracing cursor working. * Move active tracing from graphingcalculator to grapher to save some hops. Also block tracking of the active tracing key's when in the EquationTextBox. * Active tracing working, need to put button on screen for activation. * Added active tracing control button (placeholder image) * Eod * Popup trace value now tracks the highlighted point. * Popup skined * PR Updates. * Update certificate thumbnail so VS2019 doesn't have a build error. * PR comments in process. * PR Updates * PR Updates, change tracing value to use tooltip static resource so we automatically change depending on system values. And changed text formatting of the value to be generic (x,y) value. * PR updates, changed how we detect who has focus so we don't eat keys when not in active tracing. * Additional filtering for the Key Up/Down in the grapher.
This commit is contained in:
parent
7864fe6413
commit
18f80a89db
12 changed files with 742 additions and 160 deletions
|
@ -9,15 +9,24 @@
|
|||
|
||||
namespace GraphControl
|
||||
{
|
||||
[Windows::UI::Xaml::Markup::ContentPropertyAttribute(Name = L"Equations")]
|
||||
public ref class Grapher sealed : public Windows::UI::Xaml::Controls::Control
|
||||
public
|
||||
delegate void TracingChangedEventHandler(bool newValue);
|
||||
|
||||
public
|
||||
delegate void TracingValueChangedEventHandler(Windows::Foundation::Point value);
|
||||
|
||||
[Windows::UI::Xaml::Markup::ContentPropertyAttribute(Name = L"Equations")] public ref class Grapher sealed : public Windows::UI::Xaml::Controls::Control
|
||||
{
|
||||
public:
|
||||
event TracingValueChangedEventHandler ^ TracingValueChangedEvent;
|
||||
event TracingChangedEventHandler ^ TracingChangedEvent;
|
||||
|
||||
public:
|
||||
Grapher();
|
||||
|
||||
static void RegisterDependencyProperties();
|
||||
|
||||
#pragma region Windows::UI::Xaml::DataTemplate^ EquationTemplate DependencyProperty
|
||||
#pragma region Windows::UI::Xaml::DataTemplate ^ EquationTemplate DependencyProperty
|
||||
static property Windows::UI::Xaml::DependencyProperty^ EquationTemplateProperty
|
||||
{
|
||||
Windows::UI::Xaml::DependencyProperty^ get()
|
||||
|
@ -37,9 +46,9 @@ namespace GraphControl
|
|||
SetValue(s_equationTemplateProperty, value);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Platform::Object^ EquationsSource DependencyProperty
|
||||
#pragma region Platform::Object ^ EquationsSource DependencyProperty
|
||||
static property Windows::UI::Xaml::DependencyProperty^ EquationsSourceProperty
|
||||
{
|
||||
Windows::UI::Xaml::DependencyProperty^ get()
|
||||
|
@ -59,9 +68,9 @@ namespace GraphControl
|
|||
SetValue(s_equationsSourceProperty, value);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GraphControl::EquationCollection^ Equations DependencyProperty
|
||||
#pragma region GraphControl::EquationCollection ^ Equations DependencyProperty
|
||||
static property Windows::UI::Xaml::DependencyProperty^ EquationsProperty
|
||||
{
|
||||
Windows::UI::Xaml::DependencyProperty^ get()
|
||||
|
@ -77,9 +86,9 @@ namespace GraphControl
|
|||
return static_cast< GraphControl::EquationCollection^ >(GetValue(s_equationsProperty));
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Windows::Foundation::Collections::IObservableMap<Platform::String^, double>^ Variables DependencyProperty
|
||||
#pragma region Windows::Foundation::Collections::IObservableMap < Platform::String ^, double> ^ Variables DependencyProperty
|
||||
static property Windows::UI::Xaml::DependencyProperty^ VariablesProperty
|
||||
{
|
||||
Windows::UI::Xaml::DependencyProperty^ get()
|
||||
|
@ -100,9 +109,9 @@ namespace GraphControl
|
|||
SetValue(s_variablesProperty, value);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Windows::UI::Xaml::DataTemplate^ ForceProportionalAxes DependencyProperty
|
||||
#pragma region Windows::UI::Xaml::DataTemplate ^ ForceProportionalAxes DependencyProperty
|
||||
static property Windows::UI::Xaml::DependencyProperty^ ForceProportionalAxesTemplateProperty
|
||||
{
|
||||
Windows::UI::Xaml::DependencyProperty^ get()
|
||||
|
@ -122,52 +131,103 @@ namespace GraphControl
|
|||
SetValue(s_forceProportionalAxesTemplateProperty, value);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
event Windows::Foundation::EventHandler<Windows::Foundation::Collections::IMap<Platform::String^, double>^>^ VariablesUpdated;
|
||||
// Pass active tracing turned on or off down to the renderer
|
||||
property bool ActiveTracing
|
||||
{
|
||||
bool get()
|
||||
{
|
||||
return m_renderMain->ActiveTracing;
|
||||
}
|
||||
|
||||
void set(bool value)
|
||||
{
|
||||
m_renderMain->ActiveTracing = value;
|
||||
UpdateTracingChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void SetVariable(Platform::String^ variableName, double newValue);
|
||||
void ZoomFromCenter(double scale);
|
||||
void ResetGrid();
|
||||
|
||||
property Windows::Foundation::Point TraceValue
|
||||
{
|
||||
Windows::Foundation::Point get()
|
||||
{
|
||||
return m_renderMain->TraceValue;
|
||||
}
|
||||
}
|
||||
|
||||
property Windows::Foundation::Point TraceLocation
|
||||
{
|
||||
Windows::Foundation::Point get()
|
||||
{
|
||||
return m_renderMain->TraceLocation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
property Windows::Foundation::Point ActiveTraceCursorPosition
|
||||
{
|
||||
Windows::Foundation::Point get()
|
||||
{
|
||||
return m_renderMain->ActiveTraceCursorPosition;
|
||||
}
|
||||
|
||||
void set(Windows::Foundation::Point newValue)
|
||||
{
|
||||
if (m_renderMain->ActiveTraceCursorPosition != newValue)
|
||||
{
|
||||
m_renderMain->ActiveTraceCursorPosition = newValue;
|
||||
UpdateTracingChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event Windows::Foundation::EventHandler<Windows::Foundation::Collections::IMap<Platform::String ^, double> ^> ^ VariablesUpdated;
|
||||
void SetVariable(Platform::String ^ variableName, double newValue);
|
||||
|
||||
protected:
|
||||
#pragma region Control Overrides
|
||||
#pragma region Control Overrides
|
||||
void OnApplyTemplate() override;
|
||||
|
||||
void OnPointerEntered(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerMoved(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerExited(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerWheelChanged(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerReleased(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerCanceled(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnManipulationDelta(Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs^ e) override;
|
||||
#pragma endregion
|
||||
void OnPointerEntered(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnPointerMoved(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnPointerExited(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnPointerWheelChanged(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnPointerReleased(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnPointerCanceled(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnManipulationDelta(Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs ^ e) override;
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ args);
|
||||
void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ args);
|
||||
void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ args);
|
||||
void OnUnloaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ args);
|
||||
|
||||
static void OnCustomDependencyPropertyChanged(Windows::UI::Xaml::DependencyObject^ obj, Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ args);
|
||||
void OnDependencyPropertyChanged(Windows::UI::Xaml::DependencyObject^ obj, Windows::UI::Xaml::DependencyProperty^ p);
|
||||
static void OnCustomDependencyPropertyChanged(Windows::UI::Xaml::DependencyObject ^ obj, Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ args);
|
||||
void OnDependencyPropertyChanged(Windows::UI::Xaml::DependencyObject ^ obj, Windows::UI::Xaml::DependencyProperty ^ p);
|
||||
|
||||
void OnEquationTemplateChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ args);
|
||||
void OnEquationTemplateChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ args);
|
||||
|
||||
void OnEquationsSourceChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ args);
|
||||
void OnDataSourceChanged(GraphControl::InspectingDataSource^ sender, GraphControl::DataSourceChangedEventArgs args);
|
||||
void OnEquationsSourceChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ args);
|
||||
void OnDataSourceChanged(GraphControl::InspectingDataSource ^ sender, GraphControl::DataSourceChangedEventArgs args);
|
||||
|
||||
void OnEquationsChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ args);
|
||||
void OnEquationsVectorChanged(Windows::Foundation::Collections::IObservableVector<GraphControl::Equation ^> ^sender, Windows::Foundation::Collections::IVectorChangedEventArgs^ event);
|
||||
void OnEquationsChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ args);
|
||||
void OnEquationsVectorChanged(
|
||||
Windows::Foundation::Collections::IObservableVector<GraphControl::Equation ^> ^ sender,
|
||||
Windows::Foundation::Collections::IVectorChangedEventArgs ^ event);
|
||||
void OnEquationChanged();
|
||||
void OnEquationStyleChanged();
|
||||
|
||||
void UpdateGraph();
|
||||
void UpdateGraphOptions(Graphing::IGraphingOptions& options, const std::vector<Equation^>& validEqs);
|
||||
std::vector<Equation^> GetValidEquations();
|
||||
void UpdateGraphOptions(Graphing::IGraphingOptions& options, const std::vector<Equation ^>& validEqs);
|
||||
std::vector<Equation ^> GetValidEquations();
|
||||
void SetGraphArgs();
|
||||
void UpdateVariables();
|
||||
|
||||
void OnForceProportionalAxesChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ args);
|
||||
void OnForceProportionalAxesChanged(Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ args);
|
||||
|
||||
void OnBackgroundColorChanged(const Windows::UI::Color& color);
|
||||
|
||||
|
@ -177,29 +237,52 @@ namespace GraphControl
|
|||
|
||||
void ScaleRange(double centerX, double centerY, double scale);
|
||||
|
||||
void OnCoreKeyDown(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ e);
|
||||
void OnCoreKeyUp(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ e);
|
||||
|
||||
void UpdateTracingChanged();
|
||||
void HandleTracingMovementTick(Object ^ sender, Object ^ e);
|
||||
void HandleKey(bool keyDown, Windows::System::VirtualKey key);
|
||||
|
||||
|
||||
private:
|
||||
DX::RenderMain^ m_renderMain = nullptr;
|
||||
DX::RenderMain ^ m_renderMain = nullptr;
|
||||
|
||||
static Windows::UI::Xaml::DependencyProperty^ s_equationTemplateProperty;
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_equationTemplateProperty;
|
||||
|
||||
static Windows::UI::Xaml::DependencyProperty^ s_equationsSourceProperty;
|
||||
InspectingDataSource^ m_dataSource;
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_equationsSourceProperty;
|
||||
InspectingDataSource ^ m_dataSource;
|
||||
Windows::Foundation::EventRegistrationToken m_tokenDataSourceChanged;
|
||||
|
||||
static Windows::UI::Xaml::DependencyProperty^ s_equationsProperty;
|
||||
static Windows::UI::Xaml::DependencyProperty^ s_variablesProperty;
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_equationsProperty;
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_variablesProperty;
|
||||
Windows::Foundation::EventRegistrationToken m_tokenEquationsChanged;
|
||||
Windows::Foundation::EventRegistrationToken m_tokenEquationStyleChanged;
|
||||
Windows::Foundation::EventRegistrationToken m_tokenEquationChanged;
|
||||
|
||||
static Windows::UI::Xaml::DependencyProperty^ s_forceProportionalAxesTemplateProperty;
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_forceProportionalAxesTemplateProperty;
|
||||
|
||||
Windows::Foundation::EventRegistrationToken m_tokenBackgroundColorChanged;
|
||||
|
||||
const std::unique_ptr<Graphing::IMathSolver> m_solver;
|
||||
const std::shared_ptr<Graphing::IGraph> m_graph;
|
||||
|
||||
public:
|
||||
Windows::Storage::Streams::RandomAccessStreamReference^ GetGraphBitmapStream();
|
||||
bool m_tracingTracking;
|
||||
enum KeysPressedSlots
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Down,
|
||||
Up,
|
||||
Accelerator
|
||||
};
|
||||
|
||||
bool m_KeysPressed[5];
|
||||
bool m_Moving;
|
||||
|
||||
Windows::UI::Xaml::DispatcherTimer ^ m_TracingTrackingTimer;
|
||||
|
||||
public:
|
||||
Windows::Storage::Streams::RandomAccessStreamReference ^ GetGraphBitmapStream();
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue