diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2017-11-28 22:12:43 +0300 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2017-11-28 22:12:43 +0300 |
commit | 80221d816eeb98f0df38e0243390033c614952f3 (patch) | |
tree | 7618176108093921b6934343bc2f76a66ea97730 /plugins/ChangeKeyboardLayout | |
parent | 25df99ba7462958f2cb9075020ec1c9a5a7c9f50 (diff) |
Source files converted to utf-8
Diffstat (limited to 'plugins/ChangeKeyboardLayout')
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/hook_events.cpp | 12 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/options.cpp | 32 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/stdafx.h | 10 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/text_operations.cpp | 36 | ||||
-rw-r--r-- | plugins/ChangeKeyboardLayout/src/version.h | 2 |
5 files changed, 46 insertions, 46 deletions
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index 0ec26cf5f8..77917a3851 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -97,7 +97,7 @@ int ModulesLoaded(WPARAM, LPARAM) {
LPCTSTR ptszEmptySting = L"";
- // . - .
+ // Заполняем конфигурационные строки из базы. Если их там нет - генерируем.
for (int i = 0; i < bLayNum; i++) {
LPTSTR ptszCurrLayout = GenerateLayoutString(hklLayouts[i]);
LPSTR ptszTemp = GetNameOfLayout(hklLayouts[i]);
@@ -115,17 +115,17 @@ int ModulesLoaded(WPARAM, LPARAM) mir_free(ptszTemp);
}
- //
+ // Прочитаем основные настройки
ReadMainOptions();
- //
+ // Прочитаем настройки попапов
ReadPopupOptions();
- //
+ // Зарегим звук
Skin_AddSound(SND_ChangeLayout, ModuleNameW, LPGENW("Changing Layout"));
Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case"));
- //
+ // Хук на нажатие клавиши
kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId());
CreateServiceFunction(MS_CKL_CHANGELAYOUT, APIChangeLayout);
@@ -171,7 +171,7 @@ LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam) if ((wParam != VK_SHIFT) && (wParam != VK_MENU) && (wParam != VK_CONTROL) && (wParam != VK_LWIN) && (wParam != VK_RWIN))
lcode += wParam;
- // . - , 1.4
+ // Проверка на пустой хоткей. Иначе - пиздец, как в версии 1.4
if (lcode != 0) {
if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam & 0x40000000))) {
ChangeLayout(nullptr, TOT_Layout, moOptions.CurrentWordLayout);
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index b91115217a..1833095662 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -12,13 +12,13 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP MainDialogLock = TRUE;
TranslateDialogDefault(hWnd);
- //
- // ,
+ //Горячие клавиши
+ // Запрещаем вводить в контролы все, кроме обычных кнопок
SendDlgItemMessage(hWnd, IDC_HOTKEY_LAYOUT, HKM_SETRULES, 0xFF, 0);
SendDlgItemMessage(hWnd, IDC_HOTKEY_LAYOUT2, HKM_SETRULES, 0xFF, 0);
SendDlgItemMessage(hWnd, IDC_HOTKEY_CASE, HKM_SETRULES, 0xFF, 0);
- //
+ //Отображаем управляющие клавиши
CheckDlgButton(hWnd, IDC_CHECK_LAYOUT_SHIFT, (moOptions.dwHotkey_Layout&0x00000100) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_LAYOUT_CTRL, (moOptions.dwHotkey_Layout&0x00000200) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_LAYOUT_ALT, (moOptions.dwHotkey_Layout&0x00000400) ? BST_CHECKED : BST_UNCHECKED);
@@ -34,12 +34,12 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP CheckDlgButton(hWnd, IDC_CHECK_CASE_ALT, (moOptions.dwHotkey_Case&0x00000400) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_CASE_WIN, (moOptions.dwHotkey_Case&0x00000800) ? BST_CHECKED : BST_UNCHECKED);
- //
+ //Показываем символ из хоткея
SendDlgItemMessage(hWnd, IDC_HOTKEY_LAYOUT, HKM_SETHOTKEY, moOptions.dwHotkey_Layout&0x000000FF, 0);
SendDlgItemMessage(hWnd, IDC_HOTKEY_LAYOUT2, HKM_SETHOTKEY, moOptions.dwHotkey_Layout2&0x000000FF, 0);
SendDlgItemMessage(hWnd, IDC_HOTKEY_CASE, HKM_SETHOTKEY, moOptions.dwHotkey_Case&0x000000FF, 0);
- //
+ //Остальные опции
CheckDlgButton(hWnd, IDC_CHECK_LAYOUT_MODE, moOptions.CurrentWordLayout ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_LAYOUT_MODE2, moOptions.CurrentWordLayout2 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_CASE_MODE, moOptions.CurrentWordCase ? BST_CHECKED : BST_UNCHECKED);
@@ -48,7 +48,7 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP CheckDlgButton(hWnd, IDC_CHECK_CLIPBOARD, moOptions.CopyToClipboard ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_POPUP, moOptions.ShowPopup ? BST_CHECKED : BST_UNCHECKED);
- // CapsLock
+ //Смена состояния CapsLock
switch (moOptions.bCaseOperations) {
case 1:
CheckDlgButton(hWnd, IDC_RADIO_OFFCAPS, BST_CHECKED);
@@ -61,20 +61,20 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP break;
}
- // .
+ // Отображаем пример конфиг.строки
ptszMemLay = ptszLayStrings[0];
SetDlgItemText(hWnd, IDC_EDIT_EXAMPLE, ptszMemLay);
ptszShortNameLay = GetShortNameOfLayout(hklLayouts[0]);
SetDlgItemText(hWnd, IDC_STATIC_EXAMPLE, ptszShortNameLay);
mir_free(ptszShortNameLay);
- //
+ // Заполняем комбобокс с текущими раскладками
for(i = 0; i < bLayNum; i++) {
ptszShortNameLay = GetShortNameOfLayout(hklLayouts[i]);
SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_ADDSTRING, 0, (LPARAM)ptszShortNameLay);
mir_free(ptszShortNameLay);
}
- //
+ //Отображаем первую раскладку в списке
SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_SETCURSEL, 0, 0);
ptszMemLay = ptszLayStrings[0];
SetDlgItemText(hWnd, IDC_EDIT_SET, ptszMemLay);
@@ -149,12 +149,12 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- //
+ // Прочитаем хоткеи
moOptions.dwHotkey_Layout = SendDlgItemMessage(hWnd, IDC_HOTKEY_LAYOUT, HKM_GETHOTKEY, 0, 0);
moOptions.dwHotkey_Layout2 = SendDlgItemMessage(hWnd, IDC_HOTKEY_LAYOUT2, HKM_GETHOTKEY, 0, 0);
moOptions.dwHotkey_Case = SendDlgItemMessage(hWnd, IDC_HOTKEY_CASE, HKM_GETHOTKEY, 0, 0);
- //
+ //Допишем к символам управляющие клавиши
if (IsDlgButtonChecked(hWnd, IDC_CHECK_LAYOUT_SHIFT))
moOptions.dwHotkey_Layout |= 0x00000100;
if (IsDlgButtonChecked(hWnd, IDC_CHECK_LAYOUT_CTRL))
@@ -183,7 +183,7 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP moOptions.dwHotkey_Case |= 0x00000800;
- //
+ //Прочие опции
moOptions.CurrentWordLayout = IsDlgButtonChecked(hWnd, IDC_CHECK_LAYOUT_MODE);
moOptions.CurrentWordLayout2 = IsDlgButtonChecked(hWnd, IDC_CHECK_LAYOUT_MODE2);
moOptions.CurrentWordCase = IsDlgButtonChecked(hWnd, IDC_CHECK_CASE_MODE);
@@ -244,7 +244,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, TranslateDialogDefault(hWnd);
poOptionsTemp = poOptions;
- //
+ //Цвета
SendDlgItemMessage(hWnd, IDC_CUSTOM_BACK, CPM_SETCOLOUR, 0, poOptionsTemp.crBackColour);
SendDlgItemMessage(hWnd, IDC_CUSTOM_TEXT, CPM_SETCOLOUR, 0, poOptionsTemp.crTextColour);
CheckDlgButton(hWnd, IDC_RADIO_COLOURS_POPUP, poOptionsTemp.bColourType == PPC_POPUP ? BST_CHECKED : BST_UNCHECKED);
@@ -253,17 +253,17 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, EnableWindow(GetDlgItem(hWnd, IDC_CUSTOM_BACK), poOptionsTemp.bColourType == PPC_CUSTOM);
EnableWindow(GetDlgItem(hWnd, IDC_CUSTOM_TEXT), poOptionsTemp.bColourType == PPC_CUSTOM);
- //
+ // Таймаут
CheckDlgButton(hWnd, IDC_RADIO_TIMEOUT_POPUP, poOptionsTemp.bTimeoutType == PPT_POPUP ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_RADIO_TIMEOUT_PERMANENT, poOptionsTemp.bTimeoutType == PPT_PERMANENT ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_RADIO_TIMEOUT_CUSTOM, poOptionsTemp.bTimeoutType == PPT_CUSTOM ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, poOptionsTemp.bTimeout, FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_EDIT_TIMEOUT), poOptionsTemp.bTimeoutType == PPT_CUSTOM);
- //
+ // Клик левой
CheckDlgButton(hWnd, IDC_RADIO_LEFT_CLIPBOARD, poOptionsTemp.bLeftClick == 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_RADIO_LEFT_DISMISS, poOptionsTemp.bLeftClick == 1 ? BST_CHECKED : BST_UNCHECKED);
- //
+ // Клик правой
CheckDlgButton(hWnd, IDC_RADIO_RIGHT_CLIPBOARD, poOptionsTemp.bRightClick == 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_RADIO_RIGHT_DISMISS, poOptionsTemp.bRightClick == 1 ? BST_CHECKED : BST_UNCHECKED);
PopupDialogLock = FALSE;
diff --git a/plugins/ChangeKeyboardLayout/src/stdafx.h b/plugins/ChangeKeyboardLayout/src/stdafx.h index 05f8314376..85223339b5 100644 --- a/plugins/ChangeKeyboardLayout/src/stdafx.h +++ b/plugins/ChangeKeyboardLayout/src/stdafx.h @@ -35,27 +35,27 @@ #define MS_HPP_EG_NAVIGATE "History++/ExtGrid/Navigate"
#define MS_HPP_EG_OPTIONSCHANGED "History++/ExtGrid/OptionsChanged"
-//
+// Типы окон
#define WTYPE_Unknown 0
#define WTYPE_HistoryPP 1
#define WTYPE_IEView 2
#define WTYPE_RichEdit 3
#define WTYPE_Edit 4
-//
+//Тип операции над текстом
#define TOT_Layout 0
#define TOT_Case 1
-//
+// Имена звуков
#define SND_ChangeLayout "ChangingLayout"
#define SND_ChangeCase "ChangingCase"
-//
+//Цвета попапов
#define PPC_POPUP 0
#define PPC_WINDOWS 1
#define PPC_CUSTOM 2
-//
+//Таймаут попапов
#define PPT_POPUP 0
#define PPT_PERMANENT 1
#define PPT_CUSTOM 2
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 90967c017e..678d7116ac 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -112,11 +112,11 @@ LPTSTR GenerateLayoutString(HKL hklLayout) bState[shVirtualKey & 0x00FF] = 0x80;
int iRes = ToUnicodeEx(shVirtualKey, iScanCode, bState, ptszTemp, 3, 0, hklLayout);
- // -
+ // Защита от дэд-кеев
if (iRes < 0)
ToUnicodeEx(shVirtualKey, iScanCode, bState, ptszTemp, 3, 0, hklLayout);
- // , , ""
+ // Если нам вернули нулевой символ, или не вернули ничего, то присвоим "звоночек"
if (ptszTemp[0] == 0)
ptszLayStr[i] = 3;
else
@@ -232,13 +232,13 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (hTextWnd == nullptr)
return 0;
- //-------------- -----------------
+ //--------------Определяем тип окна-----------------
IEVIEWEVENT ieEvent = { 0 };
ieEvent.cbSize = sizeof(IEVIEWEVENT);
ieEvent.iType = IEE_GET_SELECTION;
if (ServiceExists(MS_HPP_EG_EVENT)) {
- // History++
+ // То же самое для History++
ieEvent.hwnd = hTextWnd;
ptszInText = (wchar_t*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&ieEvent);
@@ -247,7 +247,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
if ((WindowType == WTYPE_Unknown) && (ServiceExists(MS_IEVIEW_EVENT))) {
- // IEView
+ // Извращенное определение хэндла IEView
ieEvent.hwnd = GetParent(GetParent(hTextWnd));
ptszInText = (wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent);
@@ -272,15 +272,15 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) WindowType = WTYPE_Edit;
}
- //
+ // Получим текст из Рича или обычного Едита
if (WindowType == WTYPE_RichEdit || WindowType == WTYPE_Edit) {
dwStartWord = dwEndWord = -1;
SendMessage(hTextWnd, WM_SETREDRAW, FALSE, 0);
- //
+ // Бэкап выделения
crTemp = crSelection;
- // ,
+ // Если имеется выделенный текст, то получим его
if (crSelection.cpMin != crSelection.cpMax) {
if (WindowType == WTYPE_RichEdit) {
EditStreamData esdData;
@@ -312,9 +312,9 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
}
}
- // ,
+ // Если выделения нет, то получим нужный текст
else {
- //
+ // Получаем весь текст в поле
if (WindowType == WTYPE_RichEdit) {
crTemp.cpMin = 0;
crTemp.cpMax = -1;
@@ -348,7 +348,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) return 1;
}
}
- //
+ // Получаем текущее слово
if (CurrentWord) {
for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == nullptr); dwStartWord--);
for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == nullptr); dwEndWord++);
@@ -390,7 +390,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
}
- //--------------- --------------------
+ //---------------Выдаем результаты--------------------
WindowIsReadOnly = FALSE;
if (WindowType == WTYPE_IEView || WindowType == WTYPE_HistoryPP)
WindowIsReadOnly = TRUE;
@@ -400,7 +400,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (GetWindowLongPtr(hTextWnd, GWL_STYLE) & ES_READONLY)
WindowIsReadOnly = TRUE;
- // .
+ // Лог Иевью и ХисториПП в режиме эмуляции Иевью и поля только для чтения.
if (WindowType != WTYPE_Unknown && !IsBadStringPtr(ptszInText, MaxTextSize))
if (WindowIsReadOnly) {
ptrW ptszMBox((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
@@ -443,7 +443,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (moOptions.CopyToClipboard)
CopyTextToClipboard(ptszMBox);
- //------------------------------- ------------------------------------------
+ //-------------------------------Покажем попапы------------------------------------------
if (moOptions.ShowPopup) {
LPTSTR ptszPopupText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
mir_wstrcpy(ptszPopupText, ptszMBox);
@@ -492,7 +492,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
}
}
- //------------------ ----------------------------
+ //------------------Редактируемые поля ----------------------------
else {
ptrW ptszOutText;
if (TextOperation == TOT_Layout) {
@@ -518,16 +518,16 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) SendMessage(hTextWnd, EM_SETSEL, crSelection.cpMin, crSelection.cpMax);
}
- // Caps Lock
+ // Переключим раскладку или изменим состояние Caps Lock
if (TextOperation == TOT_Layout && hklToLay != nullptr && moOptions.ChangeSystemLayout)
ActivateKeyboardLayout(hklToLay, KLF_SETFORPROCESS);
else if (TextOperation == TOT_Case) {
- //
+ // Если нужно инвертнуть
if (moOptions.bCaseOperations == 0) {
keybd_event(VK_CAPITAL, 0x45, 0, 0);
keybd_event(VK_CAPITAL, 0x45, KEYEVENTF_KEYUP, 0);
}
- //
+ // Если нужно отключить
else if (moOptions.bCaseOperations == 1) {
if (GetKeyState(VK_CAPITAL) & 0x0001) {
keybd_event(VK_CAPITAL, 0x45, 0, 0);
diff --git a/plugins/ChangeKeyboardLayout/src/version.h b/plugins/ChangeKeyboardLayout/src/version.h index 97e6f6bfa2..6af003e08e 100644 --- a/plugins/ChangeKeyboardLayout/src/version.h +++ b/plugins/ChangeKeyboardLayout/src/version.h @@ -11,4 +11,4 @@ #define __AUTHOR "Yasnovidyashii" #define __AUTHOREMAIL "Yasnovidyashii@gmail.com" #define __AUTHORWEB "https://miranda-ng.org/p/ChangeKeyboardLayout/" -#define __COPYRIGHT " 2006-2009 Mikhail Yur'ev" +#define __COPYRIGHT "© 2006-2009 Mikhail Yur'ev" |