Release v0.6.27: menu and Alt access keys

This commit is contained in:
2026-11-02 01:23:33 +02:00
parent 22edece7cf
commit 738c81dce2
13 changed files with 138 additions and 114 deletions
+57 -57
View File
@@ -493,7 +493,7 @@ bool selectedImage(HWND w, HistoryView *v)
}
void updateHistoryActions(HWND w, HistoryView *v)
{
SetDlgItemTextW(w,114,selectedImage(w,v)?L"Edit image":L"Open item");
SetDlgItemTextW(w,114,selectedImage(w,v)?L"&Edit image":L"&Open item");
}
std::wstring selected(HWND w, HistoryView *v)
{
@@ -854,12 +854,12 @@ LRESULT CALLBACK historyProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
p={row.left,row.top}; ClientToScreen(list,&p);
}
HMENU menu = CreatePopupMenu();
AppendMenuW(menu, MF_STRING, 110, L"Paste");
AppendMenuW(menu, MF_STRING, 111, L"Paste plain text");
AppendMenuW(menu, MF_STRING, 112, L"Pin / unpin");
AppendMenuW(menu, MF_STRING, 113, L"Delete");
AppendMenuW(menu, MF_STRING, 114, selectedImage(w,v)?L"Edit image in screenshot editor":L"Open full item");
AppendMenuW(menu, MF_STRING, 115, L"Copy text from image (OCR)");
AppendMenuW(menu, MF_STRING, 110, L"&Paste");
AppendMenuW(menu, MF_STRING, 111, L"Paste plain &text");
AppendMenuW(menu, MF_STRING, 112, L"P&in / unpin");
AppendMenuW(menu, MF_STRING, 113, L"&Delete");
AppendMenuW(menu, MF_STRING, 114, selectedImage(w,v)?L"&Edit image in screenshot editor":L"&Open full item");
AppendMenuW(menu, MF_STRING, 115, L"&Copy text from image (OCR)");
int cmd = TrackPopupMenu(menu, TPM_RETURNCMD, p.x, p.y, 0, w, nullptr);
DestroyMenu(menu);
if (cmd)
@@ -1159,9 +1159,9 @@ void showAutoOptions(HWND parent, SettingsView *v)
SetWindowLongPtrW(w, GWLP_HWNDPARENT, (LONG_PTR)parent);
SetWindowLongPtrW(w, GWLP_USERDATA, (LONG_PTR) new AutoOptionsView{parent, v});
label(w, L"Offline dictionaries (only layouts in your cycle are used)", 18, 16, 525);
checkbox(w, L"English", 401, 18, 48, 150);
checkbox(w, L"Ukrainian", 402, 188, 48, 150);
checkbox(w, L"Russian", 403, 358, 48, 150);
checkbox(w, L"&English", 401, 18, 48, 150);
checkbox(w, L"&Ukrainian", 402, 188, 48, 150);
checkbox(w, L"&Russian", 403, 358, 48, 150);
for (auto &lang : v->draft.autoLanguages)
check(w, lang == L"en" ? 401 : lang == L"uk" ? 402 : 403, true);
label(w, L"Excluded applications (process names, comma-separated)", 18, 94, 525);
@@ -1174,7 +1174,7 @@ void showAutoOptions(HWND parent, SettingsView *v)
for (auto [id, language] : {std::pair{411, L"en"}, {412, L"uk"}, {413, L"ru"}})
{
int x = 18 + (id - 411) * 178;
label(w, id == 411 ? L"English" : id == 412 ? L"Ukrainian" : L"Russian", x, 302, 168);
label(w, id == 411 ? L"En&glish" : id == 412 ? L"U&krainian" : L"Ru&ssian", x, 302, 168);
edit(w, id, x, 328, 168, 56, ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_WANTRETURN);
auto words = v->draft.autoWords.find(language);
if (words != v->draft.autoWords.end()) value(w, id, commaList(words->second));
@@ -1192,10 +1192,10 @@ void showAutoOptions(HWND parent, SettingsView *v)
value(w, 408, v->draft.autoPrefixChars);
value(w, 409, v->draft.autoSuffixChars);
label(w, L"Enter punctuation without spaces or separators. These characters are kept.", 18, 530, 525);
button(w, L"Open dictionary folder", 407, 18, 562, 220);
button(w, L"Open dictionary &folder", 407, 18, 562, 220);
label(w, L"After editing files, click OK here, then Save in Settings to reload.", 18, 600, 525);
button(w, L"OK", IDOK, 326, 632, 100);
button(w, L"Cancel", IDCANCEL, 440, 632, 100);
button(w, L"&OK", IDOK, 326, 632, 100);
button(w, L"&Cancel", IDCANCEL, 440, 632, 100);
RECT initial{};
GetWindowRect(w, &initial);
initial.right += scale(w, 200);
@@ -1278,23 +1278,23 @@ void showOcrOptions(HWND parent, SettingsView *v)
SetWindowLongPtrW(w, GWLP_HWNDPARENT, (LONG_PTR)parent);
SetWindowLongPtrW(w, GWLP_USERDATA, (LONG_PTR)new OcrOptionsView{parent, v});
label(w, L"Windows OCR is used by default. Recognition stays on this computer.", 18, 16, 600);
checkbox(w, L"Use optional Tesseract 5 instead of Windows OCR", 501, 18, 48, 600);
checkbox(w, L"&Use optional Tesseract 5 instead of Windows OCR", 501, 18, 48, 600);
check(w, 501, v->draft.useTesseract);
label(w, L"Tesseract executable (blank = detect installed location)", 18, 90, 600);
edit(w, 502, 18, 118, 484);
value(w, 502, v->draft.tesseractPath);
button(w, L"Browse…", 504, 514, 117, 106);
button(w, L"&Browse…", 504, 514, 117, 106);
label(w, L"Languages used together (for example ukr+eng+rus)", 18, 160, 600);
edit(w, 503, 18, 188, 602);
value(w, 503, v->draft.tesseractLanguages);
button(w, L"Check installation", 505, 18, 228, 180);
button(w, L"Check &installation", 505, 18, 228, 180);
control(w, L"STATIC", L"", 0, 506, 212, 232, 408, 24);
button(w, L"Download Tesseract…", 507, 18, 266, 180);
button(w, L"&Download Tesseract…", 507, 18, 266, 180);
label(w, L"Opens the Windows installer page in your browser.", 212, 270, 408);
label(w, L"Changing the engine or languages reprocesses saved images in the background.", 18, 314, 602);
label(w, L"Click OK here, then Save in Settings to apply. No downloads are automatic.", 18, 344, 602);
button(w, L"OK", IDOK, 406, 390, 100);
button(w, L"Cancel", IDCANCEL, 520, 390, 100);
button(w, L"&OK", IDOK, 406, 390, 100);
button(w, L"&Cancel", IDCANCEL, 520, 390, 100);
EnableWindow(parent, FALSE);
showRequestedWindow(w); SetForegroundWindow(w);
}
@@ -1606,18 +1606,18 @@ void showHistory(App &app, bool visible)
app.historyWindow = w;
windowLayoutState(w)->history = true;
((HistoryView *)GetWindowLongPtrW(w, GWLP_USERDATA))->rich = createRichText(w, 105, false);
label(w, L"Search clipboard history", 16, 12, 500);
label(w, L"&Search clipboard history", 16, 12, 500);
edit(w, 101, 16, 38, 728);
auto list = control(w, L"LISTBOX", L"",
WS_TABSTOP | WS_VSCROLL | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_BORDER |
LBS_OWNERDRAWFIXED | LBS_HASSTRINGS,
102, 16, 76, 728, 360);
SendMessageW(list, LB_SETITEMHEIGHT, 0, scale(w, 88));
button(w, L"Paste", 110, 16, 452, 90);
button(w, L"Plain text", 111, 114, 452, 100);
button(w, L"Pin / unpin", 112, 222, 452, 110);
button(w, L"Delete", 113, 340, 452, 90);
button(w, L"Open item", 114, 438, 452, 100);
button(w, L"&Paste", 110, 16, 452, 90);
button(w, L"Plain &text", 111, 114, 452, 100);
button(w, L"P&in / unpin", 112, 222, 452, 110);
button(w, L"&Delete", 113, 340, 452, 90);
button(w, L"&Open item", 114, 438, 452, 100);
SetWindowSubclass(list, historyKey, 1, (DWORD_PTR)w);
SetWindowSubclass(GetDlgItem(w, 101), historyKey, 1, (DWORD_PTR)w);
}
@@ -1656,13 +1656,13 @@ void showSettings(App &app, bool visible)
HWND w = makeWindow(app, L"KSwitcher.Settings", L"KSwitcher settings", settingsProc, 780, 660, 0, false);
app.settingsWindow = w;
label(w, L"Text conversion", 18, 16);
checkbox(w, L"Convert recently typed text when nothing is selected", 201, 18, 43, 390);
checkbox(w, L"Switch Windows input layout after conversion", 202, 18, 70, 390);
checkbox(w, L"Record clipboard history", 203, 18, 106);
checkbox(w, L"Start with Windows", 204, 18, 133);
checkbox(w, L"Start with Windows as administrator", 206, 18, 160, 395);
checkbox(w, L"Keep screen awake", 205, 18, 184, 210);
checkbox(w, L"Write log", 208, 240, 184, 160);
checkbox(w, L"Con&vert recently typed text when nothing is selected", 201, 18, 43, 390);
checkbox(w, L"Switch Windows input &layout after conversion", 202, 18, 70, 390);
checkbox(w, L"Record clip&board history", 203, 18, 106);
checkbox(w, L"Start with &Windows", 204, 18, 133);
checkbox(w, L"Start with Windows as ad&ministrator", 206, 18, 160, 395);
checkbox(w, L"&Keep screen awake", 205, 18, 184, 210);
checkbox(w, L"Write lo&g", 208, 240, 184, 160);
label(w, L"Click a shortcut and press the desired keys", 420, 16, 350);
const wchar_t *names[] = {L"Next layout", L"Change case", L"Transliterate", L"Undo",
L"Clipboard history", L"Screen capture"};
@@ -1671,18 +1671,18 @@ void showSettings(App &app, bool visible)
label(w, names[i], 420, 48 + i * 30, 115);
hotkeyEdit(app, w, 210 + i, 540, 44 + i * 30, 220);
}
checkbox(w, L"Open editor after screen capture", 209, 420, 224, 340);
checkbox(w, L"Automatically correct layout (experimental)", 207, 18, 210, 395);
checkbox(w, L"Open editor after screen capt&ure", 209, 420, 224, 340);
checkbox(w, L"Automatically correct layout (e&xperimental)", 207, 18, 210, 395);
label(w, L"Layout cycle — top to bottom", 18, 240, 400);
control(w, L"LISTBOX", L"", WS_TABSTOP | WS_VSCROLL | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_BORDER, 220,
18, 262, 470, 172);
button(w, L"Move up", 232, 504, 262, 120);
button(w, L"Move down", 233, 632, 262, 128);
checkbox(w, L"Include in cycle", 230, 504, 300, 240);
button(w, L"Move u&p", 232, 504, 262, 120);
button(w, L"Move &down", 233, 632, 262, 128);
checkbox(w, L"&Include in cycle", 230, 504, 300, 240);
label(w, L"Direct layout shortcut", 504, 332, 240);
hotkeyEdit(app, w, 231, 504, 356, 256);
label(w, L"Backspace / Delete clears a shortcut", 504, 382, 256);
button(w, L"Refresh layouts", 253, 504, 408, 150);
button(w, L"Re&fresh layouts", 253, 504, 408, 150);
label(w, L"History limits", 18, 444);
label(w, L"Items", 18, 478, 50);
edit(w, 240, 70, 474, 90);
@@ -1690,18 +1690,18 @@ void showSettings(App &app, bool visible)
edit(w, 241, 260, 474, 90);
label(w, L"Per item MiB", 370, 478, 100);
edit(w, 242, 475, 474, 80);
button(w, L"Clear history…", 254, 580, 474, 180);
button(w, L"Clear &history…", 254, 580, 474, 180);
label(w, L"Exclude applications (process names, comma-separated)", 18, 516, 700);
edit(w, 243, 18, 544, 742);
button(w, L"Auto-correction options…", 255, 18, 575, 240);
button(w, L"View log…", 256, 278, 575, 220);
button(w, L"OCR options…", 257, 518, 575, 242);
button(w, L"Import settings…", 250, 18, 606, 145);
button(w, L"Export settings…", 251, 173, 606, 145);
button(w, L"Snippets…", 252, 328, 606, 110);
button(w, L"Sync...", 258, 448, 606, 90);
button(w, L"Save", IDOK, 548, 606, 100);
button(w, L"Cancel", IDCANCEL, 660, 606, 100);
button(w, L"&Auto-correction options…", 255, 18, 575, 240);
button(w, L"View l&og…", 256, 278, 575, 220);
button(w, L"OCR op&tions…", 257, 518, 575, 242);
button(w, L"Impo&rt settings…", 250, 18, 606, 145);
button(w, L"&Export settings…", 251, 173, 606, 145);
button(w, L"S&nippets…", 252, 328, 606, 110);
button(w, L"S&ync...", 258, 448, 606, 90);
button(w, L"&Save", IDOK, 548, 606, 100);
button(w, L"&Cancel", IDCANCEL, 660, 606, 100);
fillSettings(w, (SettingsView *)GetWindowLongPtrW(w, GWLP_USERDATA));
if (visible)
{
@@ -1721,17 +1721,17 @@ void showSnippets(App &app)
label(w, L"Triggers", 16, 16);
control(w, L"LISTBOX", L"", WS_TABSTOP | WS_VSCROLL | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_BORDER, 301,
16, 44, 200, 380);
button(w, L"Add", 310, 16, 438, 90);
button(w, L"Delete", 311, 116, 438, 100);
label(w, L"Trigger (for example ;addr)", 236, 16, 470);
button(w, L"&Add", 310, 16, 438, 90);
button(w, L"&Delete", 311, 116, 438, 100);
label(w, L"&Trigger (for example ;addr)", 236, 16, 470);
edit(w, 302, 236, 44, 488);
label(w, L"Replacement text", 236, 82, 480);
label(w, L"&Replacement text", 236, 82, 480);
edit(w, 303, 236, 110, 488, 270, ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL);
control(w, L"STATIC", L"{cursor}: caret; {enter}: press Enter after insertion.\nUse {{cursor}} / {{enter}} for literal markers.", 0, 0, 236, 392, 488, 36);
button(w, L"Insert cursor marker", 312, 236, 430, 190);
button(w, L"Insert Enter marker", 313, 436, 430, 190);
button(w, L"Save", IDOK, 510, 478, 100);
button(w, L"Cancel", IDCANCEL, 624, 478, 100);
button(w, L"Insert cursor &marker", 312, 236, 430, 190);
button(w, L"Insert &Enter marker", 313, 436, 430, 190);
button(w, L"&Save", IDOK, 510, 478, 100);
button(w, L"&Cancel", IDCANCEL, 624, 478, 100);
fillSnippets(w, (SnippetView *)GetWindowLongPtrW(w, GWLP_USERDATA));
showRequestedWindow(w);
SetForegroundWindow(w);