Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01f44d22b5 | ||
|
|
c78090f7d4 | ||
|
|
0d797c4f35 | ||
|
|
b6eaa2c85d | ||
|
|
72024c3385 | ||
|
|
d60ef626f0 | ||
|
|
e144cd6607 | ||
|
|
05a3f7a8f4 | ||
|
|
12b8f5090c | ||
|
|
19d574edcf | ||
|
|
3840744819 | ||
|
|
94e8ba4304 | ||
|
|
edb1440be0 |
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(KSwitcher VERSION 0.6.108 LANGUAGES CXX RC)
|
||||
project(KSwitcher VERSION 0.6.112 LANGUAGES CXX RC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
|
||||
endif()
|
||||
|
||||
+14
-8
@@ -19,6 +19,10 @@ Far Manager є зразком для оформлення файлового м
|
||||
не займають місця. Перед завершенням змін перевір коротке повідомлення й
|
||||
повідомлення з кількома рядками, включно з відступами до рамки та кнопок.
|
||||
Смуга прокрутки з’являється, лише коли текст не вміщується в доступну висоту.
|
||||
Панелі, списки попапів і довгі повідомлення використовують вузьку смугу
|
||||
прокрутки зі стрілками вгорі й унизу та крапковою доріжкою. Відтінки доріжки
|
||||
й повзунка залежать від фону, на якому вони малюються. Повзунок світліший
|
||||
за доріжку й показує положення та розмір видимої частини списку.
|
||||
Оформлення, кнопки й необов’язковий прапорець задаються параметрами шаблону.
|
||||
Підтвердження гібернації та віддаленого оновлення мають червоне оформлення
|
||||
Warning і початковий фокус на No.
|
||||
@@ -38,7 +42,9 @@ Warning і початковий фокус на No.
|
||||
Папка відкривається у Провіднику, файл виконує свою стандартну дію Windows.
|
||||
|
||||
- У головному вікні клавіатурний фокус залишається в командному рядку.
|
||||
Tab перемикає активну панель, а клік вибирає рядок.
|
||||
Tab без модифікаторів перемикає активну панель, а клік вибирає рядок.
|
||||
Ctrl+U міняє видимі панелі місцями разом із їхніми папками, режимами,
|
||||
курсорами й позначками. Активна панель залишається активною на новому боці.
|
||||
Page Up і Page Down пересувають курсор у панелі. Стрілки вгору й вниз
|
||||
керують панеллю, коли список підказок закритий.
|
||||
Стрілки вліво й вправо переходять до першого й останнього рядків, коли
|
||||
@@ -127,7 +133,9 @@ Warning і початковий фокус на No.
|
||||
за тими ж правилами вставлення й лапок. Рядок `..` пропускається.
|
||||
- Локальні й LAN-каталоги скануються у фоновому потоці. Під час переходу
|
||||
активна панель показує «Loading folder…» і зберігає попередній список до
|
||||
завершення сканування. Якщо надійшов новіший запит, результат попереднього
|
||||
завершення сканування. Після переходу оновлюються шлях і список цієї панелі
|
||||
та командний рядок. Сусідня панель не перемальовується через цей перехід.
|
||||
Якщо надійшов новіший запит, результат попереднього
|
||||
сканування пропускається. Після підтвердження UAC очікування списку
|
||||
від підвищеного процесу теж відбувається у фоні.
|
||||
- Ctrl+R перечитує поточну папку активної панелі. Позиція курсора й позначки
|
||||
@@ -186,7 +194,8 @@ Warning і початковий фокус на No.
|
||||
- Глобальне скорочення повертає до відкритого вікна Files у поточній сесії Windows або запускає Files, якщо такого вікна немає. Пункт **Files** у треї відкриває нове вікно.
|
||||
|
||||
- Ctrl+Shift+0–9 відкриває діалог Title і Path із поточною папкою. OK додає запис без дублювання, Escape скасовує. Title необов’язковий, порожнє значення показує шлях. Записи LAN зберігають ID ПК, а редагування Path залишає запис на тому самому ПК.
|
||||
- Ctrl+0–9 одразу відкриває єдину папку. Для кількох папок відкривається компактний попап Far з одним заголовком Folder shortcuts у подвійній рамці та коротким рядом клавіш у нижній рамці. Ширина залежить від найдовшого запису й обмежується розміром вікна, а висота — кількістю видимих рядків. Нижня рамка показує Ins Del F4 Ctrl+Up Ctrl+Down. Insert додає поточну папку через Title і Path, Delete відв’язує, F4 редагує, Ctrl+Up і Ctrl+Down змінюють і зберігають порядок. Enter відкриває папку. Escape або клік у Files поза попапом закриває його й повертає фокус до панелі. Commands → Folder shortcuts дає вибрати зайняту цифру й відкрити той самий попап навіть для єдиного запису. Brief і Wide доступні в меню Left/Right та Options.
|
||||
- Ctrl+0–9 відкриває лише папки, призначені натиснутій цифрі. Єдина папка відкривається одразу. Для кількох папок відкривається компактний попап Far з одним заголовком Folder shortcuts у подвійній рамці та коротким рядом клавіш у нижній рамці. Ширина залежить від найдовшого запису й обмежується розміром вікна, а висота — кількістю видимих рядків. Нижня рамка показує Ins Del F4 Ctrl+Up Ctrl+Down. Insert додає поточну папку через Title і Path, Delete відв’язує, F4 редагує, Ctrl+Up і Ctrl+Down змінюють і зберігають порядок. Enter відкриває папку. Escape або клік у Files поза попапом закриває його й повертає фокус до панелі. Commands → Folder shortcuts дає вибрати зайняту цифру й відкрити той самий попап навіть для єдиного запису.
|
||||
- Ctrl+F1 вмикає Brief, Ctrl+F2 вмикає Wide для активної панелі. Ctrl+F3–F12 зарезервовані для інших режимів панелей. Brief і Wide також доступні в меню Left/Right та Options.
|
||||
|
||||
## Налаштування Files
|
||||
|
||||
@@ -206,7 +215,8 @@ Warning і початковий фокус на No.
|
||||
За наявності змін перехід у перегляд пропонує Save, Discard або Cancel.
|
||||
Помилка збереження залишає відкритим редактор зі змінами.
|
||||
- Ctrl+Tab циклічно перемикає фокус між Files, редакторами й переглядачами
|
||||
у порядку їх відкриття.
|
||||
у порядку їх відкриття. Ctrl+Shift+Tab обходить ті самі вікна у зворотному
|
||||
порядку. Коли відкрито лише Files, активна панель не змінюється.
|
||||
- F3 відкриває Markdown як форматований документ із таблицями, блоками коду,
|
||||
інтерактивними чекбоксами списків і діаграмами Mermaid. Відмітки в перегляді
|
||||
діють до повторного рендерингу або виходу з цього режиму. F4 відкриває текст
|
||||
@@ -314,10 +324,6 @@ Warning і початковий фокус на No.
|
||||
у відкритих локальних папках. Фокус залишається там, де був, а курсор
|
||||
лишається на поточному елементі, якщо той ще існує.
|
||||
|
||||
- Ctrl+8 відкриває список усіх ярликів папок. Кожен рядок показує групу
|
||||
й назву або шлях. Enter відкриває папку в активній панелі, F4 редагує
|
||||
ярлик, а Delete прибирає його зі списку.
|
||||
|
||||
- У Change drive повідомлення No paired computers з’являється після
|
||||
успішної відповіді з порожнім списком. Збої локального запиту до
|
||||
KSwitcher відображаються окремо.
|
||||
|
||||
@@ -148,12 +148,14 @@ updating the application. After verifying a new package, the updater closes File
|
||||
screenshot editors, Settings, and bundled StayHere for that installation. Save open work before approving an update.
|
||||
If settings change in the tray while the configurator is open, a conflicting Save is rejected; reopen
|
||||
the configurator to load the latest settings.
|
||||
Updates from v0.3.x–v0.4.1 first install the compatible **v0.4.2 bridge** through
|
||||
Update in the tray menu. Select Update again to install the full current release;
|
||||
manual extraction is not required. Future full releases use stable `release-vX.Y.Z`
|
||||
tags, which the bridge and newer clients recognize. Older clients ignore those tags
|
||||
and continue to find the bridge instead of skipping it. Versions v0.2.3 and earlier
|
||||
still require the previously documented initial configurator migration.
|
||||
Updates from v0.3.x–v0.4.1 go through the compatible **v0.4.2 bridge**. If tray
|
||||
**Update** does not find it, download [v0.4.2](https://gitea.hrynco.com/hrynco/hrynco-kswitcher/releases/tag/v0.4.2),
|
||||
close KSwitcher and its editors, and extract the bridge ZIP into the installation
|
||||
directory while keeping personal data, dictionaries, and tools. Start v0.4.2
|
||||
and select **Update** to install the current full release. Full releases use
|
||||
stable `release-vX.Y.Z` tags recognized by the bridge and newer clients.
|
||||
Versions v0.2.3 and earlier still require the previously documented initial
|
||||
configurator migration.
|
||||
|
||||
Modern ZIPs contain `release-files.json` (schema, version, file paths, sizes and SHA-256
|
||||
hashes). The updater validates that every packaged file is declared, all hashes match,
|
||||
@@ -873,7 +875,8 @@ after Space, not immediately after a punctuation key. Save Settings to apply cha
|
||||
only to words with a rank at or below that number (for example, 10000). All dictionary words still
|
||||
protect already valid input, and ambiguous alternatives remain unchanged regardless of this limit.
|
||||
**My dictionary** provides separate English, Ukrainian and Russian fields for correct words missing
|
||||
from the bundled dictionaries. Enter words separated by commas or new lines, then click OK and Save
|
||||
from the bundled dictionaries. A hyphen is allowed between letters, as in `test-mt` or `dev-mt`.
|
||||
Enter words separated by commas or new lines, then click OK and Save
|
||||
in Settings. Case and duplicates are normalized automatically; no file editing or ranks are needed.
|
||||
The v0.6.23 bundled Ukrainian dictionary includes `поточні`. The updater preserves existing dictionary files;
|
||||
if upgrading from an older dictionary, add this word in My dictionary → Ukrainian and click OK → Save.
|
||||
@@ -897,8 +900,10 @@ language in the configured dictionary order (the UI uses English, Ukrainian, Rus
|
||||
Different valid spellings remain ambiguous and are left unchanged.
|
||||
**Minimum word length** defaults to 3 and can be set from 1 to 32 letters. Surrounding punctuation
|
||||
does not count toward this minimum; the maximum word length is 32 letters.
|
||||
Known words, ambiguous alternatives, ALL CAPS, mixed-case identifiers, numbers, URLs and email
|
||||
addresses are left unchanged. Short trailing punctuation is retained when the editor selects it
|
||||
Known words, ambiguous alternatives, mixed-case identifiers, numbers, URLs and email addresses
|
||||
are left unchanged. Fully uppercase words can be corrected when the target is in **My dictionary**.
|
||||
For example, add `qa` under English and set the minimum word length to 2 or lower to correct
|
||||
`ЙФ` to `QA` after Space. Short trailing punctuation is retained when the editor selects it
|
||||
together with the word. Actual selected text is verified before replacement. Layout switching follows
|
||||
the existing switch-layout setting. The configured Undo shortcut restores the original and suppresses
|
||||
that word for the rest of the session (until restart).
|
||||
|
||||
@@ -1,5 +1,49 @@
|
||||
# Latest Windows release
|
||||
|
||||
## v0.6.112 — 2026-11-17
|
||||
|
||||
In KSwitcher Files, **Ctrl+Shift+Tab** cycles backward through Files, Editor, and Viewer windows. **Ctrl+Tab** cycles forward. Both shortcuts wrap at the ends of the window list, including in the Markdown preview.
|
||||
|
||||
**Українською.**
|
||||
|
||||
У KSwitcher Files **Ctrl+Shift+Tab** обходить вікна Files, редактора й переглядача у зворотному порядку. **Ctrl+Tab** обходить їх у прямому порядку. Обидві комбінації працюють циклічно, зокрема в перегляді Markdown.
|
||||
|
||||
## v0.6.111 — 2026-11-17
|
||||
|
||||
- KSwitcher Files updates a panel as soon as its background folder scan finishes.
|
||||
- **Ctrl+U** swaps the panels, keeping their folders, view modes, cursors, marked items, and active panel together. Use **Tab** by itself to switch the active panel. **Ctrl+Tab** cycles between Files, Editor, and Viewer windows.
|
||||
- Panels and scrollable Files popups share a Far-style scrollbar with up and down arrows, a dotted track, and a thumb lighter than its background.
|
||||
|
||||
**Українською.**
|
||||
|
||||
- KSwitcher Files оновлює панель одразу після завершення фонового читання папки.
|
||||
- **Ctrl+U** міняє панелі місцями разом із папками, режимами перегляду, курсорами й позначками. Активна панель залишається активною на новому боці. Для перемикання активної панелі натисніть **Tab** без модифікаторів. **Ctrl+Tab** перемикає вікна Files, редактора й переглядача.
|
||||
- Панелі та попапи з прокруткою у Files мають спільний скролбар у стилі Far зі стрілками вгорі й унизу, крапковою доріжкою та повзунком, світлішим за фон.
|
||||
|
||||
## v0.6.110 — 2026-11-17
|
||||
|
||||
Entering a folder or returning to its parent in KSwitcher Files refreshes the affected panel and the command line without repainting the other panel.
|
||||
|
||||
Auto-correction can preserve all uppercase letters when correcting to a word in **My dictionary**. With `qa` in the English personal dictionary and **Minimum word length** set to 2 or lower, typing `ЙФ` and pressing Space yields `QA`.
|
||||
|
||||
**Українською.**
|
||||
|
||||
Під час входу в папку або повернення до батьківської папки KSwitcher Files оновлює потрібну панель і командний рядок. Сусідня панель більше не перемальовується через цей перехід.
|
||||
|
||||
Автокорекція зберігає верхній регістр для слів з **My dictionary**. Якщо в особистому словнику English є `qa`, а **Minimum word length** дорівнює 2 або менше, після пробілу `ЙФ` виправиться на `QA`.
|
||||
|
||||
## v0.6.109 — 2026-11-17
|
||||
|
||||
**Ctrl+0–9** in KSwitcher Files opens the assigned folder or shows only the folders assigned to that digit. **Ctrl+F1** selects Brief and **Ctrl+F2** selects Wide in the active panel. **Ctrl+F3–F12** are reserved for other panel modes. If command history used a Ctrl+function shortcut, set a new binding under **Options → Command line → Command history**.
|
||||
|
||||
**My dictionary** accepts hyphens between letters, for example `test-mt` and `dev-mt`. Enter the correct spelling in the dictionary for its language, then click **OK → Save**. Update all PCs that share settings before syncing hyphenated entries.
|
||||
|
||||
**Українською.**
|
||||
|
||||
У KSwitcher Files **Ctrl+0–9** відкриває призначену папку або показує лише папки, призначені натиснутій цифрі. **Ctrl+F1** вмикає Brief, а **Ctrl+F2** вмикає Wide в активній панелі. **Ctrl+F3–F12** зарезервовані для інших режимів панелей. Якщо історія команд використовувала Ctrl із функціональною клавішею, задайте нову комбінацію в **Options → Command line → Command history**.
|
||||
|
||||
**My dictionary** приймає дефіси між літерами, наприклад `test-mt` і `dev-mt`. Введіть правильне написання у словник відповідної мови й натисніть **OK → Save**. Перед синхронізацією слів із дефісами оновіть усі ПК, які обмінюються налаштуваннями.
|
||||
|
||||
## v0.6.108 — 2026-11-17
|
||||
|
||||
KSwitcher Files adds **Wake** beside the offline status of a paired PC in **Change drive** (Alt+F1 or Alt+F2). Click **Wake** or focus it with the arrow keys and press **Enter**. The status bar reports whether KSwitcher sent the Wake-on-LAN packet.
|
||||
|
||||
@@ -1 +1 @@
|
||||
57cb29bf72f335c7b3dff5c40a1b992b46c770f3106b6033f7b02819c665a139 KSwitcher-win-x64.zip
|
||||
8ac71477b90b4a8893c43e000d77d53df57db63c07f0d4784820c5563b106218 KSwitcher-win-x64.zip
|
||||
+67
-67
@@ -1,166 +1,166 @@
|
||||
{
|
||||
"version": "0.6.112",
|
||||
"schema": 1,
|
||||
"files": [
|
||||
{
|
||||
"size": 2479104,
|
||||
"sha256": "53c3f9aeca02136acbd2ec3c187ee858cb5f60a2f1bf5641ee264e062f73653f",
|
||||
"path": "KSwitcher.exe",
|
||||
"sha256": "eb8c6aacf2fb626b135d89b4b416dbed4e12519f9d5cca4fa3fe27bfdac524f5"
|
||||
"size": 2479104
|
||||
},
|
||||
{
|
||||
"size": 2457600,
|
||||
"sha256": "c4dbd247e48fd1d37744d280c2fd948c3355eb3507324ae79adc0dcd24ef5469",
|
||||
"path": "KSwitcher.Config.exe",
|
||||
"sha256": "542c14cc509bf5e6f9e85e4c53d7b7624289a7f53015d5d7b2213b551e987575"
|
||||
"size": 2458112
|
||||
},
|
||||
{
|
||||
"size": 3060224,
|
||||
"sha256": "30e8dbe575b3705ae379fda30174e0a486ef5605ec582dd81e01b121180c127b",
|
||||
"path": "KSwitcher.Screenshot.exe",
|
||||
"sha256": "077a3a83da0fd0055f55b7df49b6c7fdf9e9ceb6eaaf7c3b20a98fb81b9a3a43"
|
||||
"size": 3060224
|
||||
},
|
||||
{
|
||||
"size": 4208128,
|
||||
"sha256": "b45ff37c0f279dcf142606c282b73cf3403cb026c4800beea216fd532bc5993f",
|
||||
"path": "KSwitcher.Files.exe",
|
||||
"sha256": "41a77a9b94005373ee02ed83143d7f4927926fa6a57a379988d482de39825519"
|
||||
"size": 4214272
|
||||
},
|
||||
{
|
||||
"size": 194912,
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"path": "WebView2Loader.dll",
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6"
|
||||
"size": 194912
|
||||
},
|
||||
{
|
||||
"size": 1103,
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"path": "terminal/addon-fit-LICENSE.txt",
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f"
|
||||
"size": 1103
|
||||
},
|
||||
{
|
||||
"size": 1521,
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"path": "terminal/addon-fit.js",
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527"
|
||||
"size": 1521
|
||||
},
|
||||
{
|
||||
"size": 527,
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"path": "terminal/index.html",
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef"
|
||||
"size": 527
|
||||
},
|
||||
{
|
||||
"size": 1073,
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"path": "terminal/markdown-it-LICENSE.txt",
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
|
||||
"size": 1073
|
||||
},
|
||||
{
|
||||
"size": 100786,
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"path": "terminal/markdown-it.js",
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e"
|
||||
"size": 100786
|
||||
},
|
||||
{
|
||||
"size": 3530,
|
||||
"sha256": "e5381c35fb254b558c8b869746e2e575c8ed53600611ac90597ed2dd80fa321c",
|
||||
"path": "terminal/markdown.html",
|
||||
"sha256": "e5381c35fb254b558c8b869746e2e575c8ed53600611ac90597ed2dd80fa321c"
|
||||
"size": 3530
|
||||
},
|
||||
{
|
||||
"size": 14987,
|
||||
"sha256": "55c905afaf074e3253267a7c48a5ebca14edd7f15449fd85c0a884c34da22763",
|
||||
"path": "terminal/markdown.js",
|
||||
"sha256": "5d1e824df1c3570877e985de0cfaae3f2984ceef7fe23bf4c5ade3c890a93223"
|
||||
"size": 15014
|
||||
},
|
||||
{
|
||||
"size": 1089,
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"path": "terminal/mermaid-LICENSE.txt",
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80"
|
||||
"size": 1089
|
||||
},
|
||||
{
|
||||
"size": 5537838,
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"path": "terminal/mermaid.js",
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3"
|
||||
"size": 5537838
|
||||
},
|
||||
{
|
||||
"size": 5033,
|
||||
"sha256": "0557d251962301940785690a3fc49475dd166bb7d0bd0417dc3279d1f1b3a98a",
|
||||
"path": "terminal/terminal.js",
|
||||
"sha256": "0557d251962301940785690a3fc49475dd166bb7d0bd0417dc3279d1f1b3a98a"
|
||||
"size": 5033
|
||||
},
|
||||
{
|
||||
"size": 1261,
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"path": "terminal/xterm-LICENSE.txt",
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd"
|
||||
"size": 1261
|
||||
},
|
||||
{
|
||||
"size": 7112,
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"path": "terminal/xterm.css",
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6"
|
||||
"size": 7112
|
||||
},
|
||||
{
|
||||
"size": 488663,
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"path": "terminal/xterm.js",
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972"
|
||||
"size": 488663
|
||||
},
|
||||
{
|
||||
"size": 4401,
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"path": "LICENSE",
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c"
|
||||
"size": 4401
|
||||
},
|
||||
{
|
||||
"size": 1096,
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831",
|
||||
"path": "json-LICENSE.txt",
|
||||
"sha256": "61e08da79c44061654015ce6b0c4061c23ee1dd18237fbf09e9bfda3c0ea2831"
|
||||
"size": 1096
|
||||
},
|
||||
{
|
||||
"size": 883,
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"path": "files-text-license.txt",
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625"
|
||||
"size": 883
|
||||
},
|
||||
{
|
||||
"size": 94908,
|
||||
"sha256": "fcbd14b6190dc2a3575a4bc4be7229540c647022cb038d33ec4ac22176c67a9e",
|
||||
"path": "README.md",
|
||||
"sha256": "12d8b55a2d2f26060b2a614bd52e6e0ffe4a8f140e62cc454a47fc8f246cb81f"
|
||||
"size": 95289
|
||||
},
|
||||
{
|
||||
"size": 11577,
|
||||
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930",
|
||||
"path": "LAN-PREVIEW.md",
|
||||
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930"
|
||||
"size": 11577
|
||||
},
|
||||
{
|
||||
"size": 732485,
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9",
|
||||
"path": "dictionaries/en.txt",
|
||||
"sha256": "d0c022b27b9fbc2ff7b6b8bec723cc1adc4eef517202f9ff77eed5d8bea3acb9"
|
||||
"size": 732485
|
||||
},
|
||||
{
|
||||
"size": 20566,
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5",
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
|
||||
"sha256": "0bdfb0201d1803634f268cdff0993b8349d2c70e956a06dbb667c8dd65254ec5"
|
||||
"size": 20566
|
||||
},
|
||||
{
|
||||
"size": 2265,
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"path": "dictionaries/README.md",
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311"
|
||||
"size": 2265
|
||||
},
|
||||
{
|
||||
"size": 1109134,
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849",
|
||||
"path": "dictionaries/ru.txt",
|
||||
"sha256": "80e6b6a27815973535f7facb636c597eb845dfee45cfabfc4e9b3341b9332849"
|
||||
"size": 1109134
|
||||
},
|
||||
{
|
||||
"size": 1280,
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"path": "dictionaries/sources.json",
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408"
|
||||
"size": 1280
|
||||
},
|
||||
{
|
||||
"size": 940799,
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"path": "dictionaries/uk.txt",
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf"
|
||||
"size": 940799
|
||||
},
|
||||
{
|
||||
"size": 993,
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"path": "tools/README.txt",
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a"
|
||||
"size": 993
|
||||
},
|
||||
{
|
||||
"size": 133120,
|
||||
"sha256": "f1cd3477fc3e64ed26986b86d85472ca0780963b225231ab575489d4fa82e01b",
|
||||
"path": "tools/StayHere.exe",
|
||||
"sha256": "6945ac336307301285ade8d98939e3bb974d1e20b3414101a8e1e50ce31ababb"
|
||||
"size": 133120
|
||||
},
|
||||
{
|
||||
"size": 2796,
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"path": "tools/StayHere-README.md",
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413"
|
||||
"size": 2796
|
||||
}
|
||||
],
|
||||
"schema": 1,
|
||||
"version": "0.6.108"
|
||||
]
|
||||
}
|
||||
+3
-3
@@ -9,8 +9,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
|
||||
1 RT_MANIFEST "app.manifest"
|
||||
201 RCDATA "update.ps1"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 0,6,108,0
|
||||
PRODUCTVERSION 0,6,108,0
|
||||
FILEVERSION 0,6,112,0
|
||||
PRODUCTVERSION 0,6,112,0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
BEGIN
|
||||
@@ -20,7 +20,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility"
|
||||
VALUE "ProductName", "KSwitcher"
|
||||
VALUE "FileVersion", "0.6.108"
|
||||
VALUE "FileVersion", "0.6.112"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ END
|
||||
STYLE DS_SETFONT | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN
|
||||
FONT 10, "Consolas"
|
||||
BEGIN
|
||||
CONTROL "", 100, "Edit", ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | WS_VSCROLL, 14, 16, 157, 13
|
||||
CONTROL "", 100, "Edit", ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL, 14, 16, 157, 13
|
||||
AUTOCHECKBOX "&Remember for this session", 101, 14, 30, 157, 13, NOT WS_VISIBLE
|
||||
CONTROL "", 102, "Static", NOT WS_VISIBLE, 14, 35, 1, 1
|
||||
CONTROL "&OK", IDOK, "Button", BS_OWNERDRAW | WS_TABSTOP, 67, 38, 51, 15
|
||||
@@ -68,7 +68,7 @@ STYLE DS_SETFONT | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN
|
||||
FONT 10, "Consolas"
|
||||
BEGIN
|
||||
LTEXT "", 430, 14, 17, 322, 20
|
||||
LISTBOX 431, 14, 41, 322, 61, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
LISTBOX 431, 14, 41, 322, 61, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_TABSTOP
|
||||
CONTROL "", 432, "Static", NOT WS_VISIBLE, 14, 108, 1, 1
|
||||
CONTROL "&End process", 433, "Button", BS_OWNERDRAW | WS_TABSTOP, 56, 110, 80, 16
|
||||
CONTROL "&Refresh", 434, "Button", BS_OWNERDRAW | WS_TABSTOP, 140, 110, 74, 16
|
||||
|
||||
@@ -282,7 +282,7 @@ document.addEventListener('keydown', event => {
|
||||
event.preventDefault();
|
||||
} else if (event.ctrlKey && !event.altKey && event.key === 'Tab') {
|
||||
event.preventDefault();
|
||||
send('cycle');
|
||||
send('cycle', {reverse: event.shiftKey});
|
||||
} else if ((event.altKey && ['ArrowLeft', 'ArrowRight'].includes(event.key)) ||
|
||||
['BrowserBack', 'BrowserForward'].includes(event.key)) {
|
||||
event.preventDefault();
|
||||
|
||||
+11
-4
@@ -34,13 +34,14 @@ std::wstring layoutLanguage(const Layout &layout)
|
||||
return {};
|
||||
}
|
||||
}
|
||||
bool safeAutoWord(const std::wstring &word, int minimumLength)
|
||||
bool safeAutoWord(const std::wstring &word, int minimumLength, bool allowUppercase)
|
||||
{
|
||||
if (minimumLength < 1 || minimumLength > 32 || word.size() < (size_t)minimumLength || word.size() > 32 ||
|
||||
!std::all_of(word.begin(), word.end(), letter))
|
||||
return false;
|
||||
auto small = lower(word);
|
||||
return word == small || (word.substr(1) == small.substr(1) && word != upper(word));
|
||||
const bool allUppercase = word == upper(word);
|
||||
return word == small || (allUppercase ? allowUppercase : word.substr(1) == small.substr(1));
|
||||
}
|
||||
namespace {
|
||||
constexpr size_t DictionaryBlockWords = 32;
|
||||
@@ -289,9 +290,15 @@ std::optional<AutoSuggestion> AutoCorrector::suggest(const std::wstring &typed,
|
||||
if (dictionary == dictionaries.end())
|
||||
continue;
|
||||
auto converted = convert(word, layouts[source], layouts[i], true);
|
||||
if (converted == word || !safeAutoWord(converted, settings.autoMinLength))
|
||||
if (converted == word)
|
||||
continue;
|
||||
int rank = personal(dictionary->first, converted) ? 1 : dictionary->second->rank(converted);
|
||||
const bool knownPersonal = personal(dictionary->first, converted);
|
||||
auto letters = converted;
|
||||
if (knownPersonal)
|
||||
std::erase(letters, L'-');
|
||||
if (!safeAutoWord(letters, settings.autoMinLength, knownPersonal))
|
||||
continue;
|
||||
int rank = knownPersonal ? 1 : dictionary->second->rank(converted);
|
||||
if (!rank)
|
||||
continue;
|
||||
if (matchedText && *matchedText != converted)
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ struct AutoSuggestion
|
||||
std::wstring text;
|
||||
};
|
||||
std::wstring layoutLanguage(const Layout &);
|
||||
bool safeAutoWord(const std::wstring &, int minimumLength = 3);
|
||||
bool safeAutoWord(const std::wstring &, int minimumLength = 3, bool allowUppercase = false);
|
||||
bool autoClosingSelection(const std::wstring &, const Settings & = {});
|
||||
int matchAutoInput(const Run &, const std::wstring &, const std::vector<Layout> &, const Layout &,
|
||||
const Settings & = {});
|
||||
|
||||
+12
-2
@@ -3,6 +3,7 @@
|
||||
#include <cwctype>
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
|
||||
namespace ks
|
||||
{
|
||||
@@ -21,20 +22,29 @@ int snippetAppPriority(const Snippet &snippet, const std::wstring &process)
|
||||
for (const auto &app : snippet.apps) if (snippetAppName(app) == name && !name.empty()) return 2;
|
||||
return 0;
|
||||
}
|
||||
bool validAutoCorrection(const std::wstring &text, const std::wstring &alphabet)
|
||||
static bool validSeparatedWord(const std::wstring &text, const std::wstring &alphabet,
|
||||
std::wstring_view separators)
|
||||
{
|
||||
if (text.empty() || text.size() > 32) return false;
|
||||
auto isLetter = [&](wchar_t c) { return alphabet.find(c) != alphabet.npos; };
|
||||
for (size_t i = 0; i < text.size(); ++i)
|
||||
{
|
||||
if (isLetter(text[i])) continue;
|
||||
if (text[i] != L' ' && text[i] != L'\'' && text[i] != L'\u2019' && text[i] != L'\u02bc')
|
||||
if (separators.find(text[i]) == separators.npos)
|
||||
return false;
|
||||
if (i == 0 || i + 1 == text.size() || !isLetter(text[i - 1]) || !isLetter(text[i + 1]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool validAutoCorrection(const std::wstring &text, const std::wstring &alphabet)
|
||||
{
|
||||
return validSeparatedWord(text, alphabet, L" '\u2019\u02bc");
|
||||
}
|
||||
bool validPersonalWord(const std::wstring &text, const std::wstring &alphabet)
|
||||
{
|
||||
return validSeparatedWord(lower(text), alphabet, L"-");
|
||||
}
|
||||
bool validAutoReplacementSource(const std::wstring &text, const std::wstring &alphabet)
|
||||
{
|
||||
return text.find(L' ') == text.npos && text.find_first_of(alphabet) != text.npos &&
|
||||
|
||||
@@ -22,6 +22,7 @@ struct Layout
|
||||
bool letter(wchar_t ch);
|
||||
bool validAutoCorrection(const std::wstring &text, const std::wstring &alphabet);
|
||||
bool validAutoReplacementSource(const std::wstring &text, const std::wstring &alphabet);
|
||||
bool validPersonalWord(const std::wstring &text, const std::wstring &alphabet);
|
||||
std::wstring lower(std::wstring text);
|
||||
std::wstring upper(std::wstring text);
|
||||
std::wstring convert(const std::wstring &, const Layout &, const Layout &, bool force = false);
|
||||
|
||||
@@ -12,7 +12,7 @@ bool validHistoryKeys(const std::array<WORD,2> &keys)
|
||||
const bool function=key>=VK_F1 && key<=VK_F12;
|
||||
if(!letter && !function) return false;
|
||||
if(modifiers==HOTKEYF_CONTROL)
|
||||
return (letter && key!='C' && key!='F' && key!='R' && key!='V' && key!='X' && key!='A' && key!='Z' && key!='Y') || function;
|
||||
return letter && key!='C' && key!='F' && key!='R' && key!='V' && key!='X' && key!='A' && key!='Z' && key!='Y';
|
||||
if(modifiers==HOTKEYF_ALT) return function && key!=VK_F1 && key!=VK_F2 && key!=VK_F4 && key!=VK_F10;
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -140,13 +140,7 @@ LRESULT CALLBACK historyListScroll(HWND list,UINT message,WPARAM wp,LPARAM lp,UI
|
||||
SendMessageW(GetParent(list),WM_COMMAND,IDOK,0);
|
||||
return 0;
|
||||
}
|
||||
if(message==LB_GETTOPINDEX || message==WM_NCDESTROY)
|
||||
return DefSubclassProc(list,message,wp,lp);
|
||||
const auto top=SendMessageW(list,LB_GETTOPINDEX,0,0);
|
||||
const auto result=scrollList(list,message,wp,lp);
|
||||
if(top!=SendMessageW(list,LB_GETTOPINDEX,0,0))
|
||||
InvalidateRect(GetParent(list),nullptr,FALSE);
|
||||
return result;
|
||||
return DefSubclassProc(list,message,wp,lp);
|
||||
}
|
||||
|
||||
void sizeCommandHistory(HWND dialog,HWND list)
|
||||
@@ -179,7 +173,7 @@ void sizeCommandHistory(HWND dialog,HWND list)
|
||||
const int gap=MulDiv(4,dpi,96);
|
||||
const int listTop=top+2*textHeight+2*gap;
|
||||
const LONG desired=std::max<LONG>(MulDiv(320,dpi,96),
|
||||
longest+2*cellWidth+2*historyRowInset(dpi)+GetSystemMetricsForDpi(SM_CXVSCROLL,dpi))+2*inset;
|
||||
longest+2*cellWidth+2*historyRowInset(dpi)+scrollBarWidth(list))+2*inset;
|
||||
const auto target=std::min(desired,area.right-area.left);
|
||||
const auto rows=std::max<LRESULT>(1,SendMessageW(list,LB_GETCOUNT,0,0));
|
||||
RECT listWindow{},listClient{};
|
||||
@@ -198,7 +192,7 @@ void sizeCommandHistory(HWND dialog,HWND list)
|
||||
};
|
||||
place(GetDlgItem(dialog,historySearchLabel),top,textHeight);
|
||||
place(GetDlgItem(dialog,historySearch),top+textHeight+gap,textHeight);
|
||||
SetWindowPos(list,nullptr,inset,listTop,std::max(1L,target-2*inset-5),
|
||||
SetWindowPos(list,nullptr,inset,listTop,std::max(1L,target-2*inset-scrollBarWidth(list)),
|
||||
std::max(1L,height-listTop-inset),SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
GetClientRect(list,&listClient);
|
||||
if(rows*textHeight<=listClient.bottom) SendMessageW(list,LB_SETTOPINDEX,0,0);
|
||||
@@ -221,6 +215,7 @@ INT_PTR CALLBACK commandHistoryDialog(HWND dialog,UINT message,WPARAM wp,LPARAM
|
||||
prepareCopyDialog(dialog);
|
||||
const auto list=GetDlgItem(dialog,historyList);
|
||||
SetWindowSubclass(list,historyListScroll,1,0);
|
||||
installScrollBar(list,dialog);
|
||||
SendMessageW(list,WM_SETFONT,reinterpret_cast<WPARAM>(mono),TRUE);
|
||||
SendMessageW(list,LB_SETITEMHEIGHT,0,std::max(1,textHeight));
|
||||
const auto search=GetDlgItem(dialog,historySearch);
|
||||
|
||||
@@ -187,8 +187,6 @@ struct FolderShortcutView
|
||||
std::vector<int> digits;
|
||||
int rowHeight{};
|
||||
Panel *panel{};
|
||||
bool all{};
|
||||
std::vector<std::pair<int,size_t>> entries;
|
||||
};
|
||||
|
||||
std::wstring shortcutLabel(const FolderShortcut &entry)
|
||||
@@ -201,7 +199,6 @@ void layoutQuickFolders(HWND dialog,FolderShortcutView &view,int selection)
|
||||
const auto list=GetDlgItem(dialog,shortcutList);
|
||||
SendMessageW(list,LB_RESETCONTENT,0,0);
|
||||
view.digits.clear();
|
||||
view.entries.clear();
|
||||
const auto owner=GetWindow(dialog,GW_OWNER);
|
||||
const auto dc=GetDC(dialog);
|
||||
const auto font=SelectObject(dc,mono);
|
||||
@@ -219,23 +216,14 @@ void layoutQuickFolders(HWND dialog,FolderShortcutView &view,int selection)
|
||||
GetTextExtentPoint32W(dc,label.data(),static_cast<int>(label.size()),&size);
|
||||
return static_cast<int>(size.cx);
|
||||
};
|
||||
int width=std::max(measure(L"Folder shortcuts"),measure(view.all?L"Del F4":view.digit<0?L"Enter Esc":quickFolderHints))+3*cellWidth;
|
||||
int width=std::max(measure(L"Folder shortcuts"),measure(view.digit<0?L"Enter Esc":quickFolderHints))+3*cellWidth;
|
||||
const int textInset=dialogRowTextInset(cellWidth);
|
||||
const auto add=[&](const std::wstring &label)
|
||||
{
|
||||
width=std::max(width,measure(label)+2*textInset);
|
||||
SendMessageW(list,LB_ADDSTRING,0,reinterpret_cast<LPARAM>(label.c_str()));
|
||||
};
|
||||
if(view.all)
|
||||
{
|
||||
for(int digit=0;digit<static_cast<int>(folderShortcuts.size());++digit)
|
||||
for(size_t index=0;index<folderShortcuts[digit].size();++index)
|
||||
{
|
||||
view.entries.emplace_back(digit,index);
|
||||
add(std::to_wstring(digit)+L" "+shortcutLabel(folderShortcuts[digit][index]));
|
||||
}
|
||||
}
|
||||
else if(view.digit<0)
|
||||
if(view.digit<0)
|
||||
{
|
||||
for(int digit=0;digit<10;++digit)
|
||||
if(!folderShortcuts[digit].empty())
|
||||
@@ -255,7 +243,8 @@ void layoutQuickFolders(HWND dialog,FolderShortcutView &view,int selection)
|
||||
GetWindowRect(owner,&parent);
|
||||
const auto windowWidth=std::max(px(260),static_cast<int>(parent.right-parent.left));
|
||||
const auto windowHeight=std::max(px(140),static_cast<int>(parent.bottom-parent.top));
|
||||
width=std::min(width,std::max(1,std::min(windowWidth,static_cast<int>(work.right-work.left))-2*inset));
|
||||
width=std::min(width+scrollBarWidth(list),
|
||||
std::max(1,std::min(windowWidth,static_cast<int>(work.right-work.left))-2*inset));
|
||||
const auto maxRows=std::max(1,(std::min(windowHeight,static_cast<int>(work.bottom-work.top))-2*listTop)/view.rowHeight);
|
||||
const auto count=static_cast<int>(SendMessageW(list,LB_GETCOUNT,0,0));
|
||||
const int rows=std::min(count,maxRows);
|
||||
@@ -267,7 +256,8 @@ void layoutQuickFolders(HWND dialog,FolderShortcutView &view,int selection)
|
||||
const int y=std::clamp(static_cast<int>((parent.top+parent.bottom-h)/2),
|
||||
static_cast<int>(work.top),std::max(static_cast<int>(work.top),static_cast<int>(work.bottom)-h));
|
||||
SetWindowPos(dialog,nullptr,x,y,w,h,SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
SetWindowPos(list,nullptr,inset,listTop,width,listHeight,SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
SetWindowPos(list,nullptr,inset,listTop,std::max(1,width-scrollBarWidth(list)),listHeight,
|
||||
SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
SendMessageW(list,LB_SETCURSEL,std::clamp(selection,0,std::max(0,count-1)),0);
|
||||
InvalidateRect(dialog,nullptr,TRUE);
|
||||
FilesModalDialog::refreshLayout(dialog);
|
||||
@@ -290,7 +280,7 @@ LRESULT CALLBACK quickFolderKeys(HWND list,UINT message,WPARAM key,LPARAM flags,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return scrollList(list,message,key,flags);
|
||||
return DefSubclassProc(list,message,key,flags);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK quickFolderDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
@@ -303,6 +293,7 @@ INT_PTR CALLBACK quickFolderDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
layoutQuickFolders(dialog,view,0);
|
||||
const auto list=GetDlgItem(dialog,shortcutList);
|
||||
SetWindowSubclass(list,quickFolderKeys,1,0);
|
||||
installScrollBar(list,dialog);
|
||||
SetFocus(list);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -322,7 +313,8 @@ INT_PTR CALLBACK quickFolderDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
const auto bounds=paintDialogFrame(dc,client,dialogFrameMetrics(GetDpiForWindow(dialog)),teal,frame);
|
||||
DeleteObject(frame);
|
||||
paintDialogFrameCaptions(dc,client,bounds,L"Folder shortcuts",teal,colors[Text],mono,
|
||||
view->all?L"Del F4":view->digit<0?L"Enter Esc":quickFolderHints);
|
||||
view->digit<0?L"Enter Esc":quickFolderHints);
|
||||
paintScrollPosition(dialog,dc,GetDlgItem(dialog,shortcutList),colors[Dialog]);
|
||||
EndPaint(dialog,&ps);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -349,7 +341,7 @@ INT_PTR CALLBACK quickFolderDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
if(action!=quickRemove && action!=quickEdit && action!=quickInsert && action!=quickMoveUp &&
|
||||
action!=quickMoveDown && action!=IDOK && !(action==shortcutList && HIWORD(wp)==LBN_DBLCLK)) return FALSE;
|
||||
const auto row=SendDlgItemMessageW(dialog,shortcutList,LB_GETCURSEL,0,0);
|
||||
if(!view->all && view->digit<0)
|
||||
if(view->digit<0)
|
||||
{
|
||||
if((action==IDOK || action==shortcutList) && row>=0 && static_cast<size_t>(row)<view->digits.size())
|
||||
{
|
||||
@@ -358,16 +350,8 @@ INT_PTR CALLBACK quickFolderDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
int digit=view->digit;
|
||||
size_t index=static_cast<size_t>(row);
|
||||
if(view->all)
|
||||
{
|
||||
if(index>=view->entries.size() || action==quickInsert ||
|
||||
action==quickMoveUp || action==quickMoveDown) return TRUE;
|
||||
const auto &entry=view->entries[index];
|
||||
digit=entry.first;
|
||||
index=entry.second;
|
||||
}
|
||||
const auto digit=view->digit;
|
||||
const auto index=static_cast<size_t>(row);
|
||||
const auto &group=folderShortcuts[digit];
|
||||
if(action==quickInsert)
|
||||
{
|
||||
@@ -414,7 +398,7 @@ INT_PTR CALLBACK quickFolderDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
}
|
||||
folderShortcuts=std::move(updated);
|
||||
notifyFilesPreferences(GetAncestor(dialog,GA_ROOTOWNER));
|
||||
if(view->all?view->entries.size()==1:folderShortcuts[digit].empty()) FilesModalDialog::finish(dialog,IDCANCEL);
|
||||
if(folderShortcuts[digit].empty()) FilesModalDialog::finish(dialog,IDCANCEL);
|
||||
else layoutQuickFolders(dialog,*view,static_cast<int>(row));
|
||||
return TRUE;
|
||||
}
|
||||
@@ -424,7 +408,7 @@ INT_PTR CALLBACK quickFolderDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
}
|
||||
|
||||
|
||||
void showFolderShortcuts(Panel &panel,int digit,bool all)
|
||||
void showFolderShortcuts(Panel &panel,int digit)
|
||||
{
|
||||
if(digit>=0)
|
||||
{
|
||||
@@ -447,7 +431,6 @@ void showFolderShortcuts(Panel &panel,int digit,bool all)
|
||||
}
|
||||
FolderShortcutView view{digit};
|
||||
view.panel=&panel;
|
||||
view.all=all;
|
||||
const auto result=FilesModalDialog::run(GetModuleHandleW(nullptr),MAKEINTRESOURCEW(109),GetParent(panel.list),
|
||||
quickFolderDialog,reinterpret_cast<LPARAM>(&view));
|
||||
SetFocus(panel.list);
|
||||
|
||||
@@ -186,6 +186,12 @@ INT_PTR CALLBACK lockProcessesDialog(HWND window,UINT message,WPARAM wp,LPARAM l
|
||||
SetWindowLongPtrW(window,DWLP_USER,lp);
|
||||
prepareCopyDialog(window);
|
||||
for(const auto id:{430,431}) SendDlgItemMessageW(window,id,WM_SETFONT,reinterpret_cast<WPARAM>(mono),FALSE);
|
||||
const auto list=GetDlgItem(window,431);
|
||||
RECT bounds{};
|
||||
GetWindowRect(list,&bounds);
|
||||
SetWindowPos(list,nullptr,0,0,std::max(1L,bounds.right-bounds.left-scrollBarWidth(list)),
|
||||
bounds.bottom-bounds.top,SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
installScrollBar(list,window);
|
||||
layoutDialogButtons(window,432,{433,434,IDOK});
|
||||
SendMessageW(window,DM_SETDEFID,IDOK,0);
|
||||
SetFocus(GetDlgItem(window,IDOK));
|
||||
@@ -233,7 +239,7 @@ INT_PTR CALLBACK lockProcessesDialog(HWND window,UINT message,WPARAM wp,LPARAM l
|
||||
}
|
||||
}
|
||||
if(message==WM_CLOSE) {FilesModalDialog::finish(window,IDCANCEL);return TRUE;}
|
||||
return paintCopyDialog(window,message,wp,lp,L" Locking processes ",false,{432});
|
||||
return paintCopyDialog(window,message,wp,lp,L" Locking processes ",false,{432},false,GetDlgItem(window,431));
|
||||
}
|
||||
|
||||
void showLockProcesses(HWND owner,std::vector<fs::path> paths)
|
||||
|
||||
+239
-72
@@ -27,6 +27,7 @@
|
||||
#include "files_text_preferences.h"
|
||||
#include "files_menu_paint.h"
|
||||
#include "files_dropdown_paint.h"
|
||||
#include "files_scrollbar.h"
|
||||
#include "files_inline_action.h"
|
||||
#include "files_history_date.h"
|
||||
#include "files_terminal_view.h"
|
||||
@@ -314,6 +315,17 @@ struct Panel
|
||||
struct DirectoryWatch
|
||||
{
|
||||
HANDLE handle=INVALID_HANDLE_VALUE;
|
||||
DirectoryWatch()=default;
|
||||
DirectoryWatch(DirectoryWatch &&other) noexcept {std::swap(handle,other.handle);}
|
||||
DirectoryWatch &operator=(DirectoryWatch &&other) noexcept
|
||||
{
|
||||
if(this!=&other)
|
||||
{
|
||||
reset();
|
||||
std::swap(handle,other.handle);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
~DirectoryWatch() { reset(); }
|
||||
void reset()
|
||||
{
|
||||
@@ -492,7 +504,7 @@ INT_PTR showFilesNotice(HWND owner,const wchar_t *text,const wchar_t *title,File
|
||||
void openMenu(HWND window, int index);
|
||||
void showFileDetails(const Panel &panel);
|
||||
void editOptions(HWND owner);
|
||||
void showFolderShortcuts(Panel &panel,int digit,bool all=false);
|
||||
void showFolderShortcuts(Panel &panel,int digit);
|
||||
void layout(HWND window,bool activeOnly=false);
|
||||
void clearTerminalSelection();
|
||||
|
||||
@@ -535,10 +547,12 @@ fs::path savedPanelPath(const wchar_t *key)
|
||||
return path;
|
||||
}
|
||||
|
||||
constexpr const wchar_t *panelModeKeys[]{L"LeftWide",L"RightWide"};
|
||||
|
||||
void setMode(int index, bool wide)
|
||||
{
|
||||
panels[index].wide=wide;
|
||||
savePreference(index ? L"RightWide" : L"LeftWide",wide);
|
||||
savePreference(panelModeKeys[index],wide);
|
||||
notifyFilesPreferences(GetParent(panels[index].list));
|
||||
layout(GetParent(panels[index].list));
|
||||
InvalidateRect(panels[index].list,nullptr,TRUE);
|
||||
@@ -549,6 +563,7 @@ LOGFONTW displayFont{};
|
||||
int fontPoints=110;
|
||||
int textHeight=20, cellWidth=9;
|
||||
constexpr UINT refreshProgressLayout=WM_APP+1;
|
||||
constexpr UINT directoryScanReady=WM_APP+2;
|
||||
|
||||
BOOL CALLBACK updateDialogFont(HWND window,LPARAM parameter)
|
||||
{
|
||||
@@ -818,44 +833,139 @@ void showMenu(bool show)
|
||||
if (!show) ShowWindow(menuBar,SW_HIDE);
|
||||
RedrawWindow(GetParent(menuBar),nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
|
||||
}
|
||||
LRESULT scrollList(HWND list, UINT message, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
if (message == WM_MOUSEWHEEL)
|
||||
{
|
||||
int delta = GET_WHEEL_DELTA_WPARAM(wp);
|
||||
int top = static_cast<int>(SendMessageW(list, LB_GETTOPINDEX, 0, 0));
|
||||
int count = static_cast<int>(SendMessageW(list, LB_GETCOUNT, 0, 0));
|
||||
RECT rect{};
|
||||
GetClientRect(list, &rect);
|
||||
int rowHeight = static_cast<int>(SendMessageW(list, LB_GETITEMHEIGHT, 0, 0));
|
||||
int visible = std::max(1, static_cast<int>(rect.bottom) / std::max(1, rowHeight));
|
||||
SendMessageW(list, LB_SETTOPINDEX,
|
||||
std::clamp(top - (delta / WHEEL_DELTA) * 3, 0, std::max(0, count - visible)), 0);
|
||||
return 0;
|
||||
}
|
||||
return DefSubclassProc(list, message, wp, lp);
|
||||
}
|
||||
using ks::files::ScrollPosition;
|
||||
using ks::files::scrollBarWidth;
|
||||
constexpr UINT_PTR listScrollBar=2, noticeScrollBar=3, firstPanelScrollBar=4;
|
||||
|
||||
void paintScrollPosition(HWND parent, HDC dc, HWND list, COLORREF background)
|
||||
RECT scrollTrack(HWND host,HWND content)
|
||||
{
|
||||
RECT track{};
|
||||
GetWindowRect(list, &track);
|
||||
MapWindowPoints(nullptr, parent, reinterpret_cast<POINT *>(&track), 2);
|
||||
track.left = track.right;
|
||||
track.right += 5;
|
||||
SetDCBrushColor(dc, background);
|
||||
FillRect(dc, &track, static_cast<HBRUSH>(GetStockObject(DC_BRUSH)));
|
||||
int count = static_cast<int>(SendMessageW(list, LB_GETCOUNT, 0, 0));
|
||||
int rowHeight = static_cast<int>(SendMessageW(list, LB_GETITEMHEIGHT, 0, 0));
|
||||
int height = track.bottom - track.top;
|
||||
int visible = std::max(1, height / std::max(1, rowHeight));
|
||||
if (height <= 0 || count <= visible) return;
|
||||
int thumb = std::min(height, std::max(5, MulDiv(height, visible, count)));
|
||||
int top = static_cast<int>(SendMessageW(list, LB_GETTOPINDEX, 0, 0));
|
||||
track.top += MulDiv(std::clamp(top, 0, count - visible), height - thumb, count - visible);
|
||||
track.bottom = track.top + thumb;
|
||||
SetDCBrushColor(dc, colors[Frame]);
|
||||
FillRect(dc, &track, static_cast<HBRUSH>(GetStockObject(DC_BRUSH)));
|
||||
GetWindowRect(content,&track);
|
||||
MapWindowPoints(nullptr,host,reinterpret_cast<POINT *>(&track),2);
|
||||
track.left=track.right;
|
||||
track.right+=scrollBarWidth(content);
|
||||
return track;
|
||||
}
|
||||
|
||||
ScrollPosition scrollPosition(HWND content,bool edit)
|
||||
{
|
||||
RECT client{};
|
||||
GetClientRect(content,&client);
|
||||
int rowHeight{};
|
||||
if(edit)
|
||||
{
|
||||
if(const auto dc=GetDC(content))
|
||||
{
|
||||
const auto old=SelectObject(dc,mono);
|
||||
TEXTMETRICW metrics{};
|
||||
GetTextMetricsW(dc,&metrics);
|
||||
rowHeight=metrics.tmHeight;
|
||||
SelectObject(dc,old);
|
||||
ReleaseDC(content,dc);
|
||||
}
|
||||
}
|
||||
else rowHeight=static_cast<int>(SendMessageW(content,LB_GETITEMHEIGHT,0,0));
|
||||
return {
|
||||
static_cast<int>(SendMessageW(content,edit?EM_GETLINECOUNT:LB_GETCOUNT,0,0)),
|
||||
std::max(1,static_cast<int>(client.bottom)/std::max(1,rowHeight)),
|
||||
static_cast<int>(SendMessageW(content,edit?EM_GETFIRSTVISIBLELINE:LB_GETTOPINDEX,0,0))};
|
||||
}
|
||||
|
||||
void paintScrollPosition(HWND host,HDC dc,HWND content,COLORREF background,bool edit=false)
|
||||
{
|
||||
if(!IsWindowVisible(content)) return;
|
||||
const auto position=scrollPosition(content,edit);
|
||||
if(!edit || position.last())
|
||||
ks::files::paintScrollBar(dc,scrollTrack(host,content),position,background);
|
||||
}
|
||||
|
||||
void setScrollTop(HWND content,bool edit,ScrollPosition position,int top)
|
||||
{
|
||||
top=std::clamp(top,0,position.last());
|
||||
if(edit) SendMessageW(content,EM_LINESCROLL,0,top-position.top);
|
||||
else SendMessageW(content,LB_SETTOPINDEX,top,0);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK scrollContentProc(HWND content,UINT message,WPARAM wp,LPARAM lp,UINT_PTR kind,DWORD_PTR target)
|
||||
{
|
||||
const bool edit=kind==noticeScrollBar;
|
||||
const auto host=reinterpret_cast<HWND>(target);
|
||||
if(message==WM_MOUSEWHEEL)
|
||||
{
|
||||
const auto position=scrollPosition(content,edit);
|
||||
setScrollTop(content,edit,position,position.top-3*(GET_WHEEL_DELTA_WPARAM(wp)/WHEEL_DELTA));
|
||||
return 0;
|
||||
}
|
||||
const auto result=DefSubclassProc(content,message,wp,lp);
|
||||
switch(message)
|
||||
{
|
||||
case LB_DELETESTRING: case LB_RESETCONTENT: case LB_SETCURSEL:
|
||||
case LB_SETTOPINDEX: case LB_SETITEMHEIGHT: case WM_KEYDOWN: case WM_VSCROLL:
|
||||
case WM_LBUTTONDOWN: case WM_LBUTTONUP: case EM_LINESCROLL: case WM_SETTEXT:
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
const auto track=scrollTrack(host,content);
|
||||
InvalidateRect(host,&track,FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK scrollHostProc(HWND host,UINT message,WPARAM wp,LPARAM lp,UINT_PTR kind,DWORD_PTR target)
|
||||
{
|
||||
constexpr auto dragProperty=L"KSwitcher.Files.ScrollDrag";
|
||||
constexpr auto offsetProperty=L"KSwitcher.Files.ScrollDragOffset";
|
||||
const bool edit=kind==noticeScrollBar;
|
||||
const auto content=reinterpret_cast<HWND>(target);
|
||||
const bool dragging=GetPropW(host,dragProperty)==content;
|
||||
if(message==WM_CAPTURECHANGED && dragging)
|
||||
{
|
||||
RemovePropW(host,dragProperty);
|
||||
RemovePropW(host,offsetProperty);
|
||||
}
|
||||
if(message==WM_LBUTTONUP && dragging && GetCapture()==host)
|
||||
{
|
||||
ReleaseCapture();
|
||||
return 0;
|
||||
}
|
||||
if(message==WM_NCHITTEST || message==WM_LBUTTONDOWN ||
|
||||
(message==WM_MOUSEMOVE && dragging && GetCapture()==host))
|
||||
{
|
||||
POINT point{GET_X_LPARAM(lp),GET_Y_LPARAM(lp)};
|
||||
if(message==WM_NCHITTEST) ScreenToClient(host,&point);
|
||||
const auto track=scrollTrack(host,content);
|
||||
if(IsWindowVisible(content) && (PtInRect(&track,point) || message==WM_MOUSEMOVE))
|
||||
{
|
||||
const auto position=scrollPosition(content,edit);
|
||||
if(position.last())
|
||||
{
|
||||
if(message==WM_NCHITTEST) return HTCLIENT;
|
||||
const auto thumb=position.thumb(track);
|
||||
if(message==WM_MOUSEMOVE)
|
||||
{
|
||||
const auto offset=reinterpret_cast<INT_PTR>(GetPropW(host,offsetProperty))-1;
|
||||
setScrollTop(content,edit,position,position.drag(track,point.y,static_cast<int>(offset)));
|
||||
}
|
||||
else if(PtInRect(&thumb,point))
|
||||
{
|
||||
SetPropW(host,dragProperty,content);
|
||||
SetPropW(host,offsetProperty,reinterpret_cast<HANDLE>(
|
||||
static_cast<INT_PTR>(point.y-thumb.top+1)));
|
||||
SetCapture(host);
|
||||
}
|
||||
else setScrollTop(content,edit,position,position.click(track,point.y));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(host,message,wp,lp);
|
||||
}
|
||||
|
||||
void installScrollBar(HWND content,HWND host,UINT_PTR kind=listScrollBar)
|
||||
{
|
||||
SetWindowSubclass(content,scrollContentProc,kind,reinterpret_cast<DWORD_PTR>(host));
|
||||
SetWindowSubclass(host,scrollHostProc,kind,reinterpret_cast<DWORD_PTR>(content));
|
||||
}
|
||||
|
||||
void placePanelSearch(HWND window)
|
||||
@@ -876,6 +986,28 @@ void closePanelSearch()
|
||||
if(IsWindowVisible(panelSearchPopup)) ShowWindow(panelSearchPopup,SW_HIDE);
|
||||
}
|
||||
|
||||
void swapPanels(HWND window)
|
||||
{
|
||||
closePanelSearch();
|
||||
hidePicker();
|
||||
showMenu(false);
|
||||
// Move the controls with their contents to retain the cursor and scroll position.
|
||||
std::swap(panels[0],panels[1]);
|
||||
active=1-active;
|
||||
for(auto &panel:terminalCommandPanels)
|
||||
if(panel>=0) panel=1-panel;
|
||||
for(int i=0;i<2;++i)
|
||||
{
|
||||
const auto &panel=panels[i];
|
||||
SetWindowLongPtrW(panel.list,GWLP_ID,102+i);
|
||||
SetWindowLongPtrW(panel.heading,GWLP_ID,140+i);
|
||||
SetWindowLongPtrW(panel.path,GWLP_ID,142+i);
|
||||
savePreference(panelModeKeys[i],panel.wide);
|
||||
}
|
||||
notifyFilesPreferences(window);
|
||||
layout(window);
|
||||
}
|
||||
|
||||
void layout(HWND window,bool activeOnly)
|
||||
{
|
||||
RECT rect{};
|
||||
@@ -905,7 +1037,8 @@ void layout(HWND window,bool activeOnly)
|
||||
int headingHeight=panels[i].wide?textHeight:0;
|
||||
place(panels[i].heading,x+5,textHeight+10,std::max(0,end-x-13),headingHeight);
|
||||
ShowWindow(panels[i].heading,!terminalVisible && panels[i].wide?SW_SHOWNA:SW_HIDE);
|
||||
place(panels[i].list, x + 5, textHeight+10+headingHeight, std::max(0, end - x - 13),
|
||||
place(panels[i].list, x + 5, textHeight+10+headingHeight,
|
||||
std::max(0,end-x-8-scrollBarWidth(panels[i].list)),
|
||||
std::max(0, panelBottom-textHeight-10-headingHeight));
|
||||
}
|
||||
place(menuBar,0,0,width,textHeight+4);
|
||||
@@ -1014,6 +1147,12 @@ void activatePanel(int index)
|
||||
layout(GetParent(panels[index].list),true);
|
||||
}
|
||||
|
||||
bool plainPanelTab()
|
||||
{
|
||||
return !((GetKeyState(VK_CONTROL)|GetKeyState(VK_SHIFT)|GetKeyState(VK_MENU)|
|
||||
GetKeyState(VK_LWIN)|GetKeyState(VK_RWIN))&0x8000);
|
||||
}
|
||||
|
||||
std::wstring terminalInputText()
|
||||
{
|
||||
std::wstring value(GetWindowTextLengthW(terminalInput)+1,L'\0');
|
||||
@@ -1079,7 +1218,7 @@ void showFramedList(HWND list,HWND frame,int x,int y,int width,int height,int in
|
||||
{
|
||||
constexpr UINT flags=SWP_NOACTIVATE|SWP_SHOWWINDOW;
|
||||
SetWindowPos(frame,HWND_TOP,x-inset,y-inset,width+2*inset,height+2*inset,flags);
|
||||
SetWindowPos(list,HWND_TOP,x,y,width,height,flags);
|
||||
SetWindowPos(list,HWND_TOP,x,y,std::max(1,width-scrollBarWidth(list)),height,flags);
|
||||
}
|
||||
|
||||
void appendPowerShellCompletions(const CompletionQuery &query,const Json &reply,
|
||||
@@ -1144,7 +1283,7 @@ void showCompletion(HWND owner,const CompletionQuery &query,const Json &reply={}
|
||||
ReleaseDC(completionList,dc);
|
||||
}
|
||||
if(static_cast<size_t>(rows)<completionItems.size())
|
||||
desiredWidth+=GetSystemMetricsForDpi(SM_CXVSCROLL,GetDpiForWindow(owner));
|
||||
desiredWidth+=scrollBarWidth(completionList);
|
||||
const int width=std::min(desiredWidth,static_cast<int>(edit.right-edit.left)-2*inset);
|
||||
if(rows<1 || width<1) { hideCompletion(); return; }
|
||||
SendMessageW(completionList,LB_RESETCONTENT,0,0);
|
||||
@@ -1623,7 +1762,7 @@ LRESULT CALLBACK terminalInputKeys(HWND input,UINT message,WPARAM wp,LPARAM lp,U
|
||||
}
|
||||
if(message==WM_KEYDOWN && !terminalVisible && wp==VK_TAB)
|
||||
{
|
||||
activatePanel(1-active);
|
||||
if(plainPanelTab()) activatePanel(1-active);
|
||||
return 0;
|
||||
}
|
||||
if(message==WM_KEYDOWN && !terminalVisible &&
|
||||
@@ -1864,8 +2003,9 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
for (const auto &file : files) add(file, file.filename().wstring(), false);
|
||||
const auto label=(panel.peer?panel.peer->name+L" · ":std::wstring{})+directory.native();
|
||||
SetWindowTextW(panel.path,label.c_str());
|
||||
InvalidateRect(panel.path,nullptr,FALSE);
|
||||
if(&panel==&panels[active] && !sameDirectory)
|
||||
layout(GetParent(panel.list));
|
||||
layout(GetParent(panel.list),true);
|
||||
auto selected=std::find(panel.rows.begin(),panel.rows.end(),previousSelection);
|
||||
if(selected==panel.rows.end() && !panel.rows.empty())
|
||||
selected=panel.rows.begin()+std::clamp<LRESULT>(previousRow,0,panel.rows.size()-1);
|
||||
@@ -1894,10 +2034,15 @@ bool applyDirectoryScan(Panel &panel,Panel::ScanRequest request,Panel::ScanResul
|
||||
void startDirectoryScan(Panel &panel)
|
||||
{
|
||||
panel.scanStop=std::stop_source{};
|
||||
const auto owner=GetParent(panel.list);
|
||||
std::packaged_task<std::unique_ptr<Panel::ScanResult>()> task(
|
||||
[request=*panel.scanRequest,stop=panel.scanStop.get_token()] {return scanDirectory(request,stop);});
|
||||
auto future=task.get_future();
|
||||
std::thread(std::move(task)).detach();
|
||||
std::thread([task=std::move(task),owner]() mutable
|
||||
{
|
||||
task();
|
||||
PostMessageW(owner,directoryScanReady,0,0);
|
||||
}).detach();
|
||||
panel.scan=std::move(future);
|
||||
panel.scanSuperseded=false;
|
||||
}
|
||||
@@ -2288,7 +2433,7 @@ LRESULT CALLBACK pickerKeys(HWND window, UINT msg, WPARAM wp, LPARAM lp, UINT_PT
|
||||
SendMessageW(GetParent(window),WM_COMMAND,MAKEWPARAM(130+next,BN_CLICKED),0);
|
||||
return 0;
|
||||
}
|
||||
return scrollList(window,msg,wp,lp);
|
||||
return DefSubclassProc(window,msg,wp,lp);
|
||||
}
|
||||
|
||||
void queryDrivePeers()
|
||||
@@ -2371,11 +2516,12 @@ void layoutDrivePicker(int selected,bool focus)
|
||||
auto layout=BeginDeferWindowPos(2);
|
||||
if(layout) layout=DeferWindowPos(layout,pickerFrame,HWND_TOP,
|
||||
x-inset,y-vertical,width+2*inset,height+2*vertical,flags);
|
||||
if(layout) layout=DeferWindowPos(layout,picker,HWND_TOP,x,y,width,height,flags);
|
||||
if(layout) layout=DeferWindowPos(layout,picker,HWND_TOP,x,y,
|
||||
std::max(1,width-scrollBarWidth(picker)),height,flags);
|
||||
if(!layout || !EndDeferWindowPos(layout))
|
||||
{
|
||||
SetWindowPos(pickerFrame,HWND_TOP,x-inset,y-vertical,width+2*inset,height+2*vertical,flags);
|
||||
SetWindowPos(picker,HWND_TOP,x,y,width,height,flags);
|
||||
SetWindowPos(picker,HWND_TOP,x,y,std::max(1,width-scrollBarWidth(picker)),height,flags);
|
||||
}
|
||||
RedrawWindow(pickerFrame,nullptr,nullptr,RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
SendMessageW(picker,LB_SETCURSEL,selected,0);
|
||||
@@ -2992,14 +3138,14 @@ void paintDialogButton(const DRAWITEMSTRUCT &item,COLORREF surface,COLORREF fore
|
||||
|
||||
INT_PTR paintCopyDialog(HWND dialog, UINT message, WPARAM wp, LPARAM lp,
|
||||
const wchar_t *caption, bool warning, std::initializer_list<int> dividers, bool useDialogPalette=false,
|
||||
HWND scrollListControl=nullptr)
|
||||
HWND scrollControl=nullptr,bool scrollEdit=false)
|
||||
{
|
||||
const auto foreground=useDialogPalette?colors[Text]:warning?RGB(255,255,255):RGB(0,0,0);
|
||||
const auto surface=useDialogPalette?colors[Dialog]:warning?RGB(128,0,0):RGB(192,192,192);
|
||||
const auto brush=useDialogPalette?teal:warning?warningBrush:static_cast<HBRUSH>(GetStockObject(LTGRAY_BRUSH));
|
||||
if(message==WM_CTLCOLORDLG) return reinterpret_cast<INT_PTR>(brush);
|
||||
if(message==WM_CTLCOLORSTATIC || message==WM_CTLCOLOREDIT || message==WM_CTLCOLORBTN ||
|
||||
(useDialogPalette && message==WM_CTLCOLORLISTBOX))
|
||||
(message==WM_CTLCOLORLISTBOX && (useDialogPalette || reinterpret_cast<HWND>(lp)==scrollControl)))
|
||||
{
|
||||
const auto dc=reinterpret_cast<HDC>(wp);
|
||||
const bool edit=message==WM_CTLCOLOREDIT ||
|
||||
@@ -3025,7 +3171,7 @@ INT_PTR paintCopyDialog(HWND dialog, UINT message, WPARAM wp, LPARAM lp,
|
||||
FillRect(dc,÷r,black);
|
||||
}
|
||||
paintDialogFrameCaptions(dc,client,bounds,caption,brush,foreground,mono);
|
||||
if(scrollListControl) paintScrollPosition(dialog,dc,scrollListControl,surface);
|
||||
if(scrollControl) paintScrollPosition(dialog,dc,scrollControl,surface,scrollEdit);
|
||||
EndPaint(dialog,&paint);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3804,13 +3950,13 @@ void layoutFilesNotice(HWND dialog)
|
||||
SetWindowPos(GetDlgItem(dialog,id),nullptr,inset,y,contentWidth,height,SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
};
|
||||
constexpr LRESULT maxLines=8;
|
||||
ShowScrollBar(field,SB_VERT,FALSE);
|
||||
place(100,top,maxLines*lineHeight);
|
||||
const auto lines=SendMessageW(field,EM_GETLINECOUNT,0,0);
|
||||
const bool overflow=lines>maxLines;
|
||||
const auto height=static_cast<int>(std::clamp<LRESULT>(lines,1,maxLines))*lineHeight;
|
||||
place(100,top,height);
|
||||
ShowScrollBar(field,SB_VERT,overflow);
|
||||
if(overflow) SetWindowPos(field,nullptr,inset,top,
|
||||
std::max(1L,contentWidth-scrollBarWidth(field)),height,SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
const auto style=GetWindowLongPtrW(field,GWL_STYLE);
|
||||
SetWindowLongPtrW(field,GWL_STYLE,overflow?style|WS_TABSTOP:style&~WS_TABSTOP);
|
||||
if(!overflow) SendMessageW(field,EM_LINESCROLL,0,-SendMessageW(field,EM_GETFIRSTVISIBLELINE,0,0));
|
||||
@@ -3837,6 +3983,7 @@ INT_PTR CALLBACK filesNoticeDialog(HWND window,UINT message,WPARAM wp,LPARAM lp)
|
||||
const auto field=GetDlgItem(window,100);
|
||||
SendMessageW(field,EM_SETMARGINS,EC_LEFTMARGIN|EC_RIGHTMARGIN,0);
|
||||
SetWindowTextW(field,notice.text);
|
||||
installScrollBar(field,window,noticeScrollBar);
|
||||
if(notice.options.remember)
|
||||
{
|
||||
const auto checkbox=GetDlgItem(window,101);
|
||||
@@ -3883,7 +4030,7 @@ INT_PTR CALLBACK filesNoticeDialog(HWND window,UINT message,WPARAM wp,LPARAM lp)
|
||||
SetBkColor(dc,warning?RGB(128,0,0):RGB(192,192,192));
|
||||
return reinterpret_cast<INT_PTR>(warning?warningBrush:GetStockObject(LTGRAY_BRUSH));
|
||||
}
|
||||
if(const auto painted=paintCopyDialog(window,message,wp,lp,notice->title.c_str(),warning,{102},palette))
|
||||
if(const auto painted=paintCopyDialog(window,message,wp,lp,notice->title.c_str(),warning,{102},palette,GetDlgItem(window,100),true))
|
||||
return painted;
|
||||
const auto command=LOWORD(wp);
|
||||
if(message==WM_COMMAND && (command==IDOK || command==IDCANCEL || command==IDYES || command==IDNO ||
|
||||
@@ -5083,8 +5230,9 @@ void makeFolder(HWND owner,Panel &panel)
|
||||
selectPanelPath(panel,request.created);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT_PTR, DWORD_PTR index)
|
||||
LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT_PTR, DWORD_PTR)
|
||||
{
|
||||
const auto index=GetDlgCtrlID(window)-102;
|
||||
if(message==WM_LBUTTONDOWN || message==WM_LBUTTONDBLCLK ||
|
||||
(message==WM_MOUSEMOVE && (wp&MK_LBUTTON) && GetCapture()==window))
|
||||
{
|
||||
@@ -5158,7 +5306,15 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
}
|
||||
if (message == WM_KEYDOWN)
|
||||
{
|
||||
if(wp==VK_TAB) { activatePanel(static_cast<int>(1-index)); SetFocus(terminalInput); return 0; }
|
||||
if(wp==VK_TAB)
|
||||
{
|
||||
if(plainPanelTab())
|
||||
{
|
||||
activatePanel(1-index);
|
||||
SetFocus(terminalInput);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (wp == VK_RETURN) { enter(panels[index]); return 0; }
|
||||
if (wp == VK_F2)
|
||||
{
|
||||
@@ -5193,7 +5349,7 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
const bool movesCursor=message==WM_KEYDOWN &&
|
||||
(wp==VK_UP || wp==VK_DOWN || wp==VK_PRIOR || wp==VK_NEXT || wp==VK_HOME || wp==VK_END);
|
||||
const auto previous=movesCursor?SendMessageW(window,LB_GETCURSEL,0,0):LB_ERR;
|
||||
auto result=scrollList(window, message, wp, lp);
|
||||
auto result=DefSubclassProc(window,message,wp,lp);
|
||||
if(movesCursor) invalidatePanelCursorChange(window,previous);
|
||||
if(message==WM_LBUTTONUP && GetFocus()==window) restoreCommandFocus();
|
||||
if(message==WM_PAINT && panels[index].wide)
|
||||
@@ -5226,8 +5382,7 @@ bool loadFilesPreferences(HWND window)
|
||||
std::min(preference(dialogRowTextKey,defaultDialogFramePadding.rowText),maxDialogRowTextPadding)};
|
||||
loadFileStyles();
|
||||
loadFolderShortcuts();
|
||||
panels[0].wide=preference(L"LeftWide",defaultWide)!=0;
|
||||
panels[1].wide=preference(L"RightWide",defaultWide)!=0;
|
||||
for(int i=0;i<2;++i) panels[i].wide=preference(panelModeKeys[i],defaultWide)!=0;
|
||||
sizeWidth=static_cast<int>(std::clamp(preference(L"SizeWidth",defaultSizeWidth),6UL,16UL));
|
||||
alignExtensions=preference(L"AlignExtensions",defaultAlignExtensions)!=0;
|
||||
showDetails=preference(L"ShowDetails",defaultShowDetails)!=0;
|
||||
@@ -5256,8 +5411,8 @@ void openMenu(HWND window, int index)
|
||||
if(index==0 || index==4)
|
||||
{
|
||||
const bool wide=panels[index==4].wide;
|
||||
rows={wide?L" Brief":L"✓ Brief",
|
||||
wide?L"✓ Wide":L" Wide",
|
||||
rows={wide?L" Brief\tCtrl+F1":L"✓ Brief\tCtrl+F1",
|
||||
wide?L"✓ Wide\tCtrl+F2":L" Wide\tCtrl+F2",
|
||||
index==0?L" Change drive\tAlt+F1":L" Change drive\tAlt+F2"};
|
||||
}
|
||||
else if(index==1) rows={L"Copy\tF5",L"Move\tF6",L"Make folder\tF7",L"Exit\tF10"};
|
||||
@@ -5321,7 +5476,9 @@ void openMenu(HWND window, int index)
|
||||
const int x=std::clamp(static_cast<int>(anchor.left)+inset,inset,
|
||||
std::max(inset,static_cast<int>(client.right)-width-inset));
|
||||
const int y=anchor.bottom+5;
|
||||
const int height=static_cast<int>(commandActions.size())*static_cast<int>(SendMessageW(picker,LB_GETITEMHEIGHT,0,0));
|
||||
const int rowHeight=static_cast<int>(SendMessageW(picker,LB_GETITEMHEIGHT,0,0));
|
||||
const int maxRows=std::max(1,(static_cast<int>(client.bottom)-y-inset)/rowHeight);
|
||||
const int height=std::min(static_cast<int>(commandActions.size()),maxRows)*rowHeight;
|
||||
showFramedList(picker,pickerFrame,x,y,width,height,inset);
|
||||
SendMessageW(picker,LB_SETCURSEL,0,0);
|
||||
SetFocus(picker);
|
||||
@@ -5518,6 +5675,9 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
drivePeerReplyReceived=true;
|
||||
return TRUE;
|
||||
}
|
||||
case directoryScanReady:
|
||||
if(!FilesModalDialog::activeFor(window)) collectDirectoryScans();
|
||||
return 0;
|
||||
case WM_TIMER:
|
||||
if(wp==driveQueryTimer) {pollDriveQueries(window);return 0;}
|
||||
if(wp==terminalTimer)
|
||||
@@ -5568,6 +5728,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
pickerFrame=CreateWindowW(L"STATIC",L"",WS_CHILD|WS_CLIPSIBLINGS|SS_OWNERDRAW,
|
||||
0,0,0,0,window,reinterpret_cast<HMENU>(122),instance,nullptr);
|
||||
SetWindowSubclass(picker,pickerKeys,1,0);
|
||||
installScrollBar(picker,pickerFrame);
|
||||
SendMessageW(picker,LB_SETITEMHEIGHT,0,textHeight);
|
||||
status = CreateWindowW(L"STATIC", L"", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_PATHELLIPSIS,
|
||||
0, 0, 0, 0, window, reinterpret_cast<HMENU>(144), instance, nullptr);
|
||||
@@ -5580,12 +5741,13 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
terminalOutput=CreateWindowW(L"STATIC",L"",WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
|
||||
0,0,0,0,window,reinterpret_cast<HMENU>(145),instance,nullptr);
|
||||
completionList=CreateWindowW(L"LISTBOX",L"Command suggestions",
|
||||
WS_CHILD|WS_CLIPSIBLINGS|WS_VSCROLL|LBS_OWNERDRAWFIXED|LBS_HASSTRINGS|LBS_NOINTEGRALHEIGHT,
|
||||
WS_CHILD|WS_CLIPSIBLINGS|LBS_OWNERDRAWFIXED|LBS_HASSTRINGS|LBS_NOINTEGRALHEIGHT,
|
||||
0,0,0,0,window,reinterpret_cast<HMENU>(149),instance,nullptr);
|
||||
completionFrame=CreateWindowW(L"STATIC",L"",WS_CHILD|WS_CLIPSIBLINGS|SS_OWNERDRAW,
|
||||
0,0,0,0,window,nullptr,instance,nullptr);
|
||||
if(!completionList || !completionFrame) return -1;
|
||||
SetWindowSubclass(completionList,completionClick,1,0);
|
||||
installScrollBar(completionList,completionFrame);
|
||||
terminalBackground=CreateSolidBrush(RGB(24,24,24));
|
||||
if(!terminalInput || !terminalOutput || !terminalPrompt || !terminalBackground) return -1;
|
||||
for(const auto control:{terminalInput,terminalOutput,terminalPrompt})
|
||||
@@ -5620,7 +5782,8 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
const auto root=fs::path(system).root_path();
|
||||
openOn(panel,saved.is_absolute()?saved:root,false,{},savedPanelPath(panelCursorKeys[i]),
|
||||
saved.is_absolute() && saved!=root?root:fs::path{});
|
||||
SetWindowSubclass(panel.list, panelKeys, 1, i);
|
||||
SetWindowSubclass(panel.list, panelKeys, 1, 0);
|
||||
installScrollBar(panel.list,window,firstPanelScrollBar+i);
|
||||
}
|
||||
SetFocus(panels[0].list);
|
||||
return 0;
|
||||
@@ -5701,7 +5864,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
GetWindowRect(panel.list,&box);
|
||||
MapWindowPoints(nullptr,window,reinterpret_cast<POINT*>(&box),2);
|
||||
const LONG columnX=std::max(box.left,box.right-(sizeWidth+2)*static_cast<LONG>(cellWidth));
|
||||
box.right+=5;
|
||||
box.right+=scrollBarWidth(panel.list);
|
||||
InflateRect(&box,2,2);
|
||||
box.left-=2;
|
||||
RECT pathBounds{};
|
||||
@@ -5843,6 +6006,8 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
}
|
||||
paintDialogFrameCaptions(item.hDC,item.rcItem,box,L"Change drive",teal,colors[Text],mono);
|
||||
}
|
||||
const auto list=item.hwndItem==pickerFrame?picker:completionList;
|
||||
paintScrollPosition(item.hwndItem,item.hDC,list,colors[Dialog]);
|
||||
DeleteObject(border);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -6209,7 +6374,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
if(GetMessageW(&message,nullptr,0,0)<=0) break;
|
||||
if(message.message==WM_KEYDOWN && message.wParam==VK_TAB &&
|
||||
(GetKeyState(VK_CONTROL)&0x8000) && !(GetKeyState(VK_MENU)&0x8000) &&
|
||||
ks::files::cycleTextWindows(GetAncestor(message.hwnd,GA_ROOT)))
|
||||
ks::files::cycleTextWindows(GetAncestor(message.hwnd,GA_ROOT),(GetKeyState(VK_SHIFT)&0x8000)!=0))
|
||||
continue;
|
||||
if(!IsWindow(window) || (message.hwnd && GetAncestor(message.hwnd,GA_ROOTOWNER)!=window))
|
||||
{
|
||||
@@ -6277,8 +6442,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
if(message.message==WM_KEYDOWN && mainInput && !terminalVisible &&
|
||||
(GetKeyState(VK_CONTROL)&0x8000) && !(GetKeyState(VK_MENU)&0x8000) &&
|
||||
!(GetKeyState(VK_LWIN)&0x8000) && !(GetKeyState(VK_RWIN)&0x8000) &&
|
||||
message.wParam>='0' && message.wParam<='9' && !copyInProgress &&
|
||||
(message.wParam!='8' || (GetKeyState(VK_SHIFT)&0x8000)))
|
||||
message.wParam>='0' && message.wParam<='9' && !copyInProgress)
|
||||
{
|
||||
if(!(message.lParam & (1LL<<30)))
|
||||
{
|
||||
@@ -6292,17 +6456,17 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
continue;
|
||||
}
|
||||
const bool filesMessage=message.hwnd==window || IsChild(window,message.hwnd);
|
||||
if(filesMessage && !terminalVisible && !copyInProgress && !commandHistoryWindow &&
|
||||
message.message==WM_KEYDOWN && message.wParam=='8' &&
|
||||
if(mainInput && !terminalVisible && !copyInProgress &&
|
||||
message.message==WM_KEYDOWN && message.wParam>=VK_F1 && message.wParam<=VK_F12 &&
|
||||
(GetKeyState(VK_CONTROL)&0x8000) && !(GetKeyState(VK_MENU)&0x8000) &&
|
||||
!(GetKeyState(VK_SHIFT)&0x8000) && !(GetKeyState(VK_LWIN)&0x8000) &&
|
||||
!(GetKeyState(VK_RWIN)&0x8000))
|
||||
{
|
||||
if(!(message.lParam & (1LL<<30)))
|
||||
if(!(message.lParam & (1LL<<30)) && (message.wParam==VK_F1 || message.wParam==VK_F2))
|
||||
{
|
||||
hidePicker();
|
||||
showMenu(false);
|
||||
showFolderShortcuts(panels[active],-1,true);
|
||||
setMode(active,message.wParam==VK_F2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -6315,12 +6479,14 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
const bool shift=(GetKeyState(VK_SHIFT)&0x8000)!=0;
|
||||
if(ctrl && !shift &&
|
||||
(message.wParam=='F' || message.wParam=='C' || message.wParam=='R' ||
|
||||
(message.wParam=='U' && !terminalVisible) ||
|
||||
message.wParam==VK_RETURN || message.wParam==VK_INSERT))
|
||||
{
|
||||
if(!(message.lParam & (1LL<<30)))
|
||||
{
|
||||
if(message.wParam=='F') insertCurrentPanelPath();
|
||||
else if(message.wParam=='R') refreshPanel(panels[active]);
|
||||
else if(message.wParam=='U') swapPanels(window);
|
||||
else if(message.wParam==VK_RETURN) insertCurrentPanelPath(true);
|
||||
else if(message.wParam==VK_INSERT) copyCommandLineOrPanelNames(window);
|
||||
else SendMessageW(terminalInput,WM_COPY,0,0);
|
||||
@@ -6343,11 +6509,12 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
|
||||
continue;
|
||||
if((message.message==WM_LBUTTONDOWN || message.message==WM_RBUTTONDOWN ||
|
||||
message.message==WM_NCLBUTTONDOWN) && message.hwnd!=menuBar && message.hwnd!=picker &&
|
||||
message.hwnd!=pickerFrame &&
|
||||
std::find(std::begin(menuItems),std::end(menuItems),message.hwnd)==std::end(menuItems))
|
||||
{
|
||||
if(message.hwnd!=completionList) hideCompletion();
|
||||
if(message.hwnd!=completionList && message.hwnd!=completionFrame) hideCompletion();
|
||||
showMenu(false);
|
||||
if(message.hwnd!=picker) hidePicker();
|
||||
hidePicker();
|
||||
}
|
||||
if((message.message==WM_CHAR || message.message==WM_SYSCHAR) && IsWindowVisible(menuBar))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace ks::files
|
||||
{
|
||||
inline int scrollBarWidth(HWND window) {return std::max(7,MulDiv(12,GetDpiForWindow(window),96));}
|
||||
|
||||
inline int scrollArrowHeight(RECT bounds)
|
||||
{
|
||||
return std::min(bounds.right-bounds.left,(bounds.bottom-bounds.top)/3);
|
||||
}
|
||||
|
||||
struct ScrollPosition
|
||||
{
|
||||
int count, visible, top;
|
||||
|
||||
int last() const {return std::max(0,count-visible);}
|
||||
|
||||
RECT thumb(RECT track) const
|
||||
{
|
||||
const auto arrow=scrollArrowHeight(track);
|
||||
track.top+=arrow;
|
||||
track.bottom-=arrow;
|
||||
const int height=track.bottom-track.top;
|
||||
if(height<=0 || !last()) return {};
|
||||
const int size=std::clamp(MulDiv(height,visible,count),std::min(height,arrow),height);
|
||||
track.top+=MulDiv(std::clamp(top,0,last()),height-size,last());
|
||||
track.bottom=track.top+size;
|
||||
return track;
|
||||
}
|
||||
|
||||
int click(RECT track,int y) const
|
||||
{
|
||||
const auto arrow=scrollArrowHeight(track);
|
||||
const auto grip=thumb(track);
|
||||
const int delta=y<track.top+arrow?-1:y>=track.bottom-arrow?1:
|
||||
y<grip.top?-visible:y>=grip.bottom?visible:0;
|
||||
return std::clamp(top+delta,0,last());
|
||||
}
|
||||
|
||||
int drag(RECT track,int y,int offset) const
|
||||
{
|
||||
const auto grip=thumb(track);
|
||||
const auto arrow=scrollArrowHeight(track);
|
||||
const auto travel=track.bottom-track.top-2*arrow-(grip.bottom-grip.top);
|
||||
return travel>0?std::clamp(MulDiv(y-track.top-arrow-offset,last(),travel),0,last()):top;
|
||||
}
|
||||
};
|
||||
|
||||
inline void paintScrollBar(HDC dc,RECT track,ScrollPosition position,COLORREF background)
|
||||
{
|
||||
const auto brush=static_cast<HBRUSH>(GetStockObject(DC_BRUSH));
|
||||
SetDCBrushColor(dc,background);
|
||||
FillRect(dc,&track,brush);
|
||||
if(!position.last()) return;
|
||||
const auto lighter=[&](int divisor){return RGB(GetRValue(background)+(257-GetRValue(background))/divisor,
|
||||
GetGValue(background)+(257-GetGValue(background))/divisor,
|
||||
GetBValue(background)+(257-GetBValue(background))/divisor);};
|
||||
const auto ink=lighter(4),dots=lighter(7);
|
||||
const int height=scrollArrowHeight(track);
|
||||
struct
|
||||
{
|
||||
BITMAPINFOHEADER header{sizeof(BITMAPINFOHEADER),4,4,1,32,BI_RGB};
|
||||
DWORD pixels[16]{};
|
||||
} tile;
|
||||
for(int y=0;y<4;++y)
|
||||
for(int x=0;x<4;++x)
|
||||
{
|
||||
const auto color=y%2==0 && x%2==y/2?dots:background;
|
||||
// DIB pixels are stored bottom-up in BGR order.
|
||||
tile.pixels[(3-y)*4+x]=RGB(GetBValue(color),GetGValue(color),GetRValue(color));
|
||||
}
|
||||
if(const auto pattern=CreateDIBPatternBrushPt(&tile,DIB_RGB_COLORS))
|
||||
{
|
||||
const RECT channel{track.left,track.top+height,track.right,track.bottom-height};
|
||||
POINT origin{};
|
||||
SetBrushOrgEx(dc,channel.left,channel.top,&origin);
|
||||
FillRect(dc,&channel,pattern);
|
||||
SetBrushOrgEx(dc,origin.x,origin.y,nullptr);
|
||||
DeleteObject(pattern);
|
||||
}
|
||||
SetDCBrushColor(dc,ink);
|
||||
const auto thumb=position.thumb(track);
|
||||
FillRect(dc,&thumb,brush);
|
||||
const int middle=(track.left+track.right)/2;
|
||||
const int radius=std::max(0,(height-3)/2);
|
||||
for(int row=0;row<=radius;++row)
|
||||
{
|
||||
const int y=track.top+(height-radius-1)/2+row;
|
||||
const int mirrored=track.bottom-1-(y-track.top);
|
||||
const RECT up{middle-row,y,middle+row+1,y+1};
|
||||
const RECT down{middle-row,mirrored,middle+row+1,mirrored+1};
|
||||
FillRect(dc,&up,brush);
|
||||
FillRect(dc,&down,brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
-31
@@ -2,6 +2,7 @@
|
||||
#include "files_text_preferences.h"
|
||||
#include "files_menu_paint.h"
|
||||
#include "files_menu_navigation.h"
|
||||
#include "files_scrollbar.h"
|
||||
#include "files_history_date.h"
|
||||
#include "files_text_document.h"
|
||||
#include "files_text_language.h"
|
||||
@@ -317,10 +318,17 @@ struct FarPopup
|
||||
FarDropDownPalette palette;
|
||||
HFONT font{};
|
||||
int rowHeight{},inset{},visible{},top{},current{},result=-1;
|
||||
int dragOffset=-1;
|
||||
bool done{};
|
||||
|
||||
int rowTop() const { return inset+1+rowHeight/2; }
|
||||
int bottomMargin() const { return inset+1+rowHeight/4; }
|
||||
ScrollPosition scrollPosition() const {return {static_cast<int>(rows.size()),visible,top};}
|
||||
RECT scrollTrack(HWND window,RECT bounds) const
|
||||
{
|
||||
const LONG right=bounds.right-inset-1;
|
||||
return {std::max(bounds.left,right-scrollBarWidth(window)),rowTop(),right,rowTop()+visible*rowHeight};
|
||||
}
|
||||
|
||||
void select(int row)
|
||||
{
|
||||
@@ -370,8 +378,9 @@ struct FarPopup
|
||||
SetTextColor(dc,palette.text);
|
||||
SelectObject(dc,font);
|
||||
const LONG rowLeft=frame.left+inset;
|
||||
const LONG scrollWidth=static_cast<int>(rows.size())>visible?rowHeight/2:0;
|
||||
const LONG rowRight=scrollWidth?bounds.right-scrollWidth:frame.right-1;
|
||||
const auto position=scrollPosition();
|
||||
const auto track=scrollTrack(window,bounds);
|
||||
const LONG rowRight=position.last()?track.left:frame.right-1;
|
||||
LONG y=rowTop();
|
||||
for(int offset=0;offset<visible;++offset,y+=rowHeight)
|
||||
{
|
||||
@@ -400,22 +409,7 @@ struct FarPopup
|
||||
DrawTextW(dc,entry.text.data(),static_cast<int>(entry.text.size()),&box,
|
||||
DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX|DT_END_ELLIPSIS|(entry.index<0?DT_CENTER:DT_LEFT));
|
||||
}
|
||||
if(scrollWidth)
|
||||
{
|
||||
RECT up{rowRight,rowTop(),bounds.right,rowTop()+rowHeight};
|
||||
RECT down{rowRight,y-rowHeight,bounds.right,y};
|
||||
DrawTextW(dc,L"▲",1,&up,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
|
||||
DrawTextW(dc,L"▼",1,&down,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
|
||||
RECT track{up.left,up.bottom,up.right,down.top};
|
||||
for(LONG line=track.top;line<track.bottom;line+=2)
|
||||
for(LONG x=track.left+(line%4==0?0:1);x<track.right;x+=2)
|
||||
SetPixelV(dc,x,line,palette.text);
|
||||
const auto travel=std::max(0L,track.bottom-track.top-rowHeight);
|
||||
const auto thumbY=track.top+MulDiv(top,travel,static_cast<int>(rows.size())-visible);
|
||||
RECT thumb{track.left,thumbY,track.right,std::min(track.bottom,thumbY+rowHeight)};
|
||||
SetDCBrushColor(dc,palette.text);
|
||||
FillRect(dc,&thumb,brush);
|
||||
}
|
||||
if(position.last()) paintScrollBar(dc,track,position,palette.surface);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -482,17 +476,28 @@ LRESULT CALLBACK farPopupWindow(HWND window,UINT message,WPARAM wp,LPARAM lp)
|
||||
RECT bounds{};
|
||||
GetClientRect(window,&bounds);
|
||||
const POINT point{GET_X_LPARAM(lp),GET_Y_LPARAM(lp)};
|
||||
const auto position=state->scrollPosition();
|
||||
const auto track=state->scrollTrack(window,bounds);
|
||||
if(state->dragOffset>=0)
|
||||
{
|
||||
if(message==WM_MOUSEMOVE) state->top=position.drag(track,point.y,state->dragOffset);
|
||||
if(message==WM_LBUTTONUP) state->dragOffset=-1;
|
||||
InvalidateRect(window,nullptr,FALSE);
|
||||
return 0;
|
||||
}
|
||||
if(!PtInRect(&bounds,point))
|
||||
{
|
||||
if(message==WM_LBUTTONDOWN) state->done=true;
|
||||
return 0;
|
||||
}
|
||||
const auto offset=(point.y-state->rowTop())/state->rowHeight;
|
||||
const bool scroll=static_cast<int>(state->rows.size())>state->visible &&
|
||||
point.x>=bounds.right-state->rowHeight/2;
|
||||
const bool scroll=position.last() && PtInRect(&track,point);
|
||||
if(scroll && message==WM_LBUTTONDOWN)
|
||||
state->top=std::clamp(state->top+(offset<state->visible/2?-1:1),0,
|
||||
static_cast<int>(state->rows.size())-state->visible);
|
||||
{
|
||||
const auto thumb=position.thumb(track);
|
||||
if(PtInRect(&thumb,point)) state->dragOffset=point.y-thumb.top;
|
||||
else state->top=position.click(track,point.y);
|
||||
}
|
||||
if(!scroll && point.y>=state->rowTop() && offset<state->visible)
|
||||
{
|
||||
const auto row=state->top+offset;
|
||||
@@ -1542,7 +1547,7 @@ void TextWindow::updatePreview()
|
||||
}
|
||||
if(ctrl && !alt && key==VK_TAB)
|
||||
{
|
||||
PostMessageW(window,cycleWindow,0,0);
|
||||
PostMessageW(window,cycleWindow,(GetKeyState(VK_SHIFT)&0x8000)!=0,0);
|
||||
return true;
|
||||
}
|
||||
if(key==VK_BROWSER_BACK || key==VK_BROWSER_FORWARD || (alt && (key==VK_LEFT || key==VK_RIGHT)))
|
||||
@@ -1674,7 +1679,7 @@ void TextWindow::previewMessage(const std::wstring &value)
|
||||
const auto action=message.at("action").get<std::string>();
|
||||
if(action=="cycle")
|
||||
{
|
||||
PostMessageW(window,cycleWindow,0,0);
|
||||
PostMessageW(window,cycleWindow,message.value("reverse",false),0);
|
||||
return;
|
||||
}
|
||||
if(action=="failed")
|
||||
@@ -2208,7 +2213,7 @@ LRESULT CALLBACK TextWindow::procedure(HWND window, UINT message, WPARAM wparam,
|
||||
return 0;
|
||||
}
|
||||
case WM_SETFOCUS: self->focusContent(); return 0;
|
||||
case cycleWindow: cycleTextWindows(window); return 0;
|
||||
case cycleWindow: cycleTextWindows(window,wparam!=0); return 0;
|
||||
case WM_KEYDOWN:
|
||||
if(self->previewWanted && !self->previewVisible)
|
||||
{
|
||||
@@ -2407,7 +2412,7 @@ void textWindowOwnerClosed()
|
||||
if(textWindows.empty()) PostQuitMessage(0);
|
||||
}
|
||||
|
||||
bool cycleTextWindows(HWND current)
|
||||
bool cycleTextWindows(HWND current,bool reverse)
|
||||
{
|
||||
if(!current || (current!=filesOwner && !textWindows.contains(current))) return false;
|
||||
std::vector<HWND> windows;
|
||||
@@ -2417,11 +2422,12 @@ bool cycleTextWindows(HWND current)
|
||||
if(windows.size()<2) return false;
|
||||
const auto from=std::find(windows.begin(),windows.end(),current);
|
||||
if(from==windows.end()) return false;
|
||||
auto to=std::next(from);
|
||||
if(to==windows.end()) to=windows.begin();
|
||||
if(IsIconic(*to)) ShowWindow(*to,SW_RESTORE);
|
||||
SetForegroundWindow(*to);
|
||||
if(*to!=filesOwner) SendMessageW(*to,WM_SETFOCUS,0,0);
|
||||
const auto index=static_cast<size_t>(from-windows.begin());
|
||||
const auto step=reverse?windows.size()-1:1;
|
||||
const auto target=windows[(index+step)%windows.size()];
|
||||
if(IsIconic(target)) ShowWindow(target,SW_RESTORE);
|
||||
SetForegroundWindow(target);
|
||||
if(target!=filesOwner) SendMessageW(target,WM_SETFOCUS,0,0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,5 +54,5 @@ struct TextDialogs
|
||||
void openTextWindow(HWND owner,const std::filesystem::path &path,bool edit,TextDialogs dialogs,
|
||||
const lan::FilesPeer *peer=nullptr,std::string_view fragment={},bool newWindow=false);
|
||||
void textWindowOwnerClosed();
|
||||
bool cycleTextWindows(HWND current);
|
||||
bool cycleTextWindows(HWND current,bool reverse);
|
||||
}
|
||||
+3
-2
@@ -269,8 +269,9 @@ void validateSettings(const Settings &s)
|
||||
if (alphabet.empty() || words.size() > 10000)
|
||||
throw std::runtime_error("Invalid personal dictionary language or too many words");
|
||||
for (const auto &word : words)
|
||||
if (word.empty() || word.size() > 32 || lower(word).find_first_not_of(alphabet) != word.npos)
|
||||
throw std::runtime_error("Personal words must contain 1-32 letters of their selected language");
|
||||
if (!validPersonalWord(word, alphabet))
|
||||
throw std::runtime_error("Personal words must be 1-32 characters, with letters of the selected language. "
|
||||
"A hyphen (-) is allowed between letters.");
|
||||
}
|
||||
if (s.maxItems < 10 || s.maxItems > 10000 || s.maxMiB < 1 || s.maxMiB > 2048 || s.maxImageMiB < 1 ||
|
||||
s.maxImageMiB > 64)
|
||||
|
||||
+1
-1
@@ -1705,7 +1705,7 @@ void showAutoOptions(HWND parent, SettingsView *v)
|
||||
label(w, L"Never correct these words (comma-separated)", 18, 184, 525);
|
||||
edit(w, 405, 18, 212, 524, 52, ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL);
|
||||
value(w, 405, commaList(v->draft.autoNever));
|
||||
label(w, L"My dictionary: correct words, separated by commas or new lines", 18, 276, 525);
|
||||
label(w, L"My dictionary: separate words by commas or new lines. Internal hyphens allowed.", 18, 276, 525);
|
||||
for (auto [id, language] : {std::pair{411, L"en"}, {412, L"uk"}, {413, L"ru"}})
|
||||
{
|
||||
int x = 18 + (id - 411) * 178;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "platform.h"
|
||||
namespace ks
|
||||
{
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.108";
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.112";
|
||||
inline constexpr UINT UpdateMessage = WM_APP + 7;
|
||||
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
|
||||
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
param(
|
||||
[string]$Executable = "$PSScriptRoot/../build/files-cmake/KSwitcher.Files.exe",
|
||||
[string]$Screenshot
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type @'
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
public static class FilesShortcutWindow {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rect { public int Left, Top, Right, Bottom; }
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Point { public int X, Y; }
|
||||
[DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
|
||||
[DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr window);
|
||||
[DllImport("user32.dll")] static extern void keybd_event(byte key, byte scan, uint flags, UIntPtr extra);
|
||||
[DllImport("user32.dll")] public static extern IntPtr GetWindow(IntPtr window, uint command);
|
||||
[DllImport("user32.dll")] public static extern IntPtr GetDlgItem(IntPtr window, int id);
|
||||
[DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr window);
|
||||
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr window, out Rect rect);
|
||||
[DllImport("user32.dll")] public static extern uint GetDpiForWindow(IntPtr window);
|
||||
[DllImport("user32.dll")] public static extern IntPtr SetThreadDpiAwarenessContext(IntPtr context);
|
||||
[DllImport("user32.dll")] public static extern bool ScreenToClient(IntPtr window, ref Point point);
|
||||
[DllImport("user32.dll", EntryPoint="SendMessageW")]
|
||||
public static extern IntPtr Send(IntPtr window, uint message, IntPtr w, IntPtr l);
|
||||
[DllImport("user32.dll", CharSet=CharSet.Unicode)]
|
||||
public static extern IntPtr SendMessage(IntPtr window, uint msg, IntPtr w, StringBuilder text);
|
||||
public static bool Activate(IntPtr window) {
|
||||
if (GetForegroundWindow() == window) return true;
|
||||
keybd_event(0x12, 0, 0, UIntPtr.Zero);
|
||||
keybd_event(0x12, 0, 2, UIntPtr.Zero);
|
||||
SetForegroundWindow(window);
|
||||
return GetForegroundWindow() == window;
|
||||
}
|
||||
}
|
||||
'@
|
||||
function Wait-Until([scriptblock]$Condition) {
|
||||
for ($attempt = 0; $attempt -lt 100; $attempt++) {
|
||||
if (& $Condition) { return }
|
||||
Start-Sleep -Milliseconds 50
|
||||
}
|
||||
throw "Timed out waiting for: $Condition"
|
||||
}
|
||||
function Read-Text($Control, $Message = 13, $Parameter = 2048) {
|
||||
$buffer = [Text.StringBuilder]::new(2048)
|
||||
[void][FilesShortcutWindow]::SendMessage($Control, $Message, [IntPtr]$Parameter, $buffer)
|
||||
$buffer.ToString()
|
||||
}
|
||||
function Read-ShortcutDialog {
|
||||
$foreground = [FilesShortcutWindow]::GetForegroundWindow()
|
||||
if ([FilesShortcutWindow]::GetWindow($foreground, 4) -eq $window -and
|
||||
[FilesShortcutWindow]::GetDlgItem($foreground, 310) -ne [IntPtr]::Zero) { return $foreground }
|
||||
return [IntPtr]::Zero
|
||||
}
|
||||
|
||||
$exe = (Resolve-Path $Executable).Path
|
||||
$key = [Microsoft.Win32.Registry]::CurrentUser.CreateSubKey('Software\KSwitcher\Files')
|
||||
$saved = @{}
|
||||
$names = 'FolderShortcuts', 'LeftWide', 'RightWide', 'LeftPath', 'RightPath', 'LeftCursor', 'RightCursor', 'WindowPlacement'
|
||||
foreach ($name in $names) {
|
||||
if ($name -in $key.GetValueNames()) { $saved[$name] = @($key.GetValue($name), $key.GetValueKind($name)) }
|
||||
}
|
||||
$folder = [IO.Directory]::CreateTempSubdirectory('ks-files-shortcuts-').FullName
|
||||
$previousDpi = [FilesShortcutWindow]::SetThreadDpiAwarenessContext([IntPtr](-4))
|
||||
try {
|
||||
$groups = [object[]]::new(10)
|
||||
for ($digit = 0; $digit -lt 10; $digit++) { $groups[$digit] = @() }
|
||||
foreach ($entry in @(@(3, 'Three'), @(4, 'Four'), @(8, 'Eight A'), @(8, 'Eight B'))) {
|
||||
$path = [IO.Directory]::CreateDirectory((Join-Path $folder $entry[1])).FullName
|
||||
$groups[$entry[0]] += @{ path = $path; peer = ''; name = ''; title = $entry[1] }
|
||||
}
|
||||
$groups[9] = @(1..200 | ForEach-Object {
|
||||
@{ path = (Join-Path $folder "Folder $_"); peer = ''; name = ''; title = "Folder $_" }
|
||||
})
|
||||
$key.SetValue('FolderShortcuts', [Text.Encoding]::UTF8.GetBytes((ConvertTo-Json -InputObject $groups -Depth 4)), 'Binary')
|
||||
foreach ($name in 'LeftWide', 'RightWide') { $key.SetValue($name, 1, 'DWord') }
|
||||
foreach ($name in 'LeftPath', 'RightPath') { $key.SetValue($name, $folder, 'String') }
|
||||
$key.DeleteValue('WindowPlacement', $false)
|
||||
|
||||
$process = Start-Process -FilePath $exe -PassThru
|
||||
$keyboard = New-Object -ComObject WScript.Shell
|
||||
Wait-Until { $process.Refresh(); $process.MainWindowHandle -ne [IntPtr]::Zero }
|
||||
$window = $process.MainWindowHandle
|
||||
Wait-Until { [FilesShortcutWindow]::Activate($window) }
|
||||
$heading = [FilesShortcutWindow]::GetDlgItem($window, 140)
|
||||
$rightHeading = [FilesShortcutWindow]::GetDlgItem($window, 141)
|
||||
$leftPath = [FilesShortcutWindow]::GetDlgItem($window, 142)
|
||||
Wait-Until { (Read-Text $leftPath) -eq $folder }
|
||||
|
||||
$keyboard.SendKeys('^8')
|
||||
Wait-Until { (Read-ShortcutDialog) -ne [IntPtr]::Zero }
|
||||
$dialog = Read-ShortcutDialog
|
||||
$list = [FilesShortcutWindow]::GetDlgItem($dialog, 310)
|
||||
$count = [FilesShortcutWindow]::SendMessage($list, 395, [IntPtr]::Zero, $null).ToInt32()
|
||||
$rows = for ($row = 0; $row -lt $count; $row++) { Read-Text $list 393 $row }
|
||||
if (($rows -join '|') -cne 'Eight A|Eight B') {
|
||||
throw "Ctrl+8 should display only its two assigned folders. Actual rows: $($rows -join ' | ')"
|
||||
}
|
||||
if ($Screenshot) {
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
$bounds = [FilesShortcutWindow+Rect]::new()
|
||||
if (![FilesShortcutWindow]::GetWindowRect($dialog, [ref]$bounds)) { throw 'Cannot locate the rendered popup.' }
|
||||
$bitmap = [Drawing.Bitmap]::new(($bounds.Right - $bounds.Left), ($bounds.Bottom - $bounds.Top))
|
||||
try {
|
||||
$graphics = [Drawing.Graphics]::FromImage($bitmap)
|
||||
try { $graphics.CopyFromScreen($bounds.Left, $bounds.Top, 0, 0, $bitmap.Size) }
|
||||
finally { $graphics.Dispose() }
|
||||
$bitmap.Save($Screenshot, [Drawing.Imaging.ImageFormat]::Png)
|
||||
} finally { $bitmap.Dispose() }
|
||||
}
|
||||
$keyboard.SendKeys('{ESC}')
|
||||
Wait-Until { [FilesShortcutWindow]::GetForegroundWindow() -eq $window }
|
||||
$keyboard.SendKeys('^4')
|
||||
Wait-Until { (Read-Text $leftPath) -eq (Join-Path $folder 'Four') }
|
||||
if (![FilesShortcutWindow]::IsWindowVisible($heading)) { throw 'Ctrl+4 changed panel mode.' }
|
||||
$keyboard.SendKeys('^{TAB}')
|
||||
$keyboard.SendKeys('^{F1}')
|
||||
Wait-Until {
|
||||
![FilesShortcutWindow]::IsWindowVisible($heading) -or
|
||||
![FilesShortcutWindow]::IsWindowVisible($rightHeading)
|
||||
}
|
||||
if (![FilesShortcutWindow]::IsWindowVisible($rightHeading)) {
|
||||
throw 'Ctrl+Tab changed the active panel.'
|
||||
}
|
||||
$keyboard.SendKeys('{TAB}')
|
||||
$keyboard.SendKeys('^{F1}')
|
||||
Wait-Until { ![FilesShortcutWindow]::IsWindowVisible($rightHeading) }
|
||||
$keyboard.SendKeys('^{F2}')
|
||||
Wait-Until { [FilesShortcutWindow]::IsWindowVisible($rightHeading) }
|
||||
$keyboard.SendKeys('{TAB}')
|
||||
Wait-Until { ![FilesShortcutWindow]::IsWindowVisible($heading) }
|
||||
|
||||
$rightPath = [FilesShortcutWindow]::GetDlgItem($window, 143)
|
||||
$leftList = [FilesShortcutWindow]::GetDlgItem($window, 102)
|
||||
$rightList = [FilesShortcutWindow]::GetDlgItem($window, 103)
|
||||
$keyboard.SendKeys('^u')
|
||||
Wait-Until {
|
||||
(Read-Text ([FilesShortcutWindow]::GetDlgItem($window, 142))) -eq $folder -and
|
||||
(Read-Text ([FilesShortcutWindow]::GetDlgItem($window, 143))) -eq (Join-Path $folder 'Four') -and
|
||||
[FilesShortcutWindow]::IsWindowVisible($rightHeading)
|
||||
}
|
||||
$movedLeft = [FilesShortcutWindow+Rect]::new()
|
||||
$movedRight = [FilesShortcutWindow+Rect]::new()
|
||||
if (![FilesShortcutWindow]::GetWindowRect($rightList, [ref]$movedLeft) -or
|
||||
![FilesShortcutWindow]::GetWindowRect($leftList, [ref]$movedRight) -or
|
||||
$movedLeft.Right -gt $movedRight.Left -or
|
||||
[FilesShortcutWindow]::IsWindowVisible($heading)) {
|
||||
throw 'Ctrl+U did not move the visible panel lists with their modes.'
|
||||
}
|
||||
$keyboard.SendKeys('^3')
|
||||
Wait-Until { (Read-Text $leftPath) -eq (Join-Path $folder 'Three') }
|
||||
if ((Read-Text $rightPath) -ne $folder) { throw 'Ctrl+U did not preserve the active panel.' }
|
||||
$keyboard.SendKeys('^u')
|
||||
Wait-Until { [FilesShortcutWindow]::GetDlgItem($window, 142) -eq $leftPath }
|
||||
$keyboard.SendKeys('^{F2}')
|
||||
Wait-Until { [FilesShortcutWindow]::IsWindowVisible($heading) }
|
||||
|
||||
$keyboard.SendKeys('^9')
|
||||
Wait-Until { (Read-ShortcutDialog) -ne [IntPtr]::Zero }
|
||||
$dialog = Read-ShortcutDialog
|
||||
$list = [FilesShortcutWindow]::GetDlgItem($dialog, 310)
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
$bounds = [FilesShortcutWindow+Rect]::new()
|
||||
if (![FilesShortcutWindow]::GetWindowRect($list, [ref]$bounds)) { throw 'Missing overflow list.' }
|
||||
Start-Sleep -Milliseconds 150
|
||||
$barWidth = [int][Math]::Round(12 * [FilesShortcutWindow]::GetDpiForWindow($list) / 96)
|
||||
$bitmap = [Drawing.Bitmap]::new($barWidth, ($bounds.Bottom - $bounds.Top))
|
||||
try {
|
||||
$graphics = [Drawing.Graphics]::FromImage($bitmap)
|
||||
try { $graphics.CopyFromScreen($bounds.Right, $bounds.Top, 0, 0, $bitmap.Size) }
|
||||
finally { $graphics.Dispose() }
|
||||
$background = $bitmap.GetPixel(0, 0)
|
||||
$thumb = $bitmap.GetPixel(0, $barWidth + 1)
|
||||
$trackColors = @(0..4 | ForEach-Object {
|
||||
$x = $_
|
||||
0..7 | ForEach-Object { $bitmap.GetPixel($x, [int]($bitmap.Height / 2) + $_).ToArgb() }
|
||||
} | Sort-Object -Unique)
|
||||
$hasArrow = {
|
||||
param($y)
|
||||
$center = [int][Math]::Floor($barWidth / 2)
|
||||
@(0..($barWidth - 1) | Where-Object {
|
||||
$bitmap.GetPixel($center, $y + $_).ToArgb() -eq $thumb.ToArgb()
|
||||
}).Count -gt 0
|
||||
}
|
||||
if ($thumb.GetBrightness() -le $background.GetBrightness() -or $trackColors.Count -ne 2 -or
|
||||
!(& $hasArrow 0) -or !(& $hasArrow ($bitmap.Height - $barWidth))) {
|
||||
throw "Unexpected scrollbar pixels. Background $background, thumb $thumb, track colors $($trackColors.Count), arrows $(& $hasArrow 0)/$(& $hasArrow ($bitmap.Height - $barWidth))."
|
||||
}
|
||||
} finally { $bitmap.Dispose() }
|
||||
$arrow = [FilesShortcutWindow+Point]::new()
|
||||
$arrow.X = $bounds.Right + [int]($barWidth / 2)
|
||||
$arrow.Y = $bounds.Bottom - [int]($barWidth / 2)
|
||||
if (![FilesShortcutWindow]::ScreenToClient($dialog, [ref]$arrow)) { throw 'Cannot locate the down arrow.' }
|
||||
$arrowPoint = [IntPtr](($arrow.Y -shl 16) -bor $arrow.X)
|
||||
[void][FilesShortcutWindow]::Send($dialog, 0x0201, [IntPtr]1, $arrowPoint)
|
||||
if ([FilesShortcutWindow]::Send($list, 0x018E, [IntPtr]::Zero, [IntPtr]::Zero).ToInt32() -ne 1) {
|
||||
throw 'The down arrow should scroll the list by one row.'
|
||||
}
|
||||
$grip = [FilesShortcutWindow+Point]::new()
|
||||
$grip.X = $bounds.Right + [int]($barWidth / 2)
|
||||
$grip.Y = $bounds.Top + $barWidth + 4
|
||||
if (![FilesShortcutWindow]::ScreenToClient($dialog, [ref]$grip)) { throw 'Cannot locate the thumb.' }
|
||||
$gripPoint = [IntPtr](($grip.Y -shl 16) -bor $grip.X)
|
||||
$dragPoint = [IntPtr]((($grip.Y + 3 * $barWidth) -shl 16) -bor $grip.X)
|
||||
[void][FilesShortcutWindow]::Send($dialog, 0x0201, [IntPtr]1, $gripPoint)
|
||||
[void][FilesShortcutWindow]::Send($dialog, 0x0200, [IntPtr]1, $dragPoint)
|
||||
[void][FilesShortcutWindow]::Send($dialog, 0x0202, [IntPtr]::Zero, $dragPoint)
|
||||
if ([FilesShortcutWindow]::Send($list, 0x018E, [IntPtr]::Zero, [IntPtr]::Zero).ToInt32() -le 1) {
|
||||
throw 'Dragging the scrollbar thumb should advance the list.'
|
||||
}
|
||||
$keyboard.SendKeys('{ESC}')
|
||||
Write-Output 'Verified folder shortcuts, panel swapping, and the rendered overflow scrollbar.'
|
||||
} finally {
|
||||
if ($previousDpi) { [void][FilesShortcutWindow]::SetThreadDpiAwarenessContext($previousDpi) }
|
||||
if ($process -and !$process.HasExited) {
|
||||
$keyboard.SendKeys('{ESC}')
|
||||
if (!$process.CloseMainWindow() -or !$process.WaitForExit(2500)) { $process.Kill(); $process.WaitForExit() }
|
||||
}
|
||||
foreach ($name in $names) {
|
||||
if ($saved.ContainsKey($name)) { $key.SetValue($name, $saved[$name][0], $saved[$name][1]) }
|
||||
else { $key.DeleteValue($name, $false) }
|
||||
}
|
||||
$key.Dispose()
|
||||
[IO.Directory]::Delete($folder, $true)
|
||||
}
|
||||
@@ -54,10 +54,12 @@ public static class MarkdownUi {
|
||||
keybd_event(0x12,0,2,UIntPtr.Zero);
|
||||
SetForegroundWindow(window);
|
||||
}
|
||||
public static void CycleWindow() {
|
||||
public static void CycleWindow(bool reverse = false) {
|
||||
keybd_event(0x11,0,0,UIntPtr.Zero);
|
||||
if (reverse) keybd_event(0x10,0,0,UIntPtr.Zero);
|
||||
keybd_event(0x09,0,0,UIntPtr.Zero);
|
||||
keybd_event(0x09,0,2,UIntPtr.Zero);
|
||||
if (reverse) keybd_event(0x10,0,2,UIntPtr.Zero);
|
||||
keybd_event(0x11,0,2,UIntPtr.Zero);
|
||||
}
|
||||
[DllImport("user32.dll")] public static extern IntPtr GetDlgItem(IntPtr window, int id);
|
||||
@@ -328,8 +330,19 @@ const value = 42;
|
||||
Wait-Foreground $window
|
||||
Browser 'cycle' '' 'Preview.md'
|
||||
Wait-Foreground $child
|
||||
Browser 'cycle-reverse' '' 'Other.md'
|
||||
Wait-Foreground $window
|
||||
Browser 'edit' '' 'Preview.md'
|
||||
[void](Wait-For 'the first window to switch to Editor' { Find-Window 'KSwitcher.Files.Text' 'Editor' })
|
||||
[MarkdownUi]::CycleWindow($true)
|
||||
Wait-Foreground $main
|
||||
[MarkdownUi]::CycleWindow($true)
|
||||
Wait-Foreground $child
|
||||
Write-Output 'Verified backward Ctrl+Shift+Tab cycling through three windows and wrapping at Files.'
|
||||
Browser 'close' '' 'Other.md'
|
||||
[void](Wait-For 'Ctrl+W to close the Shift+click window' { ![MarkdownUi]::IsWindowVisible($child) })
|
||||
Post (Scintilla $window) 0x100 0x75
|
||||
Browser 'Перегляд Markdown' '' 'Preview.md'
|
||||
Browser 'follow'
|
||||
if ((Wait-For 'the in-place Markdown viewer' { Find-Window 'KSwitcher.Files.Text' 'Other.md' }) -ne $window) {
|
||||
throw 'A normal click did not stay in the same window.'
|
||||
|
||||
@@ -209,8 +209,9 @@ try {
|
||||
} else if (scenario === 'back' || scenario === 'forward') {
|
||||
await waitFor(() => evaluate(`!document.getElementById('${scenario}').disabled`), scenario);
|
||||
await evaluate(`document.getElementById('${scenario}').click()`);
|
||||
} else if (scenario === 'cycle') {
|
||||
await command('Input.dispatchKeyEvent', {type:'keyDown', key:'Tab', code:'Tab', modifiers:2, windowsVirtualKeyCode:9});
|
||||
} else if (scenario === 'cycle' || scenario === 'cycle-reverse') {
|
||||
const modifiers = scenario === 'cycle-reverse' ? 10 : 2;
|
||||
await command('Input.dispatchKeyEvent', {type:'keyDown', key:'Tab', code:'Tab', modifiers, windowsVirtualKeyCode:9});
|
||||
} else if (scenario === 'close') {
|
||||
await command('Input.dispatchKeyEvent', {type:'keyDown', key:'w', code:'KeyW', modifiers:2, windowsVirtualKeyCode:87});
|
||||
} else {
|
||||
|
||||
@@ -262,6 +262,33 @@ try {
|
||||
$main = Wait-Until { Find-Window 'KSwitcher.Files' $process.Id }
|
||||
$leftPanel=[SearchArrowTest]::GetDlgItem($main,102)
|
||||
$rightPanel=[SearchArrowTest]::GetDlgItem($main,103)
|
||||
# Initial directory scans repaint both panels when their results arrive.
|
||||
[void](Wait-Until {
|
||||
[SearchArrowTest]::SendText($leftPanel,0x1A2,-1,'A.txt').ToInt64() -ge 0 -and
|
||||
[SearchArrowTest]::SendText($rightPanel,0x1A2,-1,'A.txt').ToInt64() -ge 0
|
||||
})
|
||||
if (!$KeyboardCursorOnly) {
|
||||
$leftPath = [SearchArrowTest]::GetDlgItem($main,142)
|
||||
foreach ($step in @(@{ Row='[Right fixture]'; Path=$rightFixture }, @{ Row='..'; Path=$scratch })) {
|
||||
Select-Row $leftPanel $step.Row
|
||||
Start-Sleep -Milliseconds 150
|
||||
$lineCount = @(Get-Content -LiteralPath $paintTrace).Count
|
||||
Post $leftPanel 0x100 13
|
||||
[void](Wait-Until {
|
||||
$path = [Text.StringBuilder]::new(1024)
|
||||
[void][SearchArrowTest]::GetText($leftPath,0xD,$path.Capacity,$path)
|
||||
$path.ToString() -eq $step.Path
|
||||
})
|
||||
[void](Wait-Until {
|
||||
$highlight = Read-PanelHighlights $paintTrace $lineCount
|
||||
@($highlight.Keys -like '0/*').Count -gt 0
|
||||
})
|
||||
Start-Sleep -Milliseconds 150
|
||||
$draws = (Read-PanelHighlights $paintTrace $lineCount).Keys
|
||||
if ($draws -like '1/*') { throw "Opening $($step.Row) repainted rows in the other panel." }
|
||||
}
|
||||
Write-Output 'Verified folder navigation repaints only the panel that changes directories.'
|
||||
}
|
||||
$clicks=if(!$KeyboardCursorOnly){
|
||||
@(@{Panel=$leftPanel; Index=0},@{Panel=$rightPanel; Index=1},@{Panel=$rightPanel; Index=1})
|
||||
}
|
||||
@@ -319,22 +346,7 @@ try {
|
||||
Post $commandMenu 0x100 27
|
||||
[void](Wait-Until { ![SearchArrowTest]::IsWindowVisible($commandMenu) })
|
||||
Write-Output 'Verified Commands grouping, arrow navigation, and inert separators.'
|
||||
$panel = Wait-Until { $handle = [SearchArrowTest]::GetDlgItem($main,102); if ($handle -ne [IntPtr]::Zero) { $handle } }
|
||||
$pathControl = [SearchArrowTest]::GetDlgItem($main,142)
|
||||
$pathText = [Text.StringBuilder]::new(1024)
|
||||
[void][SearchArrowTest]::GetText($pathControl,0xD,$pathText.Capacity,$pathText)
|
||||
$path=$pathText.ToString()
|
||||
if ([IO.Path]::GetPathRoot($path) -ne [IO.Path]::GetPathRoot($scratch)) {
|
||||
throw 'Select a local left-panel folder on the test executable drive before running this interactive test.'
|
||||
}
|
||||
foreach ($component in $path.Substring(3).Split('\',[System.StringSplitOptions]::RemoveEmptyEntries)) {
|
||||
Select-Row $panel '..'
|
||||
[void][SearchArrowTest]::Send($panel,0x100,13,0)
|
||||
}
|
||||
foreach ($component in $scratch.Substring(3).Split('\')) {
|
||||
Select-Row $panel "[$component]"
|
||||
[void][SearchArrowTest]::Send($panel,0x100,13,0)
|
||||
}
|
||||
$panel = $leftPanel
|
||||
$fixtureRow=[SearchArrowTest]::SendText($panel,0x1A2,-1,([IO.Path]::GetFileName($fixture))).ToInt32()
|
||||
Click-PanelRow $panel $fixtureRow
|
||||
[void](Wait-Until { [SearchArrowTest]::Send($panel,0x188,0,0).ToInt32() -eq $fixtureRow })
|
||||
@@ -421,10 +433,10 @@ try {
|
||||
if (!(Test-Path -LiteralPath (Join-Path $scratch $newFolder) -PathType Container)) {
|
||||
throw 'F7 did not create the folder in the active panel.'
|
||||
}
|
||||
$newRow=[SearchArrowTest]::SendText($panel,0x1A2,-1,"[$newFolder]")
|
||||
if ($newRow.ToInt64() -lt 0 -or [SearchArrowTest]::Send($panel,0x188,0,0) -ne $newRow) {
|
||||
throw 'F7 did not select the new folder.'
|
||||
}
|
||||
[void](Wait-Until {
|
||||
$newRow=[SearchArrowTest]::SendText($panel,0x1A2,-1,"[$newFolder]")
|
||||
$newRow.ToInt64() -ge 0 -and [SearchArrowTest]::Send($panel,0x188,0,0) -eq $newRow
|
||||
})
|
||||
Post $main 0x111 115
|
||||
$makeDialog=Wait-Until { Find-Window '#32770' $process.Id 361 }
|
||||
$nameField=[SearchArrowTest]::GetDlgItem($makeDialog,361)
|
||||
@@ -526,6 +538,10 @@ try {
|
||||
!(Test-Path -LiteralPath (Join-Path $linkPath 'link-target.txt') -PathType Leaf)) {
|
||||
throw "F7 did not create a $expected pointing to Alpha."
|
||||
}
|
||||
[void](Wait-Until {
|
||||
$linkRow = [SearchArrowTest]::SendText($panel,0x1A2,-1,"[$linkName]")
|
||||
$linkRow.ToInt64() -ge 0 -and [SearchArrowTest]::Send($panel,0x188,0,0) -eq $linkRow
|
||||
})
|
||||
}
|
||||
Write-Output 'Verified F7 history, quoted batch names, and directory link handling.'
|
||||
Select-Row $panel ([IO.Path]::GetFileName($fixture))
|
||||
@@ -649,6 +665,7 @@ try {
|
||||
} finally { $bitmap.Dispose() }
|
||||
}
|
||||
|
||||
Select-Row $panel ([IO.Path]::GetFileName($fixture))
|
||||
Post $panel 0x100 0x73
|
||||
$editor=Wait-Until { Find-Window 'KSwitcher.Files.Text' $process.Id }
|
||||
$firstControl=[SearchArrowTest]::FindWindowEx($editor,0,'Scintilla',[System.Management.Automation.Language.NullString]::Value)
|
||||
@@ -684,8 +701,8 @@ try {
|
||||
if ([SearchArrowTest]::GetWindow($otherEditor,4) -ne [IntPtr]::Zero) { throw 'The second editor is owned.' }
|
||||
$editorIdentity=[SearchArrowTest]::TaskbarIdentity($editor)
|
||||
$otherIdentity=[SearchArrowTest]::TaskbarIdentity($otherEditor)
|
||||
if (!$editorIdentity -or !$otherIdentity -or $editorIdentity -eq $otherIdentity) {
|
||||
throw 'Editor windows do not have distinct Windows taskbar identities.'
|
||||
if ($editorIdentity -cne 'HrynCo.KSwitcher.Files.Editor' -or $otherIdentity -cne $editorIdentity) {
|
||||
throw 'Both editor windows must use the Editor group on the Windows taskbar.'
|
||||
}
|
||||
Post $otherEditor 0x10 0
|
||||
[void](Wait-Until { ![SearchArrowTest]::IsWindow($otherEditor) })
|
||||
|
||||
+26
-1
@@ -399,6 +399,25 @@ int main(int argc, char **argv)
|
||||
require(!supplemental.suggest(L"релызик ", 1, layouts, options),
|
||||
"never-correct list takes precedence over personal word");
|
||||
options.autoNever.clear();
|
||||
options.autoWords[L"en"] = {L"test-mt", L"dev-mt"};
|
||||
auto hyphenated = supplemental.suggest(L"Еуые-ье ", 1, layouts, options);
|
||||
require(hyphenated && hyphenated->text == L"Test-mt " && hyphenated->target == 0,
|
||||
"hyphenated personal word corrects from the wrong layout");
|
||||
options.autoMinLength = 2;
|
||||
require(!supplemental.suggest(L"ЙФ ", 2, layouts, options),
|
||||
"uppercase layout correction requires a personal dictionary entry");
|
||||
options.autoWords[L"en"].push_back(L"qa");
|
||||
auto acronym = supplemental.suggest(L"(ЙФ)! ", 2, layouts, options);
|
||||
require(acronym && acronym->text == L"(QA)! " && acronym->target == 0,
|
||||
"uppercase personal acronym corrects without changing case or punctuation");
|
||||
require(!supplemental.suggest(L"йФ ", 2, layouts, options),
|
||||
"mixed-case personal words remain protected");
|
||||
auto uppercaseHyphenated = supplemental.suggest(L"ЕУЫЕ-ЬЕ ", 1, layouts, options);
|
||||
require(uppercaseHyphenated && uppercaseHyphenated->text == L"TEST-MT ",
|
||||
"uppercase hyphenated personal words correct without changing case");
|
||||
options.autoMinLength = 3;
|
||||
require(!supplemental.suggest(L"ЙФ ", 2, layouts, options),
|
||||
"uppercase personal words respect minimum length");
|
||||
options.autoWords[L"uk"].push_back(L"робить");
|
||||
auto commaWord = supplemental.suggest(L"hj,bnm ", 0, layouts, options);
|
||||
require(commaWord && commaWord->text == L"робить " && commaWord->target == 2,
|
||||
@@ -739,7 +758,7 @@ int main(int argc, char **argv)
|
||||
settings.autoPrefixChars = L"(#";
|
||||
settings.autoSuffixChars = L");%";
|
||||
settings.autoNever = {L"myWord"};
|
||||
settings.autoWords = {{L"uk", {L"релізик"}}, {L"en", {L"kswitcher"}}};
|
||||
settings.autoWords = {{L"uk", {L"релізик"}}, {L"en", {L"kswitcher", L"test-mt", L"dev-mt"}}};
|
||||
settings.autoExcluded = {L"Code.exe"};
|
||||
settings.cycle = {L"en", L"uk"};
|
||||
settings.snippets = {{L";address", L"Line 1\r\n{cursor}Line 2"}};
|
||||
@@ -765,6 +784,12 @@ int main(int argc, char **argv)
|
||||
auto invalidWords = settings;
|
||||
invalidWords.autoWords[L"uk"] = {L"hello"};
|
||||
rejects([&] { ks::validateSettings(invalidWords); }, "personal dictionary rejects wrong language letters");
|
||||
for (const auto *word : {L"-test", L"test-", L"test--mt", L"test-і"})
|
||||
{
|
||||
invalidWords = settings;
|
||||
invalidWords.autoWords[L"en"] = {word};
|
||||
rejects([&] { ks::validateSettings(invalidWords); }, "personal dictionary rejects malformed hyphenated words");
|
||||
}
|
||||
require(ks::encodeSettings(ks::decodeSettings(ks::encodeSettings(settings), {})) == ks::encodeSettings(settings),
|
||||
"configurator snapshot survives serialization without changing the concurrency token");
|
||||
rejects([&] { ks::decodeSettings(ks::Bytes{'{', '}'}, {}); },
|
||||
|
||||
Reference in new issue
Block a user