summaryrefslogtreecommitdiff
path: root/plugins/ChangeKeyboardLayout
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ChangeKeyboardLayout')
-rw-r--r--plugins/ChangeKeyboardLayout/src/hook_events.cpp8
-rw-r--r--plugins/ChangeKeyboardLayout/src/options.cpp4
-rw-r--r--plugins/ChangeKeyboardLayout/src/text_operations.cpp48
3 files changed, 30 insertions, 30 deletions
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
index f281d863b4..0ec26cf5f8 100644
--- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp
+++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
@@ -126,7 +126,7 @@ int ModulesLoaded(WPARAM, LPARAM)
Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case"));
// Хук на нажатие клавиши
- kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId());
+ kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId());
CreateServiceFunction(MS_CKL_CHANGELAYOUT, APIChangeLayout);
CreateServiceFunction(MS_CKL_GETLAYOUTOFTEXT, APIGetLayoutOfText);
@@ -174,15 +174,15 @@ LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam)
// Проверка на пустой хоткей. Иначе - пиздец, как в версии 1.4
if (lcode != 0) {
if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam & 0x40000000))) {
- ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout);
+ ChangeLayout(nullptr, TOT_Layout, moOptions.CurrentWordLayout);
return 1;
}
if ((lcode == moOptions.dwHotkey_Layout2) && (!(lParam & 0x40000000))) {
- ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout2);
+ ChangeLayout(nullptr, TOT_Layout, moOptions.CurrentWordLayout2);
return 1;
}
if ((lcode == moOptions.dwHotkey_Case) && (!(lParam & 0x40000000))) {
- ChangeLayout(NULL, TOT_Case, moOptions.CurrentWordCase);
+ ChangeLayout(nullptr, TOT_Case, moOptions.CurrentWordCase);
return 1;
}
}
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp
index 27540781fe..b91115217a 100644
--- a/plugins/ChangeKeyboardLayout/src/options.cpp
+++ b/plugins/ChangeKeyboardLayout/src/options.cpp
@@ -224,7 +224,7 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP
SetDlgItemText(hWnd, IDC_EDIT_EXAMPLE, ptszMemLay);
UnhookWindowsHookEx(kbHook_All);
- kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId());
+ kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId());
}
}
break;
@@ -337,7 +337,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam,
case IDC_EDIT_TIMEOUT:
if (HIWORD(wParam) == EN_CHANGE) {
- dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, NULL, FALSE);
+ dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, nullptr, FALSE);
if (dwTimeOut>255)
poOptionsTemp.bTimeout = 255;
else
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp
index 7df6916a89..90967c017e 100644
--- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp
+++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp
@@ -2,7 +2,7 @@
struct EditStreamData
{
- EditStreamData() { pbBuff = 0; cbBuff = iCurrent = 0; }
+ EditStreamData() { pbBuff = nullptr; cbBuff = iCurrent = 0; }
~EditStreamData() { free(pbBuff); }
PBYTE pbBuff;
@@ -48,7 +48,7 @@ LPTSTR GeTStringFromStreamData(EditStreamData *esd)
BOOL CopyTextToClipboard(LPTSTR ptszText)
{
- if (!OpenClipboard(NULL))
+ if (!OpenClipboard(nullptr))
return FALSE;
EmptyClipboard();
@@ -85,7 +85,7 @@ HKL GetNextLayout(HKL hklCurLay)
if (hklLayouts[i] == hklCurLay)
return hklLayouts[(i+1)%(bLayNum)];
- return NULL;
+ return nullptr;
}
LPTSTR GenerateLayoutString(HKL hklLayout)
@@ -133,7 +133,7 @@ LPTSTR GetLayoutString(HKL hklLayout)
for (DWORD i = 0; i < bLayNum; i++)
if (hklLayouts[i] == hklLayout)
return ptszLayStrings[i];
- return NULL;
+ return nullptr;
}
LPTSTR ChangeTextCase(LPCTSTR ptszInText)
@@ -154,12 +154,12 @@ LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL Tw
LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
mir_wstrcpy(ptszOutText, ptszInText);
- if (hklCurLay == NULL || hklToLay == NULL)
+ if (hklCurLay == nullptr || hklToLay == nullptr)
return ptszOutText;
LPTSTR ptszKeybCur = GetLayoutString(hklCurLay);
LPTSTR ptszKeybNext = GetLayoutString(hklToLay);
- if (ptszKeybCur == 0 || ptszKeybNext == 0)
+ if (ptszKeybCur == nullptr || ptszKeybNext == nullptr)
return ptszOutText;
for (DWORD i = 0; i < mir_wstrlen(ptszInText); i++) {
@@ -189,7 +189,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText)
DWORD dwMaxSymbols = 0, dwTemp = 0;
for (DWORD j = 0; j < mir_wstrlen(ptszInText); j++)
- if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL)
+ if (wcschr(ptszKeybBuff, ptszInText[j]) != nullptr)
++dwMaxSymbols;
for (DWORD i = 1; i < bLayNum; i++) {
@@ -197,7 +197,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText)
DWORD dwCountSymbols = 0;
for (DWORD j = 0; j<mir_wstrlen(ptszInText); j++)
- if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL)
+ if (wcschr(ptszKeybBuff, ptszInText[j]) != nullptr)
++dwCountSymbols;
if (dwCountSymbols == dwMaxSymbols)
@@ -216,7 +216,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText)
int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
{
- HKL hklCurLay = 0, hklToLay = 0;
+ HKL hklCurLay = nullptr, hklToLay = nullptr;
ptrW ptszInText;
CHARRANGE crSelection = { 0 }, crTemp = { 0 };
@@ -226,10 +226,10 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
BYTE WindowType = WTYPE_Unknown;
BOOL WindowIsReadOnly, TwoWay;
- if (hTextWnd == NULL)
+ if (hTextWnd == nullptr)
hTextWnd = GetFocus();
- if (hTextWnd == NULL)
+ if (hTextWnd == nullptr)
return 0;
//--------------Определяем тип окна-----------------
@@ -260,7 +260,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
i = GetClassName(hTextWnd, ptszTemp, 255);
ptszTemp[i] = 0;
- if (wcsstr(CharUpper(ptszTemp), L"RICHEDIT") != NULL) {
+ if (wcsstr(CharUpper(ptszTemp), L"RICHEDIT") != nullptr) {
WindowType = WTYPE_RichEdit;
SendMessage(hTextWnd, EM_EXGETSEL, 0, (LPARAM)&crSelection);
}
@@ -292,7 +292,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -307,7 +307,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -329,7 +329,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -344,14 +344,14 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
// Получаем текущее слово
if (CurrentWord) {
- for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == NULL); dwStartWord--);
- for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++);
+ 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++);
crTemp.cpMin = dwStartWord;
crTemp.cpMax = dwEndWord;
@@ -368,7 +368,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -382,7 +382,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
if (mir_wstrlen(ptszInText) == 0) {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
return 1;
}
}
@@ -432,7 +432,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
if ((WindowType == WTYPE_Edit) || (WindowType == WTYPE_RichEdit)) {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
}
if (TextOperation == TOT_Layout)
@@ -488,7 +488,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pdtData, APF_NEWDATA) < 0) {
mir_free(ptszPopupText);
- MessageBox(NULL, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION);
+ MessageBox(nullptr, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION);
}
}
}
@@ -519,7 +519,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
}
// Переключим раскладку или изменим состояние Caps Lock
- if (TextOperation == TOT_Layout && hklToLay != NULL && moOptions.ChangeSystemLayout)
+ if (TextOperation == TOT_Layout && hklToLay != nullptr && moOptions.ChangeSystemLayout)
ActivateKeyboardLayout(hklToLay, KLF_SETFORPROCESS);
else if (TextOperation == TOT_Case) {
// Если нужно инвертнуть
@@ -537,7 +537,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
}
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hTextWnd, NULL, FALSE);
+ InvalidateRect(hTextWnd, nullptr, FALSE);
if (TextOperation == TOT_Layout)
Skin_PlaySound(SND_ChangeLayout);