Skip to content

Commit

Permalink
Some clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflord committed Jan 11, 2024
1 parent 085dda6 commit bee5326
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 354 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
type = static_cast<KeyboardManagerEditorType>(_wtoi(cmdArgs[1]));
}

//while (true)
//{
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
//}

std::wstring keysForShortcutToEdit = L"";
std::wstring action = L"";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ static IAsyncAction OnClickAccept(
ApplyRemappings();
}

static void OnClickAcceptNoCheck()
{
//ApplyRemappings();
}
//static void OnClickAcceptNoCheck()
//{
// //ApplyRemappings();
//}

static bool isInSingleEditMode = false;
static bool isInCreateNewMode = false;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -250,19 +252,12 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa
auto newShortcutHeaderContainer = UIHelpers::GetWrapped(newShortcutHeader, EditorConstants::ShortcutTargetColumnWidth);
tableHeader.Children().Append(newShortcutHeaderContainer.as<FrameworkElement>());

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;

Expand Down Expand Up @@ -315,17 +310,6 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa
isHidden = (keysForShortcutToEdit != it.first.ToHstringVK());
}

/*
(
StackPanel& parent,
std::vector<std::vector<std::unique_ptr<ShortcutControl>>>& 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);
}

Expand Down Expand Up @@ -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
Expand All @@ -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<StackPanel>());
}

Expand All @@ -440,10 +422,7 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa

// Remapping table
StackPanel mappingsPanel;
if (isInSingleEditMode)
{
}
else
if (!isInSingleEditMode)
{
mappingsPanel.Children().Append(tableHeader);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -584,12 +558,6 @@ LRESULT CALLBACK EditShortcutsWindowProc(HWND hWnd, UINT messageCode, WPARAM wPa

mmi->ptMinTrackSize.x = static_cast<LONG>(minWidth);
mmi->ptMinTrackSize.y = static_cast<LONG>(minHeight);

//if (isInSingleEditMode)
//{
// mmi->ptMaxTrackSize.x = static_cast<LONG>(minWidth);
// mmi->ptMaxTrackSize.y = static_cast<LONG>(minHeight);
//}
}
break;
case WM_GETDPISCALEDSIZE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "EditorHelpers.h"
#include "ShortcutErrorType.h"
#include "EditorConstants.h"
#include <Dialog.h>

// Initialized to null
KBMEditor::KeyboardManagerState* KeyDropDownControl::keyboardManagerState = nullptr;
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ void KeyboardManagerState::ConfigureDetectSingleKeyRemapUI(const StackPanel& tex
std::lock_guard<std::mutex> lock(currentSingleKeyUI_mutex);
currentSingleKeyUI = textBlock.as<winrt::Windows::Foundation::IInspectable>();
}
//void xAddKeyToLayout(const winrt::Windows::UI::Xaml::Controls::StackPanel& panel, const winrt::hstring& key);

TextBlock KeyboardManagerState::AddKeyToLayout(const StackPanel& panel, const hstring& key)
{
Expand Down Expand Up @@ -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",");
Expand Down
Loading

1 comment on commit bee5326

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (63)
actio
ALLOWCHORDS
ALREADYRUNNINGCLOSE
ALREADYRUNNINGCLOSEANDTERMINATE
ALREADYRUNNINGDONOTHING
ALREADYRUNNINGSHOWWINDOW
ALREADYRUNNINGSTARTANOTHER
ALREADYRUNNINGTERMINATE
ARGSFORPROGRAM
BADKEY
BIF
BROWSEINFO
CKBH
CLOSE'ing
cmdow
commdlg
CRTL
EDITSINGLESHORTCUT
EDITTHISSHORTCUT
ELEVATIONTYPEDIFFERENTUSER
ELEVATIONTYPEELEVATED
ELEVATIONTYPENORMAL
FILEMUSTEXIST
IUse
LABELACTION
LABELAPPNOTRUNNINGSOUND
LABELAPPRUNNINGSOUND
LABELARGS
LABELELEVATION
LABELIFRUNNING
LABELKEYS
LABELPATHURI
LABELPROGRAM
LABELSHORTCUT
LABELSTARTAS
LABELSTARTIN
Lencode
LPITEMIDLIST
lpstr
NEWDIALOGSTYLE
ofn
OPENFILENAME
PATHMUSTEXIST
PATHTOPROGRAM
pids
PROCESSENTRY
Procses
regigger
RETURNONLYFSDIRS
ritchielawrence
rowx
runasuser
SNAPPROCESS
STARTINDIRFORPROGRAM
tlhelp
Toolhelp
URIEXAMPLE
URIOr
urlmon
VIZHIDDEN
VIZNORMAL
wcsicmp
WHATCANIUSELINK
Previously acknowledged words that are now absent applicationframehost Kazakhstani qps Tenge TKey TValue unescape 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:jefflord/PowerToys.git repository
on the launch-apps-3350 branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/jefflord/PowerToys/actions/runs/7483858540/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (1849) from .github/actions/spell-check/expect.txt and unrecognized words (63)

Dictionary Entries Covers Uniquely
cspell:r/src/r.txt 543 1 1
cspell:cpp/src/people.txt 23 1
cspell:cpp/src/ecosystem.txt 51 1

Consider adding them (in .github/workflows/spelling2.yml) for uses: check-spelling/check-spelling@v0.0.22 in its with:

      with:
        extra_dictionaries:
          cspell:r/src/r.txt
          cspell:cpp/src/people.txt
          cspell:cpp/src/ecosystem.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling2.yml) for uses: check-spelling/check-spelling@v0.0.22 in its with:

check_extra_dictionaries: ''
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Please sign in to comment.