calculator/src/Calculator/Views/Calculator.xaml.h
Stephanie Anderl 442ed6a861
Key graph features (#704)
* Added IGraphAnalyzer

* Key Graph Features called and getting returned to the client. To do put all strings into the Equation object

* Updated UpdateKeyGraphFeatures to add function analysis data to all properties in Equation object

* Update KGF when variables are updated

* Key graph features ui started

* Added MathRichEditBox and started hooking up key graph features to the UI

* Updated EquationViewModel to include parity and periodicity

* Updated key graph features to update the EquationViewModel

* updated key graph features to display more values

* Key graph features populating uing MathRichEdit mode

* moved KeyGraphFeatures control to GraphingCalculator.xaml

* Use MathML formatting instead of MathRichEdit for strings passed back from the engine

* cleaned up project targeting and equation.h comments

* Updated equation edit box to populate for KeyGraphFeatures

* Fixed vcxproj files to have the correct targeting and certificates. KGF Title strings moved to x:Uid instead of the code behind

* Updated per PR feedback

* Update MathRichEditBox to detect if the string is a mathml string and use the appropriate set method to set the text

* fixed the issue where parity, periodicity and monotonicity could be set with an old value if the next one is empty

* KGF control UI adjustments and error handling

* Error control updates

* Error handling added when analysis fails

* fixed alignment on rich edit boxes

* Add monotonicity direction into the mathml string and only have 1 richeditbox

* Set hover state on KGF EquationEditBox to change button opacity and fixed spacing in Monotonicity RichEditBox

* remove sideload package certificate info VS added

* updated logic for setting error strings to be in the viewmodel

* Updated KeyGraphFeatures to populate dynamically using a ListView and TemplateSelector

* Update periodicity to not show if it isn't supported

* Fixed issue where y-intercept was using the x-intercept value

* Remove ItemsControl ItemsContainerStyle

* Updated per pr feedback. Fixed bug where analysis error would not reset

* Update MathRichEdit box to remove selection when focus is lost

* Updated mathrichedit to get LAF access for Dev, Release and Graphing projects

* Remove OnLostFocus in MathRichEdit, Change KGF ItemsControl back to ListView

* Clean up styles for KGF and ensure the match the comps

* Moved formatoptions logic to the Grapher constructor and reverted LineColor.Text resource that was mistakenly taken out

* Add copyright header to KGF Files

* fixed issue where asymptote values were not populating

* Disable KGF button when there is no equation. Fixed issue where equation populated in a new equationtextbox after the previous one was deleted

* Removed formatoptions testing lines used for debugging
2019-11-12 13:46:11 -08:00

150 lines
6.9 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "Views/Calculator.g.h"
#include "Converters/BooleanNegationConverter.h"
#include "Converters/ExpressionItemTemplateSelector.h"
#include "Converters/VisibilityNegationConverter.h"
#include "CalcViewModel/Common/Automation/NarratorNotifier.h"
#include "Controls/CalculatorButton.h"
#include "Controls/CalculationResult.h"
#include "Controls/OverflowTextBlock.h"
#include "Controls/EquationTextBox.h"
#include "Controls/MathRichEditBox.h"
#include "CalcViewModel/HistoryViewModel.h"
#include "TemplateSelectors/KeyGraphFeaturesTemplateSelector.h"
#include "Views/CalculatorProgrammerDisplayPanel.xaml.h"
#include "Views/CalculatorProgrammerOperators.xaml.h"
#include "Views/CalculatorScientificAngleButtons.xaml.h"
#include "Views/HistoryList.xaml.h"
#include "Views/Memory.xaml.h"
#include "Views/OperatorsPanel.xaml.h"
#include "Views/GraphingCalculator/KeyGraphFeaturesPanel.xaml.h"
namespace CalculatorApp
{
struct FontTable
{
std::wstring numericSystem;
double fullFont;
double fullFontMin;
double portraitMin;
double snapFont;
double fullNumPadFont;
double snapScientificNumPadFont;
double portraitScientificNumPadFont;
};
public
delegate void FullscreenFlyoutClosedEventHandler();
[Windows::Foundation::Metadata::WebHostHidden] public ref class Calculator sealed
{
public:
event FullscreenFlyoutClosedEventHandler ^ FullscreenFlyoutClosed;
Calculator();
property CalculatorApp::ViewModel::StandardCalculatorViewModel^ Model
{
CalculatorApp::ViewModel::StandardCalculatorViewModel^ get() {
return static_cast<CalculatorApp::ViewModel::StandardCalculatorViewModel^>(this->DataContext);
}
}
DEPENDENCY_PROPERTY_OWNER(Calculator);
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(bool, IsStandard, false);
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(bool, IsScientific, false);
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(bool, IsProgrammer, false);
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(bool, IsAlwaysOnTop, false);
COMMAND_FOR_METHOD(HistoryButtonPressed, Calculator::ToggleHistoryFlyout);
void AnimateCalculator(bool resultAnimate);
void InitializeHistoryView(CalculatorApp::ViewModel::HistoryViewModel ^ historyVM);
void UpdatePanelViewState();
void UnregisterEventHandlers();
void CloseHistoryFlyout();
void CloseMemoryFlyout();
void SetDefaultFocus();
private:
void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void LoadResourceStrings();
void UpdateViewState();
void UpdateMemoryState();
void UpdateHistoryState();
void OnContextRequested(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs ^ e);
void OnContextCanceled(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void OnIsScientificPropertyChanged(bool oldValue, bool newValue);
void OnIsProgrammerPropertyChanged(bool oldValue, bool newValue);
void OnIsStandardPropertyChanged(bool oldValue, bool newValue);
void OnIsAlwaysOnTopPropertyChanged(bool oldValue, bool newValue);
void OnIsInErrorPropertyChanged();
void OnCalcPropertyChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
void OnStoryboardCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
void OnLayoutStateChanged(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
void EnsureScientific();
void EnsureProgrammer();
void SetFontSizeResources();
std::wstring GetCurrentLayoutState();
void Calculator_SizeChanged(Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
private:
Windows::UI::Xaml::Controls::ListView ^ m_tokenList;
Windows::UI::Xaml::Controls::MenuFlyout ^ m_displayFlyout;
bool m_doAnimate;
bool m_resultAnimate;
bool m_isLastAnimatedInScientific;
bool m_isLastAnimatedInProgrammer;
bool m_IsLastFlyoutMemory = false;
bool m_IsLastFlyoutHistory = false;
Platform::String ^ m_openMemoryFlyoutAutomationName;
Platform::String ^ m_closeMemoryFlyoutAutomationName;
Platform::String ^ m_openHistoryFlyoutAutomationName;
Platform::String ^ m_closeHistoryFlyoutAutomationName;
Windows::UI::Xaml::Controls::PivotItem ^ m_pivotItem;
bool m_IsDigit = false;
Memory ^ m_memory;
void HistoryFlyout_Opened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
void HistoryFlyout_Closing(
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender,
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
void HistoryFlyout_Closed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
void OnHideHistoryClicked();
void OnHideMemoryClicked();
void OnHistoryItemClicked(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
void ToggleHistoryFlyout(Platform::Object ^ parameter);
void ToggleMemoryFlyout();
CalculatorApp::HistoryList ^ m_historyList;
bool m_fIsHistoryFlyoutOpen;
bool m_fIsMemoryFlyoutOpen;
void OnMemoryFlyoutOpened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
void OnMemoryFlyoutClosing(
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender,
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
void OnMemoryFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
void SetChildAsMemory();
void SetChildAsHistory();
Memory ^ GetMemory();
void EnableControls(bool enable);
void EnableMemoryControls(bool enable);
void OnMemoryFlyOutTapped(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e);
void OnHistoryFlyOutTapped(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e);
bool IsValidRegularExpression(std::wstring str);
void DockPanelTapped(_In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e);
void OnErrorLayoutCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
void OnHistoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args);
void OnMemoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args);
void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e);
};
}