diff --git a/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.cpp b/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.cpp index 21a39d9c11e8..0bbd19be61be 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.cpp @@ -77,11 +77,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, type = static_cast(_wtoi(cmdArgs[1])); } - //while (true) - //{ - // std::this_thread::sleep_for(std::chrono::milliseconds(500)); - //} - std::wstring keysForShortcutToEdit = L""; std::wstring action = L""; diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp index 587d9ea9492a..b6e1144eddcb 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp @@ -204,8 +204,7 @@ namespace BufferValidationHelpers } else { - // for now, since we will allow Chords, we do allow this: - // warn and reset the drop down + // this used to "warn and reset the drop down" but for now, since we will allow Chords, we do allow this // errorType = ShortcutErrorType::ShortcutNotMoreThanOneActionKey; } } diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp index 65214a6a6029..fd817776dac5 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp @@ -68,10 +68,10 @@ static IAsyncAction OnClickAccept( ApplyRemappings(); } -static void OnClickAcceptNoCheck() -{ - //ApplyRemappings(); -} +//static void OnClickAcceptNoCheck() +//{ +// //ApplyRemappings(); +//} static bool isInSingleEditMode = false; static bool isInCreateNewMode = false; @@ -116,10 +116,12 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa isEditShortcutsWindowRegistrationCompleted = true; } + // we might be passed via cmdline some keysForShortcutToEdit, this means we're editing just one shortcut if (!keysForShortcutToEdit.empty()) { isInSingleEditMode = true; + // or making a new one if (keysForShortcutToEdit == L"inCreateNewMode") { isInCreateNewMode = true; @@ -250,19 +252,12 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa auto newShortcutHeaderContainer = UIHelpers::GetWrapped(newShortcutHeader, EditorConstants::ShortcutTargetColumnWidth); tableHeader.Children().Append(newShortcutHeaderContainer.as()); - if (isInSingleEditMode) - { - } - else + if (!isInSingleEditMode) { + // add normal header if in normal mode tableHeader.Children().Append(targetAppHeader); } - /*if (isInSingleEditMode) - { - tableHeader.Visibility(Visibility::Collapsed); - }*/ - // Store handle of edit shortcuts window ShortcutControl::editShortcutsWindowHandle = _hWndEditShortcutsWindow; @@ -315,17 +310,6 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa isHidden = (keysForShortcutToEdit != it.first.ToHstringVK()); } - /* -( - StackPanel& parent, - std::vector>>& keyboardRemapControlObjects, - const Shortcut& originalKeys = Shortcut(), - const KeyShortcutTextUnion& newKeys = Shortcut(), - const std::wstring& targetAppName = L"", - bool isHidden = false - ); - */ - ShortcutControl::AddNewShortcutControlRow(shortcutTable, keyboardRemapControlObjects, it.first, it.second.targetShortcut, L"", isHidden, isInSingleEditMode, OnClickAcceptNoCheckFn, action); } @@ -405,8 +389,6 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa if (isInCreateNewMode) { - //ShortcutControl& newShortcut = ShortcutControl::AddNewShortcutControlRow(shortcutTable, keyboardRemapControlObjects); - ShortcutControl& newShortcut = ShortcutControl::AddNewShortcutControlRow(shortcutTable, keyboardRemapControlObjects, Shortcut(), Shortcut(), L"", false, true, nullptr, L""); // Whenever a remap is added move to the bottom of the screen @@ -415,7 +397,7 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa // Set focus to the first Type Button in the newly added row UIHelpers::SetFocusOnTypeButtonInLastRow(shortcutTable, EditorConstants::ShortcutTableColCount); - // not working from here, cross thread maybe + // not working from here, cross thread maybe, but likely just not finding the correct item // newShortcut.OpenNewShortcutControlRow(shortcutTable, shortcutTable.Children().GetAt(shortcutTable.Children().Size() - 1).as()); } @@ -440,10 +422,7 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa // Remapping table StackPanel mappingsPanel; - if (isInSingleEditMode) - { - } - else + if (!isInSingleEditMode) { mappingsPanel.Children().Append(tableHeader); } @@ -492,11 +471,10 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa if (isInSingleEditMode) { + // more regigger of the screen for single mode headerText.Text(GET_RESOURCE_STRING(IDS_EDITTHISSHORTCUT_WINDOWNAME)); addShortcut.Visibility(Visibility::Collapsed); headerText.Visibility(Visibility::Collapsed); - //shortcutRemapInfoExample.Visibility(Visibility::Collapsed); - //shortcutRemapInfoHeader.Visibility(Visibility::Collapsed); shortcutRemapInfoHeader.Text(GET_RESOURCE_STRING(IDS_EDITSINGLESHORTCUT_INFO)); StackPanel tempSp; @@ -507,10 +485,6 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa tempSp.Children().Append(applyButton); tempSp.Children().Append(cancelButton); - //mappingsPanel.Children().Append(tempSp); - //xamlContainer.Children().Append(tempSp); - //xamlContainer.SetBelow(tempSp, scrollViewer); - StackPanel tempSp2; tempSp.Margin({ 10, 10, 10, 0 }); tempSp2.Children().Append(xamlContent); @@ -584,12 +558,6 @@ LRESULT CALLBACK EditShortcutsWindowProc(HWND hWnd, UINT messageCode, WPARAM wPa mmi->ptMinTrackSize.x = static_cast(minWidth); mmi->ptMinTrackSize.y = static_cast(minHeight); - - //if (isInSingleEditMode) - //{ - // mmi->ptMaxTrackSize.x = static_cast(minWidth); - // mmi->ptMaxTrackSize.y = static_cast(minHeight); - //} } break; case WM_GETDPISCALEDSIZE: diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp index a3f00939d563..6db554b4f5fe 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDropDownControl.cpp @@ -12,7 +12,6 @@ #include "EditorHelpers.h" #include "ShortcutErrorType.h" #include "EditorConstants.h" -#include // Initialized to null KBMEditor::KeyboardManagerState* KeyDropDownControl::keyboardManagerState = nullptr; @@ -438,11 +437,6 @@ void KeyDropDownControl::AddShortcutToControl(Shortcut shortcut, StackPanel tabl { bool ignoreWarning = false; - //while (true) - //{ - // Sleep(1000); - //} - // If more than one key is to be added, ignore a shortcut to key warning on partially entering the remapping if (shortcutKeyCodes.size() > 1) { diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp index f4b63fb66ff0..cfd90a759a46 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp @@ -109,7 +109,6 @@ void KeyboardManagerState::ConfigureDetectSingleKeyRemapUI(const StackPanel& tex std::lock_guard lock(currentSingleKeyUI_mutex); currentSingleKeyUI = textBlock.as(); } -//void xAddKeyToLayout(const winrt::Windows::UI::Xaml::Controls::StackPanel& panel, const winrt::hstring& key); TextBlock KeyboardManagerState::AddKeyToLayout(const StackPanel& panel, const hstring& key) { @@ -193,7 +192,7 @@ void KeyboardManagerState::UpdateDetectShortcutUI() if (detectedShortcut.HasChord()) { - //TextBlock, to show what shortcut in text, e.g.: "CRTL+j, k" OR "CRTL+j, CRTL+k". + // add a TextBlock, to show what shortcut in text, e.g.: "CRTL+j, k" OR "CRTL+j, CRTL+k". TextBlock txtComma; txtComma.Text(L","); diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp index d2423f18dc4c..8fbbf29c1b66 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp @@ -11,7 +11,6 @@ #include "UIHelpers.h" #include "EditorHelpers.h" #include "EditorConstants.h" -//#include //Both static members are initialized to null HWND ShortcutControl::editShortcutsWindowHandle = nullptr; @@ -45,21 +44,13 @@ ShortcutControl::ShortcutControl(StackPanel table, StackPanel row, const int col fontIcon.FontFamily(Media::FontFamily(L"Segoe MDL2 Assets")); // Set the font family to Segoe MDL2 Assets // Set the FontIcon as the content of the button btnPickShortcut.as