diff options
Diffstat (limited to 'plugins/TabSRMM')
28 files changed, 2709 insertions, 3032 deletions
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 2d05a0a9e1..f691eabb33 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -122,7 +122,7 @@ static int Hlp_RemoveDatabaseSettings(HANDLE hContact, char *szModule, char *szP if (rs.szSettings != NULL) {
for (i=0; i < rs.count; i++) {
if (rs.szSettings[i] != NULL) {
- if (!DBDeleteContactSetting(hContact, szModule, rs.szSettings[i])) {
+ if (!db_unset(hContact, szModule, rs.szSettings[i])) {
count += 1;
}
free(rs.szSettings[i]);
@@ -895,7 +895,7 @@ void CB_WriteButtonSettings(HANDLE hContact, CustomButtonData *cbd) if (!(cbd->opFlags&BBSF_NTBDESTRUCT))
DBWriteContactSettingString(hContact, "TabSRMM_Toolbar", SettingName, SettingParameter);
else
- DBDeleteContactSetting(hContact, "TabSRMM_Toolbar", SettingName);
+ db_unset(hContact, "TabSRMM_Toolbar", SettingName);
}
void BB_RegisterSeparators()
@@ -1284,83 +1284,77 @@ BOOL drag = FALSE, bOptionsInit = TRUE; HANDLE hDragItem = NULL;
HWND hToolBarTree = NULL;
-
INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg) {
- case WM_INITDIALOG: {
- LONG_PTR style;
- hToolBarTree = GetDlgItem(hwndDlg, IDC_TOOLBARTREE);
+ HTREEITEM hti;
- style = GetWindowLongPtr(hToolBarTree, GWL_STYLE);
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ hToolBarTree = GetDlgItem(hwndDlg, IDC_TOOLBARTREE);
+ {
+ LONG_PTR style = GetWindowLongPtr(hToolBarTree, GWL_STYLE);
style ^= TVS_CHECKBOXES;
SetWindowLongPtr(hToolBarTree, GWL_STYLE, style);
style |= TVS_CHECKBOXES;
style |= TVS_NOHSCROLL;
SetWindowLongPtr(hToolBarTree, GWL_STYLE, style);
+ }
+ EnterCriticalSection(&ToolBarCS);
- EnterCriticalSection(&ToolBarCS);
-
- BuildMenuObjectsTree((HWND)hToolBarTree);
+ BuildMenuObjectsTree((HWND)hToolBarTree);
- LeaveCriticalSection(&ToolBarCS);
+ LeaveCriticalSection(&ToolBarCS);
- Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, MAKELONG(PluginConfig.g_iButtonsBarGap, 0));
- TranslateDialogDefault(hwndDlg);
- bOptionsInit = FALSE;
- }
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, MAKELONG(PluginConfig.g_iButtonsBarGap, 0));
+ TranslateDialogDefault(hwndDlg);
+ bOptionsInit = FALSE;
break;
- case WM_LBUTTONUP: {
-
- if (!drag)
- break;
-
+ case WM_LBUTTONUP:
+ if (drag) {
TreeView_SetInsertMark(hToolBarTree, NULL, 0);
drag = 0;
ReleaseCapture();
- {
- TVHITTESTINFO hti;
- TVITEM tvi;
- hti.pt.x = (short)LOWORD(lParam);
- hti.pt.y = (short)HIWORD(lParam);
- ClientToScreen(hwndDlg, &hti.pt);
- ScreenToClient(hToolBarTree, &hti.pt);
- hti.pt.y -= TreeView_GetItemHeight(hToolBarTree) / 2;
- TreeView_HitTest(hToolBarTree, &hti);
- if (hDragItem == hti.hItem) break;
- if (hti.flags&TVHT_ABOVE) hti.hItem = TVI_FIRST;
- tvi.mask = TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = (HTREEITEM)hDragItem;
- TreeView_GetItem(hToolBarTree, &tvi);
- if (hti.flags&(TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
- TVINSERTSTRUCT tvis;
- TCHAR strbuf[128];
- tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
- tvis.item.stateMask = 0xFFFFFFFF;
- tvis.item.pszText = strbuf;
- tvis.item.cchTextMax = sizeof(strbuf);
- tvis.item.hItem = (HTREEITEM)hDragItem;
- TreeView_GetItem(hToolBarTree, &tvis.item);
- TreeView_DeleteItem(hToolBarTree, hDragItem);
- tvis.hParent = NULL;
- tvis.hInsertAfter = hti.hItem;
- TreeView_SelectItem(hToolBarTree, TreeView_InsertItem(hToolBarTree, &tvis));
- SendMessage((GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
- }
+
+ TVHITTESTINFO hti;
+ TVITEM tvi;
+ hti.pt.x = (short)LOWORD(lParam);
+ hti.pt.y = (short)HIWORD(lParam);
+ ClientToScreen(hwndDlg, &hti.pt);
+ ScreenToClient(hToolBarTree, &hti.pt);
+ hti.pt.y -= TreeView_GetItemHeight(hToolBarTree) / 2;
+ TreeView_HitTest(hToolBarTree, &hti);
+ if (hDragItem == hti.hItem) break;
+ if (hti.flags&TVHT_ABOVE) hti.hItem = TVI_FIRST;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM;
+ tvi.hItem = (HTREEITEM)hDragItem;
+ TreeView_GetItem(hToolBarTree, &tvi);
+ if (hti.flags&(TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
+ TVINSERTSTRUCT tvis;
+ TCHAR strbuf[128];
+ tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
+ tvis.item.stateMask = 0xFFFFFFFF;
+ tvis.item.pszText = strbuf;
+ tvis.item.cchTextMax = sizeof(strbuf);
+ tvis.item.hItem = (HTREEITEM)hDragItem;
+ TreeView_GetItem(hToolBarTree, &tvis.item);
+ TreeView_DeleteItem(hToolBarTree, hDragItem);
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = hti.hItem;
+ TreeView_SelectItem(hToolBarTree, TreeView_InsertItem(hToolBarTree, &tvis));
+ SendMessage((GetParent(hwndDlg)), PSM_CHANGED, 0, 0);
}
}
break;
- case WM_MOUSEMOVE: {
+ case WM_MOUSEMOVE:
+ if (drag) {
TVHITTESTINFO hti;
- if (!drag) break;
-
hti.pt.x = (short)LOWORD(lParam);
hti.pt.y = (short)HIWORD(lParam);
ClientToScreen(hwndDlg, &hti.pt);
@@ -1382,237 +1376,200 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
break;
- case WM_COMMAND:
- if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND)lParam && (HWND)lParam != hToolBarTree)
+ case WM_COMMAND:
+ if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND)lParam && (HWND)lParam != hToolBarTree)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if ((HIWORD(wParam) == EN_CHANGE) && ((HWND)lParam == GetFocus()))
+ if (!bOptionsInit)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- if ((HIWORD(wParam) == EN_CHANGE) && ((HWND)lParam == GetFocus()))
- if (!bOptionsInit)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- switch (LOWORD(wParam)) {
- case IDC_BBRESET: {
- Hlp_RemoveDatabaseSettings(NULL, "TabSRMM_Toolbar", 0);
- CB_HardReInit();
- BuildMenuObjectsTree(hToolBarTree);
- }
- break;
- case IDC_SEPARATOR: {
- int i = 0;
- HTREEITEM hti;
- TVINSERTSTRUCT tvis;
- CustomButtonData* cbd;
-
- hti = TreeView_GetSelection(hToolBarTree);
- if (!hti)
- hti = TVI_FIRST;
- cbd = (CustomButtonData *)mir_alloc(sizeof(CustomButtonData));
- ZeroMemory(cbd, sizeof(CustomButtonData));
-
- cbd->bDummy = 1;
- cbd->bHidden = 1;
- cbd->bIMButton = 1;
- cbd->bLSided = 1;
- cbd->dwButtonOrigID = ++dwSepCount;
- cbd->pszModuleName = "Tabsrmm_sep";
- cbd->iButtonWidth = 22;
- cbd->opFlags = BBSF_NTBDESTRUCT;
- List_InsertPtr(LButtonsList, cbd);
+ switch (LOWORD(wParam)) {
+ case IDC_BBRESET:
+ Hlp_RemoveDatabaseSettings(NULL, "TabSRMM_Toolbar", 0);
+ CB_HardReInit();
+ BuildMenuObjectsTree(hToolBarTree);
+ break;
- tvis.hParent = NULL;
- tvis.hInsertAfter = hti;
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ case IDC_SEPARATOR:
+ hti = TreeView_GetSelection(hToolBarTree);
+ if (!hti)
+ hti = TVI_FIRST;
+
+ CustomButtonData *cbd = (CustomButtonData *)mir_alloc(sizeof(CustomButtonData));
+ ZeroMemory(cbd, sizeof(CustomButtonData));
+
+ cbd->bDummy = 1;
+ cbd->bHidden = 1;
+ cbd->bIMButton = 1;
+ cbd->bLSided = 1;
+ cbd->dwButtonOrigID = ++dwSepCount;
+ cbd->pszModuleName = "Tabsrmm_sep";
+ cbd->iButtonWidth = 22;
+ cbd->opFlags = BBSF_NTBDESTRUCT;
+ List_InsertPtr(LButtonsList, cbd);
+
+ TVINSERTSTRUCT tvis;
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = hti;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.pszText = TranslateT("<Separator>");
- tvis.item.iImage = tvis.item.iSelectedImage = -1;
- tvis.item.lParam = (LPARAM)cbd;
+ tvis.item.pszText = TranslateT("<Separator>");
+ tvis.item.iImage = tvis.item.iSelectedImage = -1;
+ tvis.item.lParam = (LPARAM)cbd;
+ hti = TreeView_InsertItem(hToolBarTree, &tvis);
- hti = TreeView_InsertItem(hToolBarTree, &tvis);
+ TreeView_SetCheckState(hToolBarTree, hti, (cbd->bIMButton || cbd->bChatButton));
+ }
+ break;
- TreeView_SetCheckState(hToolBarTree, hti, (cbd->bIMButton || cbd->bChatButton));
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ CB_ReInitCustomButtons();
+ dwSepCount = M->GetDword("TabSRMM_Toolbar", "SeparatorsCount", 0);
+ return 1;
+
+ case PSN_APPLY:
+ hti = TreeView_GetSelection(hToolBarTree);
+ if (hti) {
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM;
+ tvi.hItem = hti;
+ TreeView_GetItem(hToolBarTree, &tvi);
+
+ if (tvi.lParam) {
+ CustomButtonData *cbd = (CustomButtonData*)tvi.lParam;
+ if (cbd) {
+ cbd->bIMButton = IsDlgButtonChecked(hwndDlg, IDC_IMCHECK);
+ cbd->bChatButton = IsDlgButtonChecked(hwndDlg, IDC_CHATCHECK);
+ cbd->bCanBeHidden = IsDlgButtonChecked(hwndDlg, IDC_CANBEHIDDEN);
+ }
+ }
}
- break;
+
+ SaveTree(hToolBarTree);
+ CB_ReInitCustomButtons();
+ PluginConfig.g_iButtonsBarGap = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_GETPOS, 0, 0);
+
+ if (PluginConfig.g_iButtonsBarGap != M->GetByte("ButtonsBarGap", 1))
+ M->BroadcastMessageAsync(WM_SIZE, 0, 0);
+
+ M->WriteByte(SRMSGMOD_T, "ButtonsBarGap", PluginConfig.g_iButtonsBarGap);
+
+ BuildMenuObjectsTree((HWND)hToolBarTree);
+ Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
+ return 1;
}
break;
- case WM_NOTIFY: {
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY: {
- TVITEM tvi;
- HTREEITEM hti;
- CustomButtonData* cbd;
-
- hti = TreeView_GetSelection(hToolBarTree);
-
- if (hti) {
- tvi.mask = TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = hti;
- TreeView_GetItem(hToolBarTree, &tvi);
-
- if (tvi.lParam) {
- cbd = (CustomButtonData*)tvi.lParam;
- if (cbd) {
- cbd->bIMButton = IsDlgButtonChecked(hwndDlg, IDC_IMCHECK);
- cbd->bChatButton = IsDlgButtonChecked(hwndDlg, IDC_CHATCHECK);
- cbd->bCanBeHidden = IsDlgButtonChecked(hwndDlg, IDC_CANBEHIDDEN);
- }
- }
- }
-
- SaveTree(hToolBarTree);
- CB_ReInitCustomButtons();
- PluginConfig.g_iButtonsBarGap = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_GETPOS, 0, 0);
-
- if (PluginConfig.g_iButtonsBarGap != M->GetByte("ButtonsBarGap", 1))
- M->BroadcastMessageAsync(WM_SIZE, 0, 0);
-
- M->WriteByte(SRMSGMOD_T, "ButtonsBarGap", PluginConfig.g_iButtonsBarGap);
-
- BuildMenuObjectsTree((HWND)hToolBarTree);
- Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
- return 1;
- }
+ case IDC_TOOLBARTREE:
+ switch (((LPNMHDR)lParam)->code) {
+ case TVN_BEGINDRAGA:
+ case TVN_BEGINDRAGW:
+ SetCapture(hwndDlg);
+ drag = 1;
+ hDragItem = ((LPNMTREEVIEW)lParam)->itemNew.hItem;
+ TreeView_SelectItem(hToolBarTree, hDragItem);
+ break;
- case PSN_RESET: {
- CB_ReInitCustomButtons();
- dwSepCount = M->GetDword("TabSRMM_Toolbar", "SeparatorsCount", 0);
- return 1;
- }
- }
- break;
-
-
- case IDC_TOOLBARTREE:
- switch (((LPNMHDR)lParam)->code) {
-
- case TVN_BEGINDRAGA:
- case TVN_BEGINDRAGW:
- SetCapture(hwndDlg);
- drag = 1;
- hDragItem = ((LPNMTREEVIEW)lParam)->itemNew.hItem;
- TreeView_SelectItem(hToolBarTree, hDragItem);
- break;
-
- case TVN_SELCHANGINGA:
- case TVN_SELCHANGINGW:
- {
- TVITEM tvi;
- HTREEITEM hti;
- TCHAR strbuf[128];
- CustomButtonData* cbd;
-
- hti = TreeView_GetSelection(hToolBarTree);
-
- if (hti == NULL)
- break;
-
- tvi.hItem = hti;
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
-
- TreeView_GetItem(hToolBarTree, &tvi);
-
- if (tvi.lParam == 0 || !TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !_tcscmp(tvi.pszText, MIDDLE_SEPARATOR))
- break;
-
- cbd = (CustomButtonData*)tvi.lParam;
- if (cbd) {
- cbd->opFlags = (IsDlgButtonChecked(hwndDlg, IDC_IMCHECK)) ? BBSF_IMBUTTON : 0;
- cbd->opFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHATCHECK)) ? BBSF_CHATBUTTON : 0;
- cbd->opFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CANBEHIDDEN)) ? BBSF_CANBEHIDDEN : 0;
-
- cbd->bIMButton = (IsDlgButtonChecked(hwndDlg, IDC_IMCHECK) ? TRUE : FALSE);
- cbd->bChatButton = (IsDlgButtonChecked(hwndDlg, IDC_CHATCHECK) ? TRUE : FALSE);
- cbd->bCanBeHidden = (IsDlgButtonChecked(hwndDlg, IDC_CANBEHIDDEN) ? TRUE : FALSE);
- }
- }
+ case TVN_SELCHANGINGA:
+ case TVN_SELCHANGINGW:
+ hti = TreeView_GetSelection(hToolBarTree);
+ if (hti != NULL) {
+ TCHAR strbuf[128];
+
+ TVITEM tvi;
+ tvi.hItem = hti;
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
+ TreeView_GetItem(hToolBarTree, &tvi);
+
+ if (tvi.lParam == 0 || !TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !_tcscmp(tvi.pszText, MIDDLE_SEPARATOR))
break;
- case TVN_SELCHANGEDW:
- case TVN_SELCHANGEDA: {
- TVITEM tvi;
- HTREEITEM hti;
- TCHAR strbuf[128];
- CustomButtonData* cbd;
-
- hti = TreeView_GetSelection(hToolBarTree);
-
- if (hti == NULL)
- break;
-
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = hti;
- TreeView_GetItem(hToolBarTree, &tvi);
-
-
- if (!TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !_tcscmp(tvi.pszText, MIDDLE_SEPARATOR)) {
- Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
- break;
- }
-
- if (tvi.lParam == 0)
- break;
-
- cbd = (CustomButtonData*)tvi.lParam;
- if (cbd) {
- Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, TRUE);
- CheckDlgButton(hwndDlg, IDC_IMCHECK, (cbd->bIMButton) ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CHATCHECK, (cbd->bChatButton) ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CANBEHIDDEN, (cbd->bCanBeHidden) ? 1 : 0);
- }
- }
+ CustomButtonData *cbd = (CustomButtonData*)tvi.lParam;
+ if (cbd) {
+ cbd->opFlags = (IsDlgButtonChecked(hwndDlg, IDC_IMCHECK)) ? BBSF_IMBUTTON : 0;
+ cbd->opFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHATCHECK)) ? BBSF_CHATBUTTON : 0;
+ cbd->opFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CANBEHIDDEN)) ? BBSF_CANBEHIDDEN : 0;
+
+ cbd->bIMButton = (IsDlgButtonChecked(hwndDlg, IDC_IMCHECK) ? TRUE : FALSE);
+ cbd->bChatButton = (IsDlgButtonChecked(hwndDlg, IDC_CHATCHECK) ? TRUE : FALSE);
+ cbd->bCanBeHidden = (IsDlgButtonChecked(hwndDlg, IDC_CANBEHIDDEN) ? TRUE : FALSE);
+ }
+ }
+ break;
+
+ case TVN_SELCHANGEDW:
+ case TVN_SELCHANGEDA:
+ hti = TreeView_GetSelection(hToolBarTree);
+ if (hti != NULL) {
+ TCHAR strbuf[128];
+
+ TVITEM tvi;
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
+ tvi.hItem = hti;
+ TreeView_GetItem(hToolBarTree, &tvi);
+
+ if (!TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !_tcscmp(tvi.pszText, MIDDLE_SEPARATOR)) {
+ Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
break;
+ }
- case NM_CLICK: {
- TVHITTESTINFO hti = {0};
- GetCursorPos(&hti.pt);
- ScreenToClient(hToolBarTree, &hti.pt);
- if (TreeView_HitTest(hToolBarTree, &hti)) {
- if (hti.flags&TVHT_ONITEMSTATEICON) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- if (TreeView_GetCheckState(hToolBarTree, hti.hItem)) {
- Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
- CheckDlgButton(hwndDlg, IDC_IMCHECK, 1);
- } else {
- Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, TRUE);
- }
- TreeView_SelectItem(hToolBarTree, hti.hItem);
- }
- }
- }
+ if (tvi.lParam == 0)
break;
+ CustomButtonData *cbd = (CustomButtonData*)tvi.lParam;
+ if (cbd) {
+ Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, TRUE);
+ CheckDlgButton(hwndDlg, IDC_IMCHECK, (cbd->bIMButton) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CHATCHECK, (cbd->bChatButton) ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CANBEHIDDEN, (cbd->bCanBeHidden) ? 1 : 0);
+ }
+ }
+ break;
+
+ case NM_CLICK:
+ TVHITTESTINFO hti = {0};
+ GetCursorPos(&hti.pt);
+ ScreenToClient(hToolBarTree, &hti.pt);
+ if (TreeView_HitTest(hToolBarTree, &hti)) {
+ if (hti.flags&TVHT_ONITEMSTATEICON) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
+ if (TreeView_GetCheckState(hToolBarTree, hti.hItem)) {
+ Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, FALSE);
+ CheckDlgButton(hwndDlg, IDC_IMCHECK, 1);
+ } else {
+ Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, TRUE);
+ }
+ TreeView_SelectItem(hToolBarTree, hti.hItem);
}
- break;
+ }
}
}
break;
- case WM_DESTROY: {
- HIMAGELIST hIml = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TOOLBARTREE), TVSIL_NORMAL);
- ImageList_Destroy(hIml);
- hIml = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TOOLBARTREE), TVSIL_STATE);
- ImageList_Destroy(hIml);
- break;
- }
-
- default:
- break;
+ case WM_DESTROY:
+ HIMAGELIST hIml = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TOOLBARTREE), TVSIL_NORMAL);
+ ImageList_Destroy(hIml);
+ hIml = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TOOLBARTREE), TVSIL_STATE);
+ ImageList_Destroy(hIml);
+ break;
}
return FALSE;
diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp index d465202497..fbc3f290dd 100644 --- a/plugins/TabSRMM/src/chat/clist.cpp +++ b/plugins/TabSRMM/src/chat/clist.cpp @@ -89,7 +89,7 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p if (pszGroup && lstrlen(pszGroup) > 0)
CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)hContact, (LPARAM)g_Settings.hGroup);
else
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
M->WriteTString(hContact, pszModule, "Nick", pszDisplayName);
M->WriteTString(hContact, pszModule, "ChatRoomID", pszRoom);
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index 090f4ce119..2649cb2a24 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -125,7 +125,7 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, bool removeConta }
DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule , "Topic", "");
DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule, "StatusBar", "");
- DBDeleteContactSetting(pTemp->hContact, "CList", "StatusMsg");
+ db_unset(pTemp->hContact, "CList", "StatusMsg");
if (removeContact)
CallService(MS_DB_CONTACT_DELETE, (WPARAM)pTemp->hContact, 0);
@@ -608,7 +608,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) if (pTemp->hContact) {
if (pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE)
- DBDeleteContactSetting(pTemp->hContact, "CList", "Hidden");
+ db_unset(pTemp->hContact, "CList", "Hidden");
DBWriteContactSettingWord(pTemp->hContact, pTemp->pszModule, "Status", (WORD)wStatus);
}
@@ -703,7 +703,7 @@ BOOL SM_RemoveAll(void) if (m_WndList->hContact)
CList_SetOffline(m_WndList->hContact, m_WndList->iType == GCW_CHATROOM ? TRUE : FALSE);
DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule , "Topic", "");
- DBDeleteContactSetting(m_WndList->hContact, "CList", "StatusMsg");
+ db_unset(m_WndList->hContact, "CList", "StatusMsg");
DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule, "StatusBar", "");
UM_RemoveAll(&m_WndList->pUsers);
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index d74e321c5d..497a5de887 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -1044,7 +1044,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE;
M->WriteByte("Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
} else {
- DBDeleteContactSetting(NULL, "Chat", "LogDirectory");
+ db_unset(NULL, "Chat", "LogDirectory");
M->WriteByte("Chat", "LoggingEnabled", 0);
}
SM_InvalidateLogDirectories();
@@ -1056,35 +1056,35 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (iLen > 0)
M->WriteByte("Chat", "NicklistRowDist", (BYTE)iLen);
else
- DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist");
+ db_unset(NULL, "Chat", "NicklistRowDist");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "LogTimestamp");
+ } else db_unset(NULL, "Chat", "LogTimestamp");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderTime");
+ } else db_unset(NULL, "Chat", "HeaderTime");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderIncoming");
+ } else db_unset(NULL, "Chat", "HeaderIncoming");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
if (iLen > 0) {
pszText = (char *)realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing");
+ } else db_unset(NULL, "Chat", "HeaderOutgoing");
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
DBWriteContactSettingWord(NULL, "Chat", "LogLimit", (WORD)iLen);
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index ed4907467a..299fcd5b1d 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -246,7 +246,7 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
si->hContact = CList_AddRoom(gcw->pszModule, ptszID, szTemp, si->iType);
DBWriteContactSettingString(si->hContact, si->pszModule , "Topic", "");
- DBDeleteContactSetting(si->hContact, "CList", "StatusMsg");
+ db_unset(si->hContact, "CList", "StatusMsg");
if (si->ptszStatusbarText)
M->WriteTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 254459ccd7..7f3f8985d4 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -538,7 +538,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
params->sound = "ChatHighlight";
if (M->GetByte(si->hContact, "CList", "Hidden", 0) != 0)
- DBDeleteContactSetting(si->hContact, "CList", "Hidden");
+ db_unset(si->hContact, "CList", "Hidden");
if (params->bInactive) {
fFlagUnread = true;
DoTrayIcon(si, gce);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 0184c0e36f..863198f1e9 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -746,8 +746,6 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case 0x17:
PostMessage(hwndParent, WM_CLOSE, 0, 1);
return 0;
- default:
- break;
}
}
}
@@ -1197,8 +1195,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (si) {
if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "FilterFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "FilterMask");
+ db_unset(si->hContact, "Chat", "FilterFlags");
+ db_unset(si->hContact, "Chat", "FilterMask");
} else {
M->WriteDword(si->hContact, "Chat", "FilterFlags", iFlags);
M->WriteDword(si->hContact, "Chat", "FilterMask", dwMask);
@@ -1218,8 +1216,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (si) {
if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "PopupFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "PopupMask");
+ db_unset(si->hContact, "Chat", "PopupFlags");
+ db_unset(si->hContact, "Chat", "PopupMask");
} else {
M->WriteDword(si->hContact, "Chat", "PopupFlags", iFlags);
M->WriteDword(si->hContact, "Chat", "PopupMask", dwMask);
@@ -1238,8 +1236,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (si) {
if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "TrayIconFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "TrayIconMask");
+ db_unset(si->hContact, "Chat", "TrayIconFlags");
+ db_unset(si->hContact, "Chat", "TrayIconMask");
} else {
M->WriteDword(si->hContact, "Chat", "TrayIconFlags", iFlags);
M->WriteDword(si->hContact, "Chat", "TrayIconMask", dwMask);
@@ -1734,9 +1732,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
break;
- default: {
+ default:
int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
-
if (iCount != LB_ERR) {
int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
@@ -1758,9 +1755,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
}
}
- //DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
break;
- }
}
DestroyGCMenu(&hMenu, 1);
return TRUE;
@@ -2714,23 +2709,21 @@ LABEL_SHOWWINDOW: LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
if (mim_hotkey_check)
dat->fkeyProcessed = true;
- switch(mim_hotkey_check) { // nothing (yet) FIXME
- case TABSRMM_HK_CHANNELMGR:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_FILTERTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_LISTTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_MUC_SHOWSERVER:
- if (si->iType != GCW_SERVER)
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
- return(_dlgReturn(hwndDlg, 1));
- default:
- break;
+ switch(mim_hotkey_check) { // nothing (yet) FIXME
+ case TABSRMM_HK_CHANNELMGR:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_FILTERTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_LISTTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_MUC_SHOWSERVER:
+ if (si->iType != GCW_SERVER)
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
+ return(_dlgReturn(hwndDlg, 1));
}
}
@@ -2796,53 +2789,52 @@ LABEL_SHOWWINDOW: if ((uID > 800 && uID < 1400) || uID == CP_UTF8 || uID == 20866) {
dat->codePage = uID;
M->WriteDword(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
- } else if (uID == 500) {
+ }
+ else if (uID == 500) {
dat->codePage = CP_ACP;
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
- } else {
- switch (uID) {
- case 0:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
- SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all);
- SendMessage(pNmhdr->hwndFrom, WM_COPY, 0, 0);
- SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & sel);
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
+ }
+ else switch (uID) {
+ case 0:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_CLEARLOG:
- ClearLog(dat);
- break;
+ case ID_COPYALL:
+ SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all);
+ SendMessage(pNmhdr->hwndFrom, WM_COPY, 0, 0);
+ SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & sel);
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_SEARCH_GOOGLE: {
- TCHAR szURL[4096];
- if (pszWord[0]) {
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
- break;
+ case ID_CLEARLOG:
+ ClearLog(dat);
+ break;
- case ID_SEARCH_WIKIPEDIA: {
- TCHAR szURL[4096];
- if (pszWord[0]) {
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
- break;
+ case ID_SEARCH_GOOGLE:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
+ }
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- default:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
- break;
+ case ID_SEARCH_WIKIPEDIA:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) szURL);
}
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
+
+ default:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
+ break;
}
+
if (si->iType != GCW_SERVER && !(si->dwFlags & GC_UNICODE)) {
pos = GetMenuItemCount(hMenu);
RemoveMenu(hMenu, pos - 1, MF_BYPOSITION);
@@ -2955,16 +2947,16 @@ LABEL_SHOWWINDOW: CopyMemory(&uiNew, ui, sizeof(USERINFO));
uID = CreateGCMenu(hwndDlg, &hMenu, 0, pt, si, uiNew.pszUID, NULL);
switch (uID) {
- case 0:
- break;
+ case 0:
+ break;
- case ID_MESS:
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
+ case ID_MESS:
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
- default:
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
+ default:
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
+ break;
}
DestroyGCMenu(&hMenu, 1);
return TRUE;
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 8a1b014c54..05686a6e32 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -192,37 +192,27 @@ void CContactCache::updateMeta(bool fForce) */
bool CContactCache::updateUIN()
{
- bool fChanged = false;
+ m_szUIN[0] = 0;
if (m_Valid) {
- CONTACTINFO ci = {0};
-
+ CONTACTINFO ci = { sizeof(ci) };
ci.hContact = getActiveContact();
ci.szProto = const_cast<char *>(getActiveProto());
- ci.cbSize = sizeof(ci);
-
ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
switch (ci.type) {
- case CNFT_ASCIIZ:
- mir_sntprintf(m_szUIN, SIZEOF(m_szUIN), _T("%s"), reinterpret_cast<TCHAR *>(ci.pszVal));
- mir_free((void*)ci.pszVal);
- break;
- case CNFT_DWORD:
- mir_sntprintf(m_szUIN, SIZEOF(m_szUIN), _T("%u"), ci.dVal);
- break;
- default:
- m_szUIN[0] = 0;
- break;
+ case CNFT_ASCIIZ:
+ mir_sntprintf(m_szUIN, SIZEOF(m_szUIN), _T("%s"), reinterpret_cast<TCHAR *>(ci.pszVal));
+ mir_free((void*)ci.pszVal);
+ break;
+ case CNFT_DWORD:
+ mir_sntprintf(m_szUIN, SIZEOF(m_szUIN), _T("%u"), ci.dVal);
+ break;
}
- } else
- m_szUIN[0] = 0;
-
+ }
}
- else
- m_szUIN[0] = 0;
- return(fChanged);
+ return false;
}
void CContactCache::updateStats(int iType, size_t value)
@@ -231,27 +221,25 @@ void CContactCache::updateStats(int iType, size_t value) allocStats();
switch(iType) {
- case TSessionStats::UPDATE_WITH_LAST_RCV:
- if (m_stats->lastReceivedChars) {
- m_stats->iReceived++;
- m_stats->messageCount++;
- }
- else
- return;
- m_stats->iReceivedBytes += m_stats->lastReceivedChars;
- m_stats->lastReceivedChars = 0;
- break;
- case TSessionStats::INIT_TIMER:
- m_stats->started = time(0);
- return;
- case TSessionStats::SET_LAST_RCV:
- m_stats->lastReceivedChars = (unsigned int)value;
- return;
- case TSessionStats::BYTES_SENT:
- m_stats->iSent++;
- m_stats->messageCount++;
- m_stats->iSentBytes += (unsigned int)value;
+ case TSessionStats::UPDATE_WITH_LAST_RCV:
+ if (!m_stats->lastReceivedChars)
break;
+ m_stats->iReceived++;
+ m_stats->messageCount++;
+ m_stats->iReceivedBytes += m_stats->lastReceivedChars;
+ m_stats->lastReceivedChars = 0;
+ break;
+ case TSessionStats::INIT_TIMER:
+ m_stats->started = time(0);
+ break;
+ case TSessionStats::SET_LAST_RCV:
+ m_stats->lastReceivedChars = (unsigned int)value;
+ break;
+ case TSessionStats::BYTES_SENT:
+ m_stats->iSent++;
+ m_stats->messageCount++;
+ m_stats->iSentBytes += (unsigned int)value;
+ break;
}
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index fa55f0bf70..021783da7c 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -564,7 +564,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, hwndTab = GetDlgItem(hwndDlg, IDC_MSGTABS);
switch (msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ {
DWORD ws;
HMENU hSysmenu;
DWORD dwCreateFlags;
@@ -615,7 +616,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->buttonItems = g_ButtonSet.items;
pContainer->dwFlags = ((pContainer->dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)) ?
- pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
+ pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
pContainer->SideBar = new CSideBar(pContainer);
pContainer->MenuBar = new CMenuBar(hwndDlg, pContainer);
@@ -628,8 +629,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SetClassLongPtr(hwndDlg, GCL_STYLE, GetClassLongPtr(hwndDlg, GCL_STYLE) & ~CS_DROPSHADOW);
/*
- * additional system menu items...
- */
+ * additional system menu items...
+ */
hSysmenu = GetSystemMenu(hwndDlg, FALSE);
iMenuItems = GetMenuItemCount(hSysmenu);
@@ -644,8 +645,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)PluginConfig.g_iconContainer);
/*
- * make the tab control the controlling parent window for all message dialogs
- */
+ * make the tab control the controlling parent window for all message dialogs
+ */
ws = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE, ws | WS_EX_CONTROLPARENT);
@@ -663,21 +664,20 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, DM_CONFIGURECONTAINER, 0, 10);
/*
- * context menu
- */
+ * context menu
+ */
pContainer->hMenuContext = PluginConfig.g_hMenuContext;
/*
- * tab tooltips...
- */
+ * tab tooltips...
+ */
if (!fHaveTipper || M->GetByte("d_tooltips", 0) == 0) {
pContainer->hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, g_hInst, (LPVOID) NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, g_hInst, (LPVOID) NULL);
if (pContainer->hwndTip) {
SetWindowPos(pContainer->hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TabCtrl_SetToolTips(GetDlgItem(hwndDlg, IDC_MSGTABS), pContainer->hwndTip);
}
-
}
else
pContainer->hwndTip = 0;
@@ -687,9 +687,9 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, wp.length = sizeof(wp);
- SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~WS_VISIBLE);
+ SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~WS_VISIBLE);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
- SendMessage(hwndDlg, DM_RESTOREWINDOWPOS, 0, 0);
+ SendMessage(hwndDlg, DM_RESTOREWINDOWPOS, 0, 0);
//GetClientRect(hwndDlg, &pContainer->rcSaved);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
GetWindowPlacement(hwndDlg, &wp);
@@ -701,22 +701,24 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, DM_RESTOREWINDOWPOS, 0, 0);
ShowWindow(hwndDlg, SW_SHOWNORMAL);
}
+ }
- /*
- * prevent ugly back background being visible while tabbed clients are created
- */
- if (M->isAero()) {
- MARGINS m = {-1};
- CMimAPI::m_pfnDwmExtendFrameIntoClientArea(hwndDlg, &m);
- }
- return TRUE;
+ /*
+ * prevent ugly back background being visible while tabbed clients are created
+ */
+ if (M->isAero()) {
+ MARGINS m = {-1};
+ CMimAPI::m_pfnDwmExtendFrameIntoClientArea(hwndDlg, &m);
}
- case DM_RESTOREWINDOWPOS: {
+ return TRUE;
+
+ case DM_RESTOREWINDOWPOS:
+ {
char *szSetting = "CNTW_";
char szCName[CONTAINER_NAMELEN + 20];
/*
- * retrieve the container window geometry information from the database.
- */
+ * retrieve the container window geometry information from the database.
+ */
if (pContainer->isCloned && pContainer->hContactFrom != 0 && !(pContainer->dwFlags & CNT_GLOBALSIZE)) {
if (Utils_RestoreWindowPosition(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split")) {
if (Utils_RestoreWindowPositionNoMove(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split"))
@@ -741,10 +743,13 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
}
- return 0;
}
+ return 0;
- case WM_SIZE: {
+ case WM_SIZE:
+ if (IsIconic(hwndDlg))
+ pContainer->dwFlags |= CNT_DEFERREDSIZEREQUEST;
+ else {
RECT rcClient, rcUnadjusted;
int i = 0;
TCITEM item = {0};
@@ -752,11 +757,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, LONG sbarWidth, sbarWidth_left;
BOOL sizeChanged = FALSE;
- if (IsIconic(hwndDlg)) {
- pContainer->dwFlags |= CNT_DEFERREDSIZEREQUEST;
- break;
- }
-
GetClientRect(hwndDlg, &rcClient);
pContainer->MenuBar->getClientRect();
@@ -788,23 +788,23 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, DWORD dwSWPFlags = SWP_NOACTIVATE|SWP_NOZORDER |SWP_DEFERERASE | SWP_NOCOPYBITS; // | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS;
if (pContainer->dwFlags & CNT_TABSBOTTOM)
SetWindowPos(hwndTab, 0, pContainer->tBorder_outer_left + sbarWidth_left, pContainer->tBorder_outer_top + rebarHeight,
- (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
- (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
+ (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
+ (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
else
SetWindowPos(hwndTab, 0, pContainer->tBorder_outer_left + sbarWidth_left, pContainer->tBorder_outer_top + rebarHeight,
- (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
- (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
+ (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
+ (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
}
pContainer->SideBar->resizeScrollWnd(sbarWidth_left ? pContainer->tBorder_outer_left : rcClient.right - pContainer->tBorder_outer_right - (sbarWidth - 2),
- pContainer->tBorder_outer_top + rebarHeight,
- 0,
- (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight);
+ pContainer->tBorder_outer_top + rebarHeight,
+ 0,
+ (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight);
AdjustTabClientRect(pContainer, &rcClient);
sizeChanged = (((rcClient.right - rcClient.left) != pContainer->preSIZE.cx) ||
- ((rcClient.bottom - rcClient.top) != pContainer->preSIZE.cy));
+ ((rcClient.bottom - rcClient.top) != pContainer->preSIZE.cy));
if (sizeChanged) {
pContainer->preSIZE.cx = rcClient.right - rcClient.left;
pContainer->preSIZE.cy = rcClient.bottom - rcClient.top;
@@ -812,10 +812,10 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, /*
- * we care about all client sessions, but we really resize only the active tab (hwndActive)
- * we tell inactive tabs to resize theirselves later when they get activated (DM_CHECKSIZE
- * just queues a resize request)
- */
+ * we care about all client sessions, but we really resize only the active tab (hwndActive)
+ * we tell inactive tabs to resize theirselves later when they get activated (DM_CHECKSIZE
+ * just queues a resize request)
+ */
int nCount = TabCtrl_GetItemCount(hwndTab);
for (i=0; i < nCount; i++) {
@@ -823,7 +823,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, TabCtrl_GetItem(hwndTab, i, &item);
if ((HWND)item.lParam == pContainer->hwndActive) {
SetWindowPos((HWND)item.lParam, 0, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
- SWP_NOSENDCHANGING|SWP_NOACTIVATE/*|SWP_NOCOPYBITS*/);
+ SWP_NOSENDCHANGING|SWP_NOACTIVATE/*|SWP_NOCOPYBITS*/);
if (!pContainer->bSizingLoop && sizeChanged) {
TWindowData *dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 1);
@@ -863,195 +863,193 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, if (CSkin::m_bRoundedCorner)
rgn = CreateRoundRectRgn(clip, clip, (rcWindow.right - rcWindow.left) - clip + 1,
- (rcWindow.bottom - rcWindow.top) - clip + 1, CSkin::m_bRoundedCorner + clip, CSkin::m_bRoundedCorner + clip);
+ (rcWindow.bottom - rcWindow.top) - clip + 1, CSkin::m_bRoundedCorner + clip, CSkin::m_bRoundedCorner + clip);
else
rgn = CreateRectRgn(clip, clip, (rcWindow.right - rcWindow.left) - clip, (rcWindow.bottom - rcWindow.top) - clip);
SetWindowRgn(hwndDlg, rgn, TRUE);
}
else if (CSkin::m_frameSkins)
SetWindowRgn(hwndDlg, NULL, TRUE);
-
- break;
}
+ break;
- case WM_NOTIFY: {
- if (pContainer->MenuBar) {
- LRESULT processed = pContainer->MenuBar->processMsg(msg, wParam, lParam);
- if (processed != -1) {
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, processed);
- return(processed);
- }
+ case WM_NOTIFY:
+ if (pContainer->MenuBar) {
+ LRESULT processed = pContainer->MenuBar->processMsg(msg, wParam, lParam);
+ if (processed != -1) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, processed);
+ return(processed);
}
- NMHDR* pNMHDR = (NMHDR*) lParam;
- if (pContainer != NULL && pContainer->hwndStatus != 0 && ((LPNMHDR)lParam)->hwndFrom == pContainer->hwndStatus) {
- switch (((LPNMHDR)lParam)->code) {
- case NM_CLICK:
- case NM_RCLICK: {
- unsigned int nParts, nPanel;
- NMMOUSE *nm = (NMMOUSE*)lParam;
- RECT rc;
+ }
- nParts = SendMessage(pContainer->hwndStatus, SB_GETPARTS, 0, 0);
- if (nm->dwItemSpec == 0xFFFFFFFE) {
- nPanel = 2;
- SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
- if (nm->pt.x > rc.left && nm->pt.x < rc.right)
- goto panel_found;
- else
- return FALSE;
- }
- else
- nPanel = nm->dwItemSpec;
+ if (pContainer != NULL && pContainer->hwndStatus != 0 && ((LPNMHDR)lParam)->hwndFrom == pContainer->hwndStatus) {
+ switch (((LPNMHDR)lParam)->code) {
+ case NM_CLICK:
+ case NM_RCLICK: {
+ unsigned int nParts, nPanel;
+ NMMOUSE *nm = (NMMOUSE*)lParam;
+ RECT rc;
+
+ nParts = SendMessage(pContainer->hwndStatus, SB_GETPARTS, 0, 0);
+ if (nm->dwItemSpec == 0xFFFFFFFE) {
+ nPanel = 2;
+ SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
+ if (nm->pt.x > rc.left && nm->pt.x < rc.right)
+ goto panel_found;
+ else
+ return FALSE;
+ }
+ else
+ nPanel = nm->dwItemSpec;
panel_found:
- if (nPanel == 2) {
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
- if (dat)
- SI_CheckStatusIconClick(dat, pContainer->hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
- }
- else if (((LPNMHDR)lParam)->code == NM_RCLICK) {
- POINT pt;
- HANDLE hContact = 0;
- HMENU hMenu;
-
- GetCursorPos(&pt);
- SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- if (hContact) {
- int iSel = 0;
- hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) hContact, 0);
- iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (iSel)
- CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(iSel), MPCF_CONTACTMENU), (LPARAM) hContact);
- DestroyMenu(hMenu);
- }
- }
- return TRUE;
+ if (nPanel == 2) {
+ struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
+ if (dat)
+ SI_CheckStatusIconClick(dat, pContainer->hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
+ }
+ else if (((LPNMHDR)lParam)->code == NM_RCLICK) {
+ POINT pt;
+ HANDLE hContact = 0;
+ HMENU hMenu;
+
+ GetCursorPos(&pt);
+ SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ if (hContact) {
+ int iSel = 0;
+ hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) hContact, 0);
+ iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ if (iSel)
+ CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(iSel), MPCF_CONTACTMENU), (LPARAM) hContact);
+ DestroyMenu(hMenu);
}
}
- break;
+ return TRUE;
+ }
}
- switch (pNMHDR->code) {
- case TCN_SELCHANGE: {
- ZeroMemory((void*)&item, sizeof(item));
- iItem = TabCtrl_GetCurSel(hwndTab);
- item.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTab, iItem, &item)) {
- if ((HWND)item.lParam != pContainer->hwndActive) {
- if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- ShowWindow(pContainer->hwndActive, SW_HIDE);
- }
- pContainer->hwndActive = (HWND) item.lParam;
- SendMessage((HWND)item.lParam, DM_SAVESIZE, 0, 1);
- ShowWindow((HWND)item.lParam, SW_SHOW);
- if (!IsIconic(hwndDlg))
- SetFocus(pContainer->hwndActive);
- }
- SendMessage(hwndTab, EM_VALIDATEBOTTOM, 0, 0);
- return 0;
+ break;
+ }
+
+ switch (((LPNMHDR)lParam)->code) {
+ case TCN_SELCHANGE:
+ ZeroMemory((void*)&item, sizeof(item));
+ iItem = TabCtrl_GetCurSel(hwndTab);
+ item.mask = TCIF_PARAM;
+ if (TabCtrl_GetItem(hwndTab, iItem, &item)) {
+ if ((HWND)item.lParam != pContainer->hwndActive) {
+ if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
+ ShowWindow(pContainer->hwndActive, SW_HIDE);
}
- /*
- * tooltips
- */
- case NM_RCLICK: {
- HMENU subMenu;
- POINT pt, pt1;
- int iSelection, iItem;
- TCITEM item = {0};
- struct TWindowData *dat = 0;
- bool fFromSidebar = false;
+ pContainer->hwndActive = (HWND) item.lParam;
+ SendMessage((HWND)item.lParam, DM_SAVESIZE, 0, 1);
+ ShowWindow((HWND)item.lParam, SW_SHOW);
+ if (!IsIconic(hwndDlg))
+ SetFocus(pContainer->hwndActive);
+ }
+ SendMessage(hwndTab, EM_VALIDATEBOTTOM, 0, 0);
+ return 0;
- GetCursorPos(&pt);
- pt1 = pt;
- subMenu = GetSubMenu(pContainer->hMenuContext, 0);
+ /*
+ * tooltips
+ */
+ case NM_RCLICK:
+ {
+ HMENU subMenu;
+ int iSelection, iItem;
+ TCITEM item = {0};
+ struct TWindowData *dat = 0;
+ bool fFromSidebar = false;
+
+ POINT pt, pt1;
+ GetCursorPos(&pt);
+ pt1 = pt;
+ subMenu = GetSubMenu(pContainer->hMenuContext, 0);
- if (pNMHDR->idFrom == IDC_MSGTABS) {
- if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
- break;
+ if (((LPNMHDR)lParam)->idFrom == IDC_MSGTABS) {
+ if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
+ break;
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, iItem, &item);
- if (item.lParam && IsWindow((HWND)item.lParam))
- dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
- }
- /*
- * sent from a sidebar button (RMB click) instead of the tab control
- */
- else if (pNMHDR->idFrom == 5000) {
- TSideBarNotify* n = reinterpret_cast<TSideBarNotify *>(lParam);
- dat = const_cast<TWindowData *>(n->dat);
- fFromSidebar = true;
- }
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &item);
+ if (item.lParam && IsWindow((HWND)item.lParam))
+ dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ }
+ /*
+ * sent from a sidebar button (RMB click) instead of the tab control
+ */
+ else if (((LPNMHDR)lParam)->idFrom == 5000) {
+ TSideBarNotify* n = reinterpret_cast<TSideBarNotify *>(lParam);
+ dat = const_cast<TWindowData *>(n->dat);
+ fFromSidebar = true;
+ }
- if (dat)
- MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
-
- iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt1.x, pt1.y, 0, hwndDlg, NULL);
- if (iSelection >= IDM_CONTAINERMENU) {
- DBVARIANT dbv = {0};
- char szIndex[10];
- char *szKey = "TAB_ContainersW";
- mir_snprintf(szIndex, 8, "%d", iSelection - IDM_CONTAINERMENU);
- if (iSelection - IDM_CONTAINERMENU >= 0) {
- if (!M->GetTString(NULL, szKey, szIndex, &dbv)) {
- SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, (LPARAM) dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
+ if (dat)
+ MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
+
+ iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt1.x, pt1.y, 0, hwndDlg, NULL);
+ if (iSelection >= IDM_CONTAINERMENU) {
+ DBVARIANT dbv = {0};
+ char szIndex[10];
+ char *szKey = "TAB_ContainersW";
+ mir_snprintf(szIndex, 8, "%d", iSelection - IDM_CONTAINERMENU);
+ if (iSelection - IDM_CONTAINERMENU >= 0) {
+ if (!M->GetTString(NULL, szKey, szIndex, &dbv)) {
+ SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, (LPARAM) dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
- return 1;
}
- switch (iSelection) {
- case ID_TABMENU_CLOSETAB:
- if (fFromSidebar)
- SendMessage(dat->hwnd, WM_CLOSE, 1, 0);
- else
- SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt1);
- break;
- case ID_TABMENU_CLOSEOTHERTABS:
- CloseOtherTabs(hwndTab, *dat);
- break;
- case ID_TABMENU_SAVETABPOSITION:
- M->WriteDword(dat->hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
- break;
- case ID_TABMENU_CLEARSAVEDTABPOSITION:
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "tabindex");
- break;
- case ID_TABMENU_LEAVECHATROOM: {
- if (dat && dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
- if (si && dat->hContact) {
- char* szProto = GetContactProto(dat->hContact);
- if ( szProto )
- CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
- }
- }
- break;
+ return 1;
+ }
+ switch (iSelection) {
+ case ID_TABMENU_CLOSETAB:
+ if (fFromSidebar)
+ SendMessage(dat->hwnd, WM_CLOSE, 1, 0);
+ else
+ SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt1);
+ break;
+ case ID_TABMENU_CLOSEOTHERTABS:
+ CloseOtherTabs(hwndTab, *dat);
+ break;
+ case ID_TABMENU_SAVETABPOSITION:
+ M->WriteDword(dat->hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
+ break;
+ case ID_TABMENU_CLEARSAVEDTABPOSITION:
+ db_unset(dat->hContact, SRMSGMOD_T, "tabindex");
+ break;
+ case ID_TABMENU_LEAVECHATROOM:
+ if (dat && dat->bType == SESSIONTYPE_CHAT) {
+ SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ if (si && dat->hContact) {
+ char* szProto = GetContactProto(dat->hContact);
+ if ( szProto )
+ CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
}
- case ID_TABMENU_ATTACHTOCONTAINER:
- if ((iItem = GetTabItemFromMouse(hwndTab, &pt1)) == -1)
- break;
- ZeroMemory((void*)&item, sizeof(item));
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, iItem, &item);
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM) item.lParam);
- break;
- case ID_TABMENU_CONTAINEROPTIONS: {
- if (pContainer->hWndOptions == 0)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM) pContainer);
- break;
- case ID_TABMENU_CLOSECONTAINER:
- SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
- }
}
- InvalidateRect(hwndTab, NULL, FALSE);
- return 1;
+ break;
+ case ID_TABMENU_ATTACHTOCONTAINER:
+ if ((iItem = GetTabItemFromMouse(hwndTab, &pt1)) == -1)
+ break;
+ ZeroMemory((void*)&item, sizeof(item));
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &item);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM) item.lParam);
+ break;
+ case ID_TABMENU_CONTAINEROPTIONS:
+ if (pContainer->hWndOptions == 0)
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM) pContainer);
+ break;
+ case ID_TABMENU_CLOSECONTAINER:
+ SendMessage(hwndDlg, WM_CLOSE, 0, 0);
+ break;
}
+ InvalidateRect(hwndTab, NULL, FALSE);
+ return 1;
}
- break;
}
+ break;
- case WM_COMMAND: {
-
+ case WM_COMMAND:
+ {
bool fProcessContactMenu = pContainer->MenuBar->isContactMenu();
bool fProcessMainMenu = pContainer->MenuBar->isMainMenu();
pContainer->MenuBar->Cancel();
@@ -1077,109 +1075,10 @@ panel_found: SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (LOWORD(wParam) == IDC_TBFIRSTUID - 1)
break;
- /*
- else if (LOWORD(wParam) >= IDC_TBFIRSTUID) { // skinnable buttons handling
- ButtonItem *item = pContainer->buttonItems;
- WPARAM wwParam = 0;
- LPARAM llParam = 0;
- HANDLE hContact = dat ? dat->hContact : 0;
- int serviceFailure = FALSE;
-
- while (item) {
- if (item->uId == (DWORD)LOWORD(wParam)) {
- int contactOK = ServiceParamsOK(item, &wwParam, &llParam, hContact);
-
- if (item->dwFlags & BUTTON_ISSERVICE) {
- if (ServiceExists(item->szService) && contactOK)
- CallService(item->szService, wwParam, llParam);
- else if (contactOK)
- serviceFailure = TRUE;
- }
- else if (item->dwFlags & BUTTON_ISPROTOSERVICE) {
- if (contactOK) {
- char szFinalService[512];
-
- mir_snprintf(szFinalService, 512, "%s/%s", GetContactProto(hContact), item->szService);
- if (ServiceExists(szFinalService))
- CallService(szFinalService, wwParam, llParam);
- else
- serviceFailure = TRUE;
- }
- }
- else if (item->dwFlags & BUTTON_ISDBACTION) {
- BYTE *pValue;
- char *szModule = item->szModule;
- char *szSetting = item->szSetting;
- HANDLE finalhContact = 0;
-
- if (item->dwFlags & BUTTON_ISCONTACTDBACTION || item->dwFlags & BUTTON_DBACTIONONCONTACT) {
- contactOK = ServiceParamsOK(item, &wwParam, &llParam, hContact);
- if (contactOK && item->dwFlags & BUTTON_ISCONTACTDBACTION)
- szModule = GetContactProto(hContact);
- finalhContact = hContact;
- }
- else
- contactOK = 1;
-
- if (contactOK) {
- BOOL fDelete = FALSE;
-
- if (item->dwFlags & BUTTON_ISTOGGLE) {
- BOOL fChecked = (SendMessage(item->hWnd, BM_GETCHECK, 0, 0) == BST_UNCHECKED);
-
- pValue = fChecked ? item->bValueRelease : item->bValuePush;
- if (fChecked && pValue[0] == 0)
- fDelete = TRUE;
- }
- else
- pValue = item->bValuePush;
-
- if (fDelete)
- DBDeleteContactSetting(finalhContact, szModule, szSetting);
- else {
- switch (item->type) {
- case DBVT_BYTE:
- M->WriteByte(finalhContact, szModule, szSetting, pValue[0]);
- break;
- case DBVT_WORD:
- DBWriteContactSettingWord(finalhContact, szModule, szSetting, *((WORD *)&pValue[0]));
- break;
- case DBVT_DWORD:
- M->WriteDword(finalhContact, szModule, szSetting, *((DWORD *)&pValue[0]));
- break;
- case DBVT_ASCIIZ:
- DBWriteContactSettingString(finalhContact, szModule, szSetting, (char *)pValue);
- break;
- }
- }
- }
- else if (item->dwFlags & BUTTON_ISTOGGLE)
- SendMessage(item->hWnd, BM_SETCHECK, 0, 0);
- }
- if (!contactOK)
- MessageBox(0, _T("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat"), _T("Parameter mismatch"), MB_OK);
- if (serviceFailure) {
- char szError[512];
- mir_snprintf(szError, 512, "The service %s specified by the %s button definition was not found. You may need to install additional plugins", item->szService, item->szName);
- MessageBoxA(0, szError, "Service failure", MB_OK);
- }
- goto buttons_done;
- }
- item = item->nextItem;
- }
- }
- while (pItem) {
- if (LOWORD(wParam) == pItem->uId) {
- if (pItem->pfnAction != NULL)
- pItem->pfnAction(pItem, pContainer->hwndActive, dat, GetDlgItem(hwndDlg, pItem->uId));
- }
- pItem = pItem->nextItem;
- }
-buttons_done:
- */
switch (LOWORD(wParam)) {
- case IDC_TOGGLESIDEBAR: {
+ case IDC_TOGGLESIDEBAR:
+ {
RECT rc;
LONG dwNewLeft;
BOOL skinnedMode = bSkinned;
@@ -1203,38 +1102,42 @@ buttons_done: pContainer->oldDCSize.cx = pContainer->oldDCSize.cy = 0;
PostMessage(hwndDlg, WM_SIZE, 0, 1);
- break;
-
}
- case IDC_SIDEBARDOWN:
- case IDC_SIDEBARUP: {
+ break;
+
+ case IDC_SIDEBARDOWN:
+ case IDC_SIDEBARUP:
+ {
HWND hwnd = GetFocus();
pContainer->SideBar->processScrollerButtons(LOWORD(wParam));
- //if (lParam)
- //SetFocus(GetDlgItem(pContainer->hwndActive, lParam));
SetFocus(hwnd);
- break;
}
- default:
- Utils::CmdDispatcher(Utils::CMD_CONTAINER, hwndDlg, LOWORD(wParam), wParam, lParam, 0, pContainer);
+ break;
+
+ default:
+ Utils::CmdDispatcher(Utils::CMD_CONTAINER, hwndDlg, LOWORD(wParam), wParam, lParam, 0, pContainer);
}
if (pContainer->dwFlags != dwOldFlags)
SendMessage(hwndDlg, DM_CONFIGURECONTAINER, 0, 0);
- break;
}
- case WM_ENTERSIZEMOVE: {
+ break;
+
+ case WM_ENTERSIZEMOVE:
+ {
RECT rc;
- SIZE sz;
GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
+
+ SIZE sz;
sz.cx = rc.right - rc.left;
sz.cy = rc.bottom - rc.top;
pContainer->oldSize = sz;
pContainer->bSizingLoop = TRUE;
- break;
}
- case WM_EXITSIZEMOVE: {
- RECT rc;
+ break;
+ case WM_EXITSIZEMOVE:
+ {
+ RECT rc;
GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
if (!((rc.right - rc.left) == pContainer->oldSize.cx && (rc.bottom - rc.top) == pContainer->oldSize.cy)) {
TWindowData *dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
@@ -1242,20 +1145,21 @@ buttons_done: SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
}
pContainer->bSizingLoop = FALSE;
- break;
}
+ break;
/*
- * determine minimum and maximum size limits
- * 1) for maximizing the window when the "vertical maximize" option is set
- * 2) to limit the minimum height when manually resizing the window
- * (this avoids overlapping of controls inside the window and ensures
- * that at least 2 lines of the message log are always visible).
- */
- case WM_GETMINMAXINFO: {
+ * determine minimum and maximum size limits
+ * 1) for maximizing the window when the "vertical maximize" option is set
+ * 2) to limit the minimum height when manually resizing the window
+ * (this avoids overlapping of controls inside the window and ensures
+ * that at least 2 lines of the message log are always visible).
+ */
+ case WM_GETMINMAXINFO:
+ {
RECT rc, rcWindow, rcClient = {0};
POINT pt;
- MINMAXINFO *mmi = (MINMAXINFO *) lParam;
+ MINMAXINFO *mmi = (MINMAXINFO *) lParam;
mmi->ptMinTrackSize.x = 275;
mmi->ptMinTrackSize.y = 130;
GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
@@ -1265,10 +1169,10 @@ buttons_done: pt.y = rc.top;
TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_MSGTABS), FALSE, &rc);
/*
- * uChildMinHeight holds the min height for the client window only
- * so let's add the container's vertical padding (title bar, tab bar,
- * window border, status bar) to this value
- */
+ * uChildMinHeight holds the min height for the client window only
+ * so let's add the container's vertical padding (title bar, tab bar,
+ * window border, status bar) to this value
+ */
if (pContainer->hwndActive)
mmi->ptMinTrackSize.y = pContainer->uChildMinHeight + (pContainer->hwndActive ? ((rcWindow.bottom - rcWindow.top) - rcClient.bottom) : 0);
@@ -1305,8 +1209,8 @@ buttons_done: }
/*
- * protect against invalid values...
- */
+ * protect against invalid values...
+ */
if (mmi->ptMinTrackSize.y < 50 || mmi->ptMinTrackSize.y > rcDesktop.bottom)
mmi->ptMinTrackSize.y = 130;
@@ -1319,21 +1223,24 @@ buttons_done: }
}
}
- return 0;
}
- case WM_MOVE:
- if (PluginConfig.m_MathModAvail) {
- TMathWindowInfo mathWndInfo;
- RECT windRect;
- GetWindowRect(hwndDlg, &windRect);
- mathWndInfo.top = windRect.top;
- mathWndInfo.left = windRect.left;
- mathWndInfo.right = windRect.right;
- mathWndInfo.bottom = windRect.bottom;
- CallService(MTH_RESIZE, 0, (LPARAM) &mathWndInfo);
- }
- break;
- case DM_UPDATETITLE: {
+ return 0;
+
+ case WM_MOVE:
+ if (PluginConfig.m_MathModAvail) {
+ TMathWindowInfo mathWndInfo;
+ RECT windRect;
+ GetWindowRect(hwndDlg, &windRect);
+ mathWndInfo.top = windRect.top;
+ mathWndInfo.left = windRect.left;
+ mathWndInfo.right = windRect.right;
+ mathWndInfo.bottom = windRect.bottom;
+ CallService(MTH_RESIZE, 0, (LPARAM) &mathWndInfo);
+ }
+ break;
+
+ case DM_UPDATETITLE:
+ {
HANDLE hContact = 0;
const TCHAR *szNewTitle = NULL;
TWindowData *dat = NULL;
@@ -1341,12 +1248,12 @@ buttons_done: if (lParam) { // lParam != 0 means sent by a chat window
TCHAR szText[512];
dat = (struct TWindowData *)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
- GetWindowText((HWND)wParam, szText, SIZEOF(szText));
- szText[SIZEOF(szText)-1] = 0;
- SetWindowText(hwndDlg, szText);
- if (dat)
- SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hTabIcon != dat->hTabStatusIcon ? dat->hTabIcon : dat->hTabStatusIcon));
- return 0;
+ GetWindowText((HWND)wParam, szText, SIZEOF(szText));
+ szText[SIZEOF(szText)-1] = 0;
+ SetWindowText(hwndDlg, szText);
+ if (dat)
+ SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hTabIcon != dat->hTabStatusIcon ? dat->hTabIcon : dat->hTabStatusIcon));
+ return 0;
}
if (wParam == 0) { // no hContact given - obtain the hContact for the active tab
if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
@@ -1376,194 +1283,164 @@ buttons_done: free((void*)szNewTitle);
}
}
- return 0;
}
+ return 0;
+ case WM_TIMER:
+ if (wParam == TIMERID_HEARTBEAT) {
+ TWindowData *dat = 0;
+ if (GetForegroundWindow() != hwndDlg && (pContainer->settings->autoCloseSeconds > 0) && !pContainer->fHidden) {
+ BOOL fResult = TRUE;
+ BroadCastContainer(pContainer, DM_CHECKAUTOHIDE, (WPARAM)pContainer->settings->autoCloseSeconds, (LPARAM)&fResult);
- case WM_TIMER:
- if (wParam == TIMERID_HEARTBEAT) {
- /*
- int i;
- TCITEM item = {0};
- DWORD dwTimeout;
- */
- struct TWindowData *dat = 0;
- /*
- item.mask = TCIF_PARAM;
- if ((dwTimeout = PluginConfig.m_TabAutoClose) > 0) {
- int clients = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_MSGTABS));
- HWND *hwndClients = (HWND *)mir_alloc(sizeof(HWND) * (clients + 1));
- for (i=0; i < clients; i++) {
- TabCtrl_GetItem(hwndTab, i, &item);
- hwndClients[i] = (HWND)item.lParam;
- }
- for (i=0; i < clients; i++) {
- if (IsWindow(hwndClients[i])) {
- if ((HWND)hwndClients[i] != pContainer->hwndActive)
- pContainer->bDontSmartClose = TRUE;
- SendMessage((HWND)hwndClients[i], DM_CHECKAUTOCLOSE, (WPARAM)(dwTimeout * 60), 0);
- pContainer->bDontSmartClose = FALSE;
- }
- }
- mir_free(hwndClients);
- }
- */
- if (GetForegroundWindow() != hwndDlg && (pContainer->settings->autoCloseSeconds > 0) && !pContainer->fHidden) {
- BOOL fResult = TRUE;
- BroadCastContainer(pContainer, DM_CHECKAUTOHIDE, (WPARAM)pContainer->settings->autoCloseSeconds, (LPARAM)&fResult);
-
- if (fResult && 0 == pContainer->hWndOptions)
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
- }
- dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- if (dat && dat->bType == SESSIONTYPE_IM) {
- if (dat->idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- dat->Panel->Invalidate(TRUE);
- }
- else if (dat)
- SendMessage(dat->hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ if (fResult && 0 == pContainer->hWndOptions)
+ PostMessage(hwndDlg, WM_CLOSE, 1, 0);
}
- else if (wParam == TIMERID_HOVER) {
- RECT rcWindow;
- GetWindowRect(hwndDlg, &rcWindow);
+ dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ if (dat && dat->bType == SESSIONTYPE_IM) {
+ if (dat->idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
+ dat->Panel->Invalidate(TRUE);
}
+ else if (dat)
+ SendMessage(dat->hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ }
+ else if (wParam == TIMERID_HOVER) {
+ RECT rcWindow;
+ GetWindowRect(hwndDlg, &rcWindow);
+ }
+ break;
+
+ case WM_SYSCOMMAND:
+ switch (wParam) {
+ case IDM_STAYONTOP:
+ SetWindowPos(hwndDlg, (pContainer->dwFlags & CNT_STICKY) ? HWND_NOTOPMOST : HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_STAYONTOP, (pContainer->dwFlags & CNT_STICKY) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
+ ApplyContainerSetting(pContainer, CNT_STICKY, pContainer->dwFlags & CNT_STICKY ? 0 : 1, false);
break;
- case WM_SYSCOMMAND:
- switch (wParam) {
- case IDM_STAYONTOP:
- SetWindowPos(hwndDlg, (pContainer->dwFlags & CNT_STICKY) ? HWND_NOTOPMOST : HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_STAYONTOP, (pContainer->dwFlags & CNT_STICKY) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
- ApplyContainerSetting(pContainer, CNT_STICKY, pContainer->dwFlags & CNT_STICKY ? 0 : 1, false);
- break;
- case IDM_NOTITLE: {
- pContainer->oldSize.cx = 0;
- pContainer->oldSize.cy = 0;
+ case IDM_NOTITLE:
+ pContainer->oldSize.cx = 0;
+ pContainer->oldSize.cy = 0;
- CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_NOTITLE, (pContainer->dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
- ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->dwFlags & CNT_NOTITLE ? 0 : 1, false);
- break;
- }
- case IDM_MOREOPTIONS:
- if (IsIconic(pContainer->hwnd))
- SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
- if (pContainer->hWndOptions == 0)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer);
- break;
- case SC_MAXIMIZE:
- pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
- break;
- case SC_RESTORE:
- pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
- memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
- break;
- case SC_MINIMIZE: {
- TWindowData* dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
- if (dat) {
- //GetWindowRect(GetDlgItem(pContainer->hwndActive, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &pContainer->rcLogSaved);
- GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
- pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
- pContainer->ptLogSaved.y = pContainer->rcLogSaved.top;
- ScreenToClient(hwndDlg, &pContainer->ptLogSaved);
- }
- break;
- }
- }
+ CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_NOTITLE, (pContainer->dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
+ ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->dwFlags & CNT_NOTITLE ? 0 : 1, false);
+ break;
+ case IDM_MOREOPTIONS:
+ if (IsIconic(pContainer->hwnd))
+ SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ if (pContainer->hWndOptions == 0)
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer);
+ break;
+ case SC_MAXIMIZE:
+ pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
break;
- case DM_SELECTTAB: {
- switch (wParam) {
- int iItems, iCurrent, iNewTab;
- TCITEM item;
+ case SC_RESTORE:
+ pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
+ memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
+ break;
+ case SC_MINIMIZE:
+ TWindowData* dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
+ if (dat) {
+ //GetWindowRect(GetDlgItem(pContainer->hwndActive, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &pContainer->rcLogSaved);
+ GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
+ pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
+ pContainer->ptLogSaved.y = pContainer->rcLogSaved.top;
+ ScreenToClient(hwndDlg, &pContainer->ptLogSaved);
+ }
+ }
+ break;
- case DM_SELECT_BY_HWND:
- ActivateTabFromHWND(hwndTab, (HWND) lParam);
- break;
- case DM_SELECT_NEXT:
- case DM_SELECT_PREV:
- case DM_SELECT_BY_INDEX:
- iItems = TabCtrl_GetItemCount(hwndTab);
- iCurrent = TabCtrl_GetCurSel(hwndTab);
+ case DM_SELECTTAB:
+ switch (wParam) {
+ int iItems, iCurrent, iNewTab;
+ TCITEM item;
- if (iItems == 1)
- break;
- if (wParam == DM_SELECT_PREV)
- iNewTab = iCurrent ? iCurrent - 1 : iItems - 1; // cycle if current is already the leftmost tab..
- else if (wParam == DM_SELECT_NEXT)
- iNewTab = (iCurrent == (iItems - 1)) ? 0 : iCurrent + 1;
- else if (wParam == DM_SELECT_BY_INDEX) {
- if ((int)lParam > iItems)
- break;
- iNewTab = lParam - 1;
- }
+ case DM_SELECT_BY_HWND:
+ ActivateTabFromHWND(hwndTab, (HWND) lParam);
+ break;
+ case DM_SELECT_NEXT:
+ case DM_SELECT_PREV:
+ case DM_SELECT_BY_INDEX:
+ iItems = TabCtrl_GetItemCount(hwndTab);
+ iCurrent = TabCtrl_GetCurSel(hwndTab);
- if (iNewTab != iCurrent) {
- struct TabControlData *tabdat = (struct TabControlData *)GetWindowLongPtr(hwndTab, GWLP_USERDATA);
- ZeroMemory((void*)&item, sizeof(item));
- item.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTab, iNewTab, &item)) {
- TabCtrl_SetCurSel(hwndTab, iNewTab);
- ShowWindow(pContainer->hwndActive, SW_HIDE);
- pContainer->hwndActive = (HWND) item.lParam;
- ShowWindow((HWND)item.lParam, SW_SHOW);
- SetFocus(pContainer->hwndActive);
- }
- }
+ if (iItems == 1)
+ break;
+ if (wParam == DM_SELECT_PREV)
+ iNewTab = iCurrent ? iCurrent - 1 : iItems - 1; // cycle if current is already the leftmost tab..
+ else if (wParam == DM_SELECT_NEXT)
+ iNewTab = (iCurrent == (iItems - 1)) ? 0 : iCurrent + 1;
+ else if (wParam == DM_SELECT_BY_INDEX) {
+ if ((int)lParam > iItems)
break;
+ iNewTab = lParam - 1;
+ }
+
+ if (iNewTab != iCurrent) {
+ struct TabControlData *tabdat = (struct TabControlData *)GetWindowLongPtr(hwndTab, GWLP_USERDATA);
+ ZeroMemory((void*)&item, sizeof(item));
+ item.mask = TCIF_PARAM;
+ if (TabCtrl_GetItem(hwndTab, iNewTab, &item)) {
+ TabCtrl_SetCurSel(hwndTab, iNewTab);
+ ShowWindow(pContainer->hwndActive, SW_HIDE);
+ pContainer->hwndActive = (HWND) item.lParam;
+ ShowWindow((HWND)item.lParam, SW_SHOW);
+ SetFocus(pContainer->hwndActive);
+ }
}
break;
}
- case WM_INITMENUPOPUP:
- pContainer->MenuBar->setActive(reinterpret_cast<HMENU>(wParam));
- break;
+ break;
- case WM_LBUTTONDOWN: {
- POINT pt;
+ case WM_INITMENUPOPUP:
+ pContainer->MenuBar->setActive(reinterpret_cast<HMENU>(wParam));
+ break;
- if (pContainer->dwFlags & CNT_NOTITLE) {
- GetCursorPos(&pt);
- return SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
- }
- break;
+ case WM_LBUTTONDOWN:
+ if (pContainer->dwFlags & CNT_NOTITLE) {
+ POINT pt;
+ GetCursorPos(&pt);
+ return SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
+ break;
+
/*
- * pass the WM_ACTIVATE msg to the active message dialog child
- */
+ * pass the WM_ACTIVATE msg to the active message dialog child
+ */
+ case WM_NCACTIVATE:
+ if (IsWindowVisible(hwndDlg))
+ pContainer->fHidden = false;
+ break;
- case WM_NCACTIVATE:
- if (IsWindowVisible(hwndDlg))
- pContainer->fHidden = false;
+ case WM_ACTIVATE:
+ if (pContainer == NULL)
break;
- case WM_ACTIVATE:
- if (pContainer == NULL)
- break;
-
- if (LOWORD(wParam == WA_INACTIVE)) {
- BroadCastContainer(pContainer, DM_CHECKINFOTIP, wParam, lParam);
- if (PluginConfig.m_MathModAvail)
- CallService(MTH_HIDE, 0, 0);
- }
+ if (LOWORD(wParam == WA_INACTIVE)) {
+ BroadCastContainer(pContainer, DM_CHECKINFOTIP, wParam, lParam);
+ if (PluginConfig.m_MathModAvail)
+ CallService(MTH_HIDE, 0, 0);
+ }
- if (LOWORD(wParam == WA_INACTIVE) && (HWND)lParam != PluginConfig.g_hwndHotkeyHandler && GetParent((HWND)lParam) != hwndDlg) {
- BOOL fTransAllowed = !bSkinned || PluginConfig.m_bIsVista;
+ if (LOWORD(wParam == WA_INACTIVE) && (HWND)lParam != PluginConfig.g_hwndHotkeyHandler && GetParent((HWND)lParam) != hwndDlg) {
+ BOOL fTransAllowed = !bSkinned || PluginConfig.m_bIsVista;
- if (pContainer->dwFlags & CNT_TRANSPARENCY && CMimAPI::m_pSetLayeredWindowAttributes != NULL && fTransAllowed) {
- CMimAPI::m_pSetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->settings->dwTransparency), (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
- }
+ if (pContainer->dwFlags & CNT_TRANSPARENCY && CMimAPI::m_pSetLayeredWindowAttributes != NULL && fTransAllowed) {
+ CMimAPI::m_pSetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->settings->dwTransparency), (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
}
- pContainer->hwndSaved = 0;
+ }
+ pContainer->hwndSaved = 0;
- if (LOWORD(wParam) != WA_ACTIVE) {
- pContainer->MenuBar->Cancel();
- break;
- }
- case WM_MOUSEACTIVATE: {
+ if (LOWORD(wParam) != WA_ACTIVE) {
+ pContainer->MenuBar->Cancel();
+ break;
+ }
+
+ case WM_MOUSEACTIVATE:
+ if (pContainer != NULL) {
TCITEM item;
int curItem = 0;
BOOL fTransAllowed = !bSkinned || PluginConfig.m_WinVerMajor >= 6;
- if (pContainer == NULL)
- break;
-
FlashContainer(pContainer, 0, 0);
pContainer->dwFlashingStarted = 0;
pLastActiveContainer = pContainer;
@@ -1613,18 +1490,17 @@ buttons_done: }
else if (curItem >= 0)
SendMessage((HWND) item.lParam, WM_ACTIVATE, WA_ACTIVE, 0);
- break;
}
- case DM_CLOSETABATMOUSE: {
- HWND hwndCurrent;
- POINT *pt = (POINT *)lParam;
- int iItem;
- TCITEM item = {0};
+ break;
- hwndCurrent = pContainer->hwndActive;
+ case DM_CLOSETABATMOUSE:
+ {
+ HWND hwndCurrent = pContainer->hwndActive;
+ POINT *pt = (POINT *)lParam;
if ((iItem = GetTabItemFromMouse(hwndTab, pt)) == -1)
break;
- ZeroMemory((void*)&item, sizeof(item));
+
+ TCITEM item = {0};
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, iItem, &item);
if (item.lParam) {
@@ -1637,35 +1513,30 @@ buttons_done: else
SendMessage((HWND) item.lParam, WM_CLOSE, 0, 1);
}
- break;
}
- case WM_PAINT: {
- bool fAero = M->isAero();
+ break;
- if (bSkinned || fAero) {
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwndDlg, &ps);
- EndPaint(hwndDlg, &ps);
- return 0;
- }
- break;
+ case WM_PAINT:
+ if (bSkinned || M->isAero()) {
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwndDlg, &ps);
+ EndPaint(hwndDlg, &ps);
+ return 0;
}
- case WM_ERASEBKGND: {
- /*
- * avoid flickering of the menu bar when aero is active
- */
- if (!pContainer)
- break;
+ break;
- HDC hdc = (HDC)wParam;
+ case WM_ERASEBKGND:
+ /*
+ * avoid flickering of the menu bar when aero is active
+ */
+ if (pContainer) {
+ HDC hdc = (HDC)wParam;
RECT rc;
GetClientRect(hwndDlg, &rc);
if (M->isAero()) {
- HDC hdcMem;
- HANDLE hbp;
-
- hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, 0, &hdcMem);
+ HDC hdcMem;
+ HANDLE hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, 0, &hdcMem);
FillRect(hdcMem, &rc, CSkin::m_BrushBack);
CSkin::FinalizeBufferedPaint(hbp, &rc);
}
@@ -1679,7 +1550,7 @@ buttons_done: HPEN hPen = ::CreatePen(PS_SOLID, 1, PluginConfig.m_cRichBorders ? PluginConfig.m_cRichBorders : ::GetSysColor(COLOR_3DSHADOW));
HPEN hOldPen = reinterpret_cast<HPEN>(::SelectObject(hdc, hPen));
LONG x = (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? pContainer->SideBar->getWidth() - 2 + pContainer->tBorder_outer_left :
- rc.right - pContainer->SideBar->getWidth() + 1 - pContainer->tBorder_outer_right);
+ rc.right - pContainer->SideBar->getWidth() + 1 - pContainer->tBorder_outer_right);
::MoveToEx(hdc, x, rc.top, 0);
::LineTo(hdc, x, rc.bottom);
::SelectObject(hdc, hOldPen);
@@ -1691,7 +1562,10 @@ buttons_done: SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1);
return TRUE;
}
- case DM_OPTIONSAPPLIED: {
+ break;
+
+ case DM_OPTIONSAPPLIED:
+ {
char szCname[40];
TCHAR szTitleFormat[200];
TCHAR* szThemeName = NULL;
@@ -1733,20 +1607,24 @@ buttons_done: pContainer->szAbsThemeFile[0] = pContainer->szRelThemeFile[0] = 0;
pContainer->ltr_templates = pContainer->rtl_templates = 0;
- break;
}
- case DM_STATUSBARCHANGED: {
+ break;
+
+ case DM_STATUSBARCHANGED:
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ {
RECT rc;
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
GetWindowRect(hwndDlg, &rc);
SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, (rc.bottom - rc.top) + 1, SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
- if (pContainer->hwndStatus != 0 && pContainer->hwndActive != 0)
- PostMessage(pContainer->hwndActive, DM_STATUSBARCHANGED, 0, 0);
- return 0;
}
- case DM_CONFIGURECONTAINER: {
+ if (pContainer->hwndStatus != 0 && pContainer->hwndActive != 0)
+ PostMessage(pContainer->hwndActive, DM_STATUSBARCHANGED, 0, 0);
+ return 0;
+
+ case DM_CONFIGURECONTAINER:
+ {
DWORD ws, wsold, ex = 0, exold = 0;
HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE);
HANDLE hContact = 0;
@@ -1757,8 +1635,8 @@ buttons_done: ws = wsold = GetWindowLongPtr(hwndDlg, GWL_STYLE);
if (!CSkin::m_frameSkins) {
ws = (pContainer->dwFlags & CNT_NOTITLE) ?
- ((IsWindowVisible(hwndDlg) ? WS_VISIBLE : 0) | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_THICKFRAME | (CSkin::m_frameSkins ? WS_SYSMENU : WS_SYSMENU | WS_SIZEBOX)) :
- ws | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
+ ((IsWindowVisible(hwndDlg) ? WS_VISIBLE : 0) | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_THICKFRAME | (CSkin::m_frameSkins ? WS_SYSMENU : WS_SYSMENU | WS_SIZEBOX)) :
+ ws | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
}
SetWindowLongPtr(hwndDlg, GWL_STYLE, ws);
@@ -1805,7 +1683,7 @@ buttons_done: }
pContainer->dwFlags = ((pContainer->dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)) ?
- pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
+ pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
pContainer->SideBar->Init();
@@ -1841,14 +1719,15 @@ buttons_done: }
SendMessage(hwndDlg, WM_SIZE, 0, 1);
BroadCastContainer(pContainer, DM_CONFIGURETOOLBAR, 0, 1);
- return 0;
}
+ return 0;
/*
- * search the first and most recent unread events in all client tabs...
- * return all information via a RECENTINFO structure (tab indices,
- * window handles and timestamps).
- */
- case DM_QUERYRECENT: {
+ * search the first and most recent unread events in all client tabs...
+ * return all information via a RECENTINFO structure (tab indices,
+ * window handles and timestamps).
+ */
+ case DM_QUERYRECENT:
+ {
int i;
int iItems = TabCtrl_GetItemCount(hwndTab);
RECENTINFO *ri = (RECENTINFO *)lParam;
@@ -1875,16 +1754,17 @@ buttons_done: }
}
}
- return 0;
}
+ return 0;
/*
- * search tab with either next or most recent unread message and select it
- */
- case DM_QUERYPENDING: {
- NMHDR nmhdr;
+ * search tab with either next or most recent unread message and select it
+ */
+ case DM_QUERYPENDING:
+ {
RECENTINFO ri;
-
SendMessage(hwndDlg, DM_QUERYRECENT, 0, (LPARAM)&ri);
+
+ NMHDR nmhdr;
nmhdr.code = TCN_SELCHANGE;
if (wParam == DM_QUERY_NEXT && ri.iFirstIndex != -1) {
@@ -1895,10 +1775,11 @@ buttons_done: TabCtrl_SetCurSel(hwndTab, ri.iMostRecent);
SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM) &nmhdr);
}
- return 0;
}
+ return 0;
- case DM_SETICON: {
+ case DM_SETICON:
+ {
HICON hIconMsg = PluginConfig.g_IconMsgEvent;
TWindowData* dat = (TWindowData *)wParam;
HICON hIconBig = (dat && dat->cache) ? LoadSkinnedProtoIconBig(dat->cache->getActiveProto(), dat->cache->getActiveStatus()) : 0;
@@ -1946,8 +1827,8 @@ buttons_done: }
}
/*
- * default handling (no win7 taskbar)
- */
+ * default handling (no win7 taskbar)
+ */
if ((HICON)lParam == PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]) { // always set typing icon, but don't save it...
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)PluginConfig.g_IconTypingEventBig);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
@@ -1964,9 +1845,11 @@ buttons_done: if (0 != hIconBig && reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) != hIconBig)
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(hIconBig));
pContainer->hIcon = (lParam == (LPARAM)hIconMsg) ? STICK_ICON_MSG : 0;
- return 0;
}
- case WM_DRAWITEM: {
+ return 0;
+
+ case WM_DRAWITEM:
+ {
int cx = PluginConfig.m_smcxicon;
int cy = PluginConfig.m_smcyicon;
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
@@ -1978,12 +1861,14 @@ buttons_done: DrawStatusIcons(dat, dis->hDC, dis->rcItem, 2);
return TRUE;
}
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- }
- case WM_MEASUREITEM: {
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
}
- case DM_QUERYCLIENTAREA: {
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+
+ case WM_MEASUREITEM:
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+
+ case DM_QUERYCLIENTAREA:
+ {
RECT *rc = (RECT *)lParam;
if (rc) {
if (!IsIconic(hwndDlg))
@@ -1992,210 +1877,203 @@ buttons_done: CopyRect(rc, &pContainer->rcSaved);
AdjustTabClientRect(pContainer, rc);
}
- return 0;
}
- case WM_DESTROY: {
- int i = 0;
- TCITEM item;
- SESSION_INFO *node = m_WndList;
+ return 0;
- if (PluginConfig.g_FlashAvatarAvail) { // destroy own flash avatar
- FLASHAVATAR fa = {0};
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ case WM_DESTROY:
+ if (PluginConfig.g_FlashAvatarAvail) { // destroy own flash avatar
+ FLASHAVATAR fa = {0};
+ struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- fa.id = 25367;
- fa.cProto = dat ? dat->szProto : NULL;
- CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0);
- }
- ZeroMemory((void*)&item, sizeof(item));
- pContainer->hwnd = 0;
- pContainer->hwndActive = 0;
- pContainer->hMenuContext = 0;
- if (pContainer->hwndStatus)
- DestroyWindow(pContainer->hwndStatus);
-
- // free private theme...
- if (pContainer->theme.isPrivate) {
- free(pContainer->ltr_templates);
- free(pContainer->rtl_templates);
- free(pContainer->theme.logFonts);
- free(pContainer->theme.fontColors);
- free(pContainer->theme.rtfFonts);
- }
+ fa.id = 25367;
+ fa.cProto = dat ? dat->szProto : NULL;
+ CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0);
+ }
+ ZeroMemory((void*)&item, sizeof(item));
+ pContainer->hwnd = 0;
+ pContainer->hwndActive = 0;
+ pContainer->hMenuContext = 0;
+ if (pContainer->hwndStatus)
+ DestroyWindow(pContainer->hwndStatus);
+
+ // free private theme...
+ if (pContainer->theme.isPrivate) {
+ free(pContainer->ltr_templates);
+ free(pContainer->rtl_templates);
+ free(pContainer->theme.logFonts);
+ free(pContainer->theme.fontColors);
+ free(pContainer->theme.rtfFonts);
+ }
- if (pContainer->hwndTip)
- DestroyWindow(pContainer->hwndTip);
- RemoveContainerFromList(pContainer);
- if (PluginConfig.m_MathModAvail)
- CallService(MTH_HIDE, 0, 0);
+ if (pContainer->hwndTip)
+ DestroyWindow(pContainer->hwndTip);
+ RemoveContainerFromList(pContainer);
+ if (PluginConfig.m_MathModAvail)
+ CallService(MTH_HIDE, 0, 0);
+ {
+ SESSION_INFO *node = m_WndList;
while (node) {
- if (node->pContainer == pContainer) {
+ if (node->pContainer == pContainer)
node->pContainer = 0;
- }
node = node->next;
}
- if (pContainer->cachedDC) {
- SelectObject(pContainer->cachedDC, pContainer->oldHBM);
- DeleteObject(pContainer->cachedHBM);
- DeleteDC(pContainer->cachedDC);
- }
- if (pContainer->cachedToolbarDC) {
- SelectObject(pContainer->cachedToolbarDC, pContainer->oldhbmToolbarBG);
- DeleteObject(pContainer->hbmToolbarBG);
- DeleteDC(pContainer->cachedToolbarDC);
- }
- return 0;
}
+ if (pContainer->cachedDC) {
+ SelectObject(pContainer->cachedDC, pContainer->oldHBM);
+ DeleteObject(pContainer->cachedHBM);
+ DeleteDC(pContainer->cachedDC);
+ }
+ if (pContainer->cachedToolbarDC) {
+ SelectObject(pContainer->cachedToolbarDC, pContainer->oldhbmToolbarBG);
+ DeleteObject(pContainer->hbmToolbarBG);
+ DeleteDC(pContainer->cachedToolbarDC);
+ }
+ return 0;
+
+ case WM_NCDESTROY:
+ if (pContainer) {
+ delete pContainer->MenuBar;
+ delete pContainer->SideBar;
+ if (pContainer->settings != &PluginConfig.globalContainerSettings)
+ free(pContainer->settings);
+ free(pContainer);
+ }
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
- case WM_NCDESTROY:
- if (pContainer) {
- delete pContainer->MenuBar;
- delete pContainer->SideBar;
- if (pContainer->settings != &PluginConfig.globalContainerSettings)
- free(pContainer->settings);
- free(pContainer);
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
+ case WM_CLOSE:
+ if (PluginConfig.m_HideOnClose && !lParam) {
+ ShowWindow(hwndDlg, SW_HIDE);
+ pContainer->fHidden = true;
+ }
+ else {
+ WINDOWPLACEMENT wp;
+ char szCName[40];
+ char *szSetting = "CNTW_";
- case WM_CLOSE: {
- //mad
- if (PluginConfig.m_HideOnClose && !lParam) {
- ShowWindow(hwndDlg, SW_HIDE);
- pContainer->fHidden = true;
+ if (TabCtrl_GetItemCount(hwndTab) > 1) {
+ LRESULT res = CWarning::show(CWarning::WARN_CLOSEWINDOW, MB_YESNOCANCEL|MB_ICONQUESTION);
+ if (IDNO == res || IDCANCEL == res)
+ break;
}
- else {
- WINDOWPLACEMENT wp;
- char szCName[40];
- char *szSetting = "CNTW_";
- if (TabCtrl_GetItemCount(hwndTab) > 1) {
- LRESULT res = CWarning::show(CWarning::WARN_CLOSEWINDOW, MB_YESNOCANCEL|MB_ICONQUESTION);
- if (IDNO == res || IDCANCEL == res)
- break;
- }
-
- if (lParam == 0 && TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_MSGTABS)) > 0) { // dont ask if container is empty (no tabs)
- int clients = TabCtrl_GetItemCount(hwndTab), i;
- TCITEM item = {0};
- int iOpenJobs = 0;
+ if (lParam == 0 && TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_MSGTABS)) > 0) { // dont ask if container is empty (no tabs)
+ int clients = TabCtrl_GetItemCount(hwndTab), i;
+ TCITEM item = {0};
+ int iOpenJobs = 0;
- item.mask = TCIF_PARAM;
- for (i=0; i < clients; i++) {
- TabCtrl_GetItem(hwndTab, i, &item);
- if (item.lParam && IsWindow((HWND)item.lParam)) {
- SendMessage((HWND)item.lParam, DM_CHECKQUEUEFORCLOSE, 0, (LPARAM)&iOpenJobs);
- }
+ item.mask = TCIF_PARAM;
+ for (i=0; i < clients; i++) {
+ TabCtrl_GetItem(hwndTab, i, &item);
+ if (item.lParam && IsWindow((HWND)item.lParam)) {
+ SendMessage((HWND)item.lParam, DM_CHECKQUEUEFORCLOSE, 0, (LPARAM)&iOpenJobs);
}
- if (iOpenJobs && pContainer) {
- LRESULT result;
+ }
+ if (iOpenJobs && pContainer) {
+ LRESULT result;
- if (pContainer->exFlags & CNT_EX_CLOSEWARN)
- return TRUE;
+ if (pContainer->exFlags & CNT_EX_CLOSEWARN)
+ return TRUE;
- pContainer->exFlags |= CNT_EX_CLOSEWARN;
- result = SendQueue::WarnPendingJobs(iOpenJobs);
- pContainer->exFlags &= ~CNT_EX_CLOSEWARN;
- if (result == IDNO)
- return TRUE;
- }
+ pContainer->exFlags |= CNT_EX_CLOSEWARN;
+ result = SendQueue::WarnPendingJobs(iOpenJobs);
+ pContainer->exFlags &= ~CNT_EX_CLOSEWARN;
+ if (result == IDNO)
+ return TRUE;
}
+ }
- ZeroMemory((void*)&wp, sizeof(wp));
- wp.length = sizeof(wp);
- /*
- * save geometry information to the database...
- */
- if (!(pContainer->dwFlags & CNT_GLOBALSIZE)) {
- if (GetWindowPlacement(hwndDlg, &wp) != 0) {
- if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- HANDLE hContact;
- int i;
- TCITEM item = {0};
-
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &item);
- SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- M->WriteByte(hContact, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
-
- for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
- if (TabCtrl_GetItem(hwndTab, i, &item)) {
- SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- M->WriteDword(hContact, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
- M->WriteDword(hContact, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
- M->WriteDword(hContact, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- M->WriteDword(hContact, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
- }
+ ZeroMemory((void*)&wp, sizeof(wp));
+ wp.length = sizeof(wp);
+ /*
+ * save geometry information to the database...
+ */
+ if (!(pContainer->dwFlags & CNT_GLOBALSIZE)) {
+ if (GetWindowPlacement(hwndDlg, &wp) != 0) {
+ if (pContainer->isCloned && pContainer->hContactFrom != 0) {
+ HANDLE hContact;
+ int i;
+ TCITEM item = {0};
+
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &item);
+ SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ M->WriteByte(hContact, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
+
+ for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
+ if (TabCtrl_GetItem(hwndTab, i, &item)) {
+ SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ M->WriteDword(hContact, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
+ M->WriteDword(hContact, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
+ M->WriteDword(hContact, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ M->WriteDword(hContact, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
}
}
- else {
- _snprintf(szCName, 40, "%s%dx", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.left);
- _snprintf(szCName, 40, "%s%dy", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.top);
- _snprintf(szCName, 40, "%s%dwidth", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- _snprintf(szCName, 40, "%s%dheight", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
-
- M->WriteByte(SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
- }
+ }
+ else {
+ _snprintf(szCName, 40, "%s%dx", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.left);
+ _snprintf(szCName, 40, "%s%dy", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.top);
+ _snprintf(szCName, 40, "%s%dwidth", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ _snprintf(szCName, 40, "%s%dheight", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
+
+ M->WriteByte(SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
}
}
- // clear temp flags which should NEVER be saved...
+ }
+ // clear temp flags which should NEVER be saved...
- if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- HANDLE hContact;
- int i;
- TCITEM item = {0};
+ if (pContainer->isCloned && pContainer->hContactFrom != 0) {
+ HANDLE hContact;
+ int i;
+ TCITEM item = {0};
- item.mask = TCIF_PARAM;
- pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
- for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
- if (TabCtrl_GetItem(hwndTab, i, &item)) {
- SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- //Utils::WriteContainerSettingsToDB(hContact, pContainer->settings);
-
- mir_snprintf(szCName, 40, "%s_theme", szSetting);
- if (lstrlen(pContainer->szRelThemeFile) > 1) {
- if (pContainer->fPrivateThemeChanged == TRUE) {
- M->pathToRelative(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
- M->WriteTString(hContact, SRMSGMOD_T, szCName, pContainer->szRelThemeFile);
- pContainer->fPrivateThemeChanged = FALSE;
- }
- }
- else {
- DBDeleteContactSetting(hContact, SRMSGMOD_T, szCName);
+ item.mask = TCIF_PARAM;
+ pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
+ for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
+ if (TabCtrl_GetItem(hwndTab, i, &item)) {
+ SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ //Utils::WriteContainerSettingsToDB(hContact, pContainer->settings);
+
+ mir_snprintf(szCName, 40, "%s_theme", szSetting);
+ if (lstrlen(pContainer->szRelThemeFile) > 1) {
+ if (pContainer->fPrivateThemeChanged == TRUE) {
+ M->pathToRelative(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
+ M->WriteTString(hContact, SRMSGMOD_T, szCName, pContainer->szRelThemeFile);
pContainer->fPrivateThemeChanged = FALSE;
}
-
}
+ else {
+ db_unset(hContact, SRMSGMOD_T, szCName);
+ pContainer->fPrivateThemeChanged = FALSE;
+ }
+
}
}
- else
- Utils::SaveContainerSettings(pContainer, szSetting);
- DestroyWindow(hwndDlg);
}
- break;
+ else
+ Utils::SaveContainerSettings(pContainer, szSetting);
+ DestroyWindow(hwndDlg);
}
- default:
- return FALSE;
}
return FALSE;
}
/*
- * search the list of tabs and return the tab (by index) which "belongs" to the given
- * hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
- * the dialog handle is stored in the TCITEM.lParam field, because we need
- * to know the owner of the tab.
- *
- * hwndTab: handle of the tab control itself.
- * hwnd: handle of a message dialog.
- *
- * returns the tab index (zero based), -1 if no tab is found (which SHOULD not
- * really happen, but who knows... ;))
- */
+* search the list of tabs and return the tab (by index) which "belongs" to the given
+* hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
+* the dialog handle is stored in the TCITEM.lParam field, because we need
+* to know the owner of the tab.
+*
+* hwndTab: handle of the tab control itself.
+* hwnd: handle of a message dialog.
+*
+* returns the tab index (zero based), -1 if no tab is found (which SHOULD not
+* really happen, but who knows... ;))
+*/
int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
{
@@ -2219,17 +2097,17 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd) /*
- * search the list of tabs and return the tab (by index) which "belongs" to the given
- * hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
- * the dialog handle is stored in the TCITEM.lParam field, because we need
- * to know the owner of the tab.
- *
- * hwndTab: handle of the tab control itself.
- * hwnd: handle of a message dialog.
- *
- * returns the tab index (zero based), -1 if no tab is found (which SHOULD not
- * really happen, but who knows... ;))
- */
+* search the list of tabs and return the tab (by index) which "belongs" to the given
+* hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
+* the dialog handle is stored in the TCITEM.lParam field, because we need
+* to know the owner of the tab.
+*
+* hwndTab: handle of the tab control itself.
+* hwnd: handle of a message dialog.
+*
+* returns the tab index (zero based), -1 if no tab is found (which SHOULD not
+* really happen, but who knows... ;))
+*/
HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
{
@@ -2243,19 +2121,19 @@ HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx) item.mask = TCIF_PARAM;
for (i=0; i < iItems; i++)
- {
+ {
TabCtrl_GetItem(hwndTab, i, &item);
- if (i == idx)
- return (HWND)item.lParam;
+ if (i == idx)
+ return (HWND)item.lParam;
}
return NULL;
}
/*
- * activates the tab belonging to the given client HWND (handle of the actual
- * message window.
- */
+* activates the tab belonging to the given client HWND (handle of the actual
+* message window.
+*/
int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd)
{
@@ -2273,10 +2151,10 @@ int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd) }
/*
- * returns the index of the tab under the mouse pointer. Used for
- * context menu popup and tooltips
- * pt: mouse coordinates, obtained from GetCursorPos()
- */
+* returns the index of the tab under the mouse pointer. Used for
+* context menu popup and tooltips
+* pt: mouse coordinates, obtained from GetCursorPos()
+*/
int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt)
{
@@ -2292,26 +2170,26 @@ int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt) /*enumerates tabs and closes all of them, but the one in dat */
void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
{
- for (int idxt = 0; idxt < dat.pContainer->iChilds; )
- {
- HWND otherTab = GetHWNDFromTabIndex(hwndTab, idxt);
- if (otherTab != NULL && otherTab != dat.hwnd)
- {
- SendMessage(otherTab, WM_CLOSE, 1, 0);
- }
- else
- ++idxt;
- }
+ for (int idxt = 0; idxt < dat.pContainer->iChilds; )
+ {
+ HWND otherTab = GetHWNDFromTabIndex(hwndTab, idxt);
+ if (otherTab != NULL && otherTab != dat.hwnd)
+ {
+ SendMessage(otherTab, WM_CLOSE, 1, 0);
+ }
+ else
+ ++idxt;
+ }
}
/*
- * cut off contact name to the option value set via Options->Tabbed messaging
- * some people were requesting this, because really long contact list names
- * are causing extraordinary wide tabs and these are looking ugly and wasting
- * screen space.
- *
- * size = max length of target string
- */
+* cut off contact name to the option value set via Options->Tabbed messaging
+* some people were requesting this, because really long contact list names
+* are causing extraordinary wide tabs and these are looking ugly and wasting
+* screen space.
+*
+* size = max length of target string
+*/
int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size)
{
@@ -2331,8 +2209,8 @@ int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size }
/*
- * functions for handling the linked list of struct ContainerWindowData *foo
- */
+* functions for handling the linked list of struct ContainerWindowData *foo
+*/
static struct TContainerData* TSAPI AppendToContainerList(struct TContainerData *pContainer) {
struct TContainerData *pCurrent = 0;
@@ -2399,11 +2277,11 @@ static struct TContainerData* TSAPI RemoveContainerFromList(struct TContainerDat }
/*
- * calls the TabCtrl_AdjustRect to calculate the "real" client area of the tab.
- * also checks for the option "hide tabs when only one tab open" and adjusts
- * geometry if necessary
- * rc is the RECT obtained by GetClientRect(hwndTab)
- */
+* calls the TabCtrl_AdjustRect to calculate the "real" client area of the tab.
+* also checks for the option "hide tabs when only one tab open" and adjusts
+* geometry if necessary
+* rc is the RECT obtained by GetClientRect(hwndTab)
+*/
void TSAPI AdjustTabClientRect(struct TContainerData *pContainer, RECT *rc)
{
@@ -2463,9 +2341,9 @@ void TSAPI AdjustTabClientRect(struct TContainerData *pContainer, RECT *rc) }
/*
- * retrieve the container name for the given contact handle.
- * if none is assigned, return the name of the default container
- */
+* retrieve the container name for the given contact handle.
+* if none is assigned, return the name of the default container
+*/
int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLen)
{
@@ -2504,7 +2382,8 @@ int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLe return 0;
}
-void TSAPI DeleteContainer(int iIndex) {
+void TSAPI DeleteContainer(int iIndex)
+{
DBVARIANT dbv;
char szIndex[10], szSetting[CONTAINER_NAMELEN + 30];
char *szKey = "TAB_ContainersW";
@@ -2525,29 +2404,30 @@ void TSAPI DeleteContainer(int iIndex) { if (!M->GetTString(hhContact, SRMSGMOD_T, szSubKey, &dbv_c)) {
TCHAR *wszString = dbv_c.ptszVal;
if (_tcscmp(wszString, wszContainerName) && lstrlen(wszString) == lstrlen(wszContainerName))
- DBDeleteContactSetting(hhContact, SRMSGMOD_T, "containerW");
+ db_unset(hhContact, SRMSGMOD_T, "containerW");
DBFreeVariant(&dbv_c);
}
hhContact = db_find_next(hhContact);
}
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Flags", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Trans", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dwidth", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dheight", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dx", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dy", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
}
DBFreeVariant(&dbv);
}
}
-void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) {
+void TSAPI RenameContainer(int iIndex, const TCHAR *szNew)
+{
DBVARIANT dbv;
char *szKey = "TAB_ContainersW";
char *szSettingP = "CNTW_";
@@ -2608,7 +2488,7 @@ HMENU TSAPI BuildContainerMenu() if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
if (_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN))
AppendMenu(hMenu, MF_STRING, IDM_CONTAINERMENU + i, !_tcscmp(dbv.ptszVal, _T("default")) ?
- TranslateT("Default container") : dbv.ptszVal);
+ TranslateT("Default container") : dbv.ptszVal);
}
DBFreeVariant(&dbv);
i++;
@@ -2620,7 +2500,8 @@ HMENU TSAPI BuildContainerMenu() return hMenu;
}
-HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) {
+HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg)
+{
HMENU hMCContextMenu = 0, hMCSubForce = 0, hMCSubDefault = 0, hMenu = 0;
DBVARIANT dbv;
int iNumProtos = 0, i = 0, iDefaultProtoByNum = 0;
@@ -2669,7 +2550,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) { szStatusText = (TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR);
}
mir_sntprintf(szMenuLine, SIZEOF(szMenuLine), _T("%s: %s [%s] %s"), acc->tszAccountName, nick, szStatusText,
- i == isForced ? TranslateT("(Forced)") : _T(""));
+ i == isForced ? TranslateT("(Forced)") : _T(""));
iChecked = MF_UNCHECKED;
if (hContactMostOnline != 0 && hContactMostOnline == handle)
iChecked = MF_CHECKED;
@@ -2687,10 +2568,10 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) { }
/*
- * flashes the container
- * iMode != 0: turn on flashing
- * iMode == 0: turn off flashing
- */
+* flashes the container
+* iMode != 0: turn on flashing
+* iMode == 0: turn off flashing
+*/
void TSAPI FlashContainer(struct TContainerData *pContainer, int iMode, int iCount) {
FLASHWINFO fwi;
@@ -2713,15 +2594,15 @@ void TSAPI FlashContainer(struct TContainerData *pContainer, int iMode, int iCou fwi.dwTimeout = M->GetDword("flashinterval", 1000);
}
- else
- fwi.dwFlags = FLASHW_STOP;
+ else fwi.dwFlags = FLASHW_STOP;
fwi.hwnd = pContainer->hwnd;
pContainer->dwFlashingStarted = GetTickCount();
CMimAPI::m_MyFlashWindowEx(&fwi);
}
-void TSAPI ReflashContainer(struct TContainerData *pContainer) {
+void TSAPI ReflashContainer(struct TContainerData *pContainer)
+{
DWORD dwStartTime = pContainer->dwFlashingStarted;
if (GetForegroundWindow() == pContainer->hwnd || GetActiveWindow() == pContainer->hwnd) // dont care about active windows
@@ -2749,20 +2630,18 @@ void TSAPI ReflashContainer(struct TContainerData *pContainer) { }
/*
- * broadcasts a message to all child windows (tabs/sessions)
- */
-
-void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE bType) {
- int i;
- TCITEM item;
+* broadcasts a message to all child windows (tabs/sessions)
+*/
+void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE bType)
+{
HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
- ZeroMemory((void*)&item, sizeof(item));
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
int nCount = TabCtrl_GetItemCount(hwndTab);
- for (i=0; i < nCount; i++) {
+ for (int i=0; i < nCount; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
if (IsWindow((HWND)item.lParam)) {
if (bType == SESSIONTYPE_ANY)
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 9a7d8cf45c..79d92f7689 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -165,7 +165,8 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa NEN_OPTIONS *options = &nen_options;
switch (msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ {
TVINSERTSTRUCT tvi = {0};
int i;
SetWindowLongPtr(GetDlgItem(hWnd, IDC_EVENTOPTIONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hWnd, IDC_EVENTOPTIONS), GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
@@ -259,162 +260,158 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW));
bWmNotify = FALSE;
- return TRUE;
}
- case DM_STATUSMASKSET:
- M->WriteDword(MODULE, "statusmask", (DWORD)lParam);
- options->dwStatusMask = (int)lParam;
- break;
- case WM_COMMAND:
- if (!bWmNotify) {
- switch (LOWORD(wParam)) {
- case IDC_PREVIEW:
- PopupPreview(options);
- break;
- case IDC_POPUPSTATUSMODES: {
- HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, M->GetDword(MODULE, "statusmask", (DWORD) - 1));
- SendMessage(hwndNew, DM_SETPARENTDIALOG, 0, (LPARAM)hWnd);
- break;
- }
- default: {
-
- if (IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MUC))
- g_Settings.iPopupStyle = 2;
- else if (IsDlgButtonChecked(hWnd, IDC_MUC_LOGCOLORS))
- g_Settings.iPopupStyle = 1;
- else
- g_Settings.iPopupStyle = 3;
-
- Utils::enableDlgControl(hWnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2 ? TRUE : FALSE);
-
- options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
- options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
- options->bDefaultColorErr = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_ERR);
-
- options->iDelayMsg = SendDlgItemMessage(hWnd, IDC_DELAY_MESSAGE_SPIN, UDM_GETPOS, 0, 0);
- options->iDelayOthers = SendDlgItemMessage(hWnd, IDC_DELAY_OTHERS_SPIN, UDM_GETPOS, 0, 0);
- options->iDelayErr = SendDlgItemMessage(hWnd, IDC_DELAY_ERR_SPIN, UDM_GETPOS, 0, 0);
-
- g_Settings.iPopupTimeout = SendDlgItemMessage(hWnd, IDC_DELAY_MESSAGE_MUC_SPIN, UDM_GETPOS, 0, 0);
-
- if (IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW))
- options->iLimitPreview = GetDlgItemInt(hWnd, IDC_MESSAGEPREVIEWLIMIT, NULL, FALSE);
- else
- options->iLimitPreview = 0;
- Utils::enableDlgControl(hWnd, IDC_COLBACK_MESSAGE, !options->bDefaultColorMsg);
- Utils::enableDlgControl(hWnd, IDC_COLTEXT_MESSAGE, !options->bDefaultColorMsg);
- Utils::enableDlgControl(hWnd, IDC_COLBACK_OTHERS, !options->bDefaultColorOthers);
- Utils::enableDlgControl(hWnd, IDC_COLTEXT_OTHERS, !options->bDefaultColorOthers);
- Utils::enableDlgControl(hWnd, IDC_COLBACK_ERR, !options->bDefaultColorErr);
- Utils::enableDlgControl(hWnd, IDC_COLTEXT_ERR, !options->bDefaultColorErr);
- Utils::enableDlgControl(hWnd, IDC_COLTEXT_MUC, (g_Settings.iPopupStyle == 3) ? TRUE : FALSE);
- Utils::enableDlgControl(hWnd, IDC_COLBACK_MUC, (g_Settings.iPopupStyle == 3) ? TRUE : FALSE);
-
- Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW));
- Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW));
- //disable delay textbox when infinite is checked
-
- Utils::enableDlgControl(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1);
- Utils::enableDlgControl(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1);
- Utils::enableDlgControl(hWnd, IDC_DELAY_ERR, options->iDelayErr != -1);
- Utils::enableDlgControl(hWnd, IDC_DELAY_MUC, g_Settings.iPopupTimeout != -1);
-
- if (HIWORD(wParam) == CPN_COLOURCHANGED) {
- options->colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
- options->colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
- options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
- options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
- options->colBackErr = SendDlgItemMessage(hWnd, IDC_COLBACK_ERR, CPM_GETCOLOUR, 0, 0);
- options->colTextErr = SendDlgItemMessage(hWnd, IDC_COLTEXT_ERR, CPM_GETCOLOUR, 0, 0);
- g_Settings.crPUBkgColour = SendDlgItemMessage(hWnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0);
- g_Settings.crPUTextColour = SendDlgItemMessage(hWnd, IDC_COLTEXT_MUC, CPM_GETCOLOUR, 0, 0);
- }
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
+ return TRUE;
+
+ case DM_STATUSMASKSET:
+ M->WriteDword(MODULE, "statusmask", (DWORD)lParam);
+ options->dwStatusMask = (int)lParam;
+ break;
+
+ case WM_COMMAND:
+ if (!bWmNotify) {
+ HWND hwndNew;
+ switch (LOWORD(wParam)) {
+ case IDC_PREVIEW:
+ PopupPreview(options);
+ break;
+
+ case IDC_POPUPSTATUSMODES:
+ hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, M->GetDword(MODULE, "statusmask", (DWORD) - 1));
+ SendMessage(hwndNew, DM_SETPARENTDIALOG, 0, (LPARAM)hWnd);
+ break;
+
+ default:
+ if (IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MUC))
+ g_Settings.iPopupStyle = 2;
+ else if (IsDlgButtonChecked(hWnd, IDC_MUC_LOGCOLORS))
+ g_Settings.iPopupStyle = 1;
+ else
+ g_Settings.iPopupStyle = 3;
+
+ Utils::enableDlgControl(hWnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2 ? TRUE : FALSE);
+
+ options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
+ options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
+ options->bDefaultColorErr = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_ERR);
+
+ options->iDelayMsg = SendDlgItemMessage(hWnd, IDC_DELAY_MESSAGE_SPIN, UDM_GETPOS, 0, 0);
+ options->iDelayOthers = SendDlgItemMessage(hWnd, IDC_DELAY_OTHERS_SPIN, UDM_GETPOS, 0, 0);
+ options->iDelayErr = SendDlgItemMessage(hWnd, IDC_DELAY_ERR_SPIN, UDM_GETPOS, 0, 0);
+
+ g_Settings.iPopupTimeout = SendDlgItemMessage(hWnd, IDC_DELAY_MESSAGE_MUC_SPIN, UDM_GETPOS, 0, 0);
+
+ if (IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW))
+ options->iLimitPreview = GetDlgItemInt(hWnd, IDC_MESSAGEPREVIEWLIMIT, NULL, FALSE);
+ else
+ options->iLimitPreview = 0;
+ Utils::enableDlgControl(hWnd, IDC_COLBACK_MESSAGE, !options->bDefaultColorMsg);
+ Utils::enableDlgControl(hWnd, IDC_COLTEXT_MESSAGE, !options->bDefaultColorMsg);
+ Utils::enableDlgControl(hWnd, IDC_COLBACK_OTHERS, !options->bDefaultColorOthers);
+ Utils::enableDlgControl(hWnd, IDC_COLTEXT_OTHERS, !options->bDefaultColorOthers);
+ Utils::enableDlgControl(hWnd, IDC_COLBACK_ERR, !options->bDefaultColorErr);
+ Utils::enableDlgControl(hWnd, IDC_COLTEXT_ERR, !options->bDefaultColorErr);
+ Utils::enableDlgControl(hWnd, IDC_COLTEXT_MUC, (g_Settings.iPopupStyle == 3) ? TRUE : FALSE);
+ Utils::enableDlgControl(hWnd, IDC_COLBACK_MUC, (g_Settings.iPopupStyle == 3) ? TRUE : FALSE);
+
+ Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW));
+ Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW));
+ //disable delay textbox when infinite is checked
+
+ Utils::enableDlgControl(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1);
+ Utils::enableDlgControl(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1);
+ Utils::enableDlgControl(hWnd, IDC_DELAY_ERR, options->iDelayErr != -1);
+ Utils::enableDlgControl(hWnd, IDC_DELAY_MUC, g_Settings.iPopupTimeout != -1);
+
+ if (HIWORD(wParam) == CPN_COLOURCHANGED) {
+ options->colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
+ options->colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
+ options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
+ options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
+ options->colBackErr = SendDlgItemMessage(hWnd, IDC_COLBACK_ERR, CPM_GETCOLOUR, 0, 0);
+ options->colTextErr = SendDlgItemMessage(hWnd, IDC_COLTEXT_ERR, CPM_GETCOLOUR, 0, 0);
+ g_Settings.crPUBkgColour = SendDlgItemMessage(hWnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0);
+ g_Settings.crPUTextColour = SendDlgItemMessage(hWnd, IDC_COLTEXT_MUC, CPM_GETCOLOUR, 0, 0);
}
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
}
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case IDC_EVENTOPTIONS:
- if (((LPNMHDR)lParam)->code == NM_CLICK) {
- TVHITTESTINFO hti;
- TVITEM item = {0};
-
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
- item.hItem = (HTREEITEM)hti.hItem;
- SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
- item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
- SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- }
- else if (hti.flags&TVHT_ONITEMSTATEICON) {
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
- item.state = INDEXTOSTATEIMAGEMASK(1);
- SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- }
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
- }
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR) lParam)->idFrom == IDC_EVENTOPTIONS && ((LPNMHDR)lParam)->code == NM_CLICK) {
+ TVHITTESTINFO hti;
+ TVITEM item = {0};
+
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
+ item.hItem = (HTREEITEM)hti.hItem;
+ SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
+ item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
+ SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
+ }
+ else if (hti.flags&TVHT_ONITEMSTATEICON) {
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
+ item.state = INDEXTOSTATEIMAGEMASK(1);
+ SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
}
- break;
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ }
}
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY: {
- int i;
- TVITEM item = {0};
- struct TContainerData *pContainer = pFirstContainer;
-
- TOptionListItem *defaultItems = CTranslator::getTree(CTranslator::TREE_NEN);
- for (i=0; defaultItems[i].szName != NULL; i++) {
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.hItem = (HTREEITEM)defaultItems[i].handle;
- item.stateMask = TVIS_STATEIMAGEMASK;
-
- SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (defaultItems[i].uType == LOI_TYPE_SETTING) {
- BOOL *ptr = (BOOL *)defaultItems[i].lParam;
- *ptr = (item.state >> 12) == 3/*2*/ ? TRUE : FALSE;
- }
- else if (defaultItems[i].uType == LOI_TYPE_FLAG) {
- UINT *uVal = (UINT *)defaultItems[i].lParam;
- *uVal = ((item.state >> 12) == 3/*2*/) ? *uVal | defaultItems[i].id : *uVal & ~defaultItems[i].id;
- }
- }
+ }
- M->WriteByte("Chat", "PopupStyle", (BYTE)g_Settings.iPopupStyle);
- DBWriteContactSettingWord(NULL, "Chat", "PopupTimeout", g_Settings.iPopupTimeout);
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ NEN_ReadOptions(&nen_options);
+ break;
- g_Settings.crPUBkgColour = SendDlgItemMessage(hWnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0);
- M->WriteDword("Chat", "PopupColorBG", (DWORD)g_Settings.crPUBkgColour);
- g_Settings.crPUTextColour = SendDlgItemMessage(hWnd, IDC_COLTEXT_MUC, CPM_GETCOLOUR, 0, 0);
- M->WriteDword("Chat", "PopupColorText", (DWORD)g_Settings.crPUTextColour);
+ case PSN_APPLY:
+ struct TContainerData *pContainer = pFirstContainer;
- NEN_WriteOptions(&nen_options);
- CheckForRemoveMask();
- CreateSystrayIcon(nen_options.bTraySupport);
- SetEvent(g_hEvent); // wake up the thread which cares about the floater and tray
- break;
+ TOptionListItem *defaultItems = CTranslator::getTree(CTranslator::TREE_NEN);
+ for (int i=0; defaultItems[i].szName != NULL; i++) {
+ TVITEM item = {0};
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.hItem = (HTREEITEM)defaultItems[i].handle;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+
+ SendDlgItemMessageA(hWnd, IDC_EVENTOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (defaultItems[i].uType == LOI_TYPE_SETTING) {
+ BOOL *ptr = (BOOL *)defaultItems[i].lParam;
+ *ptr = (item.state >> 12) == 3/*2*/ ? TRUE : FALSE;
+ }
+ else if (defaultItems[i].uType == LOI_TYPE_FLAG) {
+ UINT *uVal = (UINT *)defaultItems[i].lParam;
+ *uVal = ((item.state >> 12) == 3/*2*/) ? *uVal | defaultItems[i].id : *uVal & ~defaultItems[i].id;
}
- case PSN_RESET:
- NEN_ReadOptions(&nen_options);
- break;
}
- break;
- case WM_DESTROY: {
- //ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hWnd, IDC_EVENTOPTIONS, TVM_GETIMAGELIST, 0, 0));
- bWmNotify = TRUE;
- break;
+
+ M->WriteByte("Chat", "PopupStyle", (BYTE)g_Settings.iPopupStyle);
+ DBWriteContactSettingWord(NULL, "Chat", "PopupTimeout", g_Settings.iPopupTimeout);
+
+ g_Settings.crPUBkgColour = SendDlgItemMessage(hWnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0);
+ M->WriteDword("Chat", "PopupColorBG", (DWORD)g_Settings.crPUBkgColour);
+ g_Settings.crPUTextColour = SendDlgItemMessage(hWnd, IDC_COLTEXT_MUC, CPM_GETCOLOUR, 0, 0);
+ M->WriteDword("Chat", "PopupColorText", (DWORD)g_Settings.crPUTextColour);
+
+ NEN_WriteOptions(&nen_options);
+ CheckForRemoveMask();
+ CreateSystrayIcon(nen_options.bTraySupport);
+ SetEvent(g_hEvent); // wake up the thread which cares about the floater and tray
}
- default:
- break;
+ break;
+
+ case WM_DESTROY:
+ bWmNotify = TRUE;
+ break;
}
+
return FALSE;
}
@@ -466,57 +463,54 @@ static BOOL CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM if (!pdata) return FALSE;
switch (message) {
- case WM_COMMAND:
- PopupAct(hWnd, pdata->pluginOptions->maskActL, pdata);
- break;
- case WM_CONTEXTMENU:
- PopupAct(hWnd, pdata->pluginOptions->maskActR, pdata);
- break;
- case UM_FREEPLUGINDATA:
- pdata->hContact = 0; // mark as removeable
- pdata->hWnd = 0;
- return TRUE;
- case UM_INITPOPUP:
- pdata->hWnd = hWnd;
- if (pdata->iSeconds > 0)
- SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, NULL);
- break;
- case WM_MOUSEWHEEL:
+ case WM_COMMAND:
+ PopupAct(hWnd, pdata->pluginOptions->maskActL, pdata);
+ break;
+ case WM_CONTEXTMENU:
+ PopupAct(hWnd, pdata->pluginOptions->maskActR, pdata);
+ break;
+ case UM_FREEPLUGINDATA:
+ pdata->hContact = 0; // mark as removeable
+ pdata->hWnd = 0;
+ return TRUE;
+ case UM_INITPOPUP:
+ pdata->hWnd = hWnd;
+ if (pdata->iSeconds > 0)
+ SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, NULL);
+ break;
+ case WM_MOUSEWHEEL:
+ break;
+ case WM_SETCURSOR:
+ break;
+ case WM_TIMER:
+ POINT pt;
+ RECT rc;
+
+ if (wParam != TIMER_TO_ACTION)
break;
- case WM_SETCURSOR:
- break;
- case WM_TIMER: {
- POINT pt;
- RECT rc;
-
- if (wParam != TIMER_TO_ACTION)
- break;
- GetCursorPos(&pt);
- GetWindowRect(hWnd, &rc);
- if (PtInRect(&rc, pt))
- break;
-
- if (pdata->iSeconds > 0)
- KillTimer(hWnd, TIMER_TO_ACTION);
- PopupAct(hWnd, pdata->pluginOptions->maskActTE, pdata);
- break;
- }
- default:
+ GetCursorPos(&pt);
+ GetWindowRect(hWnd, &rc);
+ if (PtInRect(&rc, pt))
break;
+
+ if (pdata->iSeconds > 0)
+ KillTimer(hWnd, TIMER_TO_ACTION);
+ PopupAct(hWnd, pdata->pluginOptions->maskActTE, pdata);
+ break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
/**
- * Get a preview for the message
- * caller must always mir_free() the return value
- *
- * @param eventType the event type
- * @param dbe DBEVENTINFO *: database event structure
- *
- * @return
- */
+* Get a preview for the message
+* caller must always mir_free() the return value
+*
+* @param eventType the event type
+* @param dbe DBEVENTINFO *: database event structure
+*
+* @return
+*/
static TCHAR *GetPreviewT(WORD eventType, DBEVENTINFO* dbe)
{
@@ -608,7 +602,7 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) if (hEvent) {
if (pdata->pluginOptions->bShowHeaders) {
mir_sntprintf(pdata->szHeader, SIZEOF(pdata->szHeader), _T("%s %d\n"),
- TranslateT("New messages: "), pdata->nrMerged + 1);
+ TranslateT("New messages: "), pdata->nrMerged + 1);
pdata->szHeader[255] = 0;
}
ZeroMemory(&dbe, sizeof(dbe));
@@ -634,9 +628,9 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) pdata->eventData[pdata->nrMerged].szText[MAX_SECONDLINE - 1] = 0;
/*
- * now, reassemble the popup text, make sure the *last* event is shown, and then show the most recent events
- * for which there is enough space in the popup text
- */
+ * now, reassemble the popup text, make sure the *last* event is shown, and then show the most recent events
+ * for which there is enough space in the popup text
+ */
available = MAX_SECONDLINE - 1;
if (pdata->pluginOptions->bShowHeaders) {
@@ -679,20 +673,20 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent POPUPDATAT pud = {0};
long iSeconds;
switch (eventType) {
- case EVENTTYPE_MESSAGE:
- pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
- pud.colorBack = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colBackMsg;
- pud.colorText = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colTextMsg;
- iSeconds = pluginOptions->iDelayMsg;
- break;
- case EVENTTYPE_FILE:
- pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_FILE);
- pud.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
- pud.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
- iSeconds = pluginOptions->iDelayOthers;
- break;
- default:
- return 1;
+ case EVENTTYPE_MESSAGE:
+ pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
+ pud.colorBack = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colBackMsg;
+ pud.colorText = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colTextMsg;
+ iSeconds = pluginOptions->iDelayMsg;
+ break;
+ case EVENTTYPE_FILE:
+ pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_FILE);
+ pud.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
+ pud.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
+ iSeconds = pluginOptions->iDelayOthers;
+ break;
+ default:
+ return 1;
}
DBEVENTINFO dbe = { sizeof(dbe) };
@@ -763,9 +757,9 @@ static int TSAPI PopupPreview(NEN_OPTIONS *pluginOptions) }
/*
- * updates the menu entry...
- * bForced is used to only update the status, nickname etc. and does NOT update the unread count
- */
+* updates the menu entry...
+* bForced is used to only update the status, nickname etc. and does NOT update the unread count
+*/
void TSAPI UpdateTrayMenuState(struct TWindowData *dat, BOOL bForced)
{
MENUITEMINFO mii = {0};
@@ -798,8 +792,8 @@ void TSAPI UpdateTrayMenuState(struct TWindowData *dat, BOOL bForced) }
}
/*
- * if we want tray support, add the contact to the list of unread sessions in the tray menu
- */
+* if we want tray support, add the contact to the list of unread sessions in the tray menu
+*/
int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const TCHAR *szStatus, HANDLE hContact, DWORD fromEvent)
{
@@ -889,8 +883,8 @@ int tabSRMM_ShowPopup(WPARAM wParam, LPARAM lParam, WORD eventType, int windowOp return 0;
/*
- * check the status mode against the status mask
- */
+ * check the status mode against the status mask
+ */
if (nen_options.dwStatusMask != -1) {
DWORD dwStatus = 0;
@@ -938,8 +932,8 @@ passed: }
/**
- * remove all popups for hContact, but only if the mask matches the current "mode"
- */
+* remove all popups for hContact, but only if the mask matches the current "mode"
+*/
void TSAPI DeletePopupsForContact(HANDLE hContact, DWORD dwMask)
{
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index e312c166a7..243003ab24 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -401,7 +401,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, break;
}
if (iNewLocalFormat == 0)
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "sendformat");
+ db_unset(dat->hContact, SRMSGMOD_T, "sendformat");
else if (iNewLocalFormat != iLocalFormat)
M->WriteDword(dat->hContact, SRMSGMOD_T, "sendformat", iNewLocalFormat);
@@ -501,7 +501,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, if (dat->sendMode & SMODE_NOACK)
M->WriteByte(dat->hContact, SRMSGMOD_T, "no_ack", 1);
else
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "no_ack");
+ db_unset(dat->hContact, SRMSGMOD_T, "no_ack");
break;
}
M->WriteByte(dat->hContact, SRMSGMOD_T, "no_ack", (BYTE)(dat->sendMode & SMODE_NOACK ? 1 : 0));
@@ -1788,15 +1788,15 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam) if ((TabCtrl_GetCurSel(hwndTab) != dat->iTabID) && !(dbei.flags & DBEF_SENT) && !fIsStatusChangeEvent) {
switch (dbei.eventType) {
- case EVENTTYPE_MESSAGE:
- dat->iFlashIcon = PluginConfig.g_IconMsgEvent;
- break;
- case EVENTTYPE_FILE:
- dat->iFlashIcon = PluginConfig.g_IconFileEvent;
- break;
- default:
- dat->iFlashIcon = PluginConfig.g_IconMsgEvent;
- break;
+ case EVENTTYPE_MESSAGE:
+ dat->iFlashIcon = PluginConfig.g_IconMsgEvent;
+ break;
+ case EVENTTYPE_FILE:
+ dat->iFlashIcon = PluginConfig.g_IconFileEvent;
+ break;
+ default:
+ dat->iFlashIcon = PluginConfig.g_IconMsgEvent;
+ break;
}
SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
dat->mayFlashTab = TRUE;
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 10a22aed0e..4e13942b16 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -96,135 +96,138 @@ public: c = cTemp;
}
}
- void reloadAdv();
- void reloadSystemStartup();
- void reloadSystemModulesChanged();
- void reloadSettings(bool fReloadSkins = true);
-
- void hookSystemEvents();
- bool haveAutoSwitch();
-
- const HMENU getMenuBar();
-
- HWND g_hwndHotkeyHandler;
- HICON g_iconIn, g_iconOut, g_iconErr, g_iconContainer, g_iconStatus;
- HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
- HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
- HBITMAP g_hbmUnknown;
- 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;
- HICON g_IconMsgEventBig, g_IconTypingEventBig;
- HICON g_IconFolder, g_IconChecked, g_IconUnchecked;
- HMENU g_hMenuContext, g_hMenuContainer, g_hMenuEncoding, g_hMenuTrayUnread;
- HMENU g_hMenuFavorites, g_hMenuRecent, g_hMenuTrayContext;
- HICON g_buttonBarIcons[NR_BUTTONBARICONS];
- HICON g_sideBarIcons[NR_SIDEBARICONS];
- HANDLE g_buttonBarIconHandles[23];
+ void reloadAdv();
+ void reloadSystemStartup();
+ void reloadSystemModulesChanged();
+ void reloadSettings(bool fReloadSkins = true);
+
+ void hookSystemEvents();
+ bool haveAutoSwitch();
+
+ const HMENU getMenuBar();
+
+ HWND g_hwndHotkeyHandler;
+ HICON g_iconIn, g_iconOut, g_iconErr, g_iconContainer, g_iconStatus;
+ HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
+ HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
+ HBITMAP g_hbmUnknown;
+ 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;
+ HICON g_IconMsgEventBig, g_IconTypingEventBig;
+ HICON g_IconFolder, g_IconChecked, g_IconUnchecked;
+ HMENU g_hMenuContext, g_hMenuContainer, g_hMenuEncoding, g_hMenuTrayUnread;
+ HMENU g_hMenuFavorites, g_hMenuRecent, g_hMenuTrayContext;
+ HICON g_buttonBarIcons[NR_BUTTONBARICONS];
+ HICON g_sideBarIcons[NR_SIDEBARICONS];
+ HANDLE g_buttonBarIconHandles[23];
+
// dynamic options, need reload when options change
- int m_SendOnShiftEnter;
- int m_SendOnEnter;
- int m_SendOnDblEnter;
- int m_AutoLocaleSupport;
- int m_AutoSwitchTabs;
- int m_CutContactNameOnTabs;
- int m_CutContactNameTo;
- int m_StatusOnTabs;
- int m_LogStatusChanges;
- int m_UseDividers;
- int m_DividersUsePopupConfig;
- int m_MsgTimeout;
- int m_EscapeCloses;
- int m_FlashOnClist;
- int m_AlwaysFullToolbarWidth;
- int m_LimitStaticAvatarHeight;
- int m_SendFormat;
- int m_FormatWholeWordsOnly;
- int m_RTLDefault;
- int m_MathModAvail;
- TCHAR m_MathModStartDelimiter[40];
- int m_UnreadInTray;
- int m_TrayFlashes;
- int m_TrayFlashState;
- BOOL m_SuperQuiet;
- HANDLE m_UserMenuItem;
- double g_DPIscaleX;
- double g_DPIscaleY;
- BOOL m_HideOnClose;
- BOOL g_bSoundOnTyping;
- BOOL m_AllowTab;
- BYTE m_AllowOfflineMultisend;
- BOOL g_bDisableAniAvatars;
- HBITMAP m_hbmMsgArea;
- BYTE g_iButtonsBarGap;
- BYTE m_WinVerMajor;
- BYTE m_WinVerMinor;
- bool m_bIsXP, m_bIsVista, m_bIsWin7;
- HWND m_hwndClist;
- int m_TabAppearance;
- struct myTabCtrl tabConfig;
- int m_panelHeight, m_MUCpanelHeight;
- WINDOWPLACEMENT m_GlobalContainerWpos;
- int m_IdleDetect;
- int m_smcxicon, m_smcyicon;
- int m_PasteAndSend;
- TCHAR *m_szNoStatus;
- COLORREF crIncoming, crOutgoing, crOldIncoming, crOldOutgoing, crStatus;
- BOOL bUnicodeBuild;
- HFONT hFontCaption;
- DWORD m_LangPackCP;
- BYTE m_SmileyButtonOverride;
- NONCLIENTMETRICS m_ncm;
- HICON m_AnimTrayIcons[4];
- BOOL m_visualMessageSizeIndicator;
- BOOL m_autoSplit;
- BOOL m_FlashOnMTN;
- DWORD dwThreadID;
- char szMetaName[256];
- BYTE bMetaEnabled;
- HANDLE m_hMessageWindowList, hUserPrefsWindowList;
- bool m_chat_enabled;
- HMENU m_MenuBar;
- COLORREF m_ipBackgroundGradient;
- COLORREF m_ipBackgroundGradientHigh;
- COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor;
- BYTE g_bClientInStatusBar;
- BYTE m_dontUseDefaultKbd;
- HANDLE hSvc[SERVICE_LAST];
- HANDLE m_event_MsgWin, m_event_MsgPopup;
- HANDLE m_hMenuItem;
- BYTE m_useAeroPeek;
-
- TSplitterBroadCast lastSPlitterPos;
- TContainerSettings globalContainerSettings;
-
- static TCHAR* m_default_container_name;
- static void cacheUpdateMetaChanged();
- static void logStatusChange(WPARAM wParam, const CContactCache *c);
-
- static void Ex_CopyEditToClipboard(HWND hWnd);
- static void Ex_Handler();
- static int Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, wchar_t* szReason, bool fAllowContinue);
- static INT_PTR CALLBACK Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ int m_SendOnShiftEnter;
+ int m_SendOnEnter;
+ int m_SendOnDblEnter;
+ int m_AutoLocaleSupport;
+ int m_AutoSwitchTabs;
+ int m_CutContactNameOnTabs;
+ int m_CutContactNameTo;
+ int m_StatusOnTabs;
+ int m_LogStatusChanges;
+ int m_UseDividers;
+ int m_DividersUsePopupConfig;
+ int m_MsgTimeout;
+ int m_EscapeCloses;
+ int m_FlashOnClist;
+ int m_AlwaysFullToolbarWidth;
+ int m_LimitStaticAvatarHeight;
+ int m_SendFormat;
+ int m_FormatWholeWordsOnly;
+ int m_RTLDefault;
+ int m_MathModAvail;
+ TCHAR m_MathModStartDelimiter[40];
+ int m_UnreadInTray;
+ int m_TrayFlashes;
+ int m_TrayFlashState;
+ BOOL m_SuperQuiet;
+ HANDLE m_UserMenuItem;
+ double g_DPIscaleX;
+ double g_DPIscaleY;
+ BOOL m_HideOnClose;
+ BOOL g_bSoundOnTyping;
+ BOOL m_AllowTab;
+ BYTE m_AllowOfflineMultisend;
+ BOOL g_bDisableAniAvatars;
+ HBITMAP m_hbmMsgArea;
+ BYTE g_iButtonsBarGap;
+ BYTE m_WinVerMajor;
+ BYTE m_WinVerMinor;
+ bool m_bIsXP, m_bIsVista, m_bIsWin7;
+ HWND m_hwndClist;
+ int m_TabAppearance;
+ myTabCtrl tabConfig;
+ int m_panelHeight, m_MUCpanelHeight;
+ int m_IdleDetect;
+ int m_smcxicon, m_smcyicon;
+ int m_PasteAndSend;
+ TCHAR *m_szNoStatus;
+ COLORREF crIncoming, crOutgoing, crOldIncoming, crOldOutgoing, crStatus;
+ BOOL bUnicodeBuild;
+ HFONT hFontCaption;
+ DWORD m_LangPackCP;
+ BYTE m_SmileyButtonOverride;
+ HICON m_AnimTrayIcons[4];
+ BOOL m_visualMessageSizeIndicator;
+ BOOL m_autoSplit;
+ BOOL m_FlashOnMTN;
+ DWORD dwThreadID;
+ char szMetaName[256];
+ BYTE bMetaEnabled;
+ HANDLE m_hMessageWindowList, hUserPrefsWindowList;
+ bool m_chat_enabled;
+ HMENU m_MenuBar;
+ COLORREF m_ipBackgroundGradient;
+ COLORREF m_ipBackgroundGradientHigh;
+ COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor;
+ BYTE g_bClientInStatusBar;
+ BYTE m_dontUseDefaultKbd;
+ HANDLE hSvc[SERVICE_LAST];
+ HANDLE m_event_MsgWin, m_event_MsgPopup;
+ HANDLE m_hMenuItem;
+ BYTE m_useAeroPeek;
+
+ WINDOWPLACEMENT m_GlobalContainerWpos;
+ NONCLIENTMETRICS m_ncm;
+
+ TSplitterBroadCast lastSPlitterPos;
+ TContainerSettings globalContainerSettings;
+
+ static TCHAR* m_default_container_name;
+
+ static void cacheUpdateMetaChanged();
+ static void logStatusChange(WPARAM wParam, const CContactCache *c);
+
+ static void Ex_CopyEditToClipboard(HWND hWnd);
+ static void Ex_Handler();
+ static int Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, wchar_t* szReason, bool fAllowContinue);
+ static INT_PTR CALLBACK Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
- bool m_TypingSoundAdded;
+ bool m_TypingSoundAdded;
static EXCEPTION_RECORD m_exRecord;
- static CONTEXT m_exCtx;
- static LRESULT m_exLastResult;
- static char m_exSzFile[MAX_PATH];
- static wchar_t m_exReason[256];
- static int m_exLine;
- static bool m_exAllowContinue;
+ static CONTEXT m_exCtx;
+ static LRESULT m_exLastResult;
+ static char m_exSzFile[MAX_PATH];
+ static wchar_t m_exReason[256];
+ static int m_exLine;
+ static bool m_exAllowContinue;
private:
- static int ModulesLoaded(WPARAM wParam, LPARAM lParam);
- static int DBSettingChanged(WPARAM wParam, LPARAM lParam);
- static int DBContactDeleted(WPARAM wParam, LPARAM lParam);
- static int PreshutdownSendRecv(WPARAM wParam, LPARAM lParam);
- static int MetaContactEvent(WPARAM wParam, LPARAM lParam);
- static int OkToExit(WPARAM wParam, LPARAM lParam);
- static void RestoreUnreadMessageAlerts(void);
+ static int ModulesLoaded(WPARAM wParam, LPARAM lParam);
+ static int DBSettingChanged(WPARAM wParam, LPARAM lParam);
+ static int DBContactDeleted(WPARAM wParam, LPARAM lParam);
+ static int PreshutdownSendRecv(WPARAM wParam, LPARAM lParam);
+ static int MetaContactEvent(WPARAM wParam, LPARAM lParam);
+ static int OkToExit(WPARAM wParam, LPARAM lParam);
+ static void RestoreUnreadMessageAlerts(void);
};
extern CGlobals PluginConfig;
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 5399d5a9bb..c71d186092 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1222,7 +1222,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L BYTE vNew = (iResult == 0 ? (BYTE)-1 : (iResult == 1 ? 1 : 0));
if (vNew != vOld) {
if (vNew == (BYTE)-1)
- DBDeleteContactSetting(m_dat->hContact, SRMSGMOD_T, "hideavatar");
+ db_unset(m_dat->hContact, SRMSGMOD_T, "hideavatar");
else
M->WriteByte(m_dat->hContact, SRMSGMOD_T, "hideavatar", vNew);
m_dat->panelWidth = -1;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index a9838ac9d2..fc6860a91f 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -180,7 +180,7 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) M->WriteDword(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
} else if (iSelection == 500 && idFrom == IDC_LOG) {
dat->codePage = CP_ACP;
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
+ db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
} else {
switch (iSelection) {
case IDM_COPY:
@@ -645,7 +645,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar BOOL isCtrl, isShift, isAlt;
KbdState(mwdat, isShift, isCtrl, isAlt);
//MAD: sound on typing..
- if (PluginConfig.g_bSoundOnTyping&&!isAlt&&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND)&&wParam!=VK_ESCAPE&&!(wParam==VK_TAB&&PluginConfig.m_AllowTab))
+ if (PluginConfig.g_bSoundOnTyping && !isAlt && !isCtrl && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_AllowTab))
SkinPlaySound("SoundOnTyping");
//MAD
if (wParam == 0x0d && isCtrl && PluginConfig.m_MathModAvail) {
@@ -717,7 +717,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar KbdState(mwdat, isShift, isCtrl, isAlt);
//MAD: sound on typing..
- if (PluginConfig.g_bSoundOnTyping&&!isAlt&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND)&&wParam == VK_DELETE)
+ if (PluginConfig.g_bSoundOnTyping && !isAlt && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam == VK_DELETE)
SkinPlaySound("SoundOnTyping");
//
@@ -975,7 +975,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
return 0;
- case WM_LBUTTONUP: {
+ case WM_LBUTTONUP:
HWND hwndCapture = GetCapture();
ReleaseCapture();
@@ -985,88 +985,87 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM dat->panelWidth = -1;
RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
}
- else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
- (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
- RECT rc;
- POINT pt;
- int selection;
- HMENU hMenu = GetSubMenu(dat->pContainer->hMenuContext, 12);
- LONG messagePos = GetMessagePos();
+ else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
+ (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
+ RECT rc;
+ POINT pt;
+ int selection;
+ HMENU hMenu = GetSubMenu(dat->pContainer->hMenuContext, 12);
+ LONG messagePos = GetMessagePos();
- GetClientRect(hwnd, &rc);
- if (hwndCapture != hwnd || dat->savedSplitter == (rc.right > rc.bottom ? (short) HIWORD(messagePos) + rc.bottom / 2 : (short) LOWORD(messagePos) + rc.right / 2))
- break;
- GetCursorPos(&pt);
+ GetClientRect(hwnd, &rc);
+ if (hwndCapture != hwnd || dat->savedSplitter == (rc.right > rc.bottom ? (short) HIWORD(messagePos) + rc.bottom / 2 : (short) LOWORD(messagePos) + rc.right / 2))
+ break;
+ GetCursorPos(&pt);
#if defined(__FEAT_EXP_AUTOSPLITTER)
- if (dat->fIsAutosizingInput)
- selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION;
- else
- selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL);
-#else
+ if (dat->fIsAutosizingInput)
+ selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION;
+ else
selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL);
+#else
+ selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL);
#endif
- switch (selection) {
- case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
- {
- HWND hwndParent = GetParent(hwnd);
+ switch (selection) {
+ case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
+ {
+ HWND hwndParent = GetParent(hwnd);
- dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
- M->WriteByte(dat->hContact, SRMSGMOD_T, "splitoverride", 1);
- if (dat->bType == SESSIONTYPE_IM)
- SaveSplitter(dat);
- }
- break;
+ dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
+ M->WriteByte(dat->hContact, SRMSGMOD_T, "splitoverride", 1);
+ if (dat->bType == SESSIONTYPE_IM)
+ SaveSplitter(dat);
+ }
+ break;
- case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
+ case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
#if defined(__FEAT_EXP_AUTOSPLITTER)
- if (dat->fIsAutosizingInput) {
- RECT rc;
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
- dat->iInputAreaHeight = 0;
- }
+ if (dat->fIsAutosizingInput) {
+ RECT rc;
+ GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
+ dat->iInputAreaHeight = 0;
+ }
#endif
- break;
+ break;
- case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS:
- {
- RECT rcWin;
- BYTE bSync = M->GetByte("Chat", "SyncSplitter", 0);
- DWORD dwOff_IM = 0, dwOff_CHAT = 0;
-
- dwOff_CHAT = -(2 + (PluginConfig.g_DPIscaleY > 1.0 ? 1 : 0));
- dwOff_IM = 2 + (PluginConfig.g_DPIscaleY > 1.0 ? 1 : 0);
-
- GetWindowRect(hwndParent, &rcWin);
- PluginConfig.lastSPlitterPos.pSrcDat = dat;
- PluginConfig.lastSPlitterPos.pSrcContainer = dat->pContainer;
- PluginConfig.lastSPlitterPos.lParam = rc.bottom;
- PluginConfig.lastSPlitterPos.pos = rcWin.bottom - HIWORD(messagePos);
- PluginConfig.lastSPlitterPos.pos_chat = rcWin.bottom - (short)HIWORD(messagePos) + rc.bottom / 2;
- PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT;
- PluginConfig.lastSPlitterPos.off_im = dwOff_IM;
- PluginConfig.lastSPlitterPos.bSync = bSync;
- SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
- M->BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
- }
- break;
+ case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS:
+ {
+ RECT rcWin;
+ BYTE bSync = M->GetByte("Chat", "SyncSplitter", 0);
+ DWORD dwOff_IM = 0, dwOff_CHAT = 0;
+
+ dwOff_CHAT = -(2 + (PluginConfig.g_DPIscaleY > 1.0 ? 1 : 0));
+ dwOff_IM = 2 + (PluginConfig.g_DPIscaleY > 1.0 ? 1 : 0);
+
+ GetWindowRect(hwndParent, &rcWin);
+ PluginConfig.lastSPlitterPos.pSrcDat = dat;
+ PluginConfig.lastSPlitterPos.pSrcContainer = dat->pContainer;
+ PluginConfig.lastSPlitterPos.lParam = rc.bottom;
+ PluginConfig.lastSPlitterPos.pos = rcWin.bottom - HIWORD(messagePos);
+ PluginConfig.lastSPlitterPos.pos_chat = rcWin.bottom - (short)HIWORD(messagePos) + rc.bottom / 2;
+ PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT;
+ PluginConfig.lastSPlitterPos.off_im = dwOff_IM;
+ PluginConfig.lastSPlitterPos.bSync = bSync;
+ SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
+ M->BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
+ }
+ break;
- default:
- dat->splitterY = dat->savedSplitY;
- dat->dynaSplitter = dat->savedDynaSplit;
- DM_RecalcPictureSize(dat);
- if (dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
- si->iSplitterY = dat->savedSplitY;
- dat->splitterY =si->iSplitterY + DPISCALEY_S(22);
- }
- CSkin::UpdateToolbarBG(dat);
- SendMessage(hwndParent, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
- break;
+ default:
+ dat->splitterY = dat->savedSplitY;
+ dat->dynaSplitter = dat->savedDynaSplit;
+ DM_RecalcPictureSize(dat);
+ if (dat->bType == SESSIONTYPE_CHAT) {
+ SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ si->iSplitterY = dat->savedSplitY;
+ dat->splitterY =si->iSplitterY + DPISCALEY_S(22);
}
+ CSkin::UpdateToolbarBG(dat);
+ SendMessage(hwndParent, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 0, 1);
+ break;
+ }
}
return 0;
- }
}
return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
@@ -1955,8 +1954,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP M->WriteDword(dat->hContact, SRMSGMOD_T, "mwflags", dwFlags);
}
else {
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "mwmask");
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "mwflags");
+ db_unset(dat->hContact, SRMSGMOD_T, "mwmask");
+ db_unset(dat->hContact, SRMSGMOD_T, "mwflags");
}
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
@@ -1986,8 +1985,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN);
return(_dlgReturn(hwndDlg, 1));
}
- default:
- break;
}
if (DM_GenericHotkeysCheck(&message, dat)) {
dat->fkeyProcessed = true;
@@ -3080,8 +3077,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return TRUE;
}
sendQueue->addTo(dat, memRequired, flags);
- return TRUE;
}
+ return TRUE;
case IDC_QUOTE:
{
@@ -3185,7 +3182,6 @@ quote_from_last: case IDC_ADD:
{
ADDCONTACTSTRUCT acs = {0};
-
acs.handle = dat->hContact;
acs.handleType = HANDLE_CONTACT;
acs.szProto = 0;
@@ -3234,11 +3230,13 @@ quote_from_last: }
}
break;
+
default:
Utils::CmdDispatcher(Utils::CMD_MSGDIALOG, hwndDlg, LOWORD(wParam), wParam, lParam, dat, m_pContainer);
break;
}
break;
+
case WM_CONTEXTMENU:
{
//mad
@@ -3278,8 +3276,9 @@ quote_from_last: return TRUE;
}
}
- break;
}
+ break;
+
/*
* this is now *only* called from the global ME_PROTO_ACK handler (static int ProtoAck() in msgs.c)
* it receives:
@@ -3304,7 +3303,7 @@ quote_from_last: */
case DM_CONTAINERSELECTED:
{
- struct TContainerData *pNewContainer = 0;
+ TContainerData *pNewContainer = 0;
TCHAR *szNewName = (TCHAR *)lParam;
if (!_tcscmp(szNewName, TranslateT("Default container")))
@@ -3347,13 +3346,13 @@ quote_from_last: * lParam == new text to show
*/
- case DM_ACTIVATETOOLTIP: {
+ case DM_ACTIVATETOOLTIP:
if (IsIconic(hwndContainer) || m_pContainer->hwndActive != hwndDlg)
break;
dat->Panel->showTip(wParam, lParam);
break;
- }
+
case WM_NEXTDLGCTL:
if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
return 1;
@@ -3408,7 +3407,6 @@ quote_from_last: case DM_MYAVATARCHANGED:
{
const char *szProto = dat->cache->getActiveProto();
-
if (!strcmp((char *)wParam, szProto) && lstrlenA(szProto) == lstrlenA((char *)wParam))
LoadOwnAvatar(dat);
}
@@ -3463,7 +3461,7 @@ quote_from_last: InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE);
}
return 0;
- //mad: bb-api
+
case DM_BBNEEDUPDATE:
if (lParam)
CB_ChangeButton(hwndDlg,dat,(CustomButtonData*)lParam);
@@ -3514,9 +3512,9 @@ quote_from_last: Utils::AddToFileList(&ppFiles, &totalCount, szFilename);
}
- if (!not_sending) {
+ if (!not_sending)
CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM)dat->hContact, (LPARAM)ppFiles);
- } else {
+ else {
if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
for (int i = 0; i < totalCount; i++) {
char* szFileName = mir_t2a( ppFiles[i] );
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 0570d4db2a..9cd9826722 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -397,7 +397,7 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) M->WriteDword(dat->hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
break;
case ID_TABMENU_CLEARSAVEDTABPOSITION:
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "tabindex");
+ db_unset(dat->hContact, SRMSGMOD_T, "tabindex");
break;
case ID_TABMENU_LEAVECHATROOM: {
if (dat && dat->bType == SESSIONTYPE_CHAT) {
@@ -459,7 +459,8 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) }
return 1;
}
- } else if (menuId == MENU_LOGMENU) {
+ }
+ else if (menuId == MENU_LOGMENU) {
int iLocalTime = 0;
int iRtl = (PluginConfig.m_RTLDefault == 0 ? M->GetByte(dat->hContact, "RTL", 0) : M->GetByte(dat->hContact, "RTL", 1));
int iLogStatus = (PluginConfig.m_LogStatusChanges != 0) && M->GetByte(dat->hContact, "logstatuschanges", 0);
@@ -467,24 +468,18 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) DWORD dwOldFlags = dat->dwFlags;
switch (selection) {
- case ID_MESSAGELOGSETTINGS_GLOBAL: {
- OPENOPTIONSDIALOG ood = {0};
-
- ood.cbSize = sizeof(OPENOPTIONSDIALOG);
- ood.pszGroup = NULL;
+ case ID_MESSAGELOGSETTINGS_GLOBAL:
+ {
+ OPENOPTIONSDIALOG ood = { sizeof(ood) };
ood.pszPage = "Message Sessions";
- ood.pszTab = NULL;
M->WriteByte(SRMSGMOD_T, "opage", 3); // force 3th tab to appear
Options_Open(&ood);
- return 1;
}
+ return 1;
- case ID_MESSAGELOGSETTINGS_FORTHISCONTACT:
- CallService(MS_TABMSG_SETUSERPREFS, (WPARAM)dat->hContact, 0);
- return 1;
-
- default:
- break;
+ case ID_MESSAGELOGSETTINGS_FORTHISCONTACT:
+ CallService(MS_TABMSG_SETUSERPREFS, (WPARAM)dat->hContact, 0);
+ return 1;
}
}
return 0;
@@ -1027,198 +1022,195 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) // scan the file for rtf commands and remove or parse them
inColor = 0;
p1 = _tcsstr(pszText, _T("\\pard"));
- if (p1) {
- size_t iRemoveChars;
- TCHAR InsertThis[50];
- p1 += 5;
-
- MoveMemory(pszText, p1, (lstrlen(p1) + 1) * sizeof(TCHAR));
- p1 = pszText;
- // iterate through all characters, if rtf control character found then take action
- while (*p1 != (TCHAR) '\0') {
- _sntprintf(InsertThis, 50, _T(""));
- iRemoveChars = 0;
-
- switch (*p1) {
- case (TCHAR) '\\':
- if (p1 == _tcsstr(p1, _T("\\cf"))) { // foreground color
- TCHAR szTemp[20];
- int iCol = _ttoi(p1 + 3);
- int iInd = Utils::RTFColorToIndex(iCol);
- bJustRemovedRTF = TRUE;
-
- _sntprintf(szTemp, 20, _T("%d"), iCol);
- iRemoveChars = 3 + lstrlen(szTemp);
- if (bTextHasStarted || iCol)
- _sntprintf(InsertThis, sizeof(InsertThis) / sizeof(TCHAR), (iInd > 0) ? (inColor ? _T("[/color][color=%s]") : _T("[color=%s]")) : (inColor ? _T("[/color]") : _T("")), Utils::rtf_ctable[iInd - 1].szName);
- inColor = iInd > 0 ? 1 : 0;
- } else if (p1 == _tcsstr(p1, _T("\\highlight"))) { //background color
- TCHAR szTemp[20];
- int iCol = _ttoi(p1 + 10);
- bJustRemovedRTF = TRUE;
-
- _sntprintf(szTemp, 20, _T("%d"), iCol);
- iRemoveChars = 10 + lstrlen(szTemp);
- } else if (p1 == _tcsstr(p1, _T("\\par"))) { // newline
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 4;
- } else if (p1 == _tcsstr(p1, _T("\\line"))) { // soft line break;
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 5;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("\n"));
- } else if (p1 == _tcsstr(p1, _T("\\endash"))) {
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2013);
- } else if (p1 == _tcsstr(p1, _T("\\emdash"))) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2014);
- } else if (p1 == _tcsstr(p1, _T("\\bullet"))) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2022);
- } else if (p1 == _tcsstr(p1, _T("\\ldblquote"))) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 10;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201C);
- } else if (p1 == _tcsstr(p1, _T("\\rdblquote"))) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 10;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201D);
- } else if (p1 == _tcsstr(p1, _T("\\lquote"))) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2018);
- } else if (p1 == _tcsstr(p1, _T("\\rquote"))) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2019);
- } else if (p1 == _tcsstr(p1, _T("\\b"))) { //bold
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = (p1[2] != (TCHAR) '0') ? 2 : 3;
- if (!(lf.lfWeight == FW_BOLD)) { // only allow bold if the font itself isn't a bold one, otherwise just strip it..
- if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[b]") : _T("[/b]"));
- }
-
- } else if (p1 == _tcsstr(p1, _T("\\i"))) { // italics
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = (p1[2] != (TCHAR) '0') ? 2 : 3;
- if (!lf.lfItalic) { // same as for bold
- if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[i]") : _T("[/i]"));
- }
-
- } else if (p1 == _tcsstr(p1, _T("\\strike"))) { // strike-out
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = (p1[7] != (TCHAR) '0') ? 7 : 8;
- if (!lf.lfStrikeOut) { // same as for bold
- if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[7] != (TCHAR) '0') ? _T("[s]") : _T("[/s]"));
- }
-
- } else if (p1 == _tcsstr(p1, _T("\\ul"))) { // underlined
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- if (p1[3] == (TCHAR) 'n')
- iRemoveChars = 7;
- else if (p1[3] == (TCHAR) '0')
- iRemoveChars = 4;
- else
- iRemoveChars = 3;
- if (!lf.lfUnderline) { // same as for bold
- if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[3] != (TCHAR) '0' && p1[3] != (TCHAR) 'n') ? _T("[u]") : _T("[/u]"));
- }
-
- } else if (p1 == _tcsstr(p1, _T("\\tab"))) { // tab
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 4;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x09);
- } else if (p1[1] == (TCHAR) '\\' || p1[1] == (TCHAR) '{' || p1[1] == (TCHAR) '}') { // escaped characters
- bTextHasStarted = TRUE;
- //bJustRemovedRTF = TRUE;
- iRemoveChars = 2;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), p1[1]);
- } else if (p1[1] == (TCHAR) '\'') { // special character
- bTextHasStarted = TRUE;
- bJustRemovedRTF = FALSE;
- if (p1[2] != (TCHAR) ' ' && p1[2] != (TCHAR) '\\') {
- int iLame = 0;
- TCHAR * p3;
- TCHAR *stoppedHere;
-
- if (p1[3] != (TCHAR) ' ' && p1[3] != (TCHAR) '\\') {
- _tcsncpy(InsertThis, p1 + 2, 3);
- iRemoveChars = 4;
- InsertThis[2] = 0;
- } else {
- _tcsncpy(InsertThis, p1 + 2, 2);
- iRemoveChars = 3;
- InsertThis[2] = 0;
- }
- // convert string containing char in hex format to int.
- p3 = InsertThis;
- iLame = _tcstol(p3, &stoppedHere, 16);
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), (TCHAR) iLame);
-
- } else
- iRemoveChars = 2;
- } else { // remove unknown RTF command
- int j = 1;
- bJustRemovedRTF = TRUE;
- while (!_tcschr(_T(" !$%()#*\"'"), p1[j]) && p1[j] != (TCHAR) '§' && p1[j] != (TCHAR) '\\' && p1[j] != (TCHAR) '\0')
- // while(!_tcschr(_T(" !§$%&()#*"), p1[j]) && p1[j] != (TCHAR)'\\' && p1[j] != (TCHAR)'\0')
- j++;
- // while(p1[j] != (TCHAR)' ' && p1[j] != (TCHAR)'\\' && p1[j] != (TCHAR)'\0')
- // j++;
- iRemoveChars = j;
- }
- break;
+ if (!p1)
+ return FALSE;
- case (TCHAR) '{': // other RTF control characters
- case (TCHAR) '}':
- iRemoveChars = 1;
- break;
+ size_t iRemoveChars;
+ TCHAR InsertThis[50];
+ p1 += 5;
+
+ MoveMemory(pszText, p1, (lstrlen(p1) + 1) * sizeof(TCHAR));
+ p1 = pszText;
+ // iterate through all characters, if rtf control character found then take action
+ while (*p1 != (TCHAR) '\0') {
+ _sntprintf(InsertThis, 50, _T(""));
+ iRemoveChars = 0;
+
+ switch (*p1) {
+ case (TCHAR) '\\':
+ if (p1 == _tcsstr(p1, _T("\\cf"))) { // foreground color
+ TCHAR szTemp[20];
+ int iCol = _ttoi(p1 + 3);
+ int iInd = Utils::RTFColorToIndex(iCol);
+ bJustRemovedRTF = TRUE;
+
+ _sntprintf(szTemp, 20, _T("%d"), iCol);
+ iRemoveChars = 3 + lstrlen(szTemp);
+ if (bTextHasStarted || iCol)
+ _sntprintf(InsertThis, sizeof(InsertThis) / sizeof(TCHAR), (iInd > 0) ? (inColor ? _T("[/color][color=%s]") : _T("[color=%s]")) : (inColor ? _T("[/color]") : _T("")), Utils::rtf_ctable[iInd - 1].szName);
+ inColor = iInd > 0 ? 1 : 0;
+ } else if (p1 == _tcsstr(p1, _T("\\highlight"))) { //background color
+ TCHAR szTemp[20];
+ int iCol = _ttoi(p1 + 10);
+ bJustRemovedRTF = TRUE;
+
+ _sntprintf(szTemp, 20, _T("%d"), iCol);
+ iRemoveChars = 10 + lstrlen(szTemp);
+ } else if (p1 == _tcsstr(p1, _T("\\par"))) { // newline
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 4;
+ } else if (p1 == _tcsstr(p1, _T("\\line"))) { // soft line break;
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 5;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("\n"));
+ } else if (p1 == _tcsstr(p1, _T("\\endash"))) {
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2013);
+ } else if (p1 == _tcsstr(p1, _T("\\emdash"))) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2014);
+ } else if (p1 == _tcsstr(p1, _T("\\bullet"))) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2022);
+ } else if (p1 == _tcsstr(p1, _T("\\ldblquote"))) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 10;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201C);
+ } else if (p1 == _tcsstr(p1, _T("\\rdblquote"))) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 10;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201D);
+ } else if (p1 == _tcsstr(p1, _T("\\lquote"))) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2018);
+ } else if (p1 == _tcsstr(p1, _T("\\rquote"))) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2019);
+ } else if (p1 == _tcsstr(p1, _T("\\b"))) { //bold
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = (p1[2] != (TCHAR) '0') ? 2 : 3;
+ if (!(lf.lfWeight == FW_BOLD)) { // only allow bold if the font itself isn't a bold one, otherwise just strip it..
+ if (dat->SendFormat)
+ _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[b]") : _T("[/b]"));
+ }
- case (TCHAR) ' ': // remove spaces following a RTF command
- if (bJustRemovedRTF)
- iRemoveChars = 1;
- bJustRemovedRTF = FALSE;
- bTextHasStarted = TRUE;
- break;
+ } else if (p1 == _tcsstr(p1, _T("\\i"))) { // italics
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = (p1[2] != (TCHAR) '0') ? 2 : 3;
+ if (!lf.lfItalic) { // same as for bold
+ if (dat->SendFormat)
+ _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[i]") : _T("[/i]"));
+ }
- default: // other text that should not be touched
- bTextHasStarted = TRUE;
- bJustRemovedRTF = FALSE;
+ } else if (p1 == _tcsstr(p1, _T("\\strike"))) { // strike-out
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = (p1[7] != (TCHAR) '0') ? 7 : 8;
+ if (!lf.lfStrikeOut) { // same as for bold
+ if (dat->SendFormat)
+ _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[7] != (TCHAR) '0') ? _T("[s]") : _T("[/s]"));
+ }
- break;
+ } else if (p1 == _tcsstr(p1, _T("\\ul"))) { // underlined
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ if (p1[3] == (TCHAR) 'n')
+ iRemoveChars = 7;
+ else if (p1[3] == (TCHAR) '0')
+ iRemoveChars = 4;
+ else
+ iRemoveChars = 3;
+ if (!lf.lfUnderline) { // same as for bold
+ if (dat->SendFormat)
+ _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[3] != (TCHAR) '0' && p1[3] != (TCHAR) 'n') ? _T("[u]") : _T("[/u]"));
+ }
+
+ } else if (p1 == _tcsstr(p1, _T("\\tab"))) { // tab
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 4;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x09);
+ } else if (p1[1] == (TCHAR) '\\' || p1[1] == (TCHAR) '{' || p1[1] == (TCHAR) '}') { // escaped characters
+ bTextHasStarted = TRUE;
+ //bJustRemovedRTF = TRUE;
+ iRemoveChars = 2;
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), p1[1]);
+ } else if (p1[1] == (TCHAR) '\'') { // special character
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = FALSE;
+ if (p1[2] != (TCHAR) ' ' && p1[2] != (TCHAR) '\\') {
+ int iLame = 0;
+ TCHAR * p3;
+ TCHAR *stoppedHere;
+
+ if (p1[3] != (TCHAR) ' ' && p1[3] != (TCHAR) '\\') {
+ _tcsncpy(InsertThis, p1 + 2, 3);
+ iRemoveChars = 4;
+ InsertThis[2] = 0;
+ } else {
+ _tcsncpy(InsertThis, p1 + 2, 2);
+ iRemoveChars = 3;
+ InsertThis[2] = 0;
+ }
+ // convert string containing char in hex format to int.
+ p3 = InsertThis;
+ iLame = _tcstol(p3, &stoppedHere, 16);
+ _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), (TCHAR) iLame);
+
+ } else
+ iRemoveChars = 2;
+ } else { // remove unknown RTF command
+ int j = 1;
+ bJustRemovedRTF = TRUE;
+ while (!_tcschr(_T(" !$%()#*\"'"), p1[j]) && p1[j] != (TCHAR) '§' && p1[j] != (TCHAR) '\\' && p1[j] != (TCHAR) '\0')
+ // while(!_tcschr(_T(" !§$%&()#*"), p1[j]) && p1[j] != (TCHAR)'\\' && p1[j] != (TCHAR)'\0')
+ j++;
+ // while(p1[j] != (TCHAR)' ' && p1[j] != (TCHAR)'\\' && p1[j] != (TCHAR)'\0')
+ // j++;
+ iRemoveChars = j;
}
+ break;
- // move the memory and paste in new commands instead of the old RTF
- if (lstrlen(InsertThis) || iRemoveChars) {
- MoveMemory(p1 + lstrlen(InsertThis), p1 + iRemoveChars, (lstrlen(p1) - iRemoveChars + 1) * sizeof(TCHAR));
- CopyMemory(p1, InsertThis, lstrlen(InsertThis) * sizeof(TCHAR));
- p1 += lstrlen(InsertThis);
- } else
- p1++;
+ case (TCHAR) '{': // other RTF control characters
+ case (TCHAR) '}':
+ iRemoveChars = 1;
+ break;
+
+ case (TCHAR) ' ': // remove spaces following a RTF command
+ if (bJustRemovedRTF)
+ iRemoveChars = 1;
+ bJustRemovedRTF = FALSE;
+ bTextHasStarted = TRUE;
+ break;
+
+ default: // other text that should not be touched
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = FALSE;
+ break;
}
- } else {
- return FALSE;
+ // move the memory and paste in new commands instead of the old RTF
+ if (lstrlen(InsertThis) || iRemoveChars) {
+ MoveMemory(p1 + lstrlen(InsertThis), p1 + iRemoveChars, (lstrlen(p1) - iRemoveChars + 1) * sizeof(TCHAR));
+ CopyMemory(p1, InsertThis, lstrlen(InsertThis) * sizeof(TCHAR));
+ p1 += lstrlen(InsertThis);
+ }
+ else p1++;
}
return TRUE;
}
@@ -1246,33 +1238,25 @@ void TSAPI DoTrimMessage(TCHAR *msg) void TSAPI GetMYUIN(TWindowData *dat)
{
- CONTACTINFO ci;
- ZeroMemory((void*)&ci, sizeof(ci));
-
- /*
- * get my uin
- */
-
- ci.cbSize = sizeof(ci);
- ci.hContact = 0;
+ CONTACTINFO ci = { sizeof(ci) };
ci.szProto = const_cast<char *>(dat->cache->getActiveProto());
ci.dwFlag = CNF_TCHAR | CNF_DISPLAYUID;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
switch (ci.type) {
- case CNFT_ASCIIZ:
- mir_sntprintf(dat->myUin, SIZEOF(dat->myUin), _T("%s"), reinterpret_cast<TCHAR *>(ci.pszVal));
- mir_free((void*)ci.pszVal);
- break;
- case CNFT_DWORD:
- mir_sntprintf(dat->myUin, SIZEOF(dat->myUin), _T("%u"), ci.dVal);
- break;
- default:
- dat->myUin[0] = 0;
- break;
+ case CNFT_ASCIIZ:
+ mir_sntprintf(dat->myUin, SIZEOF(dat->myUin), _T("%s"), reinterpret_cast<TCHAR *>(ci.pszVal));
+ mir_free((void*)ci.pszVal);
+ break;
+ case CNFT_DWORD:
+ mir_sntprintf(dat->myUin, SIZEOF(dat->myUin), _T("%u"), ci.dVal);
+ break;
+ default:
+ dat->myUin[0] = 0;
+ break;
}
- } else
- dat->myUin[0] = 0;
+ }
+ else dat->myUin[0] = 0;
}
static int g_IEViewAvail = -1;
@@ -1436,11 +1420,11 @@ void TSAPI FindFirstEvent(TWindowData *dat) historyMode = LOADHISTORY_COUNT;
switch (historyMode) {
- case LOADHISTORY_COUNT: {
+ case LOADHISTORY_COUNT:
+ {
int i;
HANDLE hPrevEvent;
- DBEVENTINFO dbei = { 0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
//MAD: ability to load only current session's history
if (dat->bActualHistory)
i = dat->cache->getSessionMsgCount();
@@ -1460,37 +1444,33 @@ void TSAPI FindFirstEvent(TWindowData *dat) if (!DbEventIsShown(dat, &dbei))
i++;
}
- break;
}
- case LOADHISTORY_TIME: {
- HANDLE hPrevEvent;
- DBEVENTINFO dbei = { 0};
- DWORD firstTime;
+ break;
+
+ case LOADHISTORY_TIME:
+ HANDLE hPrevEvent;
+ DWORD firstTime;
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if (dat->hDbEventFirst == NULL)
+ dbei.timestamp = time(NULL);
+ else
+ CallService(MS_DB_EVENT_GET, (WPARAM) dat->hDbEventFirst, (LPARAM) & dbei);
+ firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
+ for (;;) {
if (dat->hDbEventFirst == NULL)
- dbei.timestamp = time(NULL);
+ hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
else
- CallService(MS_DB_EVENT_GET, (WPARAM) dat->hDbEventFirst, (LPARAM) & dbei);
- firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
- for (;;) {
- if (dat->hDbEventFirst == NULL)
- hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
- else
- hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) dat->hDbEventFirst, 0);
- if (hPrevEvent == NULL)
- break;
- dbei.cbBlob = 0;
- CallService(MS_DB_EVENT_GET, (WPARAM) hPrevEvent, (LPARAM) & dbei);
- if (dbei.timestamp < firstTime)
- break;
- dat->hDbEventFirst = hPrevEvent;
- }
- break;
- }
- default: {
- break;
+ hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) dat->hDbEventFirst, 0);
+ if (hPrevEvent == NULL)
+ break;
+ dbei.cbBlob = 0;
+ CallService(MS_DB_EVENT_GET, (WPARAM) hPrevEvent, (LPARAM) & dbei);
+ if (dbei.timestamp < firstTime)
+ break;
+ dat->hDbEventFirst = hPrevEvent;
}
+ break;
}
}
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 047476d6fe..8f3e09f1f5 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -803,15 +803,15 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont icon = isSent ? LOGICON_OUT : LOGICON_IN;
else {
switch (dbei.eventType) {
- case EVENTTYPE_FILE:
- icon = LOGICON_FILE;
- break;
- case EVENTTYPE_ERRMSG:
- icon = LOGICON_ERROR;
- break;
- default:
- icon = LOGICON_MSG;
- break;
+ case EVENTTYPE_FILE:
+ icon = LOGICON_FILE;
+ break;
+ case EVENTTYPE_ERRMSG:
+ icon = LOGICON_ERROR;
+ break;
+ default:
+ icon = LOGICON_MSG;
+ break;
}
if (fIsStatusChangeEvent)
icon = LOGICON_STATUS;
@@ -943,18 +943,18 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont c = isSent ? 0x37 : 0x38;
else {
switch (dbei.eventType) {
- case EVENTTYPE_MESSAGE:
- c = (char)0xaa;
- break;
- case EVENTTYPE_FILE:
- c = (char)0xcd;
- break;
- case EVENTTYPE_ERRMSG:
- c = (char)0x72;;
- break;
- default:
- c = (char)0xaa;
- break;
+ case EVENTTYPE_MESSAGE:
+ c = (char)0xaa;
+ break;
+ case EVENTTYPE_FILE:
+ c = (char)0xcd;
+ break;
+ case EVENTTYPE_ERRMSG:
+ c = (char)0x72;;
+ break;
+ default:
+ c = (char)0xaa;
+ break;
}
if (fIsStatusChangeEvent)
c = 0x4e;
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index f4abde6c78..039b9e1cb0 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -380,7 +380,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(hwndDlg, WM_COMMAND, IDC_RELOADSKIN, 0);
}
else if (lr == 0) { // selected the <no skin> entry
- DBDeleteContactSetting(0, SRMSGMOD_T, "ContainerSkin");
+ db_unset(0, SRMSGMOD_T, "ContainerSkin");
Skin->Unload();
SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
}
@@ -564,27 +564,28 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, DWORD dwFlags = M->GetDword("mwflags", MWF_LOG_DEFAULT);
switch (msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ {
TVINSERTSTRUCT tvi = {0};
int i;
DWORD maxhist = M->GetDword("maxhist", 0);
TranslateDialogDefault(hwndDlg);
switch (M->GetByte(SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
- case LOADHISTORY_UNREAD:
- CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
- break;
- case LOADHISTORY_COUNT:
- CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, TRUE);
- break;
- case LOADHISTORY_TIME:
- CheckDlgButton(hwndDlg, IDC_LOADTIME, BST_CHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, TRUE);
- break;
+ case LOADHISTORY_UNREAD:
+ CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
+ break;
+ case LOADHISTORY_COUNT:
+ CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, TRUE);
+ break;
+ case LOADHISTORY_TIME:
+ CheckDlgButton(hwndDlg, IDC_LOADTIME, BST_CHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, TRUE);
+ break;
}
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOGOPTIONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOGOPTIONS), GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
@@ -620,7 +621,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, tvi.item.state = INDEXTOSTATEIMAGEMASK(M->GetByte((char *)lvItems[i].lParam, lvItems[i].id) ? 3 : 2); // NOTE: was 2 : 1 without state image mask
lvItems[i].handle = (LRESULT)TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_LOGOPTIONS), &tvi);
}
-
+
SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(24 * 60, 0));
@@ -667,162 +668,167 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, }
SetDlgItemText(hwndDlg, IDC_EXPLAINMSGLOGSETTINGS, TranslateT("You have chosen to use an external plugin for displaying the message history in the chat window. Most of the settings on this page are for the standard message log viewer only and will have no effect. To change the appearance of the message log, you must configure either IEView or History++."));
SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- return TRUE;
}
+ return TRUE;
+
/*
- * configure the option page - hide most of the settings here when either IEView
- * or H++ is set as the global message log viewer. Showing these options may confuse
- * the user, because they are not working and the user needs to configure the 3rd
- * party plugin.
- */
- case WM_USER + 100: {
+ * configure the option page - hide most of the settings here when either IEView
+ * or H++ is set as the global message log viewer. Showing these options may confuse
+ * the user, because they are not working and the user needs to configure the 3rd
+ * party plugin.
+ */
+ case WM_USER + 100:
+ {
LRESULT r = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
Utils::showDlgControl(hwndDlg, IDC_EXPLAINMSGLOGSETTINGS, r == 0 ? SW_HIDE : SW_SHOW);
Utils::showDlgControl(hwndDlg, IDC_LOGOPTIONS, r == 0 ? SW_SHOW : SW_HIDE);
Utils::enableDlgControl(GetDlgItem(hwndDlg, IDC_MSGLOGDIDSPLAY),r == 0 ? FALSE : TRUE);
for (int i=0; i < SIZEOF(__ctrls); i++)
Utils::enableDlgControl(hwndDlg, __ctrls[i], r == 0 ? TRUE : FALSE);
- return 0;
}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ALWAYSTRIM:
- Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
- Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
- break;
- case IDC_LOADUNREAD:
- case IDC_LOADCOUNT:
- case IDC_LOADTIME:
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- break;
- case IDC_INDENTAMOUNT:
- case IDC_LOADCOUNTN:
- case IDC_LOADTIMEN:
- case IDC_RIGHTINDENT:
- case IDC_TRIM:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
- case IDC_MODIFY: {
- TemplateEditorNew teNew = {0, 0, hwndDlg};
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
- break;
- }
- case IDC_RTLMODIFY: {
- TemplateEditorNew teNew = {0, TRUE, hwndDlg};
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
- break;
- }
- case IDC_MSGLOGDIDSPLAY:
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- break;
+ return 0;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ALWAYSTRIM:
+ Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
+ Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
+ break;
+ case IDC_LOADUNREAD:
+ case IDC_LOADCOUNT:
+ case IDC_LOADTIME:
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ break;
+ case IDC_INDENTAMOUNT:
+ case IDC_LOADCOUNTN:
+ case IDC_LOADTIMEN:
+ case IDC_RIGHTINDENT:
+ case IDC_TRIM:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return TRUE;
+ break;
+ case IDC_MODIFY:
+ {
+ TemplateEditorNew teNew = {0, 0, hwndDlg};
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
}
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case IDC_LOGOPTIONS:
- if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
- TVHITTESTINFO hti;
- TVITEM item = {0};
-
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- hti.flags |= TVHT_ONITEMSTATEICON;
- item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
- } else
- item.hItem = (HTREEITEM)hti.hItem;
- SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
- item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
- SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- } else if (hti.flags & TVHT_ONITEMSTATEICON) {
+ case IDC_RTLMODIFY:
+ {
+ TemplateEditorNew teNew = {0, TRUE, hwndDlg};
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
+ }
+ break;
+ case IDC_MSGLOGDIDSPLAY:
+ SendMessage(hwndDlg, WM_USER + 100, 0, 0);
+ break;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
- item.state = INDEXTOSTATEIMAGEMASK(1);
- SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case IDC_LOGOPTIONS:
+ if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
+ TVHITTESTINFO hti;
+ TVITEM item = {0};
+
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ hti.flags |= TVHT_ONITEMSTATEICON;
+ item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
+ } else
+ item.hItem = (HTREEITEM)hti.hItem;
+ SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
+ item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
+ SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
+ } else if (hti.flags & TVHT_ONITEMSTATEICON) {
+
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
+ item.state = INDEXTOSTATEIMAGEMASK(1);
+ SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
}
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- break;
- default:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- int i;
- TVITEM item = {0};
- LRESULT msglogmode = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
-
- dwFlags &= ~(MWF_LOG_ALL);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
- M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
- else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
- M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
- else
- M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
-
- M->WriteDword(SRMSGMOD_T, "IndentAmount", (DWORD) GetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, &translated, FALSE));
- M->WriteDword(SRMSGMOD_T, "RightIndent", (DWORD) GetDlgItemInt(hwndDlg, IDC_RIGHTINDENT, &translated, FALSE));
-
- M->WriteByte(SRMSGMOD_T, "default_ieview", 0);
- M->WriteByte(SRMSGMOD_T, "default_hpp", 0);
- switch(msglogmode) {
- case 0:
- break;
- case 1:
- if (have_ieview)
- M->WriteByte(SRMSGMOD_T, "default_ieview", 1);
- else
- M->WriteByte(SRMSGMOD_T, "default_hpp", 1);
- break;
- case 2:
- M->WriteByte(SRMSGMOD_T, "default_hpp", 1);
- break;
- }
+ }
+ }
+ break;
- /*
- * scan the tree view and obtain the options...
- */
-
- TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_LOG);
- for (i=0; lvItems[i].szName != NULL; i++) {
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.hItem = (HTREEITEM)lvItems[i].handle;
- item.stateMask = TVIS_STATEIMAGEMASK;
+ default:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ int i;
+ TVITEM item = {0};
+ LRESULT msglogmode = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
- SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (lvItems[i].uType == LOI_TYPE_FLAG)
- dwFlags |= (item.state >> 12) == 3/*2*/ ? lvItems[i].lParam : 0;
- else if (lvItems[i].uType == LOI_TYPE_SETTING)
- M->WriteByte(SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)((item.state >> 12) == 3/*2*/ ? 1 : 0)); // NOTE: state image masks changed
- }
+ dwFlags &= ~(MWF_LOG_ALL);
- M->WriteDword(SRMSGMOD_T, "mwflags", dwFlags);
- if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM))
- M->WriteDword(SRMSGMOD_T, "maxhist", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_GETPOS, 0, 0));
- else
- M->WriteDword(SRMSGMOD_T, "maxhist", 0);
- PluginConfig.reloadSettings();
- M->BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
- return TRUE;
- }
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
+ M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
+ else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
+ M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
+ else
+ M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
+ DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+
+ M->WriteDword(SRMSGMOD_T, "IndentAmount", (DWORD) GetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, &translated, FALSE));
+ M->WriteDword(SRMSGMOD_T, "RightIndent", (DWORD) GetDlgItemInt(hwndDlg, IDC_RIGHTINDENT, &translated, FALSE));
+
+ M->WriteByte(SRMSGMOD_T, "default_ieview", 0);
+ M->WriteByte(SRMSGMOD_T, "default_hpp", 0);
+ switch(msglogmode) {
+ case 0:
+ break;
+ case 1:
+ if (have_ieview)
+ M->WriteByte(SRMSGMOD_T, "default_ieview", 1);
+ else
+ M->WriteByte(SRMSGMOD_T, "default_hpp", 1);
+ break;
+ case 2:
+ M->WriteByte(SRMSGMOD_T, "default_hpp", 1);
break;
+ }
+
+ /*
+ * scan the tree view and obtain the options...
+ */
+
+ TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_LOG);
+ for (i=0; lvItems[i].szName != NULL; i++) {
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.hItem = (HTREEITEM)lvItems[i].handle;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+
+ SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (lvItems[i].uType == LOI_TYPE_FLAG)
+ dwFlags |= (item.state >> 12) == 3/*2*/ ? lvItems[i].lParam : 0;
+ else if (lvItems[i].uType == LOI_TYPE_SETTING)
+ M->WriteByte(SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)((item.state >> 12) == 3/*2*/ ? 1 : 0)); // NOTE: state image masks changed
+ }
+
+ M->WriteDword(SRMSGMOD_T, "mwflags", dwFlags);
+ if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM))
+ M->WriteDword(SRMSGMOD_T, "maxhist", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_GETPOS, 0, 0));
+ else
+ M->WriteDword(SRMSGMOD_T, "maxhist", 0);
+ PluginConfig.reloadSettings();
+ M->BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
+ return TRUE;
}
- break;
+ }
+ break;
}
return FALSE;
}
@@ -889,110 +895,109 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam static HANDLE hItemNew, hItemUnknown;
switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- CLCINFOITEM cii = { 0 };
- cii.cbSize = sizeof(cii);
- cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX;
- cii.pszText = TranslateT("** New contacts **");
- hItemNew = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii);
- cii.pszText = TranslateT("** Unknown contacts **");
- hItemUnknown = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii);
- }
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN));
- ResetCList(hwndDlg);
- RebuildList(hwndDlg, hItemNew, hItemUnknown);
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
+ CLCINFOITEM cii = { 0 };
+ cii.cbSize = sizeof(cii);
+ cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX;
+ cii.pszText = TranslateT("** New contacts **");
+ hItemNew = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii);
+ cii.pszText = TranslateT("** Unknown contacts **");
+ hItemUnknown = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii);
+ }
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN));
+ ResetCList(hwndDlg);
+ RebuildList(hwndDlg, hItemNew, hItemUnknown);
- CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING));
- CheckDlgButton(hwndDlg, IDC_TYPEFLASHWIN, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH));
+ CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING));
+ CheckDlgButton(hwndDlg, IDC_TYPEFLASHWIN, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH));
- CheckDlgButton(hwndDlg, IDC_TYPENOWIN, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1));
- CheckDlgButton(hwndDlg, IDC_TYPEWIN, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1));
- CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST));
- CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, M->GetByte(SRMSGMOD, "ShowTypingBalloon", 0));
+ CheckDlgButton(hwndDlg, IDC_TYPENOWIN, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1));
+ CheckDlgButton(hwndDlg, IDC_TYPEWIN, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1));
+ CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST));
+ CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, M->GetByte(SRMSGMOD, "ShowTypingBalloon", 0));
- CheckDlgButton(hwndDlg, IDC_NOTIFYPOPUP, M->GetByte(SRMSGMOD, "ShowTypingPopup", 0));
+ CheckDlgButton(hwndDlg, IDC_NOTIFYPOPUP, M->GetByte(SRMSGMOD, "ShowTypingPopup", 0));
- Utils::enableDlgControl(hwndDlg, IDC_TYPEWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- Utils::enableDlgControl(hwndDlg, IDC_TYPENOWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) &&
- (IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN) || IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN)));
+ Utils::enableDlgControl(hwndDlg, IDC_TYPEWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ Utils::enableDlgControl(hwndDlg, IDC_TYPENOWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) &&
+ (IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN) || IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN)));
- Utils::enableDlgControl(hwndDlg, IDC_TYPEFLASHWIN, IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
- Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
+ Utils::enableDlgControl(hwndDlg, IDC_TYPEFLASHWIN, IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
+ Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
- if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
- Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, FALSE);
- SetWindowText(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TranslateT("Show balloon popup (unsupported system)"));
- }
+ if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
+ Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, FALSE);
+ SetWindowText(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TranslateT("Show balloon popup (unsupported system)"));
+ }
- SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always"));
- SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always, but no popup when window is focused"));
- SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Only when no message window is open"));
+ SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always"));
+ SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always, but no popup when window is focused"));
+ SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Only when no message window is open"));
- SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_SETCURSEL, (WPARAM)M->GetByte("MTN_PopupMode", 0), 0);
+ SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_SETCURSEL, (WPARAM)M->GetByte("MTN_PopupMode", 0), 0);
- 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);
- }
+ 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);
+ }
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_NOTIFYTRAY:
+ Utils::enableDlgControl(hwndDlg, IDC_TYPEWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ Utils::enableDlgControl(hwndDlg, IDC_TYPENOWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_NOTIFYTRAY:
- Utils::enableDlgControl(hwndDlg, IDC_TYPEWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- Utils::enableDlgControl(hwndDlg, IDC_TYPENOWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- break;
- case IDC_SHOWNOTIFY:
- Utils::enableDlgControl(hwndDlg, IDC_TYPEFLASHWIN, IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
- break;
- case IDC_NOTIFYPOPUP:
- Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
- break;
- case IDC_TYPEWIN:
- case IDC_TYPENOWIN:
- Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) &&
- (IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN) || IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN)));
- break;
- case IDC_MTN_HELP:
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/TypingNotifications");
- return 0;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_SHOWNOTIFY:
+ Utils::enableDlgControl(hwndDlg, IDC_TYPEFLASHWIN, IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
break;
- case WM_NOTIFY:
- switch (((NMHDR *) lParam)->idFrom) {
- case IDC_CLIST:
- switch (((NMHDR *) lParam)->code) {
- case CLN_OPTIONSCHANGED:
- ResetCList(hwndDlg);
- break;
- case CLN_CHECKCHANGED:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- SaveList(hwndDlg, hItemNew, hItemUnknown);
- M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
- M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEFLASHWIN));
- M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN));
- M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
- M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- M->WriteByte(SRMSGMOD, "ShowTypingBalloon", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYBALLOON));
- M->WriteByte(SRMSGMOD, "ShowTypingPopup",(BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
- M->WriteByte(SRMSGMOD_T, "MTN_PopupMode", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_GETCURSEL, 0, 0));
- PluginConfig.reloadSettings();
- }
- }
- break;
+ case IDC_NOTIFYPOPUP:
+ Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
+ break;
+ case IDC_TYPEWIN:
+ case IDC_TYPENOWIN:
+ Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) &&
+ (IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN) || IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN)));
+ break;
+ case IDC_MTN_HELP:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/TypingNotifications");
+ return 0;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ switch (((NMHDR *) lParam)->idFrom) {
+ case IDC_CLIST:
+ switch (((NMHDR *) lParam)->code) {
+ case CLN_OPTIONSCHANGED:
+ ResetCList(hwndDlg);
+ break;
+ case CLN_CHECKCHANGED:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
}
break;
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ SaveList(hwndDlg, hItemNew, hItemUnknown);
+ M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
+ M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEFLASHWIN));
+ M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN));
+ M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
+ M->WriteByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ M->WriteByte(SRMSGMOD, "ShowTypingBalloon", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYBALLOON));
+ M->WriteByte(SRMSGMOD, "ShowTypingPopup",(BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
+ M->WriteByte(SRMSGMOD_T, "MTN_PopupMode", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_GETCURSEL, 0, 0));
+ PluginConfig.reloadSettings();
+ }
+ }
}
return FALSE;
}
@@ -1148,92 +1153,87 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG: {
- DBVARIANT dbv = {0};
-
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_CONTAINERGROUPMODE, M->GetByte("useclistgroups", 0));
- CheckDlgButton(hwndDlg, IDC_LIMITTABS, M->GetByte("limittabs", 0));
-
- SendDlgItemMessage(hwndDlg, IDC_TABLIMITSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 1));
- SendDlgItemMessage(hwndDlg, IDC_TABLIMITSPIN, UDM_SETPOS, 0, (int)M->GetDword("maxtabs", 1));
- SetDlgItemInt(hwndDlg, IDC_TABLIMIT, (int)M->GetDword("maxtabs", 1), FALSE);
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_CONTAINERGROUPMODE, M->GetByte("useclistgroups", 0));
+ CheckDlgButton(hwndDlg, IDC_LIMITTABS, M->GetByte("limittabs", 0));
+
+ SendDlgItemMessage(hwndDlg, IDC_TABLIMITSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 1));
+ SendDlgItemMessage(hwndDlg, IDC_TABLIMITSPIN, UDM_SETPOS, 0, (int)M->GetDword("maxtabs", 1));
+ SetDlgItemInt(hwndDlg, IDC_TABLIMIT, (int)M->GetDword("maxtabs", 1), FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TABLIMIT, IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
+ CheckDlgButton(hwndDlg, IDC_SINGLEWINDOWMODE, M->GetByte("singlewinmode", 0));
+ CheckDlgButton(hwndDlg, IDC_DEFAULTCONTAINERMODE, !(IsDlgButtonChecked(hwndDlg, IDC_CONTAINERGROUPMODE) || IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS) || IsDlgButtonChecked(hwndDlg, IDC_SINGLEWINDOWMODE)));
+
+ SetDlgItemInt(hwndDlg, IDC_NRFLASH, M->GetByte("nrflash", 4), FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_NRFLASHSPIN, UDM_SETRANGE, 0, MAKELONG(255, 1));
+ SendDlgItemMessage(hwndDlg, IDC_NRFLASHSPIN, UDM_SETPOS, 0, (int)M->GetByte("nrflash", 4));
+
+ SetDlgItemInt(hwndDlg, IDC_FLASHINTERVAL, M->GetDword("flashinterval", 1000), FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETRANGE, 0, MAKELONG(10000, 500));
+ SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETPOS, 0, (int)M->GetDword("flashinterval", 1000));
+ SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETACCEL, 0, (int)M->GetDword("flashinterval", 1000));
+ CheckDlgButton(hwndDlg, IDC_USEAERO, M->GetByte("useAero", 1));
+ CheckDlgButton(hwndDlg, IDC_USEAEROPEEK, M->GetByte("useAeroPeek", 1));
+ for (int i = 0; i < CSkin::AERO_EFFECT_LAST; i++)
+ SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(CSkin::m_aeroEffects[i].tszName));
+
+ SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_SETCURSEL, (WPARAM)CSkin::m_aeroEffect, 0);
+ Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, PluginConfig.m_bIsVista ? TRUE : FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_USEAERO, PluginConfig.m_bIsVista ? TRUE : FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_USEAEROPEEK, PluginConfig.m_bIsWin7 ? TRUE : FALSE);
+ if (PluginConfig.m_bIsVista)
+ Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_TABLIMIT:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return TRUE;
+ break;
+ case IDC_USEAERO:
+ Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0);
+ break;
+ case IDC_LIMITTABS:
+ case IDC_SINGLEWINDOWMODE:
+ case IDC_CONTAINERGROUPMODE:
+ case IDC_DEFAULTCONTAINERMODE:
Utils::enableDlgControl(hwndDlg, IDC_TABLIMIT, IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
- CheckDlgButton(hwndDlg, IDC_SINGLEWINDOWMODE, M->GetByte("singlewinmode", 0));
- CheckDlgButton(hwndDlg, IDC_DEFAULTCONTAINERMODE, !(IsDlgButtonChecked(hwndDlg, IDC_CONTAINERGROUPMODE) || IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS) || IsDlgButtonChecked(hwndDlg, IDC_SINGLEWINDOWMODE)));
-
- SetDlgItemInt(hwndDlg, IDC_NRFLASH, M->GetByte("nrflash", 4), FALSE);
- SendDlgItemMessage(hwndDlg, IDC_NRFLASHSPIN, UDM_SETRANGE, 0, MAKELONG(255, 1));
- SendDlgItemMessage(hwndDlg, IDC_NRFLASHSPIN, UDM_SETPOS, 0, (int)M->GetByte("nrflash", 4));
-
- SetDlgItemInt(hwndDlg, IDC_FLASHINTERVAL, M->GetDword("flashinterval", 1000), FALSE);
- SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETRANGE, 0, MAKELONG(10000, 500));
- SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETPOS, 0, (int)M->GetDword("flashinterval", 1000));
- SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETACCEL, 0, (int)M->GetDword("flashinterval", 1000));
- CheckDlgButton(hwndDlg, IDC_USEAERO, M->GetByte("useAero", 1));
- CheckDlgButton(hwndDlg, IDC_USEAEROPEEK, M->GetByte("useAeroPeek", 1));
- for (int i = 0; i < CSkin::AERO_EFFECT_LAST; i++)
- SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(CSkin::m_aeroEffects[i].tszName));
-
- SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_SETCURSEL, (WPARAM)CSkin::m_aeroEffect, 0);
- Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, PluginConfig.m_bIsVista ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_USEAERO, PluginConfig.m_bIsVista ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_USEAEROPEEK, PluginConfig.m_bIsWin7 ? TRUE : FALSE);
- if (PluginConfig.m_bIsVista)
- Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0);
-
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TABLIMIT:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
- case IDC_USEAERO:
- Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0);
- break;
- case IDC_LIMITTABS:
- case IDC_SINGLEWINDOWMODE:
- case IDC_CONTAINERGROUPMODE:
- case IDC_DEFAULTCONTAINERMODE:
- Utils::enableDlgControl(hwndDlg, IDC_TABLIMIT, IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
- break;
- case IDC_HELP_CONTAINERS:
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Containers");
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- BOOL translated;
+ case IDC_HELP_CONTAINERS:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Containers");
+ break;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- bool fOldAeroState = M->getAeroState();
- M->WriteByte(SRMSGMOD_T, "useclistgroups", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CONTAINERGROUPMODE)));
- M->WriteByte(SRMSGMOD_T, "limittabs", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS)));
- M->WriteDword(SRMSGMOD_T, "maxtabs", GetDlgItemInt(hwndDlg, IDC_TABLIMIT, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, "singlewinmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SINGLEWINDOWMODE)));
- M->WriteDword(SRMSGMOD_T, "flashinterval", GetDlgItemInt(hwndDlg, IDC_FLASHINTERVAL, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, "nrflash", (BYTE)(GetDlgItemInt(hwndDlg, IDC_NRFLASH, &translated, FALSE)));
- M->WriteByte(0, SRMSGMOD_T, "useAero", IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0);
- M->WriteByte(0, SRMSGMOD_T, "useAeroPeek", IsDlgButtonChecked(hwndDlg, IDC_USEAEROPEEK) ? 1 : 0);
- CSkin::setAeroEffect(SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_GETCURSEL, 0, 0));
-
- if (M->getAeroState() != fOldAeroState) {
- SendMessage(PluginConfig.g_hwndHotkeyHandler, WM_DWMCOMPOSITIONCHANGED, 0, 0); // simulate aero state change
- SendMessage(PluginConfig.g_hwndHotkeyHandler, WM_DWMCOLORIZATIONCOLORCHANGED, 0, 0); // simulate aero state change
- }
- BuildContainerMenu();
- return TRUE;
- }
- }
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ BOOL translated;
+ bool fOldAeroState = M->getAeroState();
+ M->WriteByte(SRMSGMOD_T, "useclistgroups", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CONTAINERGROUPMODE)));
+ M->WriteByte(SRMSGMOD_T, "limittabs", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS)));
+ M->WriteDword(SRMSGMOD_T, "maxtabs", GetDlgItemInt(hwndDlg, IDC_TABLIMIT, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, "singlewinmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SINGLEWINDOWMODE)));
+ M->WriteDword(SRMSGMOD_T, "flashinterval", GetDlgItemInt(hwndDlg, IDC_FLASHINTERVAL, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, "nrflash", (BYTE)(GetDlgItemInt(hwndDlg, IDC_NRFLASH, &translated, FALSE)));
+ M->WriteByte(0, SRMSGMOD_T, "useAero", IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0);
+ M->WriteByte(0, SRMSGMOD_T, "useAeroPeek", IsDlgButtonChecked(hwndDlg, IDC_USEAEROPEEK) ? 1 : 0);
+ CSkin::setAeroEffect(SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_GETCURSEL, 0, 0));
+
+ if (M->getAeroState() != fOldAeroState) {
+ SendMessage(PluginConfig.g_hwndHotkeyHandler, WM_DWMCOMPOSITIONCHANGED, 0, 0); // simulate aero state change
+ SendMessage(PluginConfig.g_hwndHotkeyHandler, WM_DWMCOLORIZATIONCOLORCHANGED, 0, 0); // simulate aero state change
+ }
+ BuildContainerMenu();
+ return TRUE;
}
- break;
+ }
+ break;
}
return FALSE;
}
@@ -1393,11 +1393,9 @@ struct OptCheckBox DWORD OptCheckBox_LoadValue(struct OptCheckBox *cb)
{
- switch (cb->valueType)
- {
+ switch (cb->valueType) {
case CBVT_NONE:
- switch (cb->dbType)
- {
+ switch (cb->dbType) {
case DBVT_BYTE:
return M->GetByte(cb->dbModule, cb->dbSetting, cb->defValue);
case DBVT_WORD:
@@ -1433,14 +1431,12 @@ void OptCheckBox_Save(HWND hwnd, struct OptCheckBox *cb) {
DWORD value = IsDlgButtonChecked(hwnd, cb->idc) == BST_CHECKED;
- if (cb->dwBit)
- {
+ if (cb->dwBit) {
DWORD curValue = OptCheckBox_LoadValue(cb);
value = value ? (curValue | cb->dwBit) : (curValue & ~cb->dwBit);
}
- switch (cb->dbType)
- {
+ switch (cb->dbType) {
case DBVT_BYTE:
M->WriteByte(cb->dbModule, cb->dbSetting, (BYTE)value);
break;
@@ -1452,8 +1448,7 @@ void OptCheckBox_Save(HWND hwnd, struct OptCheckBox *cb) break;
}
- switch (cb->valueType)
- {
+ switch (cb->valueType) {
case CBVT_CHAR:
*cb->charValue = (char)value;
break;
@@ -1494,38 +1489,35 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR static BOOL bInit = TRUE;
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- int i = 0;
DWORD maxhist = M->GetDword("maxhist", 0);
bInit = TRUE;
- TranslateDialogDefault(hwndDlg);
-
- for (i=0; i < SIZEOF(opts); ++i)
+ for (int i=0; i < SIZEOF(opts); ++i)
OptCheckBox_Load(hwndDlg, opts+i);
// Always on!
CheckDlgButton(hwndDlg, IDC_SENDCTRLENTER, BST_CHECKED);
switch (M->GetByte(SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
- case LOADHISTORY_UNREAD:
- CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
- break;
- case LOADHISTORY_COUNT:
- CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, TRUE);
- break;
- case LOADHISTORY_TIME:
- CheckDlgButton(hwndDlg, IDC_LOADTIME, BST_CHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, TRUE);
- break;
+ case LOADHISTORY_UNREAD:
+ CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
+ break;
+ case LOADHISTORY_COUNT:
+ CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, TRUE);
+ break;
+ case LOADHISTORY_TIME:
+ CheckDlgButton(hwndDlg, IDC_LOADTIME, BST_CHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, TRUE);
+ break;
}
SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
@@ -1539,104 +1531,91 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR Utils::enableDlgControl(hwndDlg, IDC_TRIM, maxhist != 0);
CheckDlgButton(hwndDlg, IDC_ALWAYSTRIM, maxhist != 0);
- {
- BOOL bTabOptGroups = M->GetByte("useclistgroups", 0);
- BOOL bTabOptLimit = M->GetByte("limittabs", 0);
- BOOL bTabOptSingle = M->GetByte("singlewinmode", 0);
-
- if (bTabOptSingle && !bTabOptGroups && !bTabOptLimit)
- CheckDlgButton(hwndDlg, IDC_USETABS, BST_UNCHECKED);
- else if (!bTabOptSingle && !bTabOptGroups && !bTabOptLimit)
- CheckDlgButton(hwndDlg, IDC_USETABS, BST_CHECKED);
- else
- {
- LONG s = (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_USETABS), GWL_STYLE) & ~BS_TYPEMASK) | BS_AUTO3STATE;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_USETABS), GWL_STYLE, s);
- CheckDlgButton(hwndDlg, IDC_USETABS, BST_INDETERMINATE);
- }
- }
+ BOOL bTabOptGroups = M->GetByte("useclistgroups", 0);
+ BOOL bTabOptLimit = M->GetByte("limittabs", 0);
+ BOOL bTabOptSingle = M->GetByte("singlewinmode", 0);
- bInit = FALSE;
- return TRUE;
+ if (bTabOptSingle && !bTabOptGroups && !bTabOptLimit)
+ CheckDlgButton(hwndDlg, IDC_USETABS, BST_UNCHECKED);
+ else if (!bTabOptSingle && !bTabOptGroups && !bTabOptLimit)
+ CheckDlgButton(hwndDlg, IDC_USETABS, BST_CHECKED);
+ else {
+ LONG s = (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_USETABS), GWL_STYLE) & ~BS_TYPEMASK) | BS_AUTO3STATE;
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_USETABS), GWL_STYLE, s);
+ CheckDlgButton(hwndDlg, IDC_USETABS, BST_INDETERMINATE);
+ }
}
+ bInit = FALSE;
+ return TRUE;
- case WM_DESTROY:
- bInit = TRUE;
- break;
+ case WM_DESTROY:
+ bInit = TRUE;
+ break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_LOADUNREAD:
- case IDC_LOADCOUNT:
- case IDC_LOADTIME:
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
- Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- break;
- case IDC_ALWAYSTRIM:
- Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
- Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
- break;
- case IDC_TRIM:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
- }
- if (!bInit)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_LOADUNREAD:
+ case IDC_LOADCOUNT:
+ case IDC_LOADTIME:
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
+ Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ break;
+ case IDC_ALWAYSTRIM:
+ Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
+ Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
+ break;
+ case IDC_TRIM:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return TRUE;
break;
+ }
+ if (!bInit)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case WM_NOTIFY:
- {
- switch (((LPNMHDR) lParam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR) lParam)->code)
- {
- case PSN_APPLY:
- {
- int i;
- for (i=0; i < SIZEOF(opts); ++i)
- OptCheckBox_Save(hwndDlg, opts+i);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
- M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
- else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
- M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
- else
- M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
-
- if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM))
- M->WriteDword(SRMSGMOD_T, "maxhist", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_GETPOS, 0, 0));
- else
- M->WriteDword(SRMSGMOD_T, "maxhist", 0);
-
- switch (IsDlgButtonChecked(hwndDlg, IDC_USETABS))
- {
- case BST_UNCHECKED:
- M->WriteByte(SRMSGMOD_T, "useclistgroups", 0);
- M->WriteByte(SRMSGMOD_T, "limittabs", 0);
- M->WriteByte(SRMSGMOD_T, "singlewinmode", 1);
- break;
- case BST_CHECKED:
- M->WriteByte(SRMSGMOD_T, "useclistgroups", 0);
- M->WriteByte(SRMSGMOD_T, "limittabs", 0);
- M->WriteByte(SRMSGMOD_T, "singlewinmode", 0);
- break;
- }
- PluginConfig.reloadSettings();
- M->BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
- return TRUE;
- }
- }
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ for (int i=0; i < SIZEOF(opts); ++i)
+ OptCheckBox_Save(hwndDlg, opts+i);
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
+ M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
+ else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
+ M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
+ else
+ M->WriteByte(SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
+ DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ DBWriteContactSettingWord(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM))
+ M->WriteDword(SRMSGMOD_T, "maxhist", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_GETPOS, 0, 0));
+ else
+ M->WriteDword(SRMSGMOD_T, "maxhist", 0);
+
+ switch (IsDlgButtonChecked(hwndDlg, IDC_USETABS)) {
+ case BST_UNCHECKED:
+ M->WriteByte(SRMSGMOD_T, "useclistgroups", 0);
+ M->WriteByte(SRMSGMOD_T, "limittabs", 0);
+ M->WriteByte(SRMSGMOD_T, "singlewinmode", 1);
+ break;
+ case BST_CHECKED:
+ M->WriteByte(SRMSGMOD_T, "useclistgroups", 0);
+ M->WriteByte(SRMSGMOD_T, "limittabs", 0);
+ M->WriteByte(SRMSGMOD_T, "singlewinmode", 0);
break;
+ }
+ PluginConfig.reloadSettings();
+ M->BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
+ return TRUE;
}
- break;
}
+ break;
}
return FALSE;
@@ -1685,64 +1664,57 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, static HWND hwndParent = 0;
switch (msg) {
- case WM_INITDIALOG: {
- int i;
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ dwStatusMask = lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- dwStatusMask = lParam;
-
- SetWindowText(hwndDlg, TranslateT("Choose status modes"));
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ SetWindowText(hwndDlg, TranslateT("Choose status modes"));
+ {
+ for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
SetWindowText(GetDlgItem(hwndDlg, i), (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, GSMDF_TCHAR));
if (dwStatusMask != -1 && (dwStatusMask & (1 << (i - ID_STATUS_ONLINE))))
CheckDlgButton(hwndDlg, i, TRUE);
Utils::enableDlgControl(hwndDlg, i, dwStatusMask != -1);
}
- if (dwStatusMask == -1)
- CheckDlgButton(hwndDlg, IDC_ALWAYS, TRUE);
- ShowWindow(hwndDlg, SW_SHOWNORMAL);
- return TRUE;
}
- case DM_SETPARENTDIALOG:
- hwndParent = (HWND)lParam;
- break;
- case DM_GETSTATUSMASK: {
- if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYS))
- dwNewStatusMask = -1;
- else {
- int i;
- dwNewStatusMask = 0;
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- dwNewStatusMask |= (IsDlgButtonChecked(hwndDlg, i) ? (1 << (i - ID_STATUS_ONLINE)) : 0);
- }
- break;
+ if (dwStatusMask == -1)
+ CheckDlgButton(hwndDlg, IDC_ALWAYS, TRUE);
+ ShowWindow(hwndDlg, SW_SHOWNORMAL);
+ return TRUE;
+
+ case DM_SETPARENTDIALOG:
+ hwndParent = (HWND)lParam;
+ break;
+ case DM_GETSTATUSMASK:
+ if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYS))
+ dwNewStatusMask = -1;
+ else {
+ dwNewStatusMask = 0;
+ for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ dwNewStatusMask |= (IsDlgButtonChecked(hwndDlg, i) ? (1 << (i - ID_STATUS_ONLINE)) : 0);
}
- case WM_COMMAND: {
- switch (LOWORD(wParam)) {
- case IDOK:
- case IDCANCEL:
- if (LOWORD(wParam) == IDOK) {
- SendMessage(hwndDlg, DM_GETSTATUSMASK, 0, 0);
- SendMessage(hwndParent, DM_STATUSMASKSET, 0, (LPARAM)dwNewStatusMask);
- }
- DestroyWindow(hwndDlg);
- break;
- case IDC_ALWAYS: {
- int i;
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- Utils::enableDlgControl(hwndDlg, i, !IsDlgButtonChecked(hwndDlg, IDC_ALWAYS));
- break;
- }
- default:
- break;
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ if (LOWORD(wParam) == IDOK) {
+ SendMessage(hwndDlg, DM_GETSTATUSMASK, 0, 0);
+ SendMessage(hwndParent, DM_STATUSMASKSET, 0, (LPARAM)dwNewStatusMask);
}
- }
- case WM_DESTROY:
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ DestroyWindow(hwndDlg);
break;
- default:
+ case IDC_ALWAYS:
+ for (int i=ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ Utils::enableDlgControl(hwndDlg, i, !IsDlgButtonChecked(hwndDlg, IDC_ALWAYS));
break;
+ }
+
+ case WM_DESTROY:
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
}
return FALSE;
}
diff --git a/plugins/TabSRMM/src/msgoptions_plus.cpp b/plugins/TabSRMM/src/msgoptions_plus.cpp index 9ebb60fea0..bd6e613c51 100644 --- a/plugins/TabSRMM/src/msgoptions_plus.cpp +++ b/plugins/TabSRMM/src/msgoptions_plus.cpp @@ -122,34 +122,28 @@ INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar default:
switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- TVITEM item = {0};
- DWORD msgTimeout;
- /*
- * scan the tree view and obtain the options...
- */
- TOptionListItem* lvItems = CTranslator::getTree(CTranslator::TREE_MODPLUS);
-
- for (int i=0; lvItems[i].szName != NULL; i++) {
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.hItem = (HTREEITEM)lvItems[i].handle;
- item.stateMask = TVIS_STATEIMAGEMASK;
-
- SendDlgItemMessageA(hwndDlg, IDC_PLUS_CHECKTREE, TVM_GETITEMA, 0, (LPARAM)&item);
- if (lvItems[i].uType == LOI_TYPE_SETTING)
- M->WriteByte(SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)((item.state >> 12) == 3/*2*/ ? 1 : 0)); // NOTE: state image masks changed
- }
+ case PSN_APPLY:
+ TOptionListItem* lvItems = CTranslator::getTree(CTranslator::TREE_MODPLUS);
- msgTimeout = 1000 * GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, FALSE);
- PluginConfig.m_MsgTimeout = msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout : SRMSGSET_MSGTIMEOUT_MIN;
- M->WriteDword(SRMSGMOD, SRMSGSET_MSGTIMEOUT, PluginConfig.m_MsgTimeout);
+ for (int i=0; lvItems[i].szName != NULL; i++) {
+ TVITEM item = {0};
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.hItem = (HTREEITEM)lvItems[i].handle;
+ item.stateMask = TVIS_STATEIMAGEMASK;
- M->WriteByte(SRMSGMOD_T, "historysize", (BYTE)SendDlgItemMessage(hwndDlg, IDC_HISTORYSIZESPIN, UDM_GETPOS, 0, 0));
- PluginConfig.reloadAdv();
- return TRUE;
+ SendDlgItemMessageA(hwndDlg, IDC_PLUS_CHECKTREE, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (lvItems[i].uType == LOI_TYPE_SETTING)
+ M->WriteByte(SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)((item.state >> 12) == 3/*2*/ ? 1 : 0)); // NOTE: state image masks changed
}
+
+ int msgTimeout = 1000 * GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, FALSE);
+ PluginConfig.m_MsgTimeout = msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout : SRMSGSET_MSGTIMEOUT_MIN;
+ M->WriteDword(SRMSGMOD, SRMSGSET_MSGTIMEOUT, PluginConfig.m_MsgTimeout);
+
+ M->WriteByte(SRMSGMOD_T, "historysize", (BYTE)SendDlgItemMessage(hwndDlg, IDC_HISTORYSIZESPIN, UDM_GETPOS, 0, 0));
+ PluginConfig.reloadAdv();
+ return TRUE;
}
- break;
}
break;
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 709198ef4f..500b8c22e9 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -31,6 +31,8 @@ #include "commonheaders.h"
+CSendLater *sendLater = 0;
+
#define U_PREF_UNICODE PREF_UNICODE
/*
* implementation of the CSendLaterJob class
@@ -73,7 +75,7 @@ void CSendLaterJob::cleanDB() if (isPersistentJob()) {
char szKey[100];
- DBDeleteContactSetting(hContact, "SendLater", szId);
+ db_unset(hContact, "SendLater", szId);
int iCount = M->GetDword(hContact, "SendLater", "count", 0);
if (iCount)
iCount--;
@@ -82,7 +84,7 @@ void CSendLaterJob::cleanDB() * delete flags
*/
mir_snprintf(szKey, 100, "$%s", szId);
- DBDeleteContactSetting(hContact, "SendLater", szKey);
+ db_unset(hContact, "SendLater", szKey);
}
}
@@ -650,18 +652,18 @@ void CSendLater::qMgrFillList(bool fClear) tszStatusText = TranslateT("Sent OK");
else {
switch((*it)->bCode) {
- case CSendLaterJob::JOB_DEFERRED:
- tszStatusText = TranslateT("Deferred");
- break;
- case CSendLaterJob::JOB_AGE:
- tszStatusText = TranslateT("Failed");
- break;
- case CSendLaterJob::JOB_HOLD:
- tszStatusText = TranslateT("Suspended");
- break;
- default:
- tszStatusText = TranslateT("Pending");
- break;
+ case CSendLaterJob::JOB_DEFERRED:
+ tszStatusText = TranslateT("Deferred");
+ break;
+ case CSendLaterJob::JOB_AGE:
+ tszStatusText = TranslateT("Failed");
+ break;
+ case CSendLaterJob::JOB_HOLD:
+ tszStatusText = TranslateT("Suspended");
+ break;
+ default:
+ tszStatusText = TranslateT("Pending");
+ break;
}
}
if ((*it)->bCode)
@@ -761,202 +763,180 @@ void CSendLater::qMgrSaveColumns() INT_PTR CALLBACK CSendLater::DlgProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CSendLater *s = reinterpret_cast<CSendLater *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
-
if (s)
- return(s->DlgProc(hwnd, msg, wParam, lParam));
+ return s->DlgProc(hwnd, msg, wParam, lParam);
- switch(msg) {
- case WM_INITDIALOG: {
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
- s = reinterpret_cast<CSendLater *>(lParam);
- return(s->DlgProc(hwnd, msg, wParam, lParam));
- }
- default:
- break;
+ if (msg == WM_INITDIALOG) {
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
+ s = reinterpret_cast<CSendLater *>(lParam);
+ return s->DlgProc(hwnd, msg, wParam, lParam);
}
- return(FALSE);
+ return FALSE;
}
INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG:
- m_hwndDlg = hwnd;
- TranslateDialogDefault(hwnd);
- m_hwndList = ::GetDlgItem(m_hwndDlg, IDC_QMGR_LIST);
- m_hwndFilter = ::GetDlgItem(m_hwndDlg, IDC_QMGR_FILTER);
- m_hFilter = reinterpret_cast<HANDLE>(M->GetDword(0, SRMSGMOD_T, "qmgrFilterContact", 0));
-
- ::SetWindowLongPtr(m_hwndList, GWL_STYLE, ::GetWindowLongPtr(m_hwndList, GWL_STYLE) | LVS_SHOWSELALWAYS);
- ::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_LABELTIP|LVS_EX_DOUBLEBUFFER);
- qMgrSetupColumns();
- qMgrFillList();
- if (PluginConfig.g_PopupAvail) {
- ::CheckDlgButton(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, m_fSuccessPopups ? BST_CHECKED : BST_UNCHECKED);
- ::CheckDlgButton(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, m_fErrorPopups ? BST_CHECKED : BST_UNCHECKED);
- }
- else {
- Utils::showDlgControl(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, SW_HIDE);
- Utils::showDlgControl(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, SW_HIDE);
- }
- ::ShowWindow(hwnd, SW_NORMAL);
- return(FALSE);
-
- case WM_NOTIFY: {
- NMHDR* pNMHDR = reinterpret_cast<NMHDR *>(lParam);
-
- if (pNMHDR->hwndFrom == m_hwndList) {
- switch(pNMHDR->code) {
- case NM_RCLICK: {
- HMENU hMenu = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT));
- HMENU hSubMenu = ::GetSubMenu(hMenu, 13);
- ::TranslateMenu(hSubMenu);
-
- POINT pt;
- ::GetCursorPos(&pt);
- /*
- * copy to clipboard only allowed with a single selection
- */
- if (::SendMessage(m_hwndList, LVM_GETSELECTEDCOUNT, 0, 0) == 1)
- ::EnableMenuItem(hSubMenu, ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD, MF_ENABLED);
-
- m_fIsInteractive = true;
- int selection = ::TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwndDlg, NULL);
- if (selection == ID_QUEUEMANAGER_CANCELALLMULTISENDJOBS) {
- SendLaterJobIterator it = m_sendLaterJobList.begin();
- while(it != m_sendLaterJobList.end()) {
- if ((*it)->szId[0] == 'M') {
- (*it)->fFailed = true;
- (*it)->bCode = CSendLaterJob::JOB_REMOVABLE;
- }
- it++;
- }
- }
- else if (selection != 0) {
- ::SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_QMGR_REMOVE, LOWORD(selection)), 0);
- m_last_sendlater_processed = 0; // force a queue check
+ case WM_INITDIALOG:
+ m_hwndDlg = hwnd;
+ TranslateDialogDefault(hwnd);
+ m_hwndList = ::GetDlgItem(m_hwndDlg, IDC_QMGR_LIST);
+ m_hwndFilter = ::GetDlgItem(m_hwndDlg, IDC_QMGR_FILTER);
+ m_hFilter = reinterpret_cast<HANDLE>(M->GetDword(0, SRMSGMOD_T, "qmgrFilterContact", 0));
+
+ ::SetWindowLongPtr(m_hwndList, GWL_STYLE, ::GetWindowLongPtr(m_hwndList, GWL_STYLE) | LVS_SHOWSELALWAYS);
+ ::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_LABELTIP|LVS_EX_DOUBLEBUFFER);
+ qMgrSetupColumns();
+ qMgrFillList();
+ if (PluginConfig.g_PopupAvail) {
+ ::CheckDlgButton(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, m_fSuccessPopups ? BST_CHECKED : BST_UNCHECKED);
+ ::CheckDlgButton(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, m_fErrorPopups ? BST_CHECKED : BST_UNCHECKED);
+ }
+ else {
+ Utils::showDlgControl(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, SW_HIDE);
+ Utils::showDlgControl(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, SW_HIDE);
+ }
+ ::ShowWindow(hwnd, SW_NORMAL);
+ return(FALSE);
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->hwndFrom == m_hwndList) {
+ switch(((LPNMHDR)lParam)->code) {
+ case NM_RCLICK:
+ HMENU hMenu = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT));
+ HMENU hSubMenu = ::GetSubMenu(hMenu, 13);
+ ::TranslateMenu(hSubMenu);
+
+ POINT pt;
+ ::GetCursorPos(&pt);
+ /*
+ * copy to clipboard only allowed with a single selection
+ */
+ if (::SendMessage(m_hwndList, LVM_GETSELECTEDCOUNT, 0, 0) == 1)
+ ::EnableMenuItem(hSubMenu, ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD, MF_ENABLED);
+
+ m_fIsInteractive = true;
+ int selection = ::TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwndDlg, NULL);
+ if (selection == ID_QUEUEMANAGER_CANCELALLMULTISENDJOBS) {
+ SendLaterJobIterator it = m_sendLaterJobList.begin();
+ while(it != m_sendLaterJobList.end()) {
+ if ((*it)->szId[0] == 'M') {
+ (*it)->fFailed = true;
+ (*it)->bCode = CSendLaterJob::JOB_REMOVABLE;
}
- ::DestroyMenu(hMenu);
- m_fIsInteractive = false;
- break;
+ it++;
}
- default:
- break;
}
- }
- break;
- }
-
- case WM_COMMAND:
- if (HIWORD(wParam) == CBN_SELCHANGE && reinterpret_cast<HWND>(lParam) == m_hwndFilter) {
- LRESULT lr = ::SendMessage(m_hwndFilter, CB_GETCURSEL, 0, 0);
- if (lr != CB_ERR) {
- m_hFilter = reinterpret_cast<HANDLE>(::SendMessage(m_hwndFilter, CB_GETITEMDATA, lr, 0));
- qMgrFillList();
+ else if (selection != 0) {
+ ::SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_QMGR_REMOVE, LOWORD(selection)), 0);
+ m_last_sendlater_processed = 0; // force a queue check
}
+ ::DestroyMenu(hMenu);
+ m_fIsInteractive = false;
break;
}
- switch(LOWORD(wParam)) {
- case IDOK:
- case IDCANCEL:
- qMgrSaveColumns();
- ::DestroyWindow(hwnd);
- break;
+ }
+ break;
+
+ case WM_COMMAND:
+ if (HIWORD(wParam) == CBN_SELCHANGE && reinterpret_cast<HWND>(lParam) == m_hwndFilter) {
+ LRESULT lr = ::SendMessage(m_hwndFilter, CB_GETCURSEL, 0, 0);
+ if (lr != CB_ERR) {
+ m_hFilter = reinterpret_cast<HANDLE>(::SendMessage(m_hwndFilter, CB_GETITEMDATA, lr, 0));
+ qMgrFillList();
+ }
+ break;
+ }
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ qMgrSaveColumns();
+ ::DestroyWindow(hwnd);
+ break;
- case IDC_QMGR_SUCCESSPOPUPS:
- m_fSuccessPopups = ::IsDlgButtonChecked(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS) ? true : false;
- M->WriteByte(0, SRMSGMOD_T, "qmgrSuccessPopups", m_fSuccessPopups ? 1 : 0);
- break;
+ case IDC_QMGR_SUCCESSPOPUPS:
+ m_fSuccessPopups = ::IsDlgButtonChecked(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS) ? true : false;
+ M->WriteByte(0, SRMSGMOD_T, "qmgrSuccessPopups", m_fSuccessPopups ? 1 : 0);
+ break;
- case IDC_QMGR_ERRORPOPUPS:
- m_fErrorPopups = ::IsDlgButtonChecked(m_hwndDlg, IDC_QMGR_ERRORPOPUPS) ? true : false;
- M->WriteByte(0, SRMSGMOD_T, "qmgrErrorPopups", m_fErrorPopups ? 1 : 0);
- break;
+ case IDC_QMGR_ERRORPOPUPS:
+ m_fErrorPopups = ::IsDlgButtonChecked(m_hwndDlg, IDC_QMGR_ERRORPOPUPS) ? true : false;
+ M->WriteByte(0, SRMSGMOD_T, "qmgrErrorPopups", m_fErrorPopups ? 1 : 0);
+ break;
- case IDC_QMGR_HELP:
- CallService(MS_UTILS_OPENURL, 0, reinterpret_cast<LPARAM>("http://wiki.miranda.or.at/TabSRMM/SendLater"));
- break;
- /*
- * this handles all commands sent by the context menu
- * mark jobs for removal/reset/hold/unhold
- * exception: kill all open multisend jobs is directly handled from the context menu
- */
- case IDC_QMGR_REMOVE: {
- if (::SendMessage(m_hwndList, LVM_GETSELECTEDCOUNT, 0, 0) != 0) {
- LVITEM item = {0};
- LRESULT items = ::SendMessage(m_hwndList, LVM_GETITEMCOUNT, 0, 0);
- item.mask = LVIF_STATE|LVIF_PARAM;
- item.stateMask = LVIS_SELECTED;
-
- if (HIWORD(wParam) != ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD) {
- if (MessageBox(0, TranslateT("You are about to modify the state of one or more items in the\nunattended send queue. The requested action(s) will be executed at the next scheduled queue processing.\n\nThis action cannot be made undone."), TranslateT("Queue manager"),
- MB_ICONQUESTION | MB_OKCANCEL) == IDCANCEL)
- break;
- }
- for (LRESULT i = 0; i < items; i++) {
- item.iItem = i;
- ::SendMessage(m_hwndList, LVM_GETITEM, 0, reinterpret_cast<LPARAM>(&item));
- if (item.state & LVIS_SELECTED) {
- CSendLaterJob* job = reinterpret_cast<CSendLaterJob *>(item.lParam);
- if (job) {
- switch(HIWORD(wParam)) {
- case ID_QUEUEMANAGER_MARKSELECTEDFORREMOVAL:
- job->bCode = CSendLaterJob::JOB_REMOVABLE;
- job->fFailed = true;
- break;
- case ID_QUEUEMANAGER_HOLDSELECTED:
- job->bCode = CSendLaterJob::JOB_HOLD;
- job->writeFlags();
- break;
- case ID_QUEUEMANAGER_RESUMESELECTED:
- job->bCode = 0;
- job->writeFlags();
- break;
- case ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD: {
- TCHAR *msg = mir_utf8decodeT(job->sendBuffer);
- Utils::CopyToClipBoard(msg, m_hwndDlg);
- mir_free(msg);
- break;
- }
- /*
- * reset deferred and aged jobs
- * so they can be resent at next processing
- */
- case ID_QUEUEMANAGER_RESETSELECTED: {
- if (job->bCode == CSendLaterJob::JOB_DEFERRED) {
- job->iSendCount = 0;
- job->bCode = '-';
- }
- else if (job->bCode == CSendLaterJob::JOB_AGE) {
- job->fFailed = false;
- job->bCode = '-';
- job->created = time(0);
- }
- break;
- }
- default:
- break;
- }
- }
+ case IDC_QMGR_HELP:
+ CallService(MS_UTILS_OPENURL, 0, reinterpret_cast<LPARAM>("http://wiki.miranda.or.at/TabSRMM/SendLater"));
+ break;
+ /*
+ * this handles all commands sent by the context menu
+ * mark jobs for removal/reset/hold/unhold
+ * exception: kill all open multisend jobs is directly handled from the context menu
+ */
+ case IDC_QMGR_REMOVE:
+ if (::SendMessage(m_hwndList, LVM_GETSELECTEDCOUNT, 0, 0) != 0) {
+ LVITEM item = {0};
+ LRESULT items = ::SendMessage(m_hwndList, LVM_GETITEMCOUNT, 0, 0);
+ item.mask = LVIF_STATE|LVIF_PARAM;
+ item.stateMask = LVIS_SELECTED;
+
+ if (HIWORD(wParam) != ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD) {
+ if (MessageBox(0, TranslateT("You are about to modify the state of one or more items in the\nunattended send queue. The requested action(s) will be executed at the next scheduled queue processing.\n\nThis action cannot be made undone."), TranslateT("Queue manager"),
+ MB_ICONQUESTION | MB_OKCANCEL) == IDCANCEL)
+ break;
+ }
+ for (LRESULT i = 0; i < items; i++) {
+ item.iItem = i;
+ ::SendMessage(m_hwndList, LVM_GETITEM, 0, reinterpret_cast<LPARAM>(&item));
+ if (item.state & LVIS_SELECTED) {
+ CSendLaterJob* job = reinterpret_cast<CSendLaterJob *>(item.lParam);
+ if (!job)
+ continue;
+
+ switch(HIWORD(wParam)) {
+ case ID_QUEUEMANAGER_MARKSELECTEDFORREMOVAL:
+ job->bCode = CSendLaterJob::JOB_REMOVABLE;
+ job->fFailed = true;
+ break;
+ case ID_QUEUEMANAGER_HOLDSELECTED:
+ job->bCode = CSendLaterJob::JOB_HOLD;
+ job->writeFlags();
+ break;
+ case ID_QUEUEMANAGER_RESUMESELECTED:
+ job->bCode = 0;
+ job->writeFlags();
+ break;
+ case ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD:
+ Utils::CopyToClipBoard((TCHAR*)mir_ptr<TCHAR>( mir_utf8decodeT(job->sendBuffer)), m_hwndDlg);
+ break;
+ case ID_QUEUEMANAGER_RESETSELECTED:
+ if (job->bCode == CSendLaterJob::JOB_DEFERRED) {
+ job->iSendCount = 0;
+ job->bCode = '-';
+ }
+ else if (job->bCode == CSendLaterJob::JOB_AGE) {
+ job->fFailed = false;
+ job->bCode = '-';
+ job->created = time(0);
}
+ break;
}
- qMgrFillList();
}
- break;
- }
+ }
+ qMgrFillList();
}
- break;
-
- case WM_USER + 100:
- qMgrFillList();
- break;
- case WM_NCDESTROY: {
- m_hwndDlg = 0;
- M->WriteDword(0, SRMSGMOD_T, "qmgrFilterContact", reinterpret_cast<DWORD>(m_hFilter));
- break;
}
+ break;
+
+ case WM_USER + 100:
+ qMgrFillList();
+ break;
+
+ case WM_NCDESTROY:
+ m_hwndDlg = 0;
+ M->WriteDword(0, SRMSGMOD_T, "qmgrFilterContact", reinterpret_cast<DWORD>(m_hFilter));
+ break;
}
- return(FALSE);
+ return FALSE;
}
/**
@@ -979,5 +959,3 @@ INT_PTR CSendLater::svcQMgr(WPARAM wParam, LPARAM lParam) return 0;
}
-
-CSendLater* sendLater = 0;
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 18b045794e..035d32cd43 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -917,55 +917,52 @@ void CSideBar::invalidateButton(const TWindowData* dat) LRESULT CALLBACK CSideBar::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_SIZE:
- return(TRUE);
- case WM_ERASEBKGND: {
- HDC hdc = (HDC)wParam;
- RECT rc;
- ::GetClientRect(hwnd, &rc);
- if (CSkin::m_skinEnabled) {
- CSkinItem *item = &SkinItems[ID_EXTBKSIDEBARBG];
-
- if (item->IGNORED)
- CSkin::SkinDrawBG(hwnd, m_pContainer->hwnd, m_pContainer, &rc, hdc);
- else
- CSkin::DrawItem(hdc, &rc, item);
- }
- else if (M->isAero() || M->isVSThemed()) {
- HDC hdcMem;
- HANDLE hbp = 0;
- HBITMAP hbm, hbmOld;
-
- if (CMimAPI::m_haveBufferedPaint)
- hbp = CSkin::InitiateBufferedPaint(hdc, rc, hdcMem);
- else {
- hdcMem = ::CreateCompatibleDC(hdc);
- hbm = CSkin::CreateAeroCompatibleBitmap(rc, hdcMem);
- hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcMem, hbm));
- }
+ case WM_SIZE:
+ return TRUE;
- if (M->isAero())
- ::FillRect(hdcMem, &rc, CSkin::m_BrushBack);
- else
- CSkin::FillBack(hdcMem, &rc);
-
- if (hbp)
- CSkin::FinalizeBufferedPaint(hbp, &rc);
- else {
- ::BitBlt(hdc, 0, 0, rc.right, rc.bottom, hdcMem, 0, 0, SRCCOPY);
- ::SelectObject(hdcMem, hbmOld);
- ::DeleteObject(hbm);
- ::DeleteDC(hdcMem);
- }
+ case WM_ERASEBKGND:
+ HDC hdc = (HDC)wParam;
+ RECT rc;
+ ::GetClientRect(hwnd, &rc);
+ if (CSkin::m_skinEnabled) {
+ CSkinItem *item = &SkinItems[ID_EXTBKSIDEBARBG];
+
+ if (item->IGNORED)
+ CSkin::SkinDrawBG(hwnd, m_pContainer->hwnd, m_pContainer, &rc, hdc);
+ else
+ CSkin::DrawItem(hdc, &rc, item);
+ }
+ else if (M->isAero() || M->isVSThemed()) {
+ HDC hdcMem;
+ HANDLE hbp = 0;
+ HBITMAP hbm, hbmOld;
+
+ if (CMimAPI::m_haveBufferedPaint)
+ hbp = CSkin::InitiateBufferedPaint(hdc, rc, hdcMem);
+ else {
+ hdcMem = ::CreateCompatibleDC(hdc);
+ hbm = CSkin::CreateAeroCompatibleBitmap(rc, hdcMem);
+ hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcMem, hbm));
}
+
+ if (M->isAero())
+ ::FillRect(hdcMem, &rc, CSkin::m_BrushBack);
else
- ::FillRect(hdc, &rc, ::GetSysColorBrush(COLOR_3DFACE));
- return 1;
+ CSkin::FillBack(hdcMem, &rc);
+
+ if (hbp)
+ CSkin::FinalizeBufferedPaint(hbp, &rc);
+ else {
+ ::BitBlt(hdc, 0, 0, rc.right, rc.bottom, hdcMem, 0, 0, SRCCOPY);
+ ::SelectObject(hdcMem, hbmOld);
+ ::DeleteObject(hbm);
+ ::DeleteDC(hdcMem);
+ }
}
- default:
- break;
+ else ::FillRect(hdc, &rc, ::GetSysColorBrush(COLOR_3DFACE));
+ return 1;
}
- return(DefWindowProc(hwnd, msg, wParam, lParam));
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
LRESULT CALLBACK CSideBar::wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -976,15 +973,12 @@ LRESULT CALLBACK CSideBar::wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARA return(sideBar->wndProc(hwnd, msg, wParam, lParam));
switch(msg) {
- case WM_NCCREATE: {
- CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
- return(TRUE);
- }
- default:
- break;
+ case WM_NCCREATE:
+ CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
+ return TRUE;
}
- return(::DefWindowProc(hwnd, msg, wParam, lParam));
+ return ::DefWindowProc(hwnd, msg, wParam, lParam);
}
/**
* paints the background for a switchbar item. It can paint aero, visual styles, skins or
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index ed6accf488..02c7ad097a 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -267,8 +267,6 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetTextColor((HDC)wParam, RGB(60, 60, 150));
SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
- default:
- break;
}
return FALSE;
}
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 714a362291..c9edabf1f3 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -1515,10 +1515,6 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
return TRUE;
break;
-
- default:
- break;
-
}
if (tconfig_init)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 32ad9067e6..272db8b295 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -548,16 +548,13 @@ LRESULT CALLBACK CProxyWindow::stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, L return(pWnd->wndProc(hWnd, msg, wParam, lParam));
switch(msg) {
- case WM_NCCREATE: {
- CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lParam);
- CProxyWindow *pWnd = reinterpret_cast<CProxyWindow *>(cs->lpCreateParams);
- ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<UINT_PTR>(pWnd));
- return(pWnd->wndProc(hWnd, msg, wParam, lParam));
- }
- default:
- break;
+ case WM_NCCREATE:
+ CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lParam);
+ CProxyWindow *pWnd = reinterpret_cast<CProxyWindow *>(cs->lpCreateParams);
+ ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<UINT_PTR>(pWnd));
+ return pWnd->wndProc(hWnd, msg, wParam, lParam);
}
- return(::DefWindowProc(hWnd, msg, wParam, lParam));
+ return ::DefWindowProc(hWnd, msg, wParam, lParam);
}
/**
@@ -568,53 +565,51 @@ LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA switch(msg) {
#if defined(__LOGDEBUG_)
- case WM_NCCREATE:
- _DebugTraceW(_T("create proxy WINDOW for: %s"), m_dat->cache->getNick());
- break;
+ case WM_NCCREATE:
+ _DebugTraceW(_T("create proxy WINDOW for: %s"), m_dat->cache->getNick());
+ break;
#endif
- case WM_CLOSE: {
- TContainerData* pC = m_dat->pContainer;
-
- if (m_dat->hwnd != pC->hwndActive)
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 3);
- else
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 2);
- if (!IsIconic(pC->hwnd))
- SetForegroundWindow(pC->hwnd);
- return 0;
- }
+ case WM_CLOSE:
+ {
+ TContainerData* pC = m_dat->pContainer;
+
+ if (m_dat->hwnd != pC->hwndActive)
+ SendMessage(m_dat->hwnd, WM_CLOSE, 1, 3);
+ else
+ SendMessage(m_dat->hwnd, WM_CLOSE, 1, 2);
+ if (!IsIconic(pC->hwnd))
+ SetForegroundWindow(pC->hwnd);
+ }
+ return 0;
- /*
- * proxy window was activated by clicking on the thumbnail. Send this
- * to the real message window.
- */
- case WM_ACTIVATE:
- if (WA_ACTIVE == wParam) {
- if (IsWindow(m_dat->hwnd))
- ::PostMessage(m_dat->hwnd, DM_ACTIVATEME, 0, 0);
- return 0; // no default processing, avoid flickering.
- }
- break;
+ /*
+ * proxy window was activated by clicking on the thumbnail. Send this
+ * to the real message window.
+ */
+ case WM_ACTIVATE:
+ if (WA_ACTIVE == wParam) {
+ if (IsWindow(m_dat->hwnd))
+ ::PostMessage(m_dat->hwnd, DM_ACTIVATEME, 0, 0);
+ return 0; // no default processing, avoid flickering.
+ }
+ break;
- case WM_NCDESTROY:
- ::SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
+ case WM_NCDESTROY:
+ ::SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
#if defined(__LOGDEBUG_)
- _DebugTraceW(_T("destroy proxy WINDOW for: %s"), m_dat->cache->getNick());
+ _DebugTraceW(_T("destroy proxy WINDOW for: %s"), m_dat->cache->getNick());
#endif
- break;
-
- case WM_DWMSENDICONICTHUMBNAIL:
- sendThumb(HIWORD(lParam), LOWORD(lParam));
- return 0;
+ break;
- case WM_DWMSENDICONICLIVEPREVIEWBITMAP:
- sendPreview();
- return 0;
+ case WM_DWMSENDICONICTHUMBNAIL:
+ sendThumb(HIWORD(lParam), LOWORD(lParam));
+ return 0;
- default:
- break;
+ case WM_DWMSENDICONICLIVEPREVIEWBITMAP:
+ sendPreview();
+ return 0;
}
- return(::DefWindowProc(hWnd, msg, wParam, lParam));
+ return ::DefWindowProc(hWnd, msg, wParam, lParam);
}
/**
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 94b7f53425..1cb01dccb5 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -297,7 +297,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP teInfo->selchanging = TRUE;
CopyMemory(tSet->szTemplates[teInfo->inEdit], LTR_Default.szTemplates[teInfo->inEdit], sizeof(TCHAR) * TEMPLATE_LENGTH);
SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
- DBDeleteContactSetting(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit]);
+ db_unset(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit]);
SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
teInfo->selchanging = FALSE;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index f2c0a8e1f3..8d828a3910 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -697,62 +697,46 @@ void __fastcall CImageItem::Render(const HDC hdc, const RECT *rc, bool fIgnoreGl CMimAPI::m_MyAlphaBlend(hdc, rc->left, rc->bottom - b, l, b, hdcSrc, srcOrigX, srcOrigY + (m_height - b), l, b, m_bf);
CMimAPI::m_MyAlphaBlend(hdc, rc->left + l, rc->bottom - b, width - l - r, b, hdcSrc, srcOrigX + l, srcOrigY + (m_height - b), m_inner_width, b, m_bf);
CMimAPI::m_MyAlphaBlend(hdc, rc->right - r, rc->bottom - b, r, b, hdcSrc, srcOrigX + (m_width - r), srcOrigY + (m_height - b), r, b, m_bf);
- } else {
- switch (m_bStretch) {
- case IMAGE_STRETCH_H:
- // tile image vertically, stretch to width
- {
- LONG top = rc->top;
-
- do {
- if (top + m_height <= rc->bottom) {
- CMimAPI::m_MyAlphaBlend(hdc, rc->left, top, width, m_height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
- top += m_height;
- } else {
- CMimAPI::m_MyAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, m_width, rc->bottom - top, m_bf);
- break;
- }
- } while (TRUE);
- break;
- }
- case IMAGE_STRETCH_V:
- // tile horizontally, stretch to height
- {
- LONG left = rc->left;
-
- do {
- if (left + m_width <= rc->right) {
- CMimAPI::m_MyAlphaBlend(hdc, left, rc->top, m_width, height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
- left += m_width;
- } else {
- CMimAPI::m_MyAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, m_height, m_bf);
- break;
- }
- } while (TRUE);
- break;
- }
- case IMAGE_STRETCH_B:
- // stretch the image in both directions...
- CMimAPI::m_MyAlphaBlend(hdc, rc->left, rc->top, width, height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
- break;
- /*
- case IMAGE_STRETCH_V:
- // stretch vertically, draw 3 horizontal tiles...
- AlphaBlend(hdc, rc->left, rc->top, l, height, item->hdc, 0, 0, l, item->height, item->bf);
- AlphaBlend(hdc, rc->left + l, rc->top, width - l - r, height, item->hdc, l, 0, item->inner_width, item->height, item->bf);
- AlphaBlend(hdc, rc->right - r, rc->top, r, height, item->hdc, item->width - r, 0, r, item->height, item->bf);
- break;
- case IMAGE_STRETCH_H:
- // stretch horizontally, draw 3 vertical tiles...
- AlphaBlend(hdc, rc->left, rc->top, width, t, item->hdc, 0, 0, item->width, t, item->bf);
- AlphaBlend(hdc, rc->left, rc->top + t, width, height - t - b, item->hdc, 0, t, item->width, item->inner_height, item->bf);
- AlphaBlend(hdc, rc->left, rc->bottom - b, width, b, item->hdc, 0, item->height - b, item->width, b, item->bf);
- break;
- */
- default:
- break;
+ }
+ else switch (m_bStretch) {
+ case IMAGE_STRETCH_H:
+ // tile image vertically, stretch to width
+ {
+ LONG top = rc->top;
+
+ do {
+ if (top + m_height <= rc->bottom) {
+ CMimAPI::m_MyAlphaBlend(hdc, rc->left, top, width, m_height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
+ top += m_height;
+ } else {
+ CMimAPI::m_MyAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, m_width, rc->bottom - top, m_bf);
+ break;
+ }
+ } while (TRUE);
+ break;
}
+ case IMAGE_STRETCH_V:
+ // tile horizontally, stretch to height
+ {
+ LONG left = rc->left;
+
+ do {
+ if (left + m_width <= rc->right) {
+ CMimAPI::m_MyAlphaBlend(hdc, left, rc->top, m_width, height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
+ left += m_width;
+ } else {
+ CMimAPI::m_MyAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, m_height, m_bf);
+ break;
+ }
+ } while (TRUE);
+ break;
+ }
+ case IMAGE_STRETCH_B:
+ // stretch the image in both directions...
+ CMimAPI::m_MyAlphaBlend(hdc, rc->left, rc->top, width, height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
+ break;
}
+
if (fCleanUp) {
SelectObject(hdcSrc, hbmOld);
DeleteDC(hdcSrc);
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 4ca5ebb313..563543fe95 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -65,30 +65,25 @@ static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam) static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED) {
- HANDLE hContact = PUGetContact(hWnd);
- CallService(MS_MSG_SENDMESSAGE "W",(WPARAM)hContact,0);
- PUDeletePopUp(hWnd);
- return 1;
- }
- break;
-
- case WM_CONTEXTMENU:
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ CallService(MS_MSG_SENDMESSAGE "W", (WPARAM)PUGetContact(hWnd), 0);
PUDeletePopUp(hWnd);
return 1;
-
- case UM_INITPOPUP: {
- HANDLE hContact = PUGetContact(hWnd);
- WindowList_Add(hPopUpsList, hWnd, hContact);
}
- return 1;
+ break;
- case UM_FREEPLUGINDATA:
- WindowList_Remove(hPopUpsList, hWnd);
- return 1;
- default:
- break;
+ case WM_CONTEXTMENU:
+ PUDeletePopUp(hWnd);
+ return 1;
+
+ case UM_INITPOPUP:
+ WindowList_Add(hPopUpsList, hWnd, PUGetContact(hWnd));
+ return 1;
+
+ case UM_FREEPLUGINDATA:
+ WindowList_Remove(hPopUpsList, hWnd);
+ return 1;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 7a99d15480..e594a6408c 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -193,24 +193,22 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, unsigned int iNewIEView;
switch (iMode) {
- case 0:
- M->WriteByte(hContact, SRMSGMOD_T, "ieview", 0);
- M->WriteByte(hContact, SRMSGMOD_T, "hpplog", 0);
- break;
- case 1:
- M->WriteByte(hContact, SRMSGMOD_T, "ieview", -1);
- M->WriteByte(hContact, SRMSGMOD_T, "hpplog", -1);
- break;
- case 2:
- M->WriteByte(hContact, SRMSGMOD_T, "ieview", -1);
- M->WriteByte(hContact, SRMSGMOD_T, "hpplog", 1);
- break;
- case 3:
- M->WriteByte(hContact, SRMSGMOD_T, "ieview", 1);
- M->WriteByte(hContact, SRMSGMOD_T, "hpplog", -1);
- break;
- default:
- break;
+ case 0:
+ M->WriteByte(hContact, SRMSGMOD_T, "ieview", 0);
+ M->WriteByte(hContact, SRMSGMOD_T, "hpplog", 0);
+ break;
+ case 1:
+ M->WriteByte(hContact, SRMSGMOD_T, "ieview", -1);
+ M->WriteByte(hContact, SRMSGMOD_T, "hpplog", -1);
+ break;
+ case 2:
+ M->WriteByte(hContact, SRMSGMOD_T, "ieview", -1);
+ M->WriteByte(hContact, SRMSGMOD_T, "hpplog", 1);
+ break;
+ case 3:
+ M->WriteByte(hContact, SRMSGMOD_T, "ieview", 1);
+ M->WriteByte(hContact, SRMSGMOD_T, "hpplog", -1);
+ break;
}
if (hWnd && dat) {
iNewIEView = GetIEViewMode(hWnd, dat->hContact);
@@ -222,7 +220,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, }
if ((iIndex = SendDlgItemMessage(hwndDlg, IDC_TEXTFORMATTING, CB_GETCURSEL, 0, 0)) != CB_ERR) {
if (iIndex == 0)
- DBDeleteContactSetting(hContact, SRMSGMOD_T, "sendformat");
+ db_unset(hContact, SRMSGMOD_T, "sendformat");
else
M->WriteDword(hContact, SRMSGMOD_T, "sendformat", iIndex == 2 ? -1 : 1);
}
@@ -253,7 +251,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, bAvatarVisible = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SHOWAVATAR, CB_GETCURSEL, 0, 0);
if (bAvatarVisible == 0)
- DBDeleteContactSetting(hContact, SRMSGMOD_T, "hideavatar");
+ db_unset(hContact, SRMSGMOD_T, "hideavatar");
else
M->WriteByte(hContact, SRMSGMOD_T, "hideavatar", (BYTE)(bAvatarVisible == 1 ? 1 : 0));
@@ -283,7 +281,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, if (hWnd && dat)
dat->sendMode |= SMODE_NOACK;
} else {
- DBDeleteContactSetting(hContact, SRMSGMOD_T, "no_ack");
+ db_unset(hContact, SRMSGMOD_T, "no_ack");
if (hWnd && dat)
dat->sendMode &= ~SMODE_NOACK;
}
@@ -297,8 +295,6 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, DestroyWindow(hwndDlg);
break;
}
- default:
- break;
}
break;
}
@@ -432,8 +428,8 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA M->WriteDword(hContact, SRMSGMOD_T, "mwflags", dwFlags);
}
else {
- DBDeleteContactSetting(hContact, SRMSGMOD_T, "mwmask");
- DBDeleteContactSetting(hContact, SRMSGMOD_T, "mwflags");
+ db_unset(hContact, SRMSGMOD_T, "mwmask");
+ db_unset(hContact, SRMSGMOD_T, "mwflags");
}
if (hwnd && dat) {
if (dwMask)
@@ -444,8 +440,8 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA break;
}
case IDC_REVERTGLOBAL:
- DBDeleteContactSetting(hContact, SRMSGMOD_T, "mwmask");
- DBDeleteContactSetting(hContact, SRMSGMOD_T, "mwflags");
+ db_unset(hContact, SRMSGMOD_T, "mwmask");
+ db_unset(hContact, SRMSGMOD_T, "mwflags");
SendMessage(hwndDlg, WM_COMMAND, WM_USER + 200, 0);
break;
}
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 741cea3ea2..fb5adcd782 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -352,125 +352,125 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat break;
switch (title[curpos]) {
- case 'n': {
- const TCHAR *tszNick = dat->cache->getNick();
- if (tszNick[0])
- title.insert(tempmark + 2, tszNick);
- title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(tszNick);
- break;
- }
- case 'p':
- case 'a': {
- const TCHAR *szAcc = dat->cache->getRealAccount();
- if (szAcc)
- title.insert(tempmark + 2, szAcc);
- title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(szAcc);
- break;
- }
- case 's': {
- if (dat->szStatus && dat->szStatus[0])
- title.insert(tempmark + 2, dat->szStatus);
- title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(dat->szStatus);
- break;
- }
- case 'u': {
- const TCHAR *szUIN = dat->cache->getUIN();
- if (szUIN[0])
- title.insert(tempmark + 2, szUIN);
- title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(szUIN);
- break;
- }
- case 'c': {
- TCHAR *c = (!_tcscmp(dat->pContainer->szName, _T("default")) ? TranslateT("Default container") : dat->pContainer->szName);
- title.insert(tempmark + 2, c);
- title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(c);
- break;
- }
- case 'o': {
- const TCHAR* szProto = dat->cache->getActiveProtoT();
- if (szProto)
- title.insert(tempmark + 2, szProto);
- title.erase(tempmark, 2);
- curpos = tempmark + (szProto ? lstrlen(szProto) : 0);
- break;
- }
- case 'x': {
- TCHAR *szFinalStatus = NULL;
- BYTE xStatus = dat->cache->getXStatusId();
-
- if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- DBVARIANT dbv = {0};
-
- if (!M->GetTString(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
- _tcsncpy(szTemp, dbv.ptszVal, 500);
- szTemp[500] = 0;
- DBFreeVariant(&dbv);
- title.insert(tempmark + 2, szTemp);
- curpos = tempmark + lstrlen(szTemp);
- }
- else {
- title.insert(tempmark + 2, xStatusDescr[xStatus - 1]);
- curpos = tempmark + lstrlen(xStatusDescr[xStatus - 1]);
- }
+ case 'n': {
+ const TCHAR *tszNick = dat->cache->getNick();
+ if (tszNick[0])
+ title.insert(tempmark + 2, tszNick);
+ title.erase(tempmark, 2);
+ curpos = tempmark + lstrlen(tszNick);
+ break;
+ }
+ case 'p':
+ case 'a': {
+ const TCHAR *szAcc = dat->cache->getRealAccount();
+ if (szAcc)
+ title.insert(tempmark + 2, szAcc);
+ title.erase(tempmark, 2);
+ curpos = tempmark + lstrlen(szAcc);
+ break;
+ }
+ case 's': {
+ if (dat->szStatus && dat->szStatus[0])
+ title.insert(tempmark + 2, dat->szStatus);
+ title.erase(tempmark, 2);
+ curpos = tempmark + lstrlen(dat->szStatus);
+ break;
+ }
+ case 'u': {
+ const TCHAR *szUIN = dat->cache->getUIN();
+ if (szUIN[0])
+ title.insert(tempmark + 2, szUIN);
+ title.erase(tempmark, 2);
+ curpos = tempmark + lstrlen(szUIN);
+ break;
+ }
+ case 'c': {
+ TCHAR *c = (!_tcscmp(dat->pContainer->szName, _T("default")) ? TranslateT("Default container") : dat->pContainer->szName);
+ title.insert(tempmark + 2, c);
+ title.erase(tempmark, 2);
+ curpos = tempmark + lstrlen(c);
+ break;
+ }
+ case 'o': {
+ const TCHAR* szProto = dat->cache->getActiveProtoT();
+ if (szProto)
+ title.insert(tempmark + 2, szProto);
+ title.erase(tempmark, 2);
+ curpos = tempmark + (szProto ? lstrlen(szProto) : 0);
+ break;
+ }
+ case 'x': {
+ TCHAR *szFinalStatus = NULL;
+ BYTE xStatus = dat->cache->getXStatusId();
+
+ if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
+ DBVARIANT dbv = {0};
+
+ if (!M->GetTString(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
+ _tcsncpy(szTemp, dbv.ptszVal, 500);
+ szTemp[500] = 0;
+ DBFreeVariant(&dbv);
+ title.insert(tempmark + 2, szTemp);
+ curpos = tempmark + lstrlen(szTemp);
+ }
+ else {
+ title.insert(tempmark + 2, xStatusDescr[xStatus - 1]);
+ curpos = tempmark + lstrlen(xStatusDescr[xStatus - 1]);
}
- title.erase(tempmark, 2);
- break;
}
- case 'm': {
- TCHAR *szFinalStatus = NULL;
- BYTE xStatus = dat->cache->getXStatusId();
-
- if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- DBVARIANT dbv = {0};
-
- if (!M->GetTString(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
- _tcsncpy(szTemp, dbv.ptszVal, 500);
- szTemp[500] = 0;
- DBFreeVariant(&dbv);
- title.insert(tempmark + 2, szTemp);
- } else
- szFinalStatus = xStatusDescr[xStatus - 1];
+ title.erase(tempmark, 2);
+ break;
+ }
+ case 'm': {
+ TCHAR *szFinalStatus = NULL;
+ BYTE xStatus = dat->cache->getXStatusId();
+
+ if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
+ DBVARIANT dbv = {0};
+
+ if (!M->GetTString(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
+ _tcsncpy(szTemp, dbv.ptszVal, 500);
+ szTemp[500] = 0;
+ DBFreeVariant(&dbv);
+ title.insert(tempmark + 2, szTemp);
} else
- szFinalStatus = (TCHAR *)(dat->szStatus && dat->szStatus[0] ? dat->szStatus : _T("(undef)"));
-
- if (szFinalStatus) {
- title.insert(tempmark + 2, szFinalStatus);
- curpos = tempmark + lstrlen(szFinalStatus);
- }
+ szFinalStatus = xStatusDescr[xStatus - 1];
+ } else
+ szFinalStatus = (TCHAR *)(dat->szStatus && dat->szStatus[0] ? dat->szStatus : _T("(undef)"));
- title.erase(tempmark, 2);
- break;
+ if (szFinalStatus) {
+ title.insert(tempmark + 2, szFinalStatus);
+ curpos = tempmark + lstrlen(szFinalStatus);
}
- /*
- * status message (%T will skip the "No status message" for empty
- * messages)
- */
- case 't':
- case 'T': {
- TCHAR *tszStatusMsg = dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true);
- if (tszStatusMsg) {
- title.insert(tempmark + 2, tszStatusMsg);
- curpos = tempmark + lstrlen(tszStatusMsg);
- }
- else if (title[curpos] == 't') {
- const TCHAR* tszStatusMsg = TranslateT("No status message");
- title.insert(tempmark + 2, tszStatusMsg);
- curpos = tempmark + lstrlen(tszStatusMsg);
- }
- title.erase(tempmark, 2);
- if (tszStatusMsg)
- mir_free(tszStatusMsg);
- break;
+ title.erase(tempmark, 2);
+ break;
+ }
+ /*
+ * status message (%T will skip the "No status message" for empty
+ * messages)
+ */
+ case 't':
+ case 'T': {
+ TCHAR *tszStatusMsg = dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true);
+
+ if (tszStatusMsg) {
+ title.insert(tempmark + 2, tszStatusMsg);
+ curpos = tempmark + lstrlen(tszStatusMsg);
}
- default:
- title.erase(tempmark, 1);
- break;
+ else if (title[curpos] == 't') {
+ const TCHAR* tszStatusMsg = TranslateT("No status message");
+ title.insert(tempmark + 2, tszStatusMsg);
+ curpos = tempmark + lstrlen(tszStatusMsg);
+ }
+ title.erase(tempmark, 2);
+ if (tszStatusMsg)
+ mir_free(tszStatusMsg);
+ break;
+ }
+ default:
+ title.erase(tempmark, 1);
+ break;
}
}
length = title.length();
@@ -705,8 +705,6 @@ INT_PTR CALLBACK Utils::PopupDlgProcError(HWND hWnd, UINT message, WPARAM wParam break;
case WM_SETCURSOR:
break;
- default:
- break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
@@ -804,7 +802,7 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett }
}
else {
- ::DBDeleteContactSetting(NULL, SRMSGMOD_T, szCName);
+ ::db_unset(NULL, SRMSGMOD_T, szCName);
pContainer->fPrivateThemeChanged = FALSE;
}
}
@@ -1351,23 +1349,19 @@ INT_PTR CALLBACK CWarning::stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA return(w->dlgProc(hwnd, msg, wParam, lParam));
switch(msg) {
- case WM_INITDIALOG: {
- w = reinterpret_cast<CWarning *>(lParam);
- if (w) {
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
- return(w->dlgProc(hwnd, msg, wParam, lParam));
- }
- break;
+ case WM_INITDIALOG:
+ w = reinterpret_cast<CWarning *>(lParam);
+ if (w) {
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
+ return(w->dlgProc(hwnd, msg, wParam, lParam));
}
+ break;
#if defined(__LOGDEBUG_)
- case WM_NCDESTROY:
- _DebugTraceW(L"window destroyed");
- break;
+ case WM_NCDESTROY:
+ _DebugTraceW(L"window destroyed");
+ break;
#endif
-
- default:
- break;
}
return(FALSE);
}
@@ -1378,7 +1372,8 @@ INT_PTR CALLBACK CWarning::stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ {
HICON hIcon = 0;
UINT uResId = 0;
TCHAR temp[1024];
@@ -1402,8 +1397,8 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP TranslateDialogDefault(hwnd);
/*
- * convert normal line breaks to rtf
- */
+ * convert normal line breaks to rtf
+ */
while((pos = str->find(L"\n")) != str->npos) {
str->erase(pos, 1);
str->insert(pos, L"\\line ");
@@ -1447,10 +1442,11 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP ::ShowWindow(hwnd, SW_SHOWNORMAL);
WindowList_Add(hWindowList, hwnd, hwnd);
- return(TRUE);
}
+ return TRUE;
- case WM_CTLCOLORSTATIC: {
+ case WM_CTLCOLORSTATIC:
+ {
HWND hwndChild = reinterpret_cast<HWND>(lParam);
UINT id = ::GetDlgCtrlID(hwndChild);
if (0 == m_hFontCaption) {
@@ -1472,73 +1468,61 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
}
- break;
}
+ break;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDOK:
- case IDCANCEL:
- case IDYES:
- case IDNO:
- if (!m_fIsModal && (IDOK == LOWORD(wParam) || IDCANCEL == LOWORD(wParam))) { // modeless dialogs can receive a IDCANCEL from destroyAll()
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- delete this;
- WindowList_Remove(hWindowList, hwnd);
- ::DestroyWindow(hwnd);
- }
- else {
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- delete this;
- WindowList_Remove(hWindowList, hwnd);
- ::EndDialog(hwnd, LOWORD(wParam));
- }
- break;
-
- case IDC_DONTSHOWAGAIN: {
- __int64 mask = getMask(), val64 = ((__int64)1L << m_uId), newVal = 0;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ case IDYES:
+ case IDNO:
+ if (!m_fIsModal && (IDOK == LOWORD(wParam) || IDCANCEL == LOWORD(wParam))) { // modeless dialogs can receive a IDCANCEL from destroyAll()
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ delete this;
+ WindowList_Remove(hWindowList, hwnd);
+ ::DestroyWindow(hwnd);
+ }
+ else {
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ delete this;
+ WindowList_Remove(hWindowList, hwnd);
+ ::EndDialog(hwnd, LOWORD(wParam));
+ }
+ break;
- newVal = mask | val64;
+ case IDC_DONTSHOWAGAIN:
+ __int64 mask = getMask(), val64 = ((__int64)1L << m_uId), newVal = 0;
+ newVal = mask | val64;
- if (::IsDlgButtonChecked(hwnd, IDC_DONTSHOWAGAIN)) {
- DWORD val = (DWORD)(newVal & 0x00000000ffffffff);
- M->WriteDword(SRMSGMOD_T, "cWarningsL", val);
- val = (DWORD)((newVal >> 32) & 0x00000000ffffffff);
- M->WriteDword(SRMSGMOD_T, "cWarningsH", val);
- }
- break;
- }
- default:
- break;
+ if (::IsDlgButtonChecked(hwnd, IDC_DONTSHOWAGAIN)) {
+ DWORD val = (DWORD)(newVal & 0x00000000ffffffff);
+ M->WriteDword(SRMSGMOD_T, "cWarningsL", val);
+ val = (DWORD)((newVal >> 32) & 0x00000000ffffffff);
+ M->WriteDword(SRMSGMOD_T, "cWarningsH", val);
}
- break;
+ }
+ break;
- case WM_NOTIFY: {
- switch (((NMHDR *) lParam)->code) {
- case EN_LINK:
- switch (((ENLINK *) lParam)->msg) {
- case WM_LBUTTONUP: {
- ENLINK* e = reinterpret_cast<ENLINK *>(lParam);
+ case WM_NOTIFY:
+ switch (((NMHDR *) lParam)->code) {
+ case EN_LINK:
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_LBUTTONUP:
+ ENLINK *e = reinterpret_cast<ENLINK *>(lParam);
- const wchar_t* wszUrl = Utils::extractURLFromRichEdit(e, ::GetDlgItem(hwnd, IDC_WARNTEXT));
- if (wszUrl) {
- char* szUrl = mir_t2a(wszUrl);
+ const wchar_t* wszUrl = Utils::extractURLFromRichEdit(e, ::GetDlgItem(hwnd, IDC_WARNTEXT));
+ if (wszUrl) {
+ char* szUrl = mir_t2a(wszUrl);
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)szUrl);
- mir_free(szUrl);
- mir_free(const_cast<TCHAR *>(wszUrl));
- }
- break;
- }
- }
- break;
- default:
- break;
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)szUrl);
+ mir_free(szUrl);
+ mir_free(const_cast<TCHAR *>(wszUrl));
+ }
}
- break;
}
- default:
- break;
+ break;
}
- return(FALSE);
+
+ return FALSE;
}
|