From 4fc9d798bc5f3ff82efc4fb00140103213fb81e2 Mon Sep 17 00:00:00 2001 From: Pepe Rivera Date: Wed, 26 Feb 2020 15:01:19 -0800 Subject: [PATCH] Allow copying graph as image --- src/Calculator/Resources/en-US/Resources.resw | 30 +++++++++---------- .../GraphingCalculator.xaml | 10 ++++++- .../GraphingCalculator.xaml.cpp | 10 +++++++ .../GraphingCalculator.xaml.h | 1 + 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/Calculator/Resources/en-US/Resources.resw b/src/Calculator/Resources/en-US/Resources.resw index 4e9d2df3..8e6592e6 100644 --- a/src/Calculator/Resources/en-US/Resources.resw +++ b/src/Calculator/Resources/en-US/Resources.resw @@ -3948,7 +3948,7 @@ Label for the Line Color section of the style picker - Key Graph Features + Function analysis Title for KeyGraphFeatures Control @@ -4115,16 +4115,16 @@ This is the automation name for the back button in the equation analysis page in the graphing calculator - Analyze equation - This is the tooltip for the analyze equation button + Analyze function + This is the tooltip for the analyze function button - Analyze equation - This is the automation name for the analyze equation button + Analyze function + This is the automation name for the analyze function button - Analyze equation - This is the text for the for the analyze equation context menu command + Analyze function + This is the text for the for the analyze function context menu command Remove equation @@ -4203,8 +4203,8 @@ Announcement used in Graphing Calculator when switching to the graph mode - Grid - Heading for grid extents on the settings + Window + Heading for window extents on the settings Degrees @@ -4238,10 +4238,6 @@ Y-Min Y minimum value header - - Enter an equation - Used in the Graphing Calculator to indicate to users that they can enter an equation in the textbox - Grid options This is the tooltip text for the grid options button in Graphing Calculator @@ -4255,7 +4251,11 @@ Heading for the Graph Options flyout in Graphing mode. - Enter an equation + Enter an expression this is the placeholder text used by the textbox to enter an equation - \ No newline at end of file + + Copy + Copy menu item for the graph context menu + + diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml index 7ea25cdb..406cf94c 100644 --- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml +++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml @@ -477,7 +477,15 @@ LostFocus="GraphingControl_LostFocus" RequestedTheme="Light" UseSystemFocusVisuals="True" - VariablesUpdated="GraphingControl_VariablesUpdated"/> + VariablesUpdated="GraphingControl_VariablesUpdated"> + + + + + + Focus(::FocusState::Programmatic); } } + +void GraphingCalculator::GraphMenuFlyoutItem_Click(Object ^ sender, RoutedEventArgs ^ e) +{ + auto dataPackage = ref new DataPackage(); + dataPackage->RequestedOperation = ::DataPackageOperation::Copy; + + auto bitmapStream = GraphingControl->GetGraphBitmapStream(); + dataPackage->SetBitmap(bitmapStream); + ::Clipboard::SetContent(dataPackage); +} diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h index 38f76aaa..06d317d2 100644 --- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h +++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h @@ -91,6 +91,7 @@ public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INo void LeftGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e); void OnHighContrastChanged(Windows::UI::ViewManagement::AccessibilitySettings ^ sender, Platform::Object ^ args); void OnEquationFormatRequested(Platform::Object ^ sender, CalculatorApp::Controls::MathRichEditBoxFormatRequest ^ e); + void GraphMenuFlyoutItem_Click(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); }; }