Changed output dir to modules and resolved conflicts (#2233)

This commit is contained in:
Arjun Balgovind
2020-04-21 14:14:50 -07:00
committed by GitHub
parent 394f52a725
commit d079f0ca44
12 changed files with 45 additions and 62 deletions

View File

@@ -14,38 +14,13 @@ namespace KeyboardManagerHelper
Shift,
Action
};
// Function to split a wstring based on a delimiter and return a vector of split strings
std::vector<std::wstring> splitwstring(const std::wstring& input, wchar_t delimiter);
// Function to return the next sibling element for an element under a stack panel
winrt::Windows::Foundation::IInspectable getSiblingElement(winrt::Windows::Foundation::IInspectable const& element);
// Function to convert an unsigned int vector to hstring by concatenating them
template<typename T>
winrt::hstring convertVectorToHstring(const std::vector<T>& input)
{
winrt::hstring output;
for (int i = 0; i < input.size(); i++)
{
output = output + winrt::to_hstring((unsigned int)input[i]) + winrt::to_hstring(L" ");
}
return output;
}
// Function to convert a wstring vector to a integer vector
template<typename T>
std::vector<T> convertWStringVectorToIntegerVector(const std::vector<std::wstring>& input)
{
std::vector<T> typeVector;
for (int i = 0; i < input.size(); i++)
{
typeVector.push_back((T)std::stoi(input[i]));
}
return typeVector;
}
// Function to return if the key is an extended key which requires the use of the extended key flag
bool isExtendedKey(DWORD key);

View File

@@ -44,9 +44,13 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\</OutDir>
<IntDir>$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\</OutDir>
<IntDir>$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>

View File

@@ -47,10 +47,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\</OutDir>
<IntDir>$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\</OutDir>
<IntDir>$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>

View File

@@ -84,13 +84,13 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// Header text
TextBlock headerText;
headerText.Text(winrt::to_hstring("Remap Keyboard"));
headerText.Text(L"Remap Keyboard");
headerText.FontSize(30);
headerText.Margin({ 0, 0, 1000, 0 });
// Header Cancel button
Button cancelButton;
cancelButton.Content(winrt::box_value(winrt::to_hstring("Cancel")));
cancelButton.Content(winrt::box_value(L"Cancel"));
cancelButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
// Close the window since settings do not need to be saved
PostMessage(_hWndEditKeyboardWindow, WM_CLOSE, 0, 0);
@@ -98,7 +98,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// Text block for information about remap key section.
TextBlock keyRemapInfoHeader;
keyRemapInfoHeader.Text(winrt::to_hstring("Select the key you want to remap, original key, and it's new output when pressed, the new key"));
keyRemapInfoHeader.Text(L"Select the key you want to remap, original key, and it's new output when pressed, the new key");
keyRemapInfoHeader.Margin({ 10, 0, 0, 10 });
// Table to display the key remaps
@@ -113,14 +113,14 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// First header textblock in the header row of the keys remap table
TextBlock originalKeyRemapHeader;
originalKeyRemapHeader.Text(winrt::to_hstring("Original Key:"));
originalKeyRemapHeader.Text(L"Original Key:");
originalKeyRemapHeader.FontWeight(Text::FontWeights::Bold());
originalKeyRemapHeader.Margin({ 0, 0, 0, 10 });
tableHeaderRow.Children().Append(originalKeyRemapHeader);
// Second header textblock in the header row of the keys remap table
TextBlock newKeyRemapHeader;
newKeyRemapHeader.Text(winrt::to_hstring("New Key:"));
newKeyRemapHeader.Text(L"New Key:");
newKeyRemapHeader.FontWeight(Text::FontWeights::Bold());
newKeyRemapHeader.Margin({ 0, 0, 0, 10 });
tableHeaderRow.Children().Append(newKeyRemapHeader);
@@ -186,7 +186,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// Main Header Apply button
Button applyButton;
applyButton.Content(winrt::box_value(winrt::to_hstring("Apply")));
applyButton.Content(winrt::box_value(L"Apply"));
applyButton.Flyout(applyFlyout);
applyButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
bool isSuccess = true;
@@ -240,11 +240,11 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
if (isSuccess && saveResult)
{
settingsMessage.Text(winrt::to_hstring("Remapping successful"));
settingsMessage.Text(L"Remapping successful!");
}
else if (!isSuccess && saveResult)
{
settingsMessage.Text(winrt::to_hstring("All remappings were not successfully applied"));
settingsMessage.Text(L"All remappings were not successfully applied.");
}
else
{

View File

@@ -2,7 +2,7 @@
#include <keyboardmanager/common/KeyboardManagerState.h>
// Function to create the Edit Keyboard Window
__declspec(dllexport) void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardManagerState);
void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardManagerState);
// Function to check if there is already a window active if yes bring to foreground.
__declspec(dllexport) bool CheckEditKeyboardWindowActive();
bool CheckEditKeyboardWindowActive();

View File

@@ -85,13 +85,13 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// Header text
TextBlock headerText;
headerText.Text(winrt::to_hstring("Edit Shortcuts"));
headerText.Text(L"Edit Shortcuts");
headerText.FontSize(30);
headerText.Margin({ 0, 0, 100, 0 });
// Cancel button
Button cancelButton;
cancelButton.Content(winrt::box_value(winrt::to_hstring("Cancel")));
cancelButton.Content(winrt::box_value(L"Cancel"));
cancelButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
// Close the window since settings do not need to be saved
PostMessage(_hWndEditShortcutsWindow, WM_CLOSE, 0, 0);
@@ -109,14 +109,14 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// First header textblock in the header row of the shortcut table
TextBlock originalShortcutHeader;
originalShortcutHeader.Text(winrt::to_hstring("Original Shortcut:"));
originalShortcutHeader.Text(L"Original Shortcut:");
originalShortcutHeader.FontWeight(Text::FontWeights::Bold());
originalShortcutHeader.Margin({ 0, 0, 0, 10 });
tableHeaderRow.Children().Append(originalShortcutHeader);
// Second header textblock in the header row of the shortcut table
TextBlock newShortcutHeader;
newShortcutHeader.Text(winrt::to_hstring("New Shortcut:"));
newShortcutHeader.Text(L"New Shortcut:");
newShortcutHeader.FontWeight(Text::FontWeights::Bold());
newShortcutHeader.Margin({ 0, 0, 0, 10 });
tableHeaderRow.Children().Append(newShortcutHeader);
@@ -148,7 +148,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// Apply button
Button applyButton;
applyButton.Content(winrt::box_value(winrt::to_hstring("Apply")));
applyButton.Content(winrt::box_value(L"Apply"));
applyButton.Flyout(applyFlyout);
applyButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
bool isSuccess = true;
@@ -180,11 +180,11 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
if (isSuccess && saveResult)
{
settingsMessage.Text(winrt::to_hstring("Remapping successful!"));
settingsMessage.Text(L"Remapping successful!");
}
else if (!isSuccess && saveResult)
{
settingsMessage.Text(winrt::to_hstring("All remappings were not successfully applied."));
settingsMessage.Text(L"All remappings were not successfully applied.");
}
else
{

View File

@@ -4,7 +4,7 @@
#include "keyboardmanager/common/Helpers.h"
// Function to create the Edit Shortcuts Window
__declspec(dllexport) void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardManagerState);
void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardManagerState);
// Function to check if there is already a window active if yes bring to foreground.
__declspec(dllexport) bool CheckEditShortcutsWindowActive();
bool CheckEditShortcutsWindowActive();

View File

@@ -22,13 +22,13 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
@@ -48,11 +48,13 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\</OutDir>
<IntDir>$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\modules\</OutDir>
<IntDir>$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>

View File

@@ -148,7 +148,7 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
};
TextBlock primaryButtonText;
primaryButtonText.Text(to_hstring(L"OK"));
primaryButtonText.Text(L"OK");
Button primaryButton;
primaryButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -180,7 +180,7 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
});
TextBlock cancelButtonText;
cancelButtonText.Text(to_hstring(L"Cancel"));
cancelButtonText.Text(L"Cancel");
Button cancelButton;
cancelButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -215,7 +215,7 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
// Header textblock
TextBlock text;
text.Text(winrt::to_hstring("Keys Pressed:"));
text.Text(L"Keys Pressed:");
text.Margin({ 0, 0, 0, 10 });
stackPanel.Children().Append(text);
@@ -225,13 +225,13 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
stackPanel.Children().Append(keyStackPanel);
TextBlock holdEscInfo;
holdEscInfo.Text(winrt::to_hstring("Hold Esc to discard"));
holdEscInfo.Text(L"Hold Esc to discard");
holdEscInfo.FontSize(12);
holdEscInfo.Margin({ 0, 20, 0, 0 });
stackPanel.Children().Append(holdEscInfo);
TextBlock holdEnterInfo;
holdEnterInfo.Text(winrt::to_hstring("Hold Enter to apply"));
holdEnterInfo.Text(L"Hold Enter to apply");
holdEnterInfo.FontSize(12);
holdEnterInfo.Margin({ 0, 0, 0, 0 });
stackPanel.Children().Append(holdEnterInfo);

View File

@@ -35,7 +35,7 @@ public:
shortcutDropDownStackPanel.Orientation(Windows::UI::Xaml::Controls::Orientation::Horizontal);
KeyDropDownControl::AddDropDown(shortcutDropDownStackPanel, rowIndex, colIndex, shortcutRemapBuffer, keyDropDownControlObjects);
typeShortcut.Content(winrt::box_value(winrt::to_hstring("Type Shortcut")));
typeShortcut.Content(winrt::box_value(L"Type Shortcut"));
typeShortcut.Click([&, rowIndex, colIndex](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
keyboardManagerState->SetUIState(KeyboardManagerUIState::DetectShortcutWindowActivated, EditShortcutsWindowHandle);
// Using the XamlRoot of the typeShortcut to get the root of the XAML host

View File

@@ -125,7 +125,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
};
TextBlock primaryButtonText;
primaryButtonText.Text(to_hstring(L"OK"));
primaryButtonText.Text(L"OK");
Button primaryButton;
primaryButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -155,7 +155,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
});
TextBlock cancelButtonText;
cancelButtonText.Text(to_hstring(L"Cancel"));
cancelButtonText.Text(L"Cancel");
Button cancelButton;
cancelButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -190,7 +190,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
// Header textblock
TextBlock text;
text.Text(winrt::to_hstring("Key Pressed:"));
text.Text(L"Key Pressed:");
text.Margin({ 0, 0, 0, 10 });
stackPanel.Children().Append(text);
@@ -200,13 +200,13 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
stackPanel.Children().Append(keyStackPanel);
TextBlock holdEscInfo;
holdEscInfo.Text(winrt::to_hstring("Hold Esc to discard"));
holdEscInfo.Text(L"Hold Esc to discard");
holdEscInfo.FontSize(12);
holdEscInfo.Margin({ 0, 20, 0, 0 });
stackPanel.Children().Append(holdEscInfo);
TextBlock holdEnterInfo;
holdEnterInfo.Text(winrt::to_hstring("Hold Enter to apply"));
holdEnterInfo.Text(L"Hold Enter to apply");
holdEnterInfo.FontSize(12);
holdEnterInfo.Margin({ 0, 0, 0, 0 });
stackPanel.Children().Append(holdEnterInfo);

View File

@@ -25,7 +25,7 @@ public:
SingleKeyRemapControl(const size_t rowIndex, const size_t colIndex) :
singleKeyRemapDropDown(rowIndex, colIndex, singleKeyRemapBuffer)
{
typeKey.Content(winrt::box_value(winrt::to_hstring("Type Key")));
typeKey.Content(winrt::box_value(L"Type Key"));
typeKey.Click([&, rowIndex, colIndex](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