[Keyboard Manager] Cleanup header file references to improve incremental build time (#4880)

* Remove WinUI include in KeyboardManagerState.h

* Changed include steps

* Clean up headers in KeyboardManagerUI except XamlBridge.h

* Cleaned up headers in KeyboardManager common and test

* Cleaned up headers in KeyboardManager project

* Removed headers from XamlBridge

* Removed some headers from kbm common pch

* Added MP flag to reduce build time

* Added missing include
This commit is contained in:
Arjun Balgovind
2020-07-13 11:49:09 -07:00
committed by GitHub
parent 7db5d6a307
commit 6a9badd31b
37 changed files with 291 additions and 180 deletions

View File

@@ -1,7 +1,17 @@
#pragma once
#include <keyboardmanager/common/KeyboardManagerState.h>
#include "KeyDropDownControl.h"
class KeyboardManagerState;
namespace winrt::Windows::UI::Xaml
{
struct XamlRoot;
namespace Controls
{
struct StackPanel;
struct Grid;
}
}
class SingleKeyRemapControl
{
private:
@@ -9,10 +19,10 @@ private:
KeyDropDownControl singleKeyRemapDropDown;
// Button to type the remap key
Button typeKey;
winrt::Windows::Foundation::IInspectable typeKey;
// StackPanel to parent the above controls
StackPanel singleKeyRemapControlLayout;
winrt::Windows::Foundation::IInspectable singleKeyRemapControlLayout;
public:
// Handle to the current Edit Keyboard Window
@@ -22,32 +32,14 @@ public:
// Stores the current list of remappings
static std::vector<std::vector<DWORD>> singleKeyRemapBuffer;
SingleKeyRemapControl(Grid table, const int colIndex) :
singleKeyRemapDropDown(false)
{
typeKey.Content(winrt::box_value(L"Type Key"));
typeKey.Width(KeyboardManagerConstants::RemapTableDropDownWidth);
typeKey.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
keyboardManagerState->SetUIState(KeyboardManagerUIState::DetectSingleKeyRemapWindowActivated, EditKeyboardWindowHandle);
// Using the XamlRoot of the typeKey to get the root of the XAML host
createDetectKeyWindow(sender, sender.as<Button>().XamlRoot(), singleKeyRemapBuffer, *keyboardManagerState);
});
singleKeyRemapControlLayout.Margin({ 0, 0, 0, 10 });
singleKeyRemapControlLayout.Spacing(10);
singleKeyRemapControlLayout.Children().Append(typeKey);
singleKeyRemapControlLayout.Children().Append(singleKeyRemapDropDown.GetComboBox());
// Set selection handler for the drop down
singleKeyRemapDropDown.SetSelectionHandler(table, singleKeyRemapControlLayout, colIndex, singleKeyRemapBuffer);
singleKeyRemapControlLayout.UpdateLayout();
}
// constructor
SingleKeyRemapControl(Grid table, const int colIndex);
// Function to add a new row to the remap keys table. If the originalKey and newKey args are provided, then the displayed remap keys are set to those values.
static void AddNewControlKeyRemapRow(Grid& parent, std::vector<std::vector<std::unique_ptr<SingleKeyRemapControl>>>& keyboardRemapControlObjects, const DWORD originalKey = NULL, const DWORD newKey = NULL);
static void AddNewControlKeyRemapRow(winrt::Windows::UI::Xaml::Controls::Grid& parent, std::vector<std::vector<std::unique_ptr<SingleKeyRemapControl>>>& keyboardRemapControlObjects, const DWORD originalKey = NULL, const DWORD newKey = NULL);
// Function to return the stack panel element of the SingleKeyRemapControl. This is the externally visible UI element which can be used to add it to other layouts
StackPanel getSingleKeyRemapControl();
winrt::Windows::UI::Xaml::Controls::StackPanel getSingleKeyRemapControl();
// Function to create the detect remap keys UI window
void createDetectKeyWindow(winrt::Windows::Foundation::IInspectable const& sender, XamlRoot xamlRoot, std::vector<std::vector<DWORD>>& singleKeyRemapBuffer, KeyboardManagerState& keyboardManagerState);