diff options
23 files changed, 1575 insertions, 2028 deletions
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 65c2cbbfbd..3af375bfb7 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -236,7 +236,7 @@ bool isContactGoneFor(HANDLE hContact, int days) TCHAR szInfo[200];
POPUPDATAT_V2 ppd = {0};
- ppd.cbSize = sizeof(POPUPDATAT_V2);
+ ppd.cbSize = sizeof(ppd);
ppd.lchContact = hContact;
ppd.lchIcon = Skin_GetIcon("enabled_icon");
@@ -275,8 +275,7 @@ void ReturnNotify(HANDLE hContact, TCHAR *message) if (options.iShowPopUp > 0) {
// Display PopUp
- POPUPDATAT_V2 ppd = { 0 };
- ppd.cbSize = sizeof(ppd);
+ POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact;
ppd.lchIcon = hIcon;
_tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR), MAX_CONTACTNAME);
@@ -288,7 +287,6 @@ void ReturnNotify(HANDLE hContact, TCHAR *message) ppd.PluginWindowProc = PopupDlgProc;
ppd.PluginData = NULL;
ppd.iSeconds = options.iPopUpDelay;
-
PUAddPopUpT(&ppd);
}
@@ -315,9 +313,7 @@ void GoneNotify(HANDLE hContact, TCHAR *message) if (options.iShowPopUp2 > 0) {
// Display PopUp
- POPUPDATAT_V2 ppd = {0};
- ppd.cbSize = sizeof(POPUPDATAT_V2);
-
+ POPUPDATAT ppd = {0};
ppd.lchContact = hContact;
ppd.lchIcon = hIcon;
_tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR), MAX_CONTACTNAME);
@@ -520,10 +516,8 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) // Last status
db_set_dw(hContact, MODULE_NAME, "LastStatus", prevStatus);
- if (prevStatus == ID_STATUS_OFFLINE)
- {
- if (db_get_b(hContact, MODULE_NAME, "MissYou", 0))
- {
+ if (prevStatus == ID_STATUS_OFFLINE) {
+ if (db_get_b(hContact, MODULE_NAME, "MissYou", 0)) {
// Display PopUp
POPUPDATAT_V2 ppd = {0};
ppd.cbSize = sizeof(POPUPDATAT_V2);
@@ -532,8 +526,7 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) ppd.lchIcon = Skin_GetIcon("enabled_icon");
_tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR), MAX_CONTACTNAME);
_tcsncpy(ppd.lptzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE);
- if (!options.iUsePopupColors)
- {
+ if (!options.iUsePopupColors) {
ppd.colorBack = options.iPopUpColorBack;
ppd.colorText = options.iPopUpColorFore;
}
@@ -551,16 +544,13 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) }
}
- if (currentStatus == ID_STATUS_OFFLINE)
- {
+ if (currentStatus == ID_STATUS_OFFLINE) {
setLastSeen(hContact);
return 0;
}
- if (db_get_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline)
- {
+ if (db_get_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline) {
ReturnNotify(hContact, TranslateT("has gone online for the first time."));
-
setLastSeen(hContact);
}
@@ -568,19 +558,15 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) if (isContactGoneFor(hContact, AbsencePeriod))
{
TCHAR* message = TranslateT("has returned after a long absence.");
- time_t tmpTime;
TCHAR tmpBuf[251] = {0};
- tmpTime = getLastSeen(hContact);
- if (tmpTime != -1)
- {
+ time_t tmpTime = getLastSeen(hContact);
+ if (tmpTime != -1) {
_tcsftime(tmpBuf, 250, TranslateT("has returned after being absent since %#x"), gmtime(&tmpTime));
message = tmpBuf;
}
- else
- {
+ else {
tmpTime = getLastInputMsg(hContact);
- if (tmpTime != -1)
- {
+ if (tmpTime != -1) {
_tcsftime(tmpBuf, 250, TranslateT("has returned after being absent since %#x"), gmtime(&tmpTime));
message = tmpBuf;
}
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 63a811b212..44571e1352 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -7,493 +7,406 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP LPSTR pszNameLay;
BYTE i;
- switch (uiMessage)
- {
+ switch (uiMessage) {
case WM_INITDIALOG:
- {
- MainDialogLock = TRUE;
- TranslateDialogDefault(hWnd);
+ 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);
+ //Горячие клавиши
+ // Запрещаем вводить в контролы все, кроме обычных кнопок
+ 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);
- //Отображаем управляющие клавиши
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_SHIFT, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000100), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_CTRL, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000200), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_ALT, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000400), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_WIN, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000800), 0);
-
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_SHIFT, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000100), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_CTRL, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000200), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_ALT, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000400), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_WIN, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000800), 0);
-
- SendDlgItemMessage(hWnd, IDC_CHECK_CASE_SHIFT, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000100), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_CASE_CTRL, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000200), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_CASE_ALT, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000400), 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_CASE_WIN, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000800), 0);
-
- //Показываем символ из хоткея
- 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);
+ //Отображаем управляющие клавиши
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_SHIFT, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000100), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_CTRL, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000200), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_ALT, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000400), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_WIN, BM_SETCHECK, (moOptions.dwHotkey_Layout&0x00000800), 0);
+
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_SHIFT, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000100), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_CTRL, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000200), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_ALT, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000400), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_WIN, BM_SETCHECK, (moOptions.dwHotkey_Layout2&0x00000800), 0);
+
+ SendDlgItemMessage(hWnd, IDC_CHECK_CASE_SHIFT, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000100), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_CASE_CTRL, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000200), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_CASE_ALT, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000400), 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_CASE_WIN, BM_SETCHECK, (moOptions.dwHotkey_Case&0x00000800), 0);
+
+ //Показываем символ из хоткея
+ 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);
- //Остальные опции
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE, BM_SETCHECK, moOptions.CurrentWordLayout, 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE2, BM_SETCHECK, moOptions.CurrentWordLayout2, 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_CASE_MODE, BM_SETCHECK, moOptions.CurrentWordCase, 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_TWOWAY, BM_SETCHECK, moOptions.TwoWay, 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_SYSTEMLAYOUT, BM_SETCHECK, moOptions.ChangeSystemLayout, 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_CLIPBOARD, BM_SETCHECK, moOptions.CopyToClipboard, 0);
- SendDlgItemMessage(hWnd, IDC_CHECK_POPUP, BM_SETCHECK, moOptions.ShowPopup, 0);
-
- //Смена состояния CapsLock
- switch(moOptions.bCaseOperations)
- {
- case 1:
- SendDlgItemMessage(hWnd, IDC_RADIO_OFFCAPS, BM_SETCHECK, 1, 0);
- break;
- case 2:
- SendDlgItemMessage(hWnd, IDC_RADIO_IGNORECAPS, BM_SETCHECK, 1, 0);
- break;
- default:
- SendDlgItemMessage(hWnd, IDC_RADIO_INVERTCAPS, BM_SETCHECK, 1, 0);
- break;
- }
+ //Остальные опции
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE, BM_SETCHECK, moOptions.CurrentWordLayout, 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE2, BM_SETCHECK, moOptions.CurrentWordLayout2, 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_CASE_MODE, BM_SETCHECK, moOptions.CurrentWordCase, 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_TWOWAY, BM_SETCHECK, moOptions.TwoWay, 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_SYSTEMLAYOUT, BM_SETCHECK, moOptions.ChangeSystemLayout, 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_CLIPBOARD, BM_SETCHECK, moOptions.CopyToClipboard, 0);
+ SendDlgItemMessage(hWnd, IDC_CHECK_POPUP, BM_SETCHECK, moOptions.ShowPopup, 0);
+
+ //Смена состояния CapsLock
+ switch(moOptions.bCaseOperations) {
+ case 1:
+ SendDlgItemMessage(hWnd, IDC_RADIO_OFFCAPS, BM_SETCHECK, 1, 0);
+ break;
+ case 2:
+ SendDlgItemMessage(hWnd, IDC_RADIO_IGNORECAPS, BM_SETCHECK, 1, 0);
+ break;
+ default:
+ SendDlgItemMessage(hWnd, IDC_RADIO_INVERTCAPS, BM_SETCHECK, 1, 0);
+ break;
+ }
- // Отображаем пример конфиг.строки
- ptszMemLay = ptszLayStrings[0];
- SendDlgItemMessage(hWnd, IDC_EDIT_EXAMPLE, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
- ptszShortNameLay = GetShortNameOfLayout(hklLayouts[0]);
- SendDlgItemMessage(hWnd, IDC_STATIC_EXAMPLE, WM_SETTEXT, 0, (LPARAM)ptszShortNameLay);
+ // Отображаем пример конфиг.строки
+ ptszMemLay = ptszLayStrings[0];
+ SendDlgItemMessage(hWnd, IDC_EDIT_EXAMPLE, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
+ ptszShortNameLay = GetShortNameOfLayout(hklLayouts[0]);
+ SendDlgItemMessage(hWnd, IDC_STATIC_EXAMPLE, WM_SETTEXT, 0, (LPARAM)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);
-
- // Заполняем комбобокс с текущими раскладками
- 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];
- SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
-
- if (bLayNum != 2) EnableWindow(GetDlgItem(hWnd, IDC_CHECK_TWOWAY), FALSE);
- MainDialogLock = FALSE;
- return TRUE;
}
+ //Отображаем первую раскладку в списке
+ SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_SETCURSEL, 0, 0);
+ ptszMemLay = ptszLayStrings[0];
+ SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
+
+ if (bLayNum != 2) EnableWindow(GetDlgItem(hWnd, IDC_CHECK_TWOWAY), FALSE);
+ MainDialogLock = FALSE;
+ return TRUE;
+
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_HOTKEY_LAYOUT:
- case IDC_HOTKEY_LAYOUT2:
- case IDC_HOTKEY_CASE:
-
- {
- if ((HIWORD(wParam) == EN_CHANGE))
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
- case IDC_CHECK_DETECT:
- case IDC_CHECK_LAYOUT_MODE:
- case IDC_CHECK_LAYOUT_MODE2:
- case IDC_CHECK_CASE_MODE:
- case IDC_CHECK_TWOWAY:
- case IDC_CHECK_SYSTEMLAYOUT:
- case IDC_CHECK_POPUP:
- case IDC_CHECK_CLIPBOARD:
- case IDC_CHECK_LAYOUT_SHIFT:
- case IDC_CHECK_LAYOUT_ALT:
- case IDC_CHECK_LAYOUT_CTRL:
- case IDC_CHECK_LAYOUT_WIN:
- case IDC_CHECK_LAYOUT2_SHIFT:
- case IDC_CHECK_LAYOUT2_ALT:
- case IDC_CHECK_LAYOUT2_CTRL:
- case IDC_CHECK_LAYOUT2_WIN:
- case IDC_CHECK_CASE_SHIFT:
- case IDC_CHECK_CASE_ALT:
- case IDC_CHECK_CASE_CTRL:
- case IDC_CHECK_CASE_WIN:
- case IDC_RADIO_IGNORECAPS:
- case IDC_RADIO_INVERTCAPS:
- case IDC_RADIO_OFFCAPS:
-
- {
- if ((HIWORD(wParam) == BN_CLICKED))
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
- case IDC_COMBO_LANG:
- {
- if ((HIWORD(wParam) == CBN_SELCHANGE))
- {
- MainDialogLock = TRUE;
- ptszMemLay = ptszLayStrings[SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0)];
- SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
- MainDialogLock = FALSE;
- }
- break;
- }
- case IDC_EDIT_SET:
- {
- if ((HIWORD(wParam) == EN_CHANGE) && (!MainDialogLock))
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
+ switch (LOWORD(wParam)) {
+ case IDC_HOTKEY_LAYOUT:
+ case IDC_HOTKEY_LAYOUT2:
+ case IDC_HOTKEY_CASE:
+ if ((HIWORD(wParam) == EN_CHANGE))
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
- case IDC_BUTTON_DEFAULT:
- {
- if ((HIWORD(wParam) == BN_CLICKED ))
- {
- ptszGenLay = GenerateLayoutString(hklLayouts[SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0)]);
- SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_SETTEXT, 0, (LPARAM)ptszGenLay);
- mir_free(ptszGenLay);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
- break;
- }
+ case IDC_CHECK_DETECT:
+ case IDC_CHECK_LAYOUT_MODE:
+ case IDC_CHECK_LAYOUT_MODE2:
+ case IDC_CHECK_CASE_MODE:
+ case IDC_CHECK_TWOWAY:
+ case IDC_CHECK_SYSTEMLAYOUT:
+ case IDC_CHECK_POPUP:
+ case IDC_CHECK_CLIPBOARD:
+ case IDC_CHECK_LAYOUT_SHIFT:
+ case IDC_CHECK_LAYOUT_ALT:
+ case IDC_CHECK_LAYOUT_CTRL:
+ case IDC_CHECK_LAYOUT_WIN:
+ case IDC_CHECK_LAYOUT2_SHIFT:
+ case IDC_CHECK_LAYOUT2_ALT:
+ case IDC_CHECK_LAYOUT2_CTRL:
+ case IDC_CHECK_LAYOUT2_WIN:
+ case IDC_CHECK_CASE_SHIFT:
+ case IDC_CHECK_CASE_ALT:
+ case IDC_CHECK_CASE_CTRL:
+ case IDC_CHECK_CASE_WIN:
+ case IDC_RADIO_IGNORECAPS:
+ case IDC_RADIO_INVERTCAPS:
+ case IDC_RADIO_OFFCAPS:
+ if ((HIWORD(wParam) == BN_CLICKED))
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
- }
- break;
- }
- case WM_NOTIFY:
- {
- switch(((LPNMHDR)lParam)->idFrom)
- {
- 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 (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_SHIFT, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout |= 0x00000100;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_CTRL, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout |= 0x00000200;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_ALT, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout |= 0x00000400;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_WIN, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout |= 0x00000800;
-
- if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_SHIFT, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout2 |= 0x00000100;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_CTRL, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout2 |= 0x00000200;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_ALT, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout2 |= 0x00000400;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_WIN, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Layout2 |= 0x00000800;
-
- if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_SHIFT, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Case |= 0x00000100;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_CTRL, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Case |= 0x00000200;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_ALT, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Case |= 0x00000400;
- if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_WIN, BM_GETCHECK, 0, 0))
- moOptions.dwHotkey_Case |= 0x00000800;
-
-
- //Прочие опции
- moOptions.CurrentWordLayout = SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE, BM_GETCHECK, 0, 0);
- moOptions.CurrentWordLayout2 = SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE2, BM_GETCHECK, 0, 0);
- moOptions.CurrentWordCase = SendDlgItemMessage(hWnd, IDC_CHECK_CASE_MODE, BM_GETCHECK, 0, 0);
- moOptions.TwoWay = SendDlgItemMessage(hWnd, IDC_CHECK_TWOWAY, BM_GETCHECK, 0, 0);
- moOptions.ChangeSystemLayout = SendDlgItemMessage(hWnd, IDC_CHECK_SYSTEMLAYOUT, BM_GETCHECK, 0, 0);
- moOptions.CopyToClipboard = SendDlgItemMessage(hWnd, IDC_CHECK_CLIPBOARD, BM_GETCHECK, 0, 0);
- moOptions.ShowPopup = SendDlgItemMessage(hWnd, IDC_CHECK_POPUP, BM_GETCHECK, 0, 0);
-
- // CapsLock
- if (SendDlgItemMessage(hWnd, IDC_RADIO_OFFCAPS, BM_GETCHECK, 0, 0) == BST_CHECKED)
- moOptions.bCaseOperations = 1;
- else if (SendDlgItemMessage(hWnd, IDC_RADIO_IGNORECAPS, BM_GETCHECK, 0, 0) == BST_CHECKED)
- moOptions.bCaseOperations = 2;
- else moOptions.bCaseOperations = 0;
-
- WriteMainOptions();
-
- ptszFormLay = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
- SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_GETTEXT, (WPARAM) MaxTextSize, (LPARAM)ptszFormLay);
- i = SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0);
- ptszMemLay = ptszLayStrings[i];
- if(_tcscmp(ptszMemLay, ptszFormLay) != 0)
- {
- _tcscpy(ptszMemLay, ptszFormLay);
- ptszGenLay = GenerateLayoutString(hklLayouts[i]);
- pszNameLay = GetNameOfLayout(hklLayouts[i]);
-
- if(_tcscmp(ptszMemLay, ptszGenLay) != 0)
- DBWriteContactSettingTString(NULL, ModuleName, pszNameLay, ptszMemLay);
- else
- DBDeleteContactSetting(NULL, ModuleName, pszNameLay);
-
- mir_free(pszNameLay);
- mir_free(ptszGenLay);
- }
- mir_free(ptszFormLay);
-
- ptszMemLay = ptszLayStrings[0];
- SendDlgItemMessage(hWnd, IDC_EDIT_EXAMPLE, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
-
- UnhookWindowsHookEx(kbHook_All);
- kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId());
-
- break;
- }
- }
- break;
- }
+ case IDC_COMBO_LANG:
+ if ((HIWORD(wParam) == CBN_SELCHANGE)) {
+ MainDialogLock = TRUE;
+ ptszMemLay = ptszLayStrings[SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0)];
+ SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
+ MainDialogLock = FALSE;
}
break;
- }
- case WM_DESTROY:
- {
+ case IDC_EDIT_SET:
+ if ((HIWORD(wParam) == EN_CHANGE) && (!MainDialogLock))
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_BUTTON_DEFAULT:
+ if ((HIWORD(wParam) == BN_CLICKED )) {
+ ptszGenLay = GenerateLayoutString(hklLayouts[SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0)]);
+ SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_SETTEXT, 0, (LPARAM)ptszGenLay);
+ mir_free(ptszGenLay);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
break;
}
+ break;
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ 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 (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_SHIFT, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout |= 0x00000100;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_CTRL, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout |= 0x00000200;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_ALT, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout |= 0x00000400;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_WIN, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout |= 0x00000800;
+
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_SHIFT, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout2 |= 0x00000100;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_CTRL, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout2 |= 0x00000200;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_ALT, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout2 |= 0x00000400;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT2_WIN, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Layout2 |= 0x00000800;
+
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_SHIFT, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Case |= 0x00000100;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_CTRL, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Case |= 0x00000200;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_ALT, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Case |= 0x00000400;
+ if (SendDlgItemMessage(hWnd, IDC_CHECK_CASE_WIN, BM_GETCHECK, 0, 0))
+ moOptions.dwHotkey_Case |= 0x00000800;
+
+
+ //Прочие опции
+ moOptions.CurrentWordLayout = SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE, BM_GETCHECK, 0, 0);
+ moOptions.CurrentWordLayout2 = SendDlgItemMessage(hWnd, IDC_CHECK_LAYOUT_MODE2, BM_GETCHECK, 0, 0);
+ moOptions.CurrentWordCase = SendDlgItemMessage(hWnd, IDC_CHECK_CASE_MODE, BM_GETCHECK, 0, 0);
+ moOptions.TwoWay = SendDlgItemMessage(hWnd, IDC_CHECK_TWOWAY, BM_GETCHECK, 0, 0);
+ moOptions.ChangeSystemLayout = SendDlgItemMessage(hWnd, IDC_CHECK_SYSTEMLAYOUT, BM_GETCHECK, 0, 0);
+ moOptions.CopyToClipboard = SendDlgItemMessage(hWnd, IDC_CHECK_CLIPBOARD, BM_GETCHECK, 0, 0);
+ moOptions.ShowPopup = SendDlgItemMessage(hWnd, IDC_CHECK_POPUP, BM_GETCHECK, 0, 0);
+
+ // CapsLock
+ if (SendDlgItemMessage(hWnd, IDC_RADIO_OFFCAPS, BM_GETCHECK, 0, 0) == BST_CHECKED)
+ moOptions.bCaseOperations = 1;
+ else if (SendDlgItemMessage(hWnd, IDC_RADIO_IGNORECAPS, BM_GETCHECK, 0, 0) == BST_CHECKED)
+ moOptions.bCaseOperations = 2;
+ else moOptions.bCaseOperations = 0;
+
+ WriteMainOptions();
+
+ ptszFormLay = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
+ SendDlgItemMessage(hWnd, IDC_EDIT_SET, WM_GETTEXT, (WPARAM) MaxTextSize, (LPARAM)ptszFormLay);
+ i = SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0);
+ ptszMemLay = ptszLayStrings[i];
+ if(_tcscmp(ptszMemLay, ptszFormLay) != 0) {
+ _tcscpy(ptszMemLay, ptszFormLay);
+ ptszGenLay = GenerateLayoutString(hklLayouts[i]);
+ pszNameLay = GetNameOfLayout(hklLayouts[i]);
+
+ if(_tcscmp(ptszMemLay, ptszGenLay) != 0)
+ DBWriteContactSettingTString(NULL, ModuleName, pszNameLay, ptszMemLay);
+ else
+ DBDeleteContactSetting(NULL, ModuleName, pszNameLay);
+
+ mir_free(pszNameLay);
+ mir_free(ptszGenLay);
+ }
+ mir_free(ptszFormLay);
+
+ ptszMemLay = ptszLayStrings[0];
+ SendDlgItemMessage(hWnd, IDC_EDIT_EXAMPLE, WM_SETTEXT, 0, (LPARAM)ptszMemLay);
+
+ UnhookWindowsHookEx(kbHook_All);
+ kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId());
+ }
+ }
+ break;
}
return FALSE;
}
-
INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
{
- POPUPDATAT_V2 pdtData;
static BOOL PopupDialogLock = FALSE;
LPTSTR ptszPopupPreviewText;
DWORD dwTimeOut;
- switch (uiMessage)
- {
+ switch (uiMessage) {
case WM_INITDIALOG:
- {
- PopupDialogLock = TRUE;
- 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);
- CheckDlgButton(hWnd, IDC_RADIO_COLOURS_WINDOWS, poOptionsTemp.bColourType == PPC_WINDOWS);
- CheckDlgButton(hWnd, IDC_RADIO_COLOURS_CUSTOM, poOptionsTemp.bColourType == PPC_CUSTOM);
- 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);
- CheckDlgButton(hWnd, IDC_RADIO_TIMEOUT_PERMANENT, poOptionsTemp.bTimeoutType == PPT_PERMANENT);
- CheckDlgButton(hWnd, IDC_RADIO_TIMEOUT_CUSTOM, poOptionsTemp.bTimeoutType == PPT_CUSTOM);
- 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);
- CheckDlgButton(hWnd, IDC_RADIO_LEFT_DISMISS, poOptionsTemp.bLeftClick == 1);
- // Клик правой
- CheckDlgButton(hWnd, IDC_RADIO_RIGHT_CLIPBOARD, poOptionsTemp.bRightClick == 0);
- CheckDlgButton(hWnd, IDC_RADIO_RIGHT_DISMISS, poOptionsTemp.bRightClick == 1);
- PopupDialogLock = FALSE;
- return TRUE;
- }
-
+ PopupDialogLock = TRUE;
+ 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);
+ CheckDlgButton(hWnd, IDC_RADIO_COLOURS_WINDOWS, poOptionsTemp.bColourType == PPC_WINDOWS);
+ CheckDlgButton(hWnd, IDC_RADIO_COLOURS_CUSTOM, poOptionsTemp.bColourType == PPC_CUSTOM);
+ 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);
+ CheckDlgButton(hWnd, IDC_RADIO_TIMEOUT_PERMANENT, poOptionsTemp.bTimeoutType == PPT_PERMANENT);
+ CheckDlgButton(hWnd, IDC_RADIO_TIMEOUT_CUSTOM, poOptionsTemp.bTimeoutType == PPT_CUSTOM);
+ 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);
+ CheckDlgButton(hWnd, IDC_RADIO_LEFT_DISMISS, poOptionsTemp.bLeftClick == 1);
+ // Клик правой
+ CheckDlgButton(hWnd, IDC_RADIO_RIGHT_CLIPBOARD, poOptionsTemp.bRightClick == 0);
+ CheckDlgButton(hWnd, IDC_RADIO_RIGHT_DISMISS, poOptionsTemp.bRightClick == 1);
+ PopupDialogLock = FALSE;
+ return TRUE;
+
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_RADIO_COLOURS_POPUP:
- case IDC_RADIO_COLOURS_WINDOWS:
- case IDC_RADIO_COLOURS_CUSTOM:
- {
- if ((HIWORD(wParam) == BN_CLICKED))
- {
- if (IsDlgButtonChecked(hWnd, IDC_RADIO_COLOURS_POPUP))
- poOptionsTemp.bColourType = PPC_POPUP;
- else if (IsDlgButtonChecked(hWnd, IDC_RADIO_COLOURS_WINDOWS))
- poOptionsTemp.bColourType = PPC_WINDOWS;
- else if (IsDlgButtonChecked(hWnd, IDC_RADIO_COLOURS_CUSTOM))
- poOptionsTemp.bColourType = PPC_CUSTOM;
-
- EnableWindow(GetDlgItem(hWnd, IDC_CUSTOM_BACK), poOptionsTemp.bColourType == PPC_CUSTOM);
- EnableWindow(GetDlgItem(hWnd, IDC_CUSTOM_TEXT), poOptionsTemp.bColourType == PPC_CUSTOM);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
- }
+ switch (LOWORD(wParam)) {
+ case IDC_RADIO_COLOURS_POPUP:
+ case IDC_RADIO_COLOURS_WINDOWS:
+ case IDC_RADIO_COLOURS_CUSTOM:
+ if ((HIWORD(wParam) == BN_CLICKED)) {
+ if (IsDlgButtonChecked(hWnd, IDC_RADIO_COLOURS_POPUP))
+ poOptionsTemp.bColourType = PPC_POPUP;
+ else if (IsDlgButtonChecked(hWnd, IDC_RADIO_COLOURS_WINDOWS))
+ poOptionsTemp.bColourType = PPC_WINDOWS;
+ else if (IsDlgButtonChecked(hWnd, IDC_RADIO_COLOURS_CUSTOM))
+ poOptionsTemp.bColourType = PPC_CUSTOM;
+
+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOM_BACK), poOptionsTemp.bColourType == PPC_CUSTOM);
+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOM_TEXT), poOptionsTemp.bColourType == PPC_CUSTOM);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_RADIO_TIMEOUT_POPUP:
+ case IDC_RADIO_TIMEOUT_PERMANENT:
+ case IDC_RADIO_TIMEOUT_CUSTOM:
+ if ((HIWORD(wParam) == BN_CLICKED)) {
+ if (IsDlgButtonChecked(hWnd, IDC_RADIO_TIMEOUT_POPUP))
+ poOptionsTemp.bTimeoutType = PPT_POPUP;
+ else if (IsDlgButtonChecked(hWnd, IDC_RADIO_TIMEOUT_PERMANENT))
+ poOptionsTemp.bTimeoutType = PPT_PERMANENT;
+ if (IsDlgButtonChecked(hWnd, IDC_RADIO_TIMEOUT_CUSTOM))
+ poOptionsTemp.bTimeoutType = PPT_CUSTOM;
+
+ EnableWindow(GetDlgItem(hWnd, IDC_EDIT_TIMEOUT), poOptionsTemp.bTimeoutType == PPT_CUSTOM);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_RADIO_LEFT_CLIPBOARD:
+ case IDC_RADIO_LEFT_DISMISS:
+ if ((HIWORD(wParam) == BN_CLICKED)) {
+ if (IsDlgButtonChecked(hWnd, IDC_RADIO_LEFT_CLIPBOARD))
+ poOptionsTemp.bLeftClick = 0;
+ else if (IsDlgButtonChecked(hWnd, IDC_RADIO_LEFT_DISMISS))
+ poOptionsTemp.bLeftClick = 1;
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_RADIO_RIGHT_CLIPBOARD:
+ case IDC_RADIO_RIGHT_DISMISS:
+ if ((HIWORD(wParam) == BN_CLICKED)) {
+ if (IsDlgButtonChecked(hWnd, IDC_RADIO_RIGHT_CLIPBOARD))
+ poOptionsTemp.bRightClick = 0;
+ else if (IsDlgButtonChecked(hWnd, IDC_RADIO_RIGHT_DISMISS))
+ poOptionsTemp.bRightClick = 1;
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_CUSTOM_BACK:
+ case IDC_CUSTOM_TEXT:
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ poOptionsTemp.crBackColour = SendDlgItemMessage(hWnd, IDC_CUSTOM_BACK, CPM_GETCOLOUR, 0, 0);
+ poOptionsTemp.crTextColour = SendDlgItemMessage(hWnd, IDC_CUSTOM_TEXT, CPM_GETCOLOUR, 0, 0);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_EDIT_TIMEOUT:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, NULL, FALSE);
+ if (dwTimeOut>255)
+ poOptionsTemp.bTimeout = 255;
+ else
+ poOptionsTemp.bTimeout = dwTimeOut;
+
+ if (!PopupDialogLock)
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
+ break;
-
- case IDC_RADIO_TIMEOUT_POPUP:
- case IDC_RADIO_TIMEOUT_PERMANENT:
- case IDC_RADIO_TIMEOUT_CUSTOM:
- {
- if ((HIWORD(wParam) == BN_CLICKED))
- {
- if (IsDlgButtonChecked(hWnd, IDC_RADIO_TIMEOUT_POPUP))
- poOptionsTemp.bTimeoutType = PPT_POPUP;
- else if (IsDlgButtonChecked(hWnd, IDC_RADIO_TIMEOUT_PERMANENT))
- poOptionsTemp.bTimeoutType = PPT_PERMANENT;
- if (IsDlgButtonChecked(hWnd, IDC_RADIO_TIMEOUT_CUSTOM))
- poOptionsTemp.bTimeoutType = PPT_CUSTOM;
-
- EnableWindow(GetDlgItem(hWnd, IDC_EDIT_TIMEOUT), poOptionsTemp.bTimeoutType == PPT_CUSTOM);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
+ case IDC_BUTTON_PREVIEW:
+ if ((HIWORD(wParam) == BN_CLICKED )) {
+ ptszPopupPreviewText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
+
+ POPUPDATAT_V2 pdtData = { 0 };
+ pdtData.cbSize = sizeof(POPUPDATAT_V2);
+ _tcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME);
+ _tcsncpy(pdtData.lptzText, _T("Ghbdtn? rfr ltkf&"), MAX_SECONDLINE);
+
+ switch(poOptionsTemp.bColourType) {
+ case PPC_POPUP:
+ pdtData.colorBack = pdtData.colorText = 0;
break;
- }
-
- case IDC_RADIO_LEFT_CLIPBOARD:
- case IDC_RADIO_LEFT_DISMISS:
- {
- if ((HIWORD(wParam) == BN_CLICKED))
- {
- if (IsDlgButtonChecked(hWnd, IDC_RADIO_LEFT_CLIPBOARD))
- poOptionsTemp.bLeftClick = 0;
- else if (IsDlgButtonChecked(hWnd, IDC_RADIO_LEFT_DISMISS))
- poOptionsTemp.bLeftClick = 1;
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
+ case PPC_WINDOWS:
+ pdtData.colorBack = GetSysColor(COLOR_BTNFACE);
+ pdtData.colorText = GetSysColor(COLOR_WINDOWTEXT);
break;
- }
-
- case IDC_RADIO_RIGHT_CLIPBOARD:
- case IDC_RADIO_RIGHT_DISMISS:
- {
- if ((HIWORD(wParam) == BN_CLICKED))
- {
- if (IsDlgButtonChecked(hWnd, IDC_RADIO_RIGHT_CLIPBOARD))
- poOptionsTemp.bRightClick = 0;
- else if (IsDlgButtonChecked(hWnd, IDC_RADIO_RIGHT_DISMISS))
- poOptionsTemp.bRightClick = 1;
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
+ case PPC_CUSTOM:
+ pdtData.colorBack = poOptionsTemp.crBackColour;
+ pdtData.colorText = poOptionsTemp.crTextColour;
break;
- }
+ }
- case IDC_CUSTOM_BACK:
- case IDC_CUSTOM_TEXT:
- {
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- poOptionsTemp.crBackColour = SendDlgItemMessage(hWnd, IDC_CUSTOM_BACK, CPM_GETCOLOUR, 0, 0);
- poOptionsTemp.crTextColour = SendDlgItemMessage(hWnd, IDC_CUSTOM_TEXT, CPM_GETCOLOUR, 0, 0);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
+ switch(poOptionsTemp.bTimeoutType) {
+ case PPT_POPUP:
+ pdtData.iSeconds = 0;
break;
- }
- case IDC_EDIT_TIMEOUT:
- {
- if (HIWORD(wParam) == EN_CHANGE)
- {
- dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, NULL, FALSE);
- if (dwTimeOut>255)
- poOptionsTemp.bTimeout = 255;
- else
- poOptionsTemp.bTimeout = dwTimeOut;
-
- if (!PopupDialogLock)
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
+ case PPT_PERMANENT:
+ pdtData.iSeconds = -1;
break;
- }
-
- case IDC_BUTTON_PREVIEW:
- {
- if ((HIWORD(wParam) == BN_CLICKED ))
- {
- ptszPopupPreviewText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
-
- pdtData.cbSize = sizeof(POPUPDATAT_V2);
- ZeroMemory(&pdtData, sizeof(pdtData));
- _tcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME);
- _tcsncpy(pdtData.lptzText, _T("Ghbdtn? rfr ltkf&"), MAX_SECONDLINE);
-
- switch(poOptionsTemp.bColourType)
- {
- case PPC_POPUP:
- pdtData.colorBack = pdtData.colorText = 0;
- break;
- case PPC_WINDOWS:
- pdtData.colorBack = GetSysColor(COLOR_BTNFACE);
- pdtData.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case PPC_CUSTOM:
- pdtData.colorBack = poOptionsTemp.crBackColour;
- pdtData.colorText = poOptionsTemp.crTextColour;
- break;
- default:
- break;
- }
- switch(poOptionsTemp.bTimeoutType)
- {
- case PPT_POPUP:
- pdtData.iSeconds = 0;
- break;
- case PPT_PERMANENT:
- pdtData.iSeconds = -1;
- break;
- case PPC_CUSTOM:
- pdtData.iSeconds = poOptionsTemp.bTimeout;
- break;
- }
- _tcscpy(ptszPopupPreviewText, pdtData.lptzText);
- pdtData.PluginData = ptszPopupPreviewText;
- pdtData.lchIcon = hPopupIcon;
- poOptions.paActions[0].lchIcon = hCopyIcon;
- pdtData.lpActions = poOptions.paActions;
- pdtData.actionCount = 1;
- pdtData.PluginWindowProc = (WNDPROC)CKLPopupDlgProc;
-
- if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pdtData, APF_NEWDATA)<0)
- mir_free(ptszPopupPreviewText);
- }
+ case PPC_CUSTOM:
+ pdtData.iSeconds = poOptionsTemp.bTimeout;
break;
}
-
- default:
- break;
- }
- break;
-}
-
- case WM_NOTIFY:
- {
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- poOptions = poOptionsTemp;
- WritePopupOptions();
- break;
- }
- }
- break;
+ _tcscpy(ptszPopupPreviewText, pdtData.lptzText);
+ pdtData.PluginData = ptszPopupPreviewText;
+ pdtData.lchIcon = hPopupIcon;
+ poOptions.paActions[0].lchIcon = hCopyIcon;
+ pdtData.lpActions = poOptions.paActions;
+ pdtData.actionCount = 1;
+ pdtData.PluginWindowProc = (WNDPROC)CKLPopupDlgProc;
+
+ if ( CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pdtData, APF_NEWDATA) < 0)
+ mir_free(ptszPopupPreviewText);
}
+ break;
}
break;
- }
- case WM_DESTROY:
- {
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ poOptions = poOptionsTemp;
+ WritePopupOptions();
+ }
+ }
break;
}
-
- }
return FALSE;
}
-
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index f35610625a..a7c00aa4ea 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -268,8 +268,6 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) EDITSTREAM esStream = {0};
struct EditStreamData esdData;
- POPUPDATAT_V2 pdtData;
-
esStream.dwCookie = (DWORD)&esdData;
esStream.pfnCallback = EditStreamOutRtf;
@@ -524,17 +522,16 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (moOptions.CopyToClipboard)
CopyTextToClipboard(ptszMBox);
//-------------------------------Покажем попапы------------------------------------------
- if (moOptions.ShowPopup)
- {
+ if (moOptions.ShowPopup) {
ptszPopupText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
_tcscpy(ptszPopupText, ptszMBox);
+ POPUPDATAT_V2 pdtData = { 0 };
pdtData.cbSize = sizeof(POPUPDATAT_V2);
- ZeroMemory(&pdtData, sizeof(pdtData));
_tcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME);
_tcsncpy(pdtData.lptzText, ptszPopupText, MAX_SECONDLINE);
- switch(poOptions.bColourType)
- {
+
+ switch(poOptions.bColourType) {
case PPC_POPUP:
pdtData.colorBack = pdtData.colorText = 0;
break;
@@ -546,11 +543,9 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) pdtData.colorBack = poOptions.crBackColour;
pdtData.colorText = poOptions.crTextColour;
break;
- default:
- break;
}
- switch(poOptions.bTimeoutType)
- {
+
+ switch(poOptions.bTimeoutType) {
case PPT_POPUP:
pdtData.iSeconds = 0;
break;
@@ -562,22 +557,19 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) break;
}
pdtData.PluginData = ptszPopupText;
+ pdtData.PluginWindowProc = (WNDPROC)CKLPopupDlgProc;
pdtData.lchIcon = hPopupIcon;
poOptions.paActions[0].lchIcon = hCopyIcon;
pdtData.lpActions = poOptions.paActions;
pdtData.actionCount = 1;
-
- pdtData.PluginWindowProc = (WNDPROC)CKLPopupDlgProc;
- if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pdtData, APF_NEWDATA)<0)
- {
+ if ( CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pdtData, APF_NEWDATA) < 0) {
mir_free(ptszPopupText);
MessageBox(NULL, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION);
}
}
mir_free(ptszMBox);
-
}
//------------------Редактируемые поля ----------------------------
else
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index ac9ccdce3d..20ba80c0d7 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -24,88 +24,66 @@ INT UpdatesCount = 0; void PopupAction(HWND hWnd, BYTE action)
{
- switch (action)
- {
- case PCA_CLOSEPOPUP:
- break;
- case PCA_DONOTHING:
- return;
- }//end* switch
+ switch (action) {
+ case PCA_CLOSEPOPUP:
+ break;
+ case PCA_DONOTHING:
+ return;
+ }
PUDeletePopUp(hWnd);
}
static INT_PTR CALLBACK PopupDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case UM_POPUPACTION:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
-
- if (pmpd)
- {
- switch (LOWORD(wParam))
- {
- case IDYES:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, LOWORD(wParam));
- PUDeletePopUp(hDlg);
- break;
- }
- case IDNO:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, LOWORD(wParam));
- PUDeletePopUp(hDlg);
- break;
- }
- }
+ switch (uMsg) {
+ case UM_POPUPACTION:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd) {
+ switch (LOWORD(wParam)) {
+ case IDYES:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, LOWORD(wParam));
+ PUDeletePopUp(hDlg);
+ break;
+
+ case IDNO:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, LOWORD(wParam));
+ PUDeletePopUp(hDlg);
+ break;
}
}
}
break;
- case UM_FREEPLUGINDATA:
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
- if (pmpd > 0)
- mir_free(pmpd);
- return TRUE; //TRUE or FALSE is the same, it gets ignored.
- }
- break;
-
- default:
- break;
+ case UM_FREEPLUGINDATA:
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd > 0)
+ mir_free(pmpd);
+ return TRUE; //TRUE or FALSE is the same, it gets ignored.
}
return DefWindowProc(hDlg, uMsg, wParam, lParam);
}
static INT_PTR CALLBACK PopupDlgProc2(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_COMMAND:
- {
- PopupAction(hDlg, MyOptions.LeftClickAction);
- break;
- }
- case WM_CONTEXTMENU:
- {
- PopupAction(hDlg, MyOptions.RightClickAction);
- break;
- }
- case UM_FREEPLUGINDATA:
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
- if (pmpd > 0)
- mir_free(pmpd);
- return TRUE; //TRUE or FALSE is the same, it gets ignored.
- }
+ switch (uMsg) {
+ case WM_COMMAND:
+ PopupAction(hDlg, MyOptions.LeftClickAction);
+ break;
+
+ case WM_CONTEXTMENU:
+ PopupAction(hDlg, MyOptions.RightClickAction);
break;
+
+ case UM_FREEPLUGINDATA:
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd > 0)
+ mir_free(pmpd);
+ return TRUE; //TRUE or FALSE is the same, it gets ignored.
}
+
return DefWindowProc(hDlg, uMsg, wParam, lParam);
}
@@ -129,54 +107,45 @@ static VOID MakePopupAction(POPUPACTION &pa, INT id) VOID show_popup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType)
{
- POPUPDATAT_V2 pd;
- LPMSGPOPUPDATA pmpd;
- pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
- if (pmpd)
- {
- ZeroMemory(&pd, sizeof(pd));
- pd.cbSize = sizeof(POPUPDATAT_V2);
- pd.lchContact = NULL; //(HANDLE)wParam;
- pd.lchIcon = LoadSkinnedIcon(PopupsList[Number].Icon);
- lstrcpyn(pd.lptzText, Text, SIZEOF(pd.lptzText));
- lstrcpyn(pd.lptzContactName, Title, SIZEOF(pd.lptzContactName));
- switch (MyOptions.DefColors)
- {
- case byCOLOR_WINDOWS:
- pd.colorBack = GetSysColor(COLOR_BTNFACE);
- pd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case byCOLOR_OWN:
- pd.colorBack = PopupsList[Number].colorBack;
- pd.colorText = PopupsList[Number].colorText;
- break;
- case byCOLOR_POPUP:
- pd.colorBack = pd.colorText = 0;
- break;
- }//end* switch
- if (Number == 0 && ActType != 0)
- pd.PluginWindowProc = (WNDPROC)PopupDlgProc;
- else
- pd.PluginWindowProc = (WNDPROC)PopupDlgProc2;
- pd.PluginData = pmpd;
- if (Number == 0)
- pd.iSeconds = -1;
- else
- pd.iSeconds = MyOptions.Timeout;
- pd.hNotification = NULL;
- pd.lpActions = pmpd->pa;
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
+ if (!pmpd)
+ return;
+
+ POPUPDATAT_V2 pd = { 0 };
+ pd.cbSize = sizeof(pd);
+ pd.lchContact = NULL; //(HANDLE)wParam;
+ pd.lchIcon = LoadSkinnedIcon(PopupsList[Number].Icon);
+ lstrcpyn(pd.lptzText, Text, SIZEOF(pd.lptzText));
+ lstrcpyn(pd.lptzContactName, Title, SIZEOF(pd.lptzContactName));
+ switch (MyOptions.DefColors) {
+ case byCOLOR_WINDOWS:
+ pd.colorBack = GetSysColor(COLOR_BTNFACE);
+ pd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case byCOLOR_OWN:
+ pd.colorBack = PopupsList[Number].colorBack;
+ pd.colorText = PopupsList[Number].colorText;
+ break;
+ case byCOLOR_POPUP:
+ pd.colorBack = pd.colorText = 0;
+ break;
}
+ if (Number == 0 && ActType != 0)
+ pd.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ else
+ pd.PluginWindowProc = (WNDPROC)PopupDlgProc2;
+ pd.PluginData = pmpd;
+ if (Number == 0)
+ pd.iSeconds = -1;
+ else
+ pd.iSeconds = MyOptions.Timeout;
+ pd.hNotification = NULL;
+ pd.lpActions = pmpd->pa;
+
pmpd->hDialog = hDlg;
- switch (ActType)
- {
- case 0:
- break;
- case 1:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- }
- break;
+ if (ActType == 1) {
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
}
CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
@@ -184,28 +153,24 @@ VOID show_popup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType) INT_PTR CALLBACK DlgDownload(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
+ switch (message) {
case WM_INITDIALOG:
- SetWindowText(GetDlgItem(hDlg, IDC_LABEL), tszDialogMsg);
- SetWindowLongPtr(GetDlgItem(hDlg, IDC_PB), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_PB), GWL_STYLE) | PBS_MARQUEE);
- SendMessage(GetDlgItem(hDlg, IDC_PB), PBM_SETMARQUEE, 1, 50);
- return TRUE;
- }//end* switch
+ SetWindowText(GetDlgItem(hDlg, IDC_LABEL), tszDialogMsg);
+ SetWindowLongPtr(GetDlgItem(hDlg, IDC_PB), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_PB), GWL_STYLE) | PBS_MARQUEE);
+ SendMessage(GetDlgItem(hDlg, IDC_PB), PBM_SETMARQUEE, 1, 50);
+ return TRUE;
+ }
return FALSE;
}
INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
+ switch (uMsg) {
case WM_INITDIALOG:
- {
- Number = 3;
- show_popup(hDlg, Title, Text, Number, 0);
- return TRUE;
- } // end* WM_INITDIALOG:
- } // end* switch (uMsg)
+ Number = 3;
+ show_popup(hDlg, Title, Text, Number, 0);
+ return TRUE;
+ }
return FALSE;
}
@@ -227,12 +192,10 @@ static void __stdcall DestroyDownloadDialog(void*) void DlgDownloadProc()
{
CallFunctionAsync(CreateDownloadDialog, 0);
- if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath))
- {
+ if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occured while downloading the update.");
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
- {
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(0, Title, Text, Number, 0);
}
@@ -246,427 +209,340 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam {
HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
- switch (message)
- {
- case WM_INITDIALOG:
+ switch (message) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault( hDlg );
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
+ SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
+ {
+ LVCOLUMN lvc = {0};
+ // Initialize the LVCOLUMN structure.
+ // The mask specifies that the format, width, text, and
+ // subitem members of the structure are valid.
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+ lvc.fmt = LVCFMT_LEFT;
+
+ lvc.iSubItem = 0;
+ lvc.pszText = TranslateT("Component Name");
+ lvc.cx = 145; // width of column in pixels
+ ListView_InsertColumn(hwndList, 0, &lvc);
+
+ lvc.iSubItem = 1;
+ lvc.pszText = TranslateT("Current Version");
+ lvc.cx = 95; // width of column in pixels
+ ListView_InsertColumn(hwndList, 1, &lvc);
+
+ lvc.iSubItem = 2;
+ lvc.pszText = TranslateT("New Version");
+ lvc.cx = 82; // width of column in pixels
+ ListView_InsertColumn(hwndList, 2, &lvc);
+
+ //enumerate plugins, fill in list
+ //bool one_enabled = false;
+ ListView_DeleteAllItems(hwndList);
+
+ LVITEM lvI = {0};
+
+ // Some code to create the list-view control.
+ // Initialize LVITEM members that are common to all
+ // items.
+ lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
+
+ vector<FILEINFO> &todo = *(vector<FILEINFO> *)lParam;
+ for (int i = 0; i < (int)todo.size(); ++i)
{
- TranslateDialogDefault( hDlg );
- SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
-
- LVCOLUMN lvc = {0};
- // Initialize the LVCOLUMN structure.
- // The mask specifies that the format, width, text, and
- // subitem members of the structure are valid.
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
- lvc.fmt = LVCFMT_LEFT;
-
- lvc.iSubItem = 0;
- lvc.pszText = TranslateT("Component Name");
- lvc.cx = 145; // width of column in pixels
- ListView_InsertColumn(hwndList, 0, &lvc);
-
- lvc.iSubItem = 1;
- lvc.pszText = TranslateT("Current Version");
- lvc.cx = 95; // width of column in pixels
- ListView_InsertColumn(hwndList, 1, &lvc);
-
- lvc.iSubItem = 2;
- lvc.pszText = TranslateT("New Version");
- lvc.cx = 82; // width of column in pixels
- ListView_InsertColumn(hwndList, 2, &lvc);
-
- //enumerate plugins, fill in list
- //bool one_enabled = false;
- ListView_DeleteAllItems(hwndList);
-
- LVITEM lvI = {0};
-
- // Some code to create the list-view control.
- // Initialize LVITEM members that are common to all
- // items.
- lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
-
- vector<FILEINFO> &todo = *(vector<FILEINFO> *)lParam;
- for (int i = 0; i < (int)todo.size(); ++i)
- {
- lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_IMAGE;
- lvI.iSubItem = 0;
- lvI.lParam = (LPARAM)&todo[i];
- lvI.pszText = todo[i].tszDescr;
- lvI.iItem = i;
- ListView_InsertItem(hwndList, &lvI);
-
- lvI.mask = LVIF_TEXT;// | LVIF_IMAGE;
-
- lvI.iSubItem = 1;
- lvI.pszText = todo[i].tszCurVer;
- ListView_SetItem(hwndList, &lvI);
-
- lvI.iSubItem = 2;
- lvI.pszText = todo[i].tszNewVer;
- ListView_SetItem(hwndList, &lvI);
-
- // remember whether the user has decided not to update this component with this particular new version
- /*char stored_setting[256];
- char* descr = mir_t2a(todo[i].tszDescr);
- mir_snprintf(stored_setting, 256, "DisabledVer%s", descr);
- mir_free(descr);
- DBVARIANT dbv;
- bool check = todo[i].enabled;
- if (!DBGetContactSettingTString(0, MODNAME, stored_setting, &dbv))
- {
- if (dbv.ptszVal && lstrcmp(dbv.ptszVal, todo[i].tszNewVer) == 0)
- check = false;
- else
- DBDeleteContactSetting(0, MODNAME, stored_setting);
- DBFreeVariant(&dbv);
- }
- one_enabled |= check;*/
- ListView_SetCheckState(hwndList, lvI.iItem, true);
- todo[i].enabled = true;
- }
- HWND hwOk = GetDlgItem(hDlg, IDOK);
- EnableWindow(hwOk, true/*one_enabled ? TRUE : FALSE*/);
- // do this after filling list - enables 'ITEMCHANGED' below
- SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
- Utils_RestoreWindowPositionNoSize(hDlg,0,MODNAME,"ConfirmWindow");
- //if (!IsUserAnAdmin())
- //SendDlgItemMessage(hDlg, IDOK, BCM_SETSHIELD, 0, TRUE);
- return TRUE;
+ lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_IMAGE;
+ lvI.iSubItem = 0;
+ lvI.lParam = (LPARAM)&todo[i];
+ lvI.pszText = todo[i].tszDescr;
+ lvI.iItem = i;
+ ListView_InsertItem(hwndList, &lvI);
+
+ lvI.mask = LVIF_TEXT;// | LVIF_IMAGE;
+
+ lvI.iSubItem = 1;
+ lvI.pszText = todo[i].tszCurVer;
+ ListView_SetItem(hwndList, &lvI);
+
+ lvI.iSubItem = 2;
+ lvI.pszText = todo[i].tszNewVer;
+ ListView_SetItem(hwndList, &lvI);
+
+ ListView_SetCheckState(hwndList, lvI.iItem, true);
+ todo[i].enabled = true;
}
- case WM_NOTIFY:
- {
- if (((LPNMHDR) lParam)->hwndFrom == hwndList)
- {
- switch (((LPNMHDR) lParam)->code)
- {
- case LVN_ITEMCHANGED:
- {
- if (GetWindowLongPtr(hDlg, GWLP_USERDATA))
- {
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
-
- LVITEM lvI = {0};
-
- lvI.iItem = nmlv->iItem;
- lvI.iSubItem = 0;
- lvI.mask = LVIF_PARAM;
- ListView_GetItem(hwndList, &lvI);
-
- vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)
- {
- todo[lvI.iItem].enabled = ListView_GetCheckState(hwndList, nmlv->iItem);
-
- /*char stored_setting[256];
- mir_snprintf(stored_setting, 256, "DisabledVer%s", ((UpdateInternal *)lvI.lParam)->update.szComponentName);
-
- if (((UpdateInternal *)lvI.lParam)->update_options.enabled)
- DBDeleteContactSetting(0, "Updater", stored_setting); // user has re-enabled update to this version - remove setting from db
- else
- DBWriteContactSettingString(0, "Updater", stored_setting, ((UpdateInternal *)lvI.lParam)->newVersion);
- //ListView_SetItem(hwndList, &lvI);
- */
-
- bool enableOk = false;
- for(int i=0; i<(int)todo.size(); ++i)
- {
- if(todo[i].enabled)
- {
- enableOk = true;
- break;
- }
- }
- HWND hwOk = GetDlgItem(hDlg, IDOK);
- EnableWindow(hwOk, enableOk ? TRUE : FALSE);
- }
- if (nmlv->uNewState & LVIS_SELECTED)
- {
- if (lstrcmp(todo[lvI.iItem].tszInfoURL, _T("")))
- EnableWindow(GetDlgItem(hDlg, IDC_INFO), TRUE);
- else
- EnableWindow(GetDlgItem(hDlg, IDC_INFO), FALSE);
- SetDlgItemText(hDlg, IDC_MESSAGE, TranslateTS(todo[lvI.iItem].tszMessage));
- /*char stored_setting[256];
- char* descr = mir_t2a(todo[lvI.iItem].tszDescr);
- mir_snprintf(stored_setting, 256, "DisabledVer%s", descr);
- mir_free(descr);
- DBVARIANT dbv;
- if (!DBGetContactSettingTString(0, MODNAME, stored_setting, &dbv))
- {
- if(dbv.ptszVal && lstrcmp(dbv.ptszVal, todo[lvI.iItem].tszNewVer) == 0)
- CheckDlgButton(hDlg, IDC_DONOTREMIND, BST_CHECKED);
- else
- DBDeleteContactSetting(0, MODNAME, stored_setting);
- DBFreeVariant(&dbv);
- }
- else
- CheckDlgButton(hDlg, IDC_DONOTREMIND, BST_UNCHECKED);
- */
-
- }
- }
+ HWND hwOk = GetDlgItem(hDlg, IDOK);
+ EnableWindow(hwOk, true/*one_enabled ? TRUE : FALSE*/);
+ // do this after filling list - enables 'ITEMCHANGED' below
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
+ Utils_RestoreWindowPositionNoSize(hDlg,0,MODNAME,"ConfirmWindow");
+ }
+ return TRUE;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR) lParam)->hwndFrom == hwndList) {
+ switch (((LPNMHDR) lParam)->code) {
+ case LVN_ITEMCHANGED:
+ if (GetWindowLongPtr(hDlg, GWLP_USERDATA)) {
+ NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
+
+ LVITEM lvI = {0};
+
+ lvI.iItem = nmlv->iItem;
+ lvI.iSubItem = 0;
+ lvI.mask = LVIF_PARAM;
+ ListView_GetItem(hwndList, &lvI);
+
+ vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK) {
+ todo[lvI.iItem].enabled = ListView_GetCheckState(hwndList, nmlv->iItem);
+
+ bool enableOk = false;
+ for(int i=0; i<(int)todo.size(); ++i) {
+ if(todo[i].enabled) {
+ enableOk = true;
break;
}
+ }
+ HWND hwOk = GetDlgItem(hDlg, IDOK);
+ EnableWindow(hwOk, enableOk ? TRUE : FALSE);
+ }
+ if (nmlv->uNewState & LVIS_SELECTED) {
+ if (lstrcmp(todo[lvI.iItem].tszInfoURL, _T("")))
+ EnableWindow(GetDlgItem(hDlg, IDC_INFO), TRUE);
+ else
+ EnableWindow(GetDlgItem(hDlg, IDC_INFO), FALSE);
+ SetDlgItemText(hDlg, IDC_MESSAGE, TranslateTS(todo[lvI.iItem].tszMessage));
}
}
break;
}
- case WM_COMMAND:
- {
- if (HIWORD( wParam ) == BN_CLICKED)
+ }
+ break;
+
+ case WM_COMMAND:
+ if (HIWORD( wParam ) == BN_CLICKED) {
+ switch(LOWORD(wParam)) {
+ case IDOK:
{
- switch(LOWORD(wParam))
- {
- case IDOK:
- {
- vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- ShowWindow(hDlg, SW_HIDE);
- TCHAR tszBuff[2048] = {0}, tszFileDest[MAX_PATH] = {0}, tszFilePathDest[MAX_PATH] = {0}, tszFilePathBack[MAX_PATH] = {0}, tszFileName[MAX_PATH] = {0};
- TCHAR* tszExt = NULL;
- char szKey[64] = {0};
- vector<int> arFileType;
- vector<tString> arFilePath;
- vector<tString> arFileName;
- vector<tString> arAdvFolder;
- vector<tString> arExt;
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
-
- SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
- /*DBWriteContactSettingByte(NULL, "Updater", "DefaultConfAll", IsDlgButtonChecked(hwndDlg, IDC_CHK_CONFALL) ? 1 : 0);
- DBWriteContactSettingByte(NULL, "Updater", "NoInstall", IsDlgButtonChecked(hwndDlg, IDC_CHK_NOINSTALL) ? 1 : 0);
-
- if (IsDlgButtonChecked(hDlg, IDC_CHK_CONFALL))
- EndDialog(hDlg, CD_CONFALL);
- else if (IsDlgButtonChecked(hDlg, IDC_CHK_NOINSTALL))
- EndDialog(hDlg, CD_NOINSTALL);
+ vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ ShowWindow(hDlg, SW_HIDE);
+ TCHAR tszBuff[2048] = {0}, tszFileDest[MAX_PATH] = {0}, tszFilePathDest[MAX_PATH] = {0}, tszFilePathBack[MAX_PATH] = {0}, tszFileName[MAX_PATH] = {0};
+ TCHAR* tszExt = NULL;
+ char szKey[64] = {0};
+ vector<int> arFileType;
+ vector<tString> arFilePath;
+ vector<tString> arFileName;
+ vector<tString> arAdvFolder;
+ vector<tString> arExt;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
+ Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
+
+ arFileType.clear();
+ arFilePath.clear();
+ arFileName.clear();
+ arAdvFolder.clear();
+ arExt.clear();
+ for(int i=0; i<(int)todo.size(); ++i) {
+ if(todo[i].enabled) {
+ switch (todo[i].FileType) {
+ case 1:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Pack"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 2:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Plugins"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 3:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Icons"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 4:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ case 5:
+ mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ CreateDirectory(tszFileDest, NULL);
+ break;
+ default:
+ lstrcpyn(tszFileDest, tszRoot, SIZEOF(tszFileDest));
+ break;
+ }
+ mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\Backups"), tszRoot);
+ CreateDirectory(tszBuff, NULL);
+ lstrcpyn(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
+ mir_sntprintf(todo[i].File.tszDiskPath, SIZEOF(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
+ UpdatesCount++;
+
+ tszExt = &todo[i].File.tszDownloadURL[lstrlen(todo[i].File.tszDownloadURL)-5];
+ if (lstrcmp(tszExt, _T(".html")) == 0) {
+ char* szUrl = mir_t2a(todo[i].File.tszDownloadURL);
+ CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl);
+ mir_free(szUrl);
+ }
+ else {
+ // download update
+ pFileUrl = &todo[i].File;
+ Title = TranslateT("Pack Updater");
+ if (todo[i].FileType == 1)
+ Text = TranslateT("Downloading pack updates...");
else
- */
-
- arFileType.clear();
- arFilePath.clear();
- arFileName.clear();
- arAdvFolder.clear();
- arExt.clear();
- for(int i=0; i<(int)todo.size(); ++i)
- {
- if(todo[i].enabled)
- {
- switch (todo[i].FileType)
- {
- case 1:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Pack"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
- break;
- case 2:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Plugins"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
- break;
- case 3:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Icons"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
- break;
- case 4:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
- break;
- case 5:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
- CreateDirectory(tszFileDest, NULL);
- break;
- default:
- lstrcpyn(tszFileDest, tszRoot, SIZEOF(tszFileDest));
- break;
- }//end * switch (todo[i].FileType)
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\Backups"), tszRoot);
- CreateDirectory(tszBuff, NULL);
- lstrcpyn(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
- mir_sntprintf(todo[i].File.tszDiskPath, SIZEOF(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
- UpdatesCount++;
-
- tszExt = &todo[i].File.tszDownloadURL[lstrlen(todo[i].File.tszDownloadURL)-5];
- if (lstrcmp(tszExt, _T(".html")) == 0)
- {
- char* szUrl = mir_t2a(todo[i].File.tszDownloadURL);
- CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl);
- mir_free(szUrl);
- }
- else
- {
- // download update
- pFileUrl = &todo[i].File;
- Title = TranslateT("Pack Updater");
- if (todo[i].FileType == 1)
- Text = TranslateT("Downloading pack updates...");
- else
- Text = TranslateT("Downloading update...");
- DlgDownloadProc();
- if (!DlgDld)
- {
- if (UpdatesCount)
- UpdatesCount--;
- continue;
- }
- }
- lstrcpyn(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
- DBWriteContactSettingTString(NULL, MODNAME, szKey, todo[i].tszCurVer);
- arFileType.push_back(todo[i].FileType);
- arFilePath.push_back(todo[i].File.tszDiskPath);
- arFileName.push_back(tszFileName);
- arAdvFolder.push_back(todo[i].tszAdvFolder);
- arExt.push_back(tszExt);
- if (todo[i].FileType == 1)
- i = (int)todo.size();
- }
+ Text = TranslateT("Downloading update...");
+ DlgDownloadProc();
+ if (!DlgDld) {
+ if (UpdatesCount)
+ UpdatesCount--;
+ continue;
}
+ }
+ lstrcpyn(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
+ mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
+ DBWriteContactSettingTString(NULL, MODNAME, szKey, todo[i].tszCurVer);
+ arFileType.push_back(todo[i].FileType);
+ arFilePath.push_back(todo[i].File.tszDiskPath);
+ arFileName.push_back(tszFileName);
+ arAdvFolder.push_back(todo[i].tszAdvFolder);
+ arExt.push_back(tszExt);
+ if (todo[i].FileType == 1)
+ i = (int)todo.size();
+ }
+ }
- if (UpdatesCount > 1 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- lstrcpyn(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
- else if (UpdatesCount == 1 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- lstrcpyn(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
- if (UpdatesCount > 0 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- {
- INT rc = -1;
- Title = TranslateT("Pack Updater");
- Text = tszBuff;
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && ServiceExists(MS_POPUP_REGISTERACTIONS) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1))
- rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop);
+ if (UpdatesCount > 1 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0)
+ lstrcpyn(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ else if (UpdatesCount == 1 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0)
+ lstrcpyn(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ if (UpdatesCount > 0 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0) {
+ INT rc = -1;
+ Title = TranslateT("Pack Updater");
+ Text = tszBuff;
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && ServiceExists(MS_POPUP_REGISTERACTIONS) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1))
+ rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop);
+ else
+ rc = MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
+ if (rc == IDYES) {
+ for (int i = 0; i < UpdatesCount; i++) {
+ TCHAR* tszUtilRootPlug = NULL;
+ TCHAR* tszUtilRootIco = NULL;
+ TCHAR* tszUtilRoot = NULL;
+
+ switch (arFileType[i]) {
+ case 0:
+ break;
+ case 1:
+ if (Reminder == 2)
+ DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 1);
+ memset(&si, 0, sizeof(STARTUPINFO));
+ memset(&pi, 0, sizeof(PROCESS_INFORMATION));
+ si.cb = sizeof(STARTUPINFO);
+ CreateProcess(arFilePath[i].c_str(), _T(""), NULL, NULL, FALSE, NULL, NULL, NULL, &si, &pi);
+ i = UpdatesCount;
+ CallFunctionAsync(ExitMe, 0);
+ break;
+ case 2:
+ tszUtilRootPlug = Utils_ReplaceVarsT(_T("%miranda_path%\\Plugins"));
+ if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
else
- rc = MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
- if (rc == IDYES)
- {
- for (int i = 0; i < UpdatesCount; i++)
- {
- TCHAR* tszUtilRootPlug = NULL;
- TCHAR* tszUtilRootIco = NULL;
- TCHAR* tszUtilRoot = NULL;
-
- switch (arFileType[i])
- {
- case 0:
- break;
- case 1:
- if (Reminder == 2)
- DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 1);
- memset(&si, 0, sizeof(STARTUPINFO));
- memset(&pi, 0, sizeof(PROCESS_INFORMATION));
- si.cb = sizeof(STARTUPINFO);
- CreateProcess(arFilePath[i].c_str(), _T(""), NULL, NULL, FALSE, NULL, NULL, NULL, &si, &pi);
- i = UpdatesCount;
- CallFunctionAsync(ExitMe, 0);
- break;
- case 2:
- tszUtilRootPlug = Utils_ReplaceVarsT(_T("%miranda_path%\\Plugins"));
- if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRootPlug);
- if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
- break;
- case 3:
- tszUtilRootIco = Utils_ReplaceVarsT(_T("%miranda_path%\\Icons"));
- if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRootIco);
- if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
- break;
- case 4:
- tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
- if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRoot);
- if (i == UpdatesCount - 1)
- CallFunctionAsync(RestartMe, 0);
- break;
- case 5:
- tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
- if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
- else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
- MoveFile(tszFilePathDest, tszFilePathBack);
- MoveFile(arFilePath[i].c_str(), tszFilePathDest);
- mir_free(tszUtilRoot);
- break;
- }//end* switch (arFileType[i])
- }//end* for (int i = 0; i < UpdatesCount; i++)
- }//end* if (IDYES == MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION))
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRootPlug);
+ if (i == UpdatesCount - 1)
+ CallFunctionAsync(RestartMe, 0);
+ break;
+ case 3:
+ tszUtilRootIco = Utils_ReplaceVarsT(_T("%miranda_path%\\Icons"));
+ if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
else
- {//reminder for not installed pack update
- if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
- DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 2);
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
- Title = TranslateT("Pack Updater");
- Text = tszBuff;
- if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
- {
- Number = 2;
- show_popup(0, Title, Text, Number, 0);
- }
- else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
- MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
- }
- }//end* if (UpdatesCount > 0)
-
- EndDialog(hDlg, IDOK);
- return TRUE;
- }
- case IDCANCEL:
- {
- SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
- EndDialog(hDlg, IDCANCEL);
- return TRUE;
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRootIco);
+ if (i == UpdatesCount - 1)
+ CallFunctionAsync(RestartMe, 0);
+ break;
+ case 4:
+ tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
+ if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
+ else
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRoot);
+ if (i == UpdatesCount - 1)
+ CallFunctionAsync(RestartMe, 0);
+ break;
+ case 5:
+ tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
+ if (lstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
+ else
+ mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ MoveFile(tszFilePathDest, tszFilePathBack);
+ MoveFile(arFilePath[i].c_str(), tszFilePathDest);
+ mir_free(tszUtilRoot);
+ break;
+ }
}
- case IDC_INFO:
+ }
+ else { //reminder for not installed pack update
+ if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
+ DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 2);
+ mir_sntprintf(tszBuff, SIZEOF(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
+ Title = TranslateT("Pack Updater");
+ Text = tszBuff;
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
- int sel = ListView_GetSelectionMark(hwndList);
- vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- char* szUrl = mir_t2a(todo[sel].tszInfoURL);
- CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl);
- mir_free(szUrl);
- break;
+ Number = 2;
+ show_popup(0, Title, Text, Number, 0);
}
+ else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
+ }
}
}
- break;
+ EndDialog(hDlg, IDOK);
+ return TRUE;
+
+ case IDCANCEL:
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
+ Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
+ EndDialog(hDlg, IDCANCEL);
+ return TRUE;
+
+ case IDC_INFO:
+ int sel = ListView_GetSelectionMark(hwndList);
+ vector<FILEINFO> &todo = *(vector<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
+ char* szUrl = mir_t2a(todo[sel].tszInfoURL);
+ CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl);
+ mir_free(szUrl);
}
+ break;
+ }
}
return FALSE;
}
INT_PTR CALLBACK DlgMsgPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
+ switch (uMsg) {
case WM_INITDIALOG:
- {
- Number = 0;
- show_popup(hDlg, Title, Text, Number, 1);
- return TRUE;
- } // end* WM_INITDIALOG:
- } // end* switch (uMsg)
+ Number = 0;
+ show_popup(hDlg, Title, Text, Number, 1);
+ return TRUE;
+ }
ShowWindow(hDlg, SW_HIDE);
return FALSE;
}
\ No newline at end of file diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index 184ec0aae2..1170b44f1e 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -138,7 +138,7 @@ void ShowPopup(HWND hDlg, LPCTSTR ptszTitle, LPCTSTR ptszText, int Number, int A return;
POPUPDATAT_V2 pd = { 0 };
- pd.cbSize = sizeof(POPUPDATAT_V2);
+ pd.cbSize = sizeof(pd);
pd.lchContact = NULL; //(HANDLE)wParam;
pd.lchIcon = LoadSkinnedIcon(PopupsList[Number].Icon);
lstrcpyn(pd.lptzText, TranslateTS(ptszText), MAX_SECONDLINE);
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index f93129a25f..13feea82db 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -190,23 +190,6 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) { hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), 0, w - si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY), 0, 0, h - si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), 0, 1, h - si->iSplitterY + SPLITTER_HEIGHT, w - 2, si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
-/*
-
- toolbarTopY = h - toolbarHeight;
- if (si->windowData.hwndLog != NULL) {
- logBottom = (h - si->iSplitterY) / 2;
- } else {
- logBottom = h - si->iSplitterY;
- }
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_LOG), 0, 0, 0, bNick?w - si->iSplitterX:w, logBottom, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_LIST), 0, w - si->iSplitterX + 2, 0, si->iSplitterX - 1, h - si->iSplitterY, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), 0, w - si->iSplitterX, 1, 2, h - si->iSplitterY, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY), 0, 0, h - si->iSplitterY, w, splitterHeight, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), 0, 0, h - si->iSplitterY + splitterHeight, bSend?w-64:w, si->iSplitterY - toolbarHeight - splitterHeight, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDOK), 0, w - 64, h - si->iSplitterY + splitterHeight, 64, si->iSplitterY - toolbarHeight - splitterHeight - 1, SWP_NOZORDER);
-
-*/
-
hdwp = ResizeToolbar(hwndDlg, hdwp, w, toolbarTopY + 1, toolbarHeight - 1, SIZEOF(toolbarButtons), toolbarButtons, buttonVisibility);
EndDeferWindowPos(hdwp);
if (si->windowData.hwndLog != NULL) {
@@ -250,9 +233,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, windowData = &Parentsi->windowData;
result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
- if (result != -1) {
+ if (result != -1)
return result;
- }
switch (msg) {
case EM_SUBCLASSED:
diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index ddf11830e6..71accc2067 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -561,198 +561,149 @@ INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) */
INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
+ switch (uMsg) {
case WM_INITDIALOG:
{
- POPUPDATAT_V2 pd;
- LPMSGPOPUPDATA pmpd;
- LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
-
MoveWindow(hDlg,-10,-10,0,0,FALSE);
- pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
- if (pmpd)
- {
- ZeroMemory(&pd, sizeof(pd));
- pd.cbSize = sizeof(POPUPDATAT);
- pd.lchContact = NULL; //(HANDLE)wParam;
- // icon
- pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
-
- // CALLBAC Proc
- pd.PluginWindowProc = (WNDPROC)PopupProc;
- //
- pd.PluginData = pmpd;
-
- pd.iSeconds = -1;
-
- pd.hNotification = NULL;
- pd.lpActions = pmpd->pa;
-
- // set color of popup
- switch (pMsgBox->uType & MB_ICONMASK)
- {
- case MB_ICON_ERROR:
- {
- pd.colorBack = RGB(200, 10, 0);
- pd.colorText = RGB(255, 255, 255);
- }
- break;
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
+ if (pmpd) {
+ POPUPDATAT_V2 pd = { 0 };
+ pd.cbSize = sizeof(POPUPDATAT);
+ pd.lchContact = NULL; //(HANDLE)wParam;
+
+ // icon
+ LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
+ pd.lchIcon = MsgLoadIcon(pMsgBox);
+ mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
+ mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+
+ // CALLBAC Proc
+ pd.PluginWindowProc = (WNDPROC)PopupProc;
+ pd.PluginData = pmpd;
+
+ pd.iSeconds = -1;
+
+ pd.hNotification = NULL;
+ pd.lpActions = pmpd->pa;
+
+ // set color of popup
+ switch (pMsgBox->uType & MB_ICONMASK) {
+ case MB_ICON_ERROR:
+ pd.colorBack = RGB(200, 10, 0);
+ pd.colorText = RGB(255, 255, 255);
+ break;
- case MB_ICON_WARNING:
- {
- pd.colorBack = RGB(200, 100, 0);
- pd.colorText = RGB(255, 255, 255);
- }
- break;
+ case MB_ICON_WARNING:
+ pd.colorBack = RGB(200, 100, 0);
+ pd.colorText = RGB(255, 255, 255);
+ break;
- default:
- {
- if (pMsgBox->uType & MB_CUSTOMCOLOR)
- {
- pd.colorBack = pMsgBox->colorBack;
- pd.colorText = pMsgBox->colorText;
- }
- }
+ default:
+ if (pMsgBox->uType & MB_CUSTOMCOLOR) {
+ pd.colorBack = pMsgBox->colorBack;
+ pd.colorText = pMsgBox->colorText;
}
+ }
- // handle for MakePopupAction
- pmpd->hDialog = hDlg;
-
- // active buttons
- switch (MB_TYPE(pMsgBox->uType))
- {
- case MB_OK:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
- }
- break;
+ // handle for MakePopupAction
+ pmpd->hDialog = hDlg;
- case MB_OKCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ // active buttons
+ switch (MB_TYPE(pMsgBox->uType)) {
+ case MB_OK:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
+ break;
- case MB_RETRYCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ case MB_OKCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- case MB_YESNO:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- }
- break;
+ case MB_RETRYCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- case MB_ABORTRETRYIGNORE:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDABORT);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDIGNORE);
- }
- break;
+ case MB_YESNO:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ break;
- case MB_YESNOCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ case MB_ABORTRETRYIGNORE:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDABORT);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDIGNORE);
+ break;
- case MB_YESALLNO:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDALL);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- }
- break;
+ case MB_YESNOCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- } // end* switch
+ case MB_YESALLNO:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDALL);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ break;
+ }
- // create popup
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
- if (MB_TYPE(pMsgBox->uType) == MB_OK)
- {
- EndDialog(hDlg, IDOK);
- }
- } // end*if (pmpd)
+ // create popup
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
+ if (MB_TYPE(pMsgBox->uType) == MB_OK)
+ EndDialog(hDlg, IDOK);
+ }
break;
- } // end* WM_INITDIALOG:
- } // end* switch (uMsg)
+ }
+ }
return FALSE;
}
/**
- * This is the message procedure for popup
- *
- * @param hDlg - window handle
- * @param uMsg - message to handle
- * @param wParam - message specific parameter
- * @param lParam - message specific parameter
- *
- * @return TRUE, FALSE, IDOK, IDYES, IDALL, IDNO or IDCANCEL
- **/
+* This is the message procedure for popup
+*
+* @param hDlg - window handle
+* @param uMsg - message to handle
+* @param wParam - message specific parameter
+* @param lParam - message specific parameter
+*
+* @return TRUE, FALSE, IDOK, IDYES, IDALL, IDNO or IDCANCEL
+**/
INT_PTR CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case UM_POPUPACTION:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
-
- if (pmpd)
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- case IDCANCEL:
- case IDABORT:
- case IDRETRY:
- case IDIGNORE:
- case IDYES:
- case IDNO:
- case IDALL:
- case IDNONE:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, LOWORD(wParam));
- }
+ switch (uMsg) {
+ case UM_POPUPACTION:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd) {
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ case IDABORT:
+ case IDRETRY:
+ case IDIGNORE:
+ case IDYES:
+ case IDNO:
+ case IDALL:
+ case IDNONE:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, LOWORD(wParam));
break;
- default:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, IDCANCEL);
- }
- }
+ default:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, IDCANCEL);
}
- PUDeletePopUp(hDlg);
}
+ PUDeletePopUp(hDlg);
}
break;
- case UM_FREEPLUGINDATA:
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
- if (pmpd > 0) {
- mir_freeAndNil(pmpd);
- }
- return TRUE; //TRUE or FALSE is the same, it gets ignored.
- }
- break;
-
- default:
- break;
+ case UM_FREEPLUGINDATA:
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd > 0)
+ mir_freeAndNil(pmpd);
+ return TRUE; //TRUE or FALSE is the same, it gets ignored.
}
return DefWindowProc(hDlg, uMsg, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index e6576b39e9..254459ccd7 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -190,7 +190,7 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA static int ShowPopup(HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
{
- POPUPDATAT_V2 pd = {0};
+ POPUPDATAT pd = {0};
va_list marker;
static TCHAR szBuf[4*1024];
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 362adf97b3..9a7d8cf45c 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -669,12 +669,6 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType, HWND hContainer)
{
- POPUPDATAT_V2 pud = {0};
- PLUGIN_DATAT *pdata;
- DBEVENTINFO dbe;
- long iSeconds = 0;
- TCHAR *szPreview = NULL;
-
//there has to be a maximum number of popups shown at the same time
if (PopupList.size() >= MAX_POPUPS)
return(2);
@@ -682,6 +676,8 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent if (!PluginConfig.g_PopupAvail)
return 0;
+ POPUPDATAT pud = {0};
+ long iSeconds;
switch (eventType) {
case EVENTTYPE_MESSAGE:
pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
@@ -699,23 +695,18 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent return 1;
}
- ZeroMemory(&dbe, sizeof(dbe));
- dbe.pBlob = NULL;
- dbe.cbSize = sizeof(dbe);
-
+ DBEVENTINFO dbe = { sizeof(dbe) };
// fix for a crash
if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
dbe.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
- } else
- dbe.cbBlob = 0;
+ }
CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbe);
if (hEvent == 0 && hContact == 0)
dbe.szModule = Translate("Unknown module or contact");
- pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
-
+ PLUGIN_DATAT *pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
pdata->eventType = eventType;
pdata->hContact = hContact;
pdata->pluginOptions = pluginOptions;
@@ -737,7 +728,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent mir_free(szModule);
}
- szPreview = GetPreviewT((WORD)eventType, &dbe);
+ TCHAR *szPreview = GetPreviewT((WORD)eventType, &dbe);
if (szPreview) {
mir_sntprintf(pud.lptzText, MAX_SECONDLINE, _T("%s"), szPreview);
mir_free(szPreview);
@@ -753,14 +744,11 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent pdata->nrMerged = 1;
// fix for broken popups -- process failures
- if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pud, 0) < 0) {
- // failed to display, perform cleanup
- if (pdata->eventData)
- mir_free(pdata->eventData);
+ if ( PUAddPopUpT(&pud) < 0) {
+ mir_free(pdata->eventData);
mir_free(pdata);
}
- else
- PopupList.push_back(pdata);
+ else PopupList.push_back(pdata);
if (dbe.pBlob)
free(dbe.pBlob);
@@ -936,7 +924,7 @@ int tabSRMM_ShowPopup(WPARAM wParam, LPARAM lParam, WORD eventType, int windowOp return 0;
}
passed:
- if (!(PluginConfig.g_PopupAvail && PluginConfig.g_PopupWAvail))
+ if ( !PluginConfig.g_PopupAvail)
return 0;
if (PU_GetByContact((HANDLE)wParam) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) {
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index 5b440cb7aa..d5746cca5a 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -176,7 +176,7 @@ int TSAPI LoadLocalFlags(HWND hwnd, TWindowData *dat); int TN_ModuleInit();
int TN_OptionsInitialize(WPARAM wParam, LPARAM lParam);
int TN_ModuleDeInit();
-int TN_TypingMessage(WPARAM wParam, LPARAM lParam);
+void TN_TypingMessage(HANDLE hContact, int iMode);
// mod plus
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 9fad90a235..f358f550bd 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -202,7 +202,6 @@ void CGlobals::reloadSystemModulesChanged() }
g_PopupAvail = ServiceExists(MS_POPUP_ADDPOPUP);
- g_PopupWAvail = ServiceExists(MS_POPUP_ADDPOPUPW);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -2000090000;
@@ -404,7 +403,7 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) ::RegisterFontServiceFonts();
::CacheLogFonts();
::Chat_ModulesLoaded(wParam, lParam);
- if (PluginConfig.g_PopupWAvail||PluginConfig.g_PopupAvail)
+ if (PluginConfig.g_PopupAvail)
TN_ModuleInit();
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged);
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 279016b8df..10a22aed0e 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -111,7 +111,7 @@ public: HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
HBITMAP g_hbmUnknown;
- int g_MetaContactsAvail, g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_PopupWAvail, g_WantHPP;
+ int g_MetaContactsAvail, g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP;
int g_FlashAvatarAvail;
HIMAGELIST g_hImageList;
HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index f57c312a5a..0c9f5a33f9 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -502,14 +502,12 @@ void CMimAPI::InitAPI() int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam)
{
- HWND hwnd = 0;
- int issplit = 1, foundWin = 0, preTyping = 0;
- struct TContainerData *pContainer = NULL;
- BOOL fShowOnClist = TRUE;
+ HWND hwnd = 0;
+ int issplit = 1, foundWin = 0, preTyping = 0;
+ BOOL fShowOnClist = TRUE;
if (wParam) {
-
- if ((hwnd = M->FindWindow((HANDLE) wParam)) && M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
+ if ((hwnd = M->FindWindow((HANDLE)wParam)) && M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
preTyping = SendMessage(hwnd, DM_TYPING, 0, lParam);
if (hwnd && IsWindowVisible(hwnd))
@@ -517,59 +515,54 @@ int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam) else
foundWin = 0;
-
+ TContainerData *pContainer = NULL;
if (hwnd) {
SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
if (pContainer == NULL)
return 0; // should never happen
}
- if (M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) {
+ if ( M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) {
if (!hwnd && !M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1))
fShowOnClist = FALSE;
if (hwnd && !M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1))
fShowOnClist = FALSE;
}
- else
- fShowOnClist = FALSE;
+ else fShowOnClist = FALSE;
- if ((!foundWin || !(pContainer->dwFlags&CNT_NOSOUND)) && preTyping != (lParam != 0)) {
- if (lParam)
- SkinPlaySound("TNStart");
- else
- SkinPlaySound("TNStop");
- }
+ if ((!foundWin || !(pContainer->dwFlags&CNT_NOSOUND)) && preTyping != (lParam != 0))
+ SkinPlaySound((lParam) ? "TNStart" : "TNStop");
if (M->GetByte(SRMSGMOD, "ShowTypingPopup", 0)) {
- BOOL fShow = FALSE;
- int iMode = M->GetByte("MTN_PopupMode", 0);
+ BOOL fShow = FALSE;
+ int iMode = M->GetByte("MTN_PopupMode", 0);
switch(iMode) {
- case 0:
+ case 0:
+ fShow = TRUE;
+ break;
+ case 1:
+ if (!foundWin || !(pContainer && pContainer->hwndActive == hwnd && GetForegroundWindow() == pContainer->hwnd))
fShow = TRUE;
- break;
- case 1:
- if (!foundWin || !(pContainer && pContainer->hwndActive == hwnd && GetForegroundWindow() == pContainer->hwnd))
- fShow = TRUE;
- break;
- case 2:
- if (hwnd == 0)
- fShow = TRUE;
- else {
- if (PluginConfig.m_HideOnClose) {
- struct TContainerData *pContainer = 0;
- SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer && pContainer->fHidden)
- fShow = TRUE;
- }
+ break;
+ case 2:
+ if (hwnd == 0)
+ fShow = TRUE;
+ else {
+ if (PluginConfig.m_HideOnClose) {
+ struct TContainerData *pContainer = 0;
+ SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
+ if (pContainer && pContainer->fHidden)
+ fShow = TRUE;
}
- break;
+ }
+ break;
}
if (fShow)
- TN_TypingMessage(wParam, lParam);
+ TN_TypingMessage((HANDLE)wParam, lParam);
}
- if ((int) lParam) {
+ if (lParam) {
TCHAR szTip[256];
_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message."), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR));
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 77d73409db..f4abde6c78 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_SETCURSEL, (WPARAM)M->GetByte("MTN_PopupMode", 0), 0);
- if (!PluginConfig.g_PopupWAvail) {
+ if (!PluginConfig.g_PopupAvail) {
Utils::showDlgControl(hwndDlg, IDC_NOTIFYPOPUP, SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_STATIC111, SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_MTN_POPUPMODE, SW_HIDE);
@@ -1265,7 +1265,7 @@ struct { static int OptInitialise(WPARAM wParam, LPARAM lParam)
{
- if (PluginConfig.g_PopupWAvail||PluginConfig.g_PopupAvail)
+ if (PluginConfig.g_PopupAvail)
TN_OptionsInitialize(wParam, lParam);
OPTIONSDIALOGPAGE odp = { 0 };
diff --git a/plugins/TabSRMM/src/nen.h b/plugins/TabSRMM/src/nen.h index d21f2533b6..815737feb7 100644 --- a/plugins/TabSRMM/src/nen.h +++ b/plugins/TabSRMM/src/nen.h @@ -133,26 +133,28 @@ struct NEN_OPTIONS { DWORD dwRemoveMask;
};
-typedef struct {
+struct EVENT_DATAT
+{
HANDLE hEvent;
- TCHAR szText[MAX_SECONDLINE + 2];
- DWORD timestamp;
-} EVENT_DATAT;
+ TCHAR szText[MAX_SECONDLINE + 2];
+ DWORD timestamp;
+};
-typedef struct {
- UINT eventType;
- HANDLE hContact;
+struct PLUGIN_DATAT
+{
+ UINT eventType;
+ HANDLE hContact;
NEN_OPTIONS *pluginOptions;
- POPUPDATAT_V2* pud;
- HWND hWnd;
- long iSeconds;
- TCHAR szHeader[256];
- int nrMerged;
+ POPUPDATAT *pud;
+ HWND hWnd;
+ long iSeconds;
+ TCHAR szHeader[256];
+ int nrMerged;
EVENT_DATAT *eventData;
- int nrEventsAlloced;
- int iActionTaken;
- HWND hContainer;
-} PLUGIN_DATAT;
+ int nrEventsAlloced;
+ int iActionTaken;
+ HWND hContainer;
+};
#define NR_MERGED 5
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 4b62744ec7..709198ef4f 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -125,8 +125,6 @@ void CSendLaterJob::writeFlags() CSendLaterJob::~CSendLaterJob()
{
if (fSuccess || fFailed) {
- POPUPDATAT_V2 ppd = {0};
-
if ((sendLater->haveErrorPopups() && fFailed) || (sendLater->haveSuccessPopups() && fSuccess)) {
bool fShowPopup = true;
@@ -138,9 +136,8 @@ CSendLaterJob::~CSendLaterJob() if (PluginConfig.g_PopupAvail && fShowPopup) {
TCHAR *tszName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
- ZeroMemory((void*)&ppd, sizeof(ppd));
+ POPUPDATAT ppd = {0};
ppd.lchContact = hContact;
- ppd.cbSize = sizeof(ppd);
mir_sntprintf(ppd.lptzContactName, MAX_CONTACTNAME, _T("%s"), tszName ? tszName : TranslateT("'(Unknown Contact)'"));
TCHAR *msgPreview = Utils::GetPreviewWithEllipsis(reinterpret_cast<TCHAR *>(&pBuf[lstrlenA((char *)pBuf) + 1]), 100);
if (fSuccess) {
@@ -162,7 +159,7 @@ CSendLaterJob::~CSendLaterJob() ppd.lchIcon = fFailed ? PluginConfig.g_iconErr : PluginConfig.g_IconMsgEvent;
ppd.PluginData = (void*)hContact;
ppd.iSeconds = fFailed ? -1 : nen_options.iDelayMsg;
- CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, 0);
+ PUAddPopUpT(&ppd);
}
}
if (fFailed && (bCode == JOB_AGE || bCode == JOB_REMOVABLE) && szId[0] == 'S')
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 49a095064e..e2a609db61 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -690,30 +690,28 @@ void SendQueue::UpdateSaveAndSendButton(TWindowData *dat) void SendQueue::NotifyDeliveryFailure(const TWindowData *dat)
{
- POPUPDATAT_V2 ppd = {0};
- int ibsize = 1023;
-
if (M->GetByte("adv_noErrorPopups", 0))
return;
- if (CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) {
- ZeroMemory((void*)&ppd, sizeof(ppd));
- ppd.lchContact = dat->hContact;
- mir_sntprintf(ppd.lptzContactName, MAX_CONTACTNAME, _T("%s"), dat->cache->getNick());
- mir_sntprintf(ppd.lptzText, MAX_SECONDLINE, _T("%s"), TranslateT("A message delivery has failed.\nClick to open the message window."));
- if (!(BOOL)M->GetByte(MODULE, OPT_COLDEFAULT_ERR, TRUE))
- {
- ppd.colorText = (COLORREF)M->GetDword(MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
- ppd.colorBack = (COLORREF)M->GetDword(MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
- }
- else
- ppd.colorText = ppd.colorBack = 0;
- ppd.PluginWindowProc = reinterpret_cast<WNDPROC>(Utils::PopupDlgProcError);
- ppd.lchIcon = PluginConfig.g_iconErr;
- ppd.PluginData = (void*)dat->hContact;
- ppd.iSeconds = (int)M->GetDword(MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY);
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
+ if ( CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) != 1)
+ return;
+
+ POPUPDATAT ppd = { 0 };
+ ppd.lchContact = dat->hContact;
+ lstrcpyn(ppd.lptzContactName, dat->cache->getNick(), MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, TranslateT("A message delivery has failed.\nClick to open the message window."), MAX_SECONDLINE);
+
+ if (!(BOOL)M->GetByte(MODULE, OPT_COLDEFAULT_ERR, TRUE)) {
+ ppd.colorText = (COLORREF)M->GetDword(MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
+ ppd.colorBack = (COLORREF)M->GetDword(MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
}
+ else ppd.colorText = ppd.colorBack = 0;
+
+ ppd.PluginWindowProc = reinterpret_cast<WNDPROC>(Utils::PopupDlgProcError);
+ ppd.lchIcon = PluginConfig.g_iconErr;
+ ppd.PluginData = (void*)dat->hContact;
+ ppd.iSeconds = (int)M->GetDword(MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY);
+ PUAddPopUpT(&ppd);
}
/*
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 4ce0796936..d42c2cac8c 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -2,11 +2,49 @@ HANDLE hTypingNotify;
+static HANDLE hDisableMenu = NULL;
+static HANDLE hPopUpsList = NULL;
+
+static BYTE OnePopUp;
+static BYTE ShowMenu;
+static BYTE StartDisabled;
+static BYTE StopDisabled;
+static BYTE Disabled;
+static BYTE ColorMode;
+static BYTE TimeoutMode;
+static BYTE TimeoutMode2;
+static int Timeout;
+static int Timeout2;
+static int newTimeout;
+static int newTimeout2;
+static BYTE newTimeoutMode;
+static BYTE newTimeoutMode2;
+static BYTE newColorMode;
+static TCHAR szStart[128];
+static TCHAR szStop[128];
+
+static HANDLE hntfStarted = 0;
+static HANDLE hntfStopped = 0;
+
+struct
+{
+ int res;
+ char desc[10];
+ COLORREF color;
+}
+static colorPicker[4] =
+{
+ { IDC_TYPEON_BG, "ON_BG", RGB(255,255,255)},
+ { IDC_TYPEON_TX, "ON_TX", RGB(0,0,0)},
+ { IDC_TYPEOFF_BG, "OFF_BG", RGB(255,255,255)},
+ { IDC_TYPEOFF_TX, "OFF_TX", RGB(0,0,0)}
+};
+
static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam)
{
- Disabled = !(Disabled);
+ Disabled = !Disabled;
- if (PopupService) {
+ if (PluginConfig.g_PopupAvail) {
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ICON | CMIM_NAME;
@@ -55,161 +93,156 @@ static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM return DefWindowProc(hWnd, message, wParam, lParam);
}
-int TN_TypingMessage(WPARAM wParam, LPARAM lParam)
+void TN_TypingMessage(HANDLE hContact, int iMode)
{
- POPUPDATAT_V2 ppd = { 0 };
- TCHAR *szContactName = NULL;
- HWND hPopUpWnd = NULL;
- int notyping;
-
// hidden & ignored contacts check
- if (M->GetByte((HANDLE)wParam, "CList", "Hidden", 0) || (M->GetDword((HANDLE)wParam, "Ignore", "Mask1",0) & 1)) // 9 - online notification
- return 0;
+ if (M->GetByte(hContact, "CList", "Hidden", 0) || (M->GetDword(hContact, "Ignore", "Mask1",0) & 1)) // 9 - online notification
+ return;
- szContactName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GSMDF_TCHAR);
+ if (!PluginConfig.g_PopupAvail || Disabled)
+ return;
- if (PopupService && !Disabled) {
- if (OnePopUp) {
- hPopUpWnd = WindowList_Find(hPopUpsList, (HANDLE) wParam);
- while (hPopUpWnd) {
- PUDeletePopUp(hPopUpWnd);
- hPopUpWnd = WindowList_Find(hPopUpsList, (HANDLE) wParam);
- }
- }
+ TCHAR *szContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GSMDF_TCHAR);
- switch (lParam) {
- case PROTOTYPE_CONTACTTYPING_OFF:
- if (StopDisabled)
- return 0;
- lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
- ppd.hNotification = hntfStopped;
- notyping = 1;
- break;
- default:
- if (StartDisabled)
- return 0;
- lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
- ppd.hNotification = hntfStarted;
- notyping = 0;
- break;
+ if (OnePopUp) {
+ HWND hPopUpWnd = WindowList_Find(hPopUpsList, hContact);
+ while (hPopUpWnd) {
+ PUDeletePopUp(hPopUpWnd);
+ hPopUpWnd = WindowList_Find(hPopUpsList, hContact);
}
+ }
- switch (ColorMode) {
- case COLOR_OWN:
- ppd.colorBack = colorPicker[2* notyping ].color;
- ppd.colorText = colorPicker[2* notyping + 1].color;
- break;
- case COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case COLOR_POPUP:
- default:
- ppd.colorBack = ppd.colorText = 0;
- break;
- }
+ int notyping;
+ POPUPDATAT_V2 ppd = { 0 };
- if (notyping)
- switch (TimeoutMode2) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = Timeout2;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
- else
- switch (TimeoutMode) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = Timeout;
- break;
- case TIMEOUT_PROTO:
- ppd.iSeconds = (DWORD) lParam;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
+ if (iMode == PROTOTYPE_CONTACTTYPING_OFF) {
+ if (StopDisabled)
+ return;
+ lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
+ ppd.hNotification = hntfStopped;
+ notyping = 1;
+ }
+ else {
+ if (StartDisabled)
+ return;
+ lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
+ ppd.hNotification = hntfStarted;
+ notyping = 0;
+ }
- ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
- ppd.lchContact = (HANDLE) wParam;
- ppd.PluginWindowProc = (WNDPROC) PopupDlgProc;
- ppd.PluginData = NULL;
+ switch (ColorMode) {
+ case COLOR_OWN:
+ ppd.colorBack = colorPicker[2* notyping ].color;
+ ppd.colorText = colorPicker[2* notyping + 1].color;
+ break;
+ case COLOR_WINDOWS:
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case COLOR_POPUP:
+ default:
+ ppd.colorBack = ppd.colorText = 0;
+ break;
+ }
- ppd.cbSize = sizeof(ppd);
+ if (notyping)
+ switch (TimeoutMode2) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = Timeout2;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
+ else
+ switch (TimeoutMode) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = Timeout;
+ break;
+ case TIMEOUT_PROTO:
+ ppd.iSeconds = iMode;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NEWDATA);
- }
- return 0;
+ ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
+ ppd.lchContact = hContact;
+ ppd.PluginWindowProc = (WNDPROC) PopupDlgProc;
+ ppd.PluginData = NULL;
+ ppd.cbSize = sizeof(ppd);
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NEWDATA);
}
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WORD i;
+ int i;
switch (msg) {
- case WM_INITDIALOG: {
- TranslateDialogDefault(hwndDlg);
-
- if (ColorMode == COLOR_WINDOWS) {
- CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_CHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, TRUE);
- CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_UNCHECKED);
- } else if (ColorMode == COLOR_POPUP) {
- CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_UNCHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, TRUE);
- CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
- }
-
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) {
- SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_SETCOLOUR, 0, colorPicker[i].color);
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, (ColorMode == COLOR_OWN));
- }
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ if (ColorMode == COLOR_WINDOWS) {
+ CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_CHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, TRUE);
+ CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_UNCHECKED);
+ }
+ else if (ColorMode == COLOR_POPUP) {
+ CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_UNCHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, TRUE);
+ CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
+ }
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT, (TimeoutMode == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP, (TimeoutMode == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_PROTO, (TimeoutMode == TIMEOUT_PROTO) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM, (TimeoutMode == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE, Timeout, 0);
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, TimeoutMode == TIMEOUT_CUSTOM);
-
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT2, (TimeoutMode2 == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP2, (TimeoutMode2 == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM2, (TimeoutMode2 == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE2, Timeout2, 0);
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, TimeoutMode2 == TIMEOUT_CUSTOM);
-
- CheckDlgButton(hwndDlg, IDC_START, (StartDisabled) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_STOP, (StopDisabled) ? BST_UNCHECKED : BST_CHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopUp) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED);
-
- Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PopupService);
- Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PopupService);
- Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PopupService/*&&!ServiceExists(MS_POPUP_REGISTERNOTIFICATION)*/);
-
- newTimeout = Timeout;
- newTimeoutMode = TimeoutMode;
- newTimeout2 = Timeout2;
- newTimeoutMode2 = TimeoutMode2;
- newColorMode = ColorMode;
+ for (i=0; i < SIZEOF(colorPicker); i++) {
+ SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_SETCOLOUR, 0, colorPicker[i].color);
+ Utils::enableDlgControl(hwndDlg, colorPicker[i].res, (ColorMode == COLOR_OWN));
}
- break;
- case WM_COMMAND: {
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT, (TimeoutMode == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP, (TimeoutMode == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_PROTO, (TimeoutMode == TIMEOUT_PROTO) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM, (TimeoutMode == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE, Timeout, 0);
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, TimeoutMode == TIMEOUT_CUSTOM);
+
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT2, (TimeoutMode2 == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP2, (TimeoutMode2 == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM2, (TimeoutMode2 == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE2, Timeout2, 0);
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, TimeoutMode2 == TIMEOUT_CUSTOM);
+
+ CheckDlgButton(hwndDlg, IDC_START, (StartDisabled) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_STOP, (StopDisabled) ? BST_UNCHECKED : BST_CHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopUp) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED);
+
+ Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PluginConfig.g_PopupAvail);
+ Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PluginConfig.g_PopupAvail);
+ Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PluginConfig.g_PopupAvail/*&&!ServiceExists(MS_POPUP_REGISTERNOTIFICATION)*/);
+
+ newTimeout = Timeout;
+ newTimeoutMode = TimeoutMode;
+ newTimeout2 = Timeout2;
+ newTimeoutMode2 = TimeoutMode2;
+ newColorMode = ColorMode;
+ break;
+
+ case WM_COMMAND:
+ {
WORD idCtrl = LOWORD(wParam), wNotifyCode = HIWORD(wParam);
if (wNotifyCode == CPN_COLOURCHANGED) {
@@ -218,37 +251,37 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
switch (idCtrl) {
- case IDC_USEWINCOLORS: {
- BOOL bEnableOthers = FALSE;
-
- if (wNotifyCode != BN_CLICKED)
- break;
+ case IDC_USEWINCOLORS:
+ if (wNotifyCode == BN_CLICKED) {
+ BOOL bEnableOthers;
if (IsDlgButtonChecked(hwndDlg, IDC_USEWINCOLORS)) {
newColorMode = COLOR_WINDOWS;
bEnableOthers = FALSE;
- } else {
+ }
+ else {
newColorMode = COLOR_OWN;
bEnableOthers = TRUE;
}
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++)
+ for (i=0; i < SIZEOF(colorPicker); i++)
Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, bEnableOthers);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
}
- case IDC_USEPOPUPCOLORS: {
- BOOL bEnableOthers = FALSE;
- if (wNotifyCode != BN_CLICKED)
- break;
+ break;
+
+ case IDC_USEPOPUPCOLORS:
+ if (wNotifyCode == BN_CLICKED) {
+ BOOL bEnableOthers;
if (IsDlgButtonChecked(hwndDlg, IDC_USEPOPUPCOLORS)) {
newColorMode = COLOR_POPUP;
bEnableOthers = FALSE;
- } else {
+ }
+ else {
newColorMode = COLOR_OWN;
bEnableOthers = TRUE;
}
@@ -259,156 +292,157 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, bEnableOthers);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
}
- case IDC_ONEPOPUP:
- case IDC_CLIST:
- case IDC_DISABLED:
- case IDC_SHOWMENU:
- case IDC_START:
- case IDC_STOP:
- case IDC_WOCL:
- if (wNotifyCode == BN_CLICKED)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_PREVIEW: {
- POPUPDATAT_V2 ppd = { 0 };
- char *szProto = NULL;
- int i, notyping;
-
- HANDLE hContact = db_find_first();
+ break;
- if (!PopupService)
- break;
+ case IDC_ONEPOPUP:
+ case IDC_CLIST:
+ case IDC_DISABLED:
+ case IDC_SHOWMENU:
+ case IDC_START:
+ case IDC_STOP:
+ case IDC_WOCL:
+ if (wNotifyCode == BN_CLICKED)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_PREVIEW:
+ if (PluginConfig.g_PopupAvail) {
+ HANDLE hContact = db_find_first();
while (hContact) {
- szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto != NULL)
break;
hContact = db_find_next(hContact);
}
+ POPUPDATAT ppd = { 0 };
for (i=0; i < 2; i++) {
-
- switch (i) {
- case PROTOTYPE_CONTACTTYPING_OFF:
- lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
- lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
- notyping = 1;
- break;
- default:
- lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
- lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
- notyping = 0;
- break;
+ int notyping;
+ if (i == PROTOTYPE_CONTACTTYPING_OFF) {
+ lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
+ lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
+ notyping = 1;
+ }
+ else {
+ lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
+ lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
+ notyping = 0;
}
switch (newColorMode) {
- case COLOR_OWN:
- ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2* notyping + 1].res, CPM_GETCOLOUR, 0, 0);
- ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2* notyping ].res, CPM_GETCOLOUR, 0, 0);
+ case COLOR_OWN:
+ ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2*notyping + 1].res, CPM_GETCOLOUR, 0, 0);
+ ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2*notyping ].res, CPM_GETCOLOUR, 0, 0);
+ break;
+ case COLOR_WINDOWS:
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case COLOR_POPUP:
+ default:
+ ppd.colorBack = ppd.colorText = 0;
+ break;
+ }
+
+ if (notyping)
+ switch (newTimeoutMode2) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout2;
break;
- case COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
break;
- case COLOR_POPUP:
+ case TIMEOUT_POPUP:
default:
- ppd.colorBack = ppd.colorText = 0;
+ ppd.iSeconds = 0;
break;
}
-
- if (notyping)
- switch (newTimeoutMode2) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout2;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
else
switch (newTimeoutMode) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout;
- break;
- case TIMEOUT_PROTO:
- ppd.iSeconds = 10;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout;
+ break;
+ case TIMEOUT_PROTO:
+ ppd.iSeconds = 10;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
ppd.lchContact = (HANDLE) wParam;
ppd.PluginWindowProc = NULL;
ppd.PluginData = NULL;
-
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
-
+ PUAddPopUpT(&ppd);
}
- break;
}
- case IDC_TIMEOUT_POPUP2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_POPUP;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_POPUP2:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_CUSTOM2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_CUSTOM;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 1);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode2 = TIMEOUT_POPUP;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_CUSTOM2:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_POPUP:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_POPUP;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode2 = TIMEOUT_CUSTOM;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 1);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_POPUP:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_PERMANENT:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_PERMANENT;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode = TIMEOUT_POPUP;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_PERMANENT:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_PERMANENT2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_PERMANENT;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode = TIMEOUT_PERMANENT;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_PERMANENT2:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_CUSTOM:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_CUSTOM;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 1);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode2 = TIMEOUT_PERMANENT;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_CUSTOM:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_PROTO:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_PROTO;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode = TIMEOUT_CUSTOM;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 1);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_PROTO:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_VALUE:
- case IDC_TIMEOUT_VALUE2: {
+ newTimeoutMode = TIMEOUT_PROTO;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_VALUE:
+ case IDC_TIMEOUT_VALUE2:
+ {
int newValue = GetDlgItemInt(hwndDlg, idCtrl, NULL, 0);
if (wNotifyCode == EN_KILLFOCUS) {
@@ -437,51 +471,45 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA newTimeout2 = newValue;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
}
-
}
- break;
}
- case WM_NOTIFY: {
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) {
- colorPicker[i].color = SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_GETCOLOUR, 0, 0);
- M->WriteDword(Module, colorPicker[i].desc, colorPicker[i].color);
- }
-
- Timeout = newTimeout;
- TimeoutMode = newTimeoutMode;
- Timeout2 = newTimeout2;
- TimeoutMode2 = newTimeoutMode2;
- ColorMode = newColorMode;
-
- if (Disabled != IsDlgButtonChecked(hwndDlg, IDC_DISABLED))
- EnableDisableMenuCommand(0, 0);
-
- StartDisabled = IsDlgButtonChecked(hwndDlg, IDC_START) ? 0 : 2;
- StopDisabled = IsDlgButtonChecked(hwndDlg, IDC_STOP) ? 0 : 4;
- OnePopUp = IsDlgButtonChecked(hwndDlg, IDC_ONEPOPUP);
- ShowMenu = IsDlgButtonChecked(hwndDlg, IDC_SHOWMENU);
-
- M->WriteByte(Module, SET_ONEPOPUP, OnePopUp);
- M->WriteByte(Module, SET_SHOWDISABLEMENU, ShowMenu);
- M->WriteByte(Module, SET_DISABLED, (BYTE) (StartDisabled | StopDisabled));
- M->WriteByte(Module, SET_COLOR_MODE, ColorMode);
- M->WriteByte(Module, SET_TIMEOUT_MODE, TimeoutMode);
- M->WriteByte(Module, SET_TIMEOUT, (BYTE) Timeout);
- M->WriteByte(Module, SET_TIMEOUT_MODE2, TimeoutMode2);
- M->WriteByte(Module, SET_TIMEOUT2, (BYTE) Timeout2);
-
- return TRUE;
- }
- break;
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) {
+ colorPicker[i].color = SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_GETCOLOUR, 0, 0);
+ M->WriteDword(Module, colorPicker[i].desc, colorPicker[i].color);
+ }
+
+ Timeout = newTimeout; TimeoutMode = newTimeoutMode;
+ Timeout2 = newTimeout2; TimeoutMode2 = newTimeoutMode2;
+ ColorMode = newColorMode;
+
+ if (Disabled != IsDlgButtonChecked(hwndDlg, IDC_DISABLED))
+ EnableDisableMenuCommand(0, 0);
+
+ StartDisabled = IsDlgButtonChecked(hwndDlg, IDC_START) ? 0 : 2;
+ StopDisabled = IsDlgButtonChecked(hwndDlg, IDC_STOP) ? 0 : 4;
+ OnePopUp = IsDlgButtonChecked(hwndDlg, IDC_ONEPOPUP);
+ ShowMenu = IsDlgButtonChecked(hwndDlg, IDC_SHOWMENU);
+
+ M->WriteByte(Module, SET_ONEPOPUP, OnePopUp);
+ M->WriteByte(Module, SET_SHOWDISABLEMENU, ShowMenu);
+ M->WriteByte(Module, SET_DISABLED, (BYTE) (StartDisabled | StopDisabled));
+ M->WriteByte(Module, SET_COLOR_MODE, ColorMode);
+ M->WriteByte(Module, SET_TIMEOUT_MODE, TimeoutMode);
+ M->WriteByte(Module, SET_TIMEOUT, (BYTE) Timeout);
+ M->WriteByte(Module, SET_TIMEOUT_MODE2, TimeoutMode2);
+ M->WriteByte(Module, SET_TIMEOUT2, (BYTE) Timeout2);
+ return TRUE;
}
- break;
}
+ break;
}
return FALSE;
}
@@ -505,16 +533,12 @@ int TN_OptionsInitialize(WPARAM wParam, LPARAM lParam) int TN_ModuleInit()
{
- WORD i;
-
- PopupService = (PluginConfig.g_PopupWAvail || PluginConfig.g_PopupAvail);
-
hPopUpsList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
OnePopUp = M->GetByte(Module,SET_ONEPOPUP,DEF_ONEPOPUP);
ShowMenu = M->GetByte(Module,SET_SHOWDISABLEMENU,DEF_SHOWDISABLEMENU);
- i = M->GetByte(Module,SET_DISABLED,DEF_DISABLED);
+ int i = M->GetByte(Module,SET_DISABLED,DEF_DISABLED);
Disabled = i & 1;
StartDisabled = i & 2;
StopDisabled = i & 4;
@@ -526,22 +550,21 @@ int TN_ModuleInit() Timeout2 = M->GetByte(Module,SET_TIMEOUT2,DEF_TIMEOUT2);
if (!(M->GetDword(Module, colorPicker[0].desc, 1) && !M->GetDword(Module, colorPicker[0].desc, 0)))
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++)
+ for (i=0; i < SIZEOF(colorPicker); i++)
colorPicker[i].color = M->GetDword(Module,colorPicker[i].desc,0);
mir_sntprintf(szStart, sizeof(szStart), TranslateT("...is typing a message."));
mir_sntprintf(szStop, sizeof(szStop), TranslateT("...has stopped typing."));
- if (PopupService && ShowMenu) {
+ if (PluginConfig.g_PopupAvail && ShowMenu) {
hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand);
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = 0;
-
if (!Disabled) {
mi.pszName = LPGEN("Disable &typing notification");
mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED));
- } else {
+ }
+ else {
mi.pszName = LPGEN("Enable &typing notification");
mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED));
}
diff --git a/plugins/TabSRMM/src/typingnotify.h b/plugins/TabSRMM/src/typingnotify.h index 03fb9851b7..e825002b73 100644 --- a/plugins/TabSRMM/src/typingnotify.h +++ b/plugins/TabSRMM/src/typingnotify.h @@ -32,45 +32,3 @@ #define DEF_SHOWDISABLEMENU 1
#define SET_ONEPOPUP "OnePopUp"
#define DEF_ONEPOPUP 1
-
-
-static HANDLE hDisableMenu = NULL;
-static HANDLE hPopUpsList = NULL;
-
-static BYTE OnePopUp;
-static BYTE ShowMenu;
-static BYTE PopupService=0;
-static BYTE StartDisabled;
-static BYTE StopDisabled;
-static BYTE Disabled;
-static BYTE ColorMode;
-static BYTE TimeoutMode;
-static BYTE TimeoutMode2;
-static int Timeout;
-static int Timeout2;
-static int newTimeout;
-static int newTimeout2;
-static BYTE newTimeoutMode;
-static BYTE newTimeoutMode2;
-static BYTE newColorMode;
-static TCHAR szStart[128];
-static TCHAR szStop[128];
-
-static HANDLE hntfStarted = 0;
-static HANDLE hntfStopped = 0;
-
-
-struct colors_s
-{
- int res;
- char desc[10];
- COLORREF color;
-};
-
-static struct colors_s colorPicker[4] =
-{
- {IDC_TYPEON_BG, "ON_BG", RGB(255,255,255)},
- {IDC_TYPEON_TX, "ON_TX", RGB(0,0,0)},
- {IDC_TYPEOFF_BG, "OFF_BG", RGB(255,255,255)},
- {IDC_TYPEOFF_TX, "OFF_TX", RGB(0,0,0)}
-};
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 065f274821..0b57e0d2e8 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -561,132 +561,96 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l */
static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
+ switch (uMsg) {
case WM_INITDIALOG:
- {
- POPUPDATAT_V2 pd;
- LPMSGPOPUPDATA pmpd;
- LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
-
- MoveWindow(hDlg,-10,-10,0,0,FALSE);
- pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
- if (pmpd)
- {
- ZeroMemory(&pd, sizeof(pd));
- pd.cbSize = sizeof(POPUPDATAT_V2);
- pd.lchContact = NULL; //(HANDLE)wParam;
- // icon
- pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
-
- // CALLBAC Proc
- pd.PluginWindowProc = PopupProc;
- //
- pd.PluginData = pmpd;
-
- pd.iSeconds = -1;
-
- pd.hNotification = NULL;
- pd.lpActions = pmpd->pa;
-
- // set color of popup
- switch (pMsgBox->uType & MB_ICONMASK)
- {
- case MB_ICON_ERROR:
- {
- pd.colorBack = RGB(200, 10, 0);
- pd.colorText = RGB(255, 255, 255);
- }
- break;
-
- case MB_ICON_WARNING:
- {
- pd.colorBack = RGB(200, 100, 0);
- pd.colorText = RGB(255, 255, 255);
- }
- break;
+ LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
+
+ MoveWindow(hDlg,-10,-10,0,0,FALSE);
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
+ if (pmpd) {
+ POPUPDATAT_V2 pd = { 0 };
+ pd.cbSize = sizeof(POPUPDATAT_V2);
+ pd.lchContact = NULL; //(HANDLE)wParam;
+ // icon
+ pd.lchIcon = MsgLoadIcon(pMsgBox);
+ mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
+ mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+
+ // CALLBAC Proc
+ pd.PluginWindowProc = PopupProc;
+ pd.PluginData = pmpd;
+ pd.iSeconds = -1;
+ pd.lpActions = pmpd->pa;
+
+ // set color of popup
+ switch (pMsgBox->uType & MB_ICONMASK) {
+ case MB_ICON_ERROR:
+ pd.colorBack = RGB(200, 10, 0);
+ pd.colorText = RGB(255, 255, 255);
+ break;
- default:
- {
- if (pMsgBox->uType & MB_CUSTOMCOLOR)
- {
- pd.colorBack = pMsgBox->colorBack;
- pd.colorText = pMsgBox->colorText;
- }
- }
- }
+ case MB_ICON_WARNING:
+ pd.colorBack = RGB(200, 100, 0);
+ pd.colorText = RGB(255, 255, 255);
+ break;
- // handle for MakePopupAction
- pmpd->hDialog = hDlg;
+ default:
+ if (pMsgBox->uType & MB_CUSTOMCOLOR) {
+ pd.colorBack = pMsgBox->colorBack;
+ pd.colorText = pMsgBox->colorText;
+ }
+ }
- // active buttons
- switch (MB_TYPE(pMsgBox->uType))
- {
- case MB_OK:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
- }
- break;
+ // handle for MakePopupAction
+ pmpd->hDialog = hDlg;
- case MB_OKCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ // active buttons
+ switch (MB_TYPE(pMsgBox->uType)) {
+ case MB_OK:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
+ break;
- case MB_RETRYCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ case MB_OKCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- case MB_YESNO:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- }
- break;
+ case MB_RETRYCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- case MB_ABORTRETRYIGNORE:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDABORT);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDIGNORE);
- }
- break;
+ case MB_YESNO:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ break;
- case MB_YESNOCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ case MB_ABORTRETRYIGNORE:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDABORT);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDIGNORE);
+ break;
- case MB_YESALLNO:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDALL);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- }
- break;
+ case MB_YESNOCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- } // end* switch
+ case MB_YESALLNO:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDALL);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ break;
+ }
- // create popup
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
- if (MB_TYPE(pMsgBox->uType) == MB_OK)
- {
- EndDialog(hDlg, IDOK);
- }
- } // end*if (pmpd)
- break;
- } // end* WM_INITDIALOG:
- } // end* switch (uMsg)
+ // create popup
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
+ if (MB_TYPE(pMsgBox->uType) == MB_OK)
+ EndDialog(hDlg, IDOK);
+ }
+ break;
+ }
return FALSE;
}
@@ -702,57 +666,39 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP **/
static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case UM_POPUPACTION:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
-
- if (pmpd)
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- case IDCANCEL:
- case IDABORT:
- case IDRETRY:
- case IDIGNORE:
- case IDYES:
- case IDNO:
- case IDALL:
- case IDNONE:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, LOWORD(wParam));
- }
+ switch (uMsg) {
+ case UM_POPUPACTION:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd) {
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ case IDABORT:
+ case IDRETRY:
+ case IDIGNORE:
+ case IDYES:
+ case IDNO:
+ case IDALL:
+ case IDNONE:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, LOWORD(wParam));
break;
- default:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, IDCANCEL);
- }
- }
+ default:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, IDCANCEL);
}
- PUDeletePopUp(hDlg);
- }
- }
- break;
-
- case UM_FREEPLUGINDATA:
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
- if (pmpd > 0) {
- MIR_FREE(pmpd);
}
- return TRUE; //TRUE or FALSE is the same, it gets ignored.
+ PUDeletePopUp(hDlg);
}
break;
- default:
- break;
+ case UM_FREEPLUGINDATA:
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd > 0)
+ MIR_FREE(pmpd);
+ return TRUE;
}
return DefWindowProc(hDlg, uMsg, wParam, lParam);
}
@@ -768,28 +714,21 @@ static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP **/
INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam)
{
- INT rc = -1;
LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
// check input
- if (PtrIsValid(pMsgBox) && pMsgBox->cbSize == sizeof(MSGBOX))
- {
+ if ( PtrIsValid(pMsgBox) && pMsgBox->cbSize == sizeof(MSGBOX)) {
// Shall the MessageBox displayed as popup?
if (!(pMsgBox->uType & (MB_INFOBAR|MB_NOPOPUP)) && // message box can be a popup?
ServiceExists(MS_POPUP_ADDPOPUPT) && // popups exist?
myGlobals.PopUpActionsExist == 1 && // popup support ext stuct?
(DB::Setting::GetDWord(NULL, "PopUp","Actions", 0) & 1) && // popup++ actions on?
- DB::Setting::GetByte(SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX) // user likes popups?
- )
- {
- rc = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
- }
- else
- {
- rc = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
- }
+ DB::Setting::GetByte(SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
+ return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
+
+ return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
}
- return rc;
+ return -1;
}
/**
@@ -799,22 +738,22 @@ INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam) **/
INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPTSTR pszTitle, LPTSTR pszInfo, LPTSTR pszFormat, ...)
{
- MSGBOX mb = {0};
- TCHAR tszMsg[MAX_SECONDLINE];
- va_list vl;
+ TCHAR tszMsg[MAX_SECONDLINE];
+ va_list vl;
va_start(vl, pszFormat);
mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
- mb.cbSize = sizeof(MSGBOX);
- mb.hParent = hParent;
- mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
- mb.hiMsg = NULL;
- mb.ptszTitle = TranslateTS(pszTitle);
- mb.ptszInfoText = TranslateTS(pszInfo);
- mb.ptszMsg = tszMsg;
- mb.uType = uType;
+ MSGBOX mb = {0};
+ mb.cbSize = sizeof(MSGBOX);
+ mb.hParent = hParent;
+ mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
+ mb.hiMsg = NULL;
+ mb.ptszTitle = TranslateTS(pszTitle);
+ mb.ptszInfoText = TranslateTS(pszInfo);
+ mb.ptszMsg = tszMsg;
+ mb.uType = uType;
return MsgBoxService(NULL, (LPARAM)&mb);
}
@@ -825,23 +764,21 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPTSTR pszTitle, LPTSTR pszInf **/
INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
- MSGBOX mb = {0};
- TCHAR tszTitle[MAX_SECONDLINE];
- TCHAR tszMsg[MAX_SECONDLINE];
- va_list vl;
-
+ TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
mir_sntprintf(tszTitle, SIZEOF(tszMsg),_T("%s - %s") ,_T(MODNAME), TranslateT("Error"));
+ va_list vl;
va_start(vl, pszFormat);
mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
- mb.cbSize = sizeof(MSGBOX);
- mb.hParent = hParent;
- mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
- mb.hiMsg = NULL;
- mb.ptszTitle = tszTitle;
- mb.ptszMsg = tszMsg;
- mb.uType = MB_OK|MB_ICON_ERROR;
+ MSGBOX mb = {0};
+ mb.cbSize = sizeof(MSGBOX);
+ mb.hParent = hParent;
+ mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
+ mb.hiMsg = NULL;
+ mb.ptszTitle = tszTitle;
+ mb.ptszMsg = tszMsg;
+ mb.uType = MB_OK|MB_ICON_ERROR;
return MsgBoxService(NULL, (LPARAM)&mb);
}
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index ac7bc94f34..2a2af80bd3 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -1099,176 +1099,138 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR break;
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
+ switch (LOWORD(wParam)) {
+ case BTN_PREVIEW:
{
- case BTN_PREVIEW:
- {
- POPUPDATAT_V2 ppd;
-
- ZeroMemory(&ppd, sizeof(POPUPDATAT_V2));
- ppd.iSeconds = (INT)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
- mir_tcsncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
-
- // Birthday
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
- ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0);
- if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR))
- {
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- }
- else if (!IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR))
- {
- ppd.colorBack = SendDlgItemMessage(hDlg, CLR_BBACK, CPM_GETCOLOUR, 0, 0);
- ppd.colorText = SendDlgItemMessage(hDlg, CLR_BTEXT, CPM_GETCOLOUR, 0, 0);
- }
- PUAddPopUpT(&ppd);
-
- // Anniversary
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
- ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
- if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR))
- {
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- }
- else if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR))
- {
- ppd.colorBack = 0;
- ppd.colorText = 0;
- }
- else
- {
- ppd.colorBack = SendDlgItemMessage(hDlg, CLR_ABACK, CPM_GETCOLOUR, 0, 0);
- ppd.colorText = SendDlgItemMessage(hDlg, CLR_ATEXT, CPM_GETCOLOUR, 0, 0);
- }
- PUAddPopUpT(&ppd);
+ POPUPDATAT ppd = { 0 };
+ ppd.iSeconds = (INT)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
+ mir_tcsncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
+
+ // Birthday
+ mir_tcsncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
+ ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0);
+ if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- break;
-
- case CHECK_OPT_POPUP_MSGBOX:
- case CHECK_OPT_POPUP_PROGRESS:
- {
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
+ else if (!IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR)) {
+ ppd.colorBack = SendDlgItemMessage(hDlg, CLR_BBACK, CPM_GETCOLOUR, 0, 0);
+ ppd.colorText = SendDlgItemMessage(hDlg, CLR_BTEXT, CPM_GETCOLOUR, 0, 0);
}
- break;
+ PUAddPopUpT(&ppd);
+
+ // Anniversary
+ mir_tcsncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
+ ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
+ if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR)) {
+ ppd.colorBack = 0;
+ ppd.colorText = 0;
+ }
+ else {
+ ppd.colorBack = SendDlgItemMessage(hDlg, CLR_ABACK, CPM_GETCOLOUR, 0, 0);
+ ppd.colorText = SendDlgItemMessage(hDlg, CLR_ATEXT, CPM_GETCOLOUR, 0, 0);
+ }
+ PUAddPopUpT(&ppd);
+ }
+ break;
- case CHECK_OPT_POPUP_ENABLED:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- const BOOL bEnabled = SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL);
- const INT idCtrl[] = {
- CHECK_OPT_POPUP_DEFCLR, CHECK_OPT_POPUP_WINCLR,
- CLR_BBACK, TXT_OPT_POPUP_CLR_BACK,
- CLR_BTEXT, TXT_OPT_POPUP_CLR_TEXT,
- CHECK_OPT_POPUP_ADEFCLR, CHECK_OPT_POPUP_AWINCLR,
- CLR_ABACK, TXT_OPT_POPUP_CLR_ABACK,
- CLR_ATEXT, TXT_OPT_POPUP_CLR_ATEXT,
- RADIO_OPT_POPUP_DEFAULT, RADIO_OPT_POPUP_CUSTOM,
- RADIO_OPT_POPUP_PERMANENT, EDIT_DELAY
- };
+ case CHECK_OPT_POPUP_MSGBOX:
+ case CHECK_OPT_POPUP_PROGRESS:
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ break;
+
+ case CHECK_OPT_POPUP_ENABLED:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ const BOOL bEnabled = SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL);
+ const INT idCtrl[] = {
+ CHECK_OPT_POPUP_DEFCLR, CHECK_OPT_POPUP_WINCLR,
+ CLR_BBACK, TXT_OPT_POPUP_CLR_BACK,
+ CLR_BTEXT, TXT_OPT_POPUP_CLR_TEXT,
+ CHECK_OPT_POPUP_ADEFCLR, CHECK_OPT_POPUP_AWINCLR,
+ CLR_ABACK, TXT_OPT_POPUP_CLR_ABACK,
+ CLR_ATEXT, TXT_OPT_POPUP_CLR_ATEXT,
+ RADIO_OPT_POPUP_DEFAULT, RADIO_OPT_POPUP_CUSTOM,
+ RADIO_OPT_POPUP_PERMANENT, EDIT_DELAY
+ };
- EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled);
+ EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- }
- break;
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
- case CHECK_OPT_POPUP_DEFCLR:
- case CHECK_OPT_POPUP_WINCLR:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_DEFCLR, BM_GETCHECK, NULL, NULL);
- INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_WINCLR, BM_GETCHECK, NULL, NULL);
-
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_DEFCLR, !bWinClr);
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_WINCLR, !bDefClr);
- EnableDlgItem(hDlg, CLR_BBACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_BACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, CLR_BTEXT, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_TEXT, !(bDefClr || bWinClr));
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- }
- break;
+ case CHECK_OPT_POPUP_DEFCLR:
+ case CHECK_OPT_POPUP_WINCLR:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_DEFCLR, BM_GETCHECK, NULL, NULL);
+ INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_WINCLR, BM_GETCHECK, NULL, NULL);
+
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_DEFCLR, !bWinClr);
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_WINCLR, !bDefClr);
+ EnableDlgItem(hDlg, CLR_BBACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_BACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, CLR_BTEXT, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_TEXT, !(bDefClr || bWinClr));
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
- case CHECK_OPT_POPUP_ADEFCLR:
- case CHECK_OPT_POPUP_AWINCLR:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_ADEFCLR, BM_GETCHECK, NULL, NULL);
- INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_AWINCLR, BM_GETCHECK, NULL, NULL);
-
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_ADEFCLR, !bWinClr);
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_AWINCLR, !bDefClr);
- EnableDlgItem(hDlg, CLR_ABACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ABACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, CLR_ATEXT, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ATEXT, !(bDefClr || bWinClr));
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- }
- break;
+ case CHECK_OPT_POPUP_ADEFCLR:
+ case CHECK_OPT_POPUP_AWINCLR:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_ADEFCLR, BM_GETCHECK, NULL, NULL);
+ INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_AWINCLR, BM_GETCHECK, NULL, NULL);
+
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_ADEFCLR, !bWinClr);
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_AWINCLR, !bDefClr);
+ EnableDlgItem(hDlg, CLR_ABACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ABACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, CLR_ATEXT, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ATEXT, !(bDefClr || bWinClr));
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
- case RADIO_OPT_POPUP_DEFAULT:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- break;
- case RADIO_OPT_POPUP_CUSTOM:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- EnableDlgItem(hDlg, EDIT_DELAY, TRUE);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- break;
- case RADIO_OPT_POPUP_PERMANENT:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- break;
- case EDIT_DELAY:
- if (bInitialized && HIWORD(wParam) == EN_UPDATE)
- {
+ case RADIO_OPT_POPUP_DEFAULT:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
+ if (bInitialized)
NotifyParentOfChange(hDlg);
- }
- break;
- default:
- if (bInitialized && HIWORD(wParam) == CPN_COLOURCHANGED)
- {
+ }
+ break;
+
+ case RADIO_OPT_POPUP_CUSTOM:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ EnableDlgItem(hDlg, EDIT_DELAY, TRUE);
+ if (bInitialized)
NotifyParentOfChange(hDlg);
- }
}
+ break;
+
+ case RADIO_OPT_POPUP_PERMANENT:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
+
+ case EDIT_DELAY:
+ if (bInitialized && HIWORD(wParam) == EN_UPDATE)
+ NotifyParentOfChange(hDlg);
+ break;
+
+ default:
+ if (bInitialized && HIWORD(wParam) == CPN_COLOURCHANGED)
+ NotifyParentOfChange(hDlg);
}
}
return FALSE;
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 74878359bb..d61aad666b 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -424,9 +424,7 @@ public: **/
virtual HWND Create(LPCTSTR szTitle, PUpdCallback pFnCallBack)
{
- POPUPDATAT_V2 pd;
-
- ZeroMemory(&pd, sizeof(POPUPDATAT_V2));
+ POPUPDATAT_V2 pd = { 0 };
pd.cbSize = sizeof(POPUPDATAT_V2);
pd.lchIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
pd.iSeconds = -1;
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 3bfc5b6084..c5112d2a54 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -254,31 +254,24 @@ static INT NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, INT DaysToA {
if (gRemindOpts.bPopups)
{
- POPUPDATAT_V2 ppd;
-
- ZeroMemory(&ppd, sizeof(POPUPDATAT_V2));
+ POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
ppd.iSeconds = (INT)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
- if (hContact)
- {
+ if (hContact) {
ppd.lchContact = hContact;
mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName),
_T("%s - %s"), TranslateTS(pszDesc), DB::Contact::DisplayName(hContact));
}
- else
- {
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
- }
+ else mir_tcsncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
+
mir_tcsncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
ppd.lchIcon = GetAnnivIcon(CEvent(eventType, DaysToAnniv));
- switch (eventType)
- {
+ switch (eventType) {
case CEvent::BIRTHDAY:
- switch (DB::Setting::GetByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM))
- {
+ switch (DB::Setting::GetByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -292,8 +285,7 @@ static INT NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, INT DaysToA break;
case CEvent::ANNIVERSARY:
- switch (DB::Setting::GetByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM))
- {
+ switch (DB::Setting::GetByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
|