From 8d23d76f0d43ca65a3c6a259382d26df567b2356 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 21 Feb 2015 12:21:36 +0000 Subject: - fix for underlining processing; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@12231 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/buttonsbar.cpp | 64 +++---- plugins/TabSRMM/src/chat/window.cpp | 18 +- plugins/TabSRMM/src/containeroptions.cpp | 46 +++-- plugins/TabSRMM/src/eventpopups.cpp | 28 +-- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/globals.cpp | 10 +- plugins/TabSRMM/src/globals.h | 12 +- plugins/TabSRMM/src/infopanel.cpp | 4 +- plugins/TabSRMM/src/msgdialog.cpp | 20 +-- plugins/TabSRMM/src/msgdlgutils.cpp | 268 +++++++++------------------- plugins/TabSRMM/src/msgdlgutils.h | 4 +- plugins/TabSRMM/src/msgoptions.cpp | 104 +++++------ plugins/TabSRMM/src/sendlater.cpp | 4 +- plugins/TabSRMM/src/taskbar.cpp | 2 +- plugins/TabSRMM/src/typingnotify.cpp | 26 +-- plugins/TabSRMM/src/userprefs.cpp | 34 ++-- plugins/TabSRMM/src/utils.cpp | 13 +- plugins/TabSRMM/src/utils.h | 4 +- 18 files changed, 279 insertions(+), 384 deletions(-) diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 20e13e190d..fda5d6aa7e 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -286,10 +286,10 @@ static INT_PTR CB_SetButtonState(WPARAM wParam, LPARAM lParam) if (bbdi->pszTooltip) SendDlgItemMessage(hwndDlg, tempCID, BUTTONADDTOOLTIP, (WPARAM)bbdi->ptszTooltip, (bbdi->bbbFlags & BBBF_ANSITOOLTIP) ? 0 : BATF_TCHAR); if (bbdi->bbbFlags) { - Utils::showDlgControl(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_HIDDEN) ? SW_HIDE : SW_SHOW); - Utils::enableDlgControl(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_DISABLED) ? 0 : 1); - CheckDlgButton(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_PUSHED) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_RELEASED) ? BST_UNCHECKED : BST_CHECKED); + Utils::showDlgControl(hwndDlg, tempCID, (bbdi->bbbFlags & BBSF_HIDDEN) ? SW_HIDE : SW_SHOW); + Utils::enableDlgControl(hwndDlg, tempCID, !(bbdi->bbbFlags & BBSF_DISABLED)); + CheckDlgButton(hwndDlg, tempCID, (bbdi->bbbFlags & BBSF_PUSHED) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, tempCID, (bbdi->bbbFlags & BBSF_RELEASED) ? BST_UNCHECKED : BST_CHECKED); } return 0; } @@ -427,7 +427,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat) RECT rcSplitter; POINT ptSplitter; int splitterY; - BYTE gap = DPISCALEX_S(PluginConfig.g_iButtonsBarGap); + BYTE gap = DPISCALEX_S(PluginConfig.m_iButtonsBarGap); BOOL isThemed = TRUE; if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED && @@ -557,7 +557,7 @@ BOOL TSAPI BB_SetButtonsPos(TWindowData *dat) int i; HWND hwndBtn = 0; - BYTE gap = DPISCALEX_S(PluginConfig.g_iButtonsBarGap); + BYTE gap = DPISCALEX_S(PluginConfig.m_iButtonsBarGap); bool showToolbar = !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR); bool bBottomToolbar = (dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0; @@ -579,7 +579,7 @@ BOOL TSAPI BB_SetButtonsPos(TWindowData *dat) int splitterY = (!bBottomToolbar) ? ptSplitter.y - DPISCALEY_S(1) : rect.bottom; int tempL = dat->bbLSideWidth, tempR = dat->bbRSideWidth; int lwidth = 0, rwidth = 0; - int iOff = DPISCALEY_S((PluginConfig.g_DPIscaleY > 1.0) ? (dat->bType == SESSIONTYPE_IM ? 22 : 23) : 22); + int iOff = DPISCALEY_S((PluginConfig.m_DPIscaleY > 1.0) ? (dat->bType == SESSIONTYPE_IM ? 22 : 23) : 22); int foravatar = 0; if ((rect.bottom - ptSplitter.y - (rcSplitter.bottom - rcSplitter.top) /*- DPISCALEY(2)*/ - (bBottomToolbar ? DPISCALEY_S(24) : 0) < dat->pic.cy - DPISCALEY_S(2)) && dat->bShowAvatar && !PluginConfig.m_bAlwaysFullToolbarWidth) @@ -1150,12 +1150,12 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l BuildMenuObjectsTree(hToolBarTree); } - 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)); + SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, MAKELONG(PluginConfig.m_iButtonsBarGap, 0)); TranslateDialogDefault(hwndDlg); bOptionsInit = FALSE; break; @@ -1294,17 +1294,17 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SaveTree(hToolBarTree); CB_ReInitCustomButtons(); - PluginConfig.g_iButtonsBarGap = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_GETPOS, 0, 0); + PluginConfig.m_iButtonsBarGap = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_GETPOS, 0, 0); - if (PluginConfig.g_iButtonsBarGap != M.GetByte("ButtonsBarGap", 1)) + if (PluginConfig.m_iButtonsBarGap != M.GetByte("ButtonsBarGap", 1)) M.BroadcastMessageAsync(WM_SIZE, 0, 0); - db_set_b(0, SRMSGMOD_T, "ButtonsBarGap", PluginConfig.g_iButtonsBarGap); + db_set_b(0, SRMSGMOD_T, "ButtonsBarGap", PluginConfig.m_iButtonsBarGap); BuildMenuObjectsTree((HWND)hToolBarTree); - 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); return 1; } break; @@ -1341,9 +1341,9 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l 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); + cbd->bIMButton = IsDlgButtonChecked(hwndDlg, IDC_IMCHECK) != 0; + cbd->bChatButton = IsDlgButtonChecked(hwndDlg, IDC_CHATCHECK) != 0; + cbd->bCanBeHidden = IsDlgButtonChecked(hwndDlg, IDC_CANBEHIDDEN) != 0; } } break; @@ -1362,9 +1362,9 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l 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); + Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, false); + Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, false); + Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, false); break; } @@ -1373,9 +1373,9 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l 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); + Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, true); + Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, true); + Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, true); CheckDlgButton(hwndDlg, IDC_IMCHECK, (cbd->bIMButton) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHATCHECK, (cbd->bChatButton) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CANBEHIDDEN, (cbd->bCanBeHidden) ? BST_CHECKED : BST_UNCHECKED); @@ -1391,15 +1391,15 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l 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); + Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, false); + Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, false); + Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, false); CheckDlgButton(hwndDlg, IDC_IMCHECK, BST_CHECKED); } else { - Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, TRUE); - Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, TRUE); - Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, TRUE); + Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, true); + Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, true); + Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, true); } TreeView_SelectItem(hToolBarTree, hti.hItem); } diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index f3550e2061..7b16eae570 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -324,8 +324,8 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) Utils::showDlgControl(hwndDlg, IDC_LIST, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); Utils::showDlgControl(hwndDlg, IDC_SPLITTERX, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); - Utils::enableDlgControl(hwndDlg, IDC_SHOWNICKLIST, TRUE); - Utils::enableDlgControl(hwndDlg, IDC_FILTER, TRUE); + Utils::enableDlgControl(hwndDlg, IDC_SHOWNICKLIST, true); + Utils::enableDlgControl(hwndDlg, IDC_FILTER, true); if (si->iType == GCW_CHATROOM) { MODULEINFO* tmp = pci->MM_FindModule(si->pszModule); if (tmp) @@ -338,9 +338,9 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) } if (si->iType == GCW_SERVER) { - Utils::enableDlgControl(hwndDlg, IDC_SHOWNICKLIST, FALSE); - Utils::enableDlgControl(hwndDlg, IDC_FILTER, FALSE); - Utils::enableDlgControl(hwndDlg, IDC_CHANMGR, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_SHOWNICKLIST, false); + Utils::enableDlgControl(hwndDlg, IDC_FILTER, false); + Utils::enableDlgControl(hwndDlg, IDC_CHANMGR, false); } switch (urc->wId) { @@ -353,7 +353,7 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) urc->rcItem.top = 0; urc->rcItem.left = 0; urc->rcItem.right = bNick ? urc->dlgNewSize.cx - si->iSplitterX : urc->dlgNewSize.cx; - urc->rcItem.bottom = (bToolbar && !bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - (PluginConfig.g_DPIscaleY > 1.0 ? DPISCALEY_S(24) : DPISCALEY_S(23))) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2)); + urc->rcItem.bottom = (bToolbar && !bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - (PluginConfig.m_DPIscaleY > 1.0 ? DPISCALEY_S(24) : DPISCALEY_S(23))) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2)); if (bInfoPanel) urc->rcItem.top += panelHeight; if (CSkin::m_skinEnabled) { @@ -1855,7 +1855,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); dat->Panel->loadHeight(); - Utils::enableDlgControl(hwndDlg, IDC_SMILEYBTN, TRUE); + Utils::enableDlgControl(hwndDlg, IDC_SMILEYBTN, true); if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL) UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE); @@ -2903,12 +2903,12 @@ LABEL_SHOWWINDOW: rtrimt(ptszText); if (mi && mi->bAckMsg) { - Utils::enableDlgControl(hwndDlg, IDC_CHAT_MESSAGE, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_CHAT_MESSAGE, false); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, TRUE, 0); } else SetDlgItemText(hwndDlg, IDC_CHAT_MESSAGE, _T("")); - Utils::enableDlgControl(hwndDlg, IDOK, FALSE); + Utils::enableDlgControl(hwndDlg, IDOK, false); // Typing support for GCW_PRIVMESS sessions if (si->iType == GCW_PRIVMESS) { diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index cf80aefeb4..b8dd0df52e 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -154,7 +154,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, mir_sntprintf(szNewTitle, SIZEOF(szNewTitle), TranslateT("Configure container options for\n%s"), !_tcscmp(pContainer->szName, _T("default")) ? TranslateT("Default container") : pContainer->szName); SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle); - Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, CSkin::m_frameSkins ? FALSE : TRUE); + Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins); CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top")); @@ -198,7 +198,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE)); ShowPage(hwndDlg, 0, TRUE); SetFocus(hwndTree); - Utils::enableDlgControl(hwndDlg, IDC_APPLY, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0); LOGFONT lf = {0}; @@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_HSCROLL: if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_ACTIVE) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_INACTIVE)) - Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE); + Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); break; case WM_COMMAND: @@ -269,10 +269,9 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, goto do_apply; } case IDC_TRANSPARENCY: { - int isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY); - - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans ? TRUE : FALSE); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans ? TRUE : FALSE); + bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); goto do_apply; } case IDC_SECTIONTREE: @@ -373,16 +372,16 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (LOWORD(wParam) == IDOK) DestroyWindow(hwndDlg); else - Utils::enableDlgControl(hwndDlg, IDC_APPLY, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); break; } case IDCANCEL: DestroyWindow(hwndDlg); return TRUE; + default: -do_apply: - Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE); +do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); break; } break; @@ -392,7 +391,6 @@ do_apply: DWORD dwFlags = cs->dwFlags; DWORD dwTransparency = cs->dwTransparency; DWORD dwFlagsEx = cs->dwFlagsEx; - int isTrans; BOOL fAllowTrans = FALSE; if (PluginConfig.m_WinVerMajor >= 6) @@ -447,11 +445,11 @@ do_apply: else CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans ? TRUE : FALSE); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans); - isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans ? TRUE : FALSE); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans ? TRUE : FALSE); + bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); @@ -459,10 +457,10 @@ do_apply: SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency)); SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency)); - Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, nen_options.bWindowCheck == 0); - Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, nen_options.bWindowCheck == 0); - Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, nen_options.bWindowCheck == 0); - Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, nen_options.bWindowCheck == 0); + Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck); SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0); SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0); @@ -475,11 +473,11 @@ do_apply: } case DM_SC_CONFIG: { - LRESULT enable = (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? BST_CHECKED : BST_UNCHECKED); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, enable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, enable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, enable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, enable); + bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0; + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable); return 0; } diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index e2b061a203..48b014b8d2 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -152,7 +152,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa { TreeViewInit(GetDlgItem(hWnd, IDC_EVENTOPTIONS), CTranslator::TREE_NEN, 0, TRUE); - if (!PluginConfig.g_PopupAvail) { + if (!PluginConfig.g_bPopupAvail) { HWND hwndChild = FindWindowEx(hWnd, 0, 0, 0); while(hwndChild) { ShowWindow(hwndChild, SW_HIDE); @@ -192,18 +192,18 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa 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_COLTEXT_MUC, g_Settings.iPopupStyle == 3); + Utils::enableDlgControl(hWnd, IDC_COLBACK_MUC, g_Settings.iPopupStyle == 3); CheckDlgButton(hWnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle < 2 ? BST_CHECKED : BST_UNCHECKED); - Utils::enableDlgControl(hWnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2 ? TRUE : FALSE); + Utils::enableDlgControl(hWnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2); SetDlgItemInt(hWnd, IDC_MESSAGEPREVIEWLIMIT, options->iLimitPreview, FALSE); CheckDlgButton(hWnd, IDC_LIMITPREVIEW, (options->iLimitPreview > 0) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, UDM_SETRANGE, 0, MAKELONG(2048, options->iLimitPreview > 0 ? 50 : 0)); SendDlgItemMessage(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, UDM_SETPOS, 0, (LPARAM)options->iLimitPreview); - Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW)); - Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW)); + Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW) != 0); + Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW) != 0); bWmNotify = FALSE; } @@ -241,7 +241,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa else g_Settings.iPopupStyle = 3; - Utils::enableDlgControl(hWnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2 ? TRUE : FALSE); + Utils::enableDlgControl(hWnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2); options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE); options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS); @@ -263,11 +263,11 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa 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_COLTEXT_MUC, g_Settings.iPopupStyle == 3); + Utils::enableDlgControl(hWnd, IDC_COLBACK_MUC, g_Settings.iPopupStyle == 3); - Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW)); - Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW)); + Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW) != 0); + Utils::enableDlgControl(hWnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW) != 0); //disable delay textbox when infinite is checked Utils::enableDlgControl(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1); @@ -566,7 +566,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve if (arPopupList.getCount() >= MAX_POPUPS) return 2; - if (!PluginConfig.g_PopupAvail) + if (!PluginConfig.g_bPopupAvail) return 0; DBEVENTINFO dbe = { sizeof(dbe) }; @@ -797,7 +797,7 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi return 0; } passed: - if ( !PluginConfig.g_PopupAvail) + if ( !PluginConfig.g_bPopupAvail) return 0; if ( PU_GetByContact(hContact) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) { @@ -815,7 +815,7 @@ passed: void TSAPI DeletePopupsForContact(MCONTACT hContact, DWORD dwMask) { - if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable || !PluginConfig.g_PopupAvail) + if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable || !PluginConfig.g_bPopupAvail) return; PLUGIN_DATAT *_T = 0; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 6f20e66691..d2221afc73 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1355,7 +1355,7 @@ void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM, LPARAM lParam) SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); - GetSendFormat(dat, 1); + GetSendFormat(dat); SetDialogToType(hwndDlg); SendMessage(hwndDlg, DM_CONFIGURETOOLBAR, 0, 0); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index f5227a5ff8..c69c2e941f 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -96,8 +96,8 @@ void CGlobals::reloadSystemStartup() hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); HDC hScrnDC = GetDC(0); - g_DPIscaleX = GetDeviceCaps(hScrnDC, LOGPIXELSX) / 96.0; - g_DPIscaleY = GetDeviceCaps(hScrnDC, LOGPIXELSY) / 96.0; + m_DPIscaleX = GetDeviceCaps(hScrnDC, LOGPIXELSX) / 96.0; + m_DPIscaleY = GetDeviceCaps(hScrnDC, LOGPIXELSY) / 96.0; ReleaseDC(0, hScrnDC); reloadSettings(false); @@ -130,10 +130,10 @@ void CGlobals::reloadSystemModulesChanged() } else db_set_b(0, SRMSGMOD_T, "ieview_installed", 0); - g_iButtonsBarGap = M.GetByte("ButtonsBarGap", 1); + m_iButtonsBarGap = M.GetByte("ButtonsBarGap", 1); m_hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); - g_PopupAvail = ServiceExists(MS_POPUP_ADDPOPUPT); + g_bPopupAvail = ServiceExists(MS_POPUP_ADDPOPUPT) != 0; CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090000; @@ -345,7 +345,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) ::RegisterFontServiceFonts(); ::CacheLogFonts(); - if (PluginConfig.g_PopupAvail) + if (PluginConfig.g_bPopupAvail) TN_ModuleInit(); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged); diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index b4851bb201..73a2aeafb3 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -70,7 +70,7 @@ public: HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock; HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand; HBITMAP g_hbmUnknown; - int g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP; + bool g_SmileyAddAvail, g_WantIEView, g_bPopupAvail, g_WantHPP; HIMAGELIST g_hImageList; HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend; HICON g_IconMsgEventBig, g_IconTypingEventBig; @@ -110,10 +110,10 @@ public: int m_TrayFlashes; int m_TrayFlashState; HANDLE m_UserMenuItem; - double g_DPIscaleX; - double g_DPIscaleY; + double m_DPIscaleX; + double m_DPIscaleY; HBITMAP m_hbmMsgArea; - BYTE g_iButtonsBarGap; + BYTE m_iButtonsBarGap; BYTE m_WinVerMajor; BYTE m_WinVerMinor; bool m_bIsVista, m_bIsWin7; @@ -175,7 +175,7 @@ private: extern CGlobals PluginConfig; -#define DPISCALEY_S(argY) ((int) ((double)(argY) * PluginConfig.g_DPIscaleY)) -#define DPISCALEX_S(argX) ((int) ((double)(argX) * PluginConfig.g_DPIscaleX)) +#define DPISCALEY_S(argY) ((int) ((double)(argY) * PluginConfig.m_DPIscaleY)) +#define DPISCALEX_S(argX) ((int) ((double)(argX) * PluginConfig.m_DPIscaleX)) #endif /* __GLOBALS_H */ diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index b0092883e0..56f06d9617 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1091,7 +1091,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Never show it at all")); ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_SETCURSEL, (v == (BYTE)-1 ? 0 : (v == 1 ? 1 : 2)), 0); } - else Utils::enableDlgControl(hwnd, IDC_PANELPICTUREVIS, FALSE); + else Utils::enableDlgControl(hwnd, IDC_PANELPICTUREVIS, false); } return FALSE; @@ -1387,7 +1387,7 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const TCHAR *szTit m_rcRich.left = LEFT_BORDER + m_leftWidth; m_rcRich.top = TOP_BORDER; m_rcRich.right -= (LEFT_BORDER + RIGHT_BORDER + m_leftWidth); - int twips = (int)(15.0f / PluginConfig.g_DPIscaleY); + int twips = (int)(15.0f / PluginConfig.m_DPIscaleY); m_rcRich.right = m_rcRich.left + (twips * (m_rcRich.right - m_rcRich.left)) - 10 * twips; m_rcRich.bottom = m_rcRich.top + (twips * (m_rcRich.bottom - m_rcRich.top)); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index dc187812fd..9bcfd2b3a2 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -429,11 +429,11 @@ void TSAPI SetDialogToType(HWND hwndDlg) } } - Utils::enableDlgControl(hwndDlg, IDC_TIME, TRUE); + Utils::enableDlgControl(hwndDlg, IDC_TIME, true); if (dat->hwndIEView || dat->hwndHPP) { Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE); - Utils::enableDlgControl(hwndDlg, IDC_LOG, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_LOG, false); Utils::showDlgControl(hwndDlg, IDC_MESSAGE, SW_SHOW); } else ShowMultipleControls(hwndDlg, sendControls, sizeof(sendControls) / sizeof(sendControls[0]), SW_SHOW); @@ -461,7 +461,7 @@ void TSAPI SetDialogToType(HWND hwndDlg) SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1); SendMessage(hwndDlg, WM_SIZE, 0, 0); - Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, false); dat->Panel->Configure(); } @@ -928,8 +928,8 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM BYTE bSync = M.GetByte(CHAT_MODULE, "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); + dwOff_CHAT = -(2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0)); + dwOff_IM = 2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0); RECT rcWin; GetWindowRect(hwndParent, &rcWin); @@ -2153,7 +2153,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); if (lParam == 1) { - GetSendFormat(dat, 1); + GetSendFormat(dat); SetDialogToType(hwndDlg); } @@ -2684,14 +2684,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (streamOut == NULL) break; - ptrT decoded(mir_utf8decodeT(streamOut)); - if (decoded == NULL) + CMString decoded(ptrT(mir_utf8decodeT(streamOut))); + if (decoded.IsEmpty()) break; char *utfResult = NULL; if (final_sendformat) - DoRtfToTags(decoded, dat); - rtrimt(decoded); + DoRtfToTags(dat, decoded); + decoded.Trim(); int bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0); size_t memRequired = 0; diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 5da388058e..37cd081c08 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -843,15 +843,9 @@ char* TSAPI Message_GetFromStream(HWND hwndRtf, const TWindowData *dat, DWORD dw // convert rich edit code to bbcode (if wanted). Otherwise, strip all RTF formatting // tags and return plain text -#define SETCHAR(c) InsertThis[0]=c; InsertThis[1]=0; - -BOOL TSAPI DoRtfToTags(TCHAR *pszText, const TWindowData *dat) +BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText) { - BOOL bJustRemovedRTF = TRUE; - BOOL bTextHasStarted = FALSE; - static int inColor = 0; - - if (!pszText) + if (pszText.IsEmpty()) return FALSE; // used to filter out attributes which are already set for the default message input area font @@ -859,216 +853,125 @@ BOOL TSAPI DoRtfToTags(TCHAR *pszText, const TWindowData *dat) // create an index of colors in the module and map them to // corresponding colors in the RTF color table - Utils::CreateColorMap(pszText); + // scan the file for rtf commands and remove or parse them - inColor = 0; - TCHAR *p1 = _tcsstr(pszText, _T("\\pard")); - if (!p1) + int idx = pszText.Find(_T("\\pard")); + if (idx == -1) return FALSE; - size_t iRemoveChars; - TCHAR InsertThis[50]; - p1 += 5; + bool bInsideColor = false; + CMString res; - memmove(pszText, p1, (mir_tstrlen(p1) + 1) * sizeof(TCHAR)); - p1 = pszText; // iterate through all characters, if rtf control character found then take action - while (*p1 != '\0') { - mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("")); - iRemoveChars = 0; - - switch (*p1) { + for (const TCHAR *p = pszText.GetString() + idx + 5; *p;) { + switch (*p) { case '\\': - if (!_tcsncmp(p1, _T("\\cf"), 3)) { // foreground color - TCHAR szTemp[20]; - int iCol = _ttoi(p1 + 3); + if (!_tcsncmp(p, _T("\\cf"), 3)) { // foreground color + int iCol = _ttoi(p + 3); int iInd = Utils::RTFColorToIndex(iCol); - bJustRemovedRTF = TRUE; - mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), iCol); - iRemoveChars = 3 + mir_tstrlen(szTemp); - if (bTextHasStarted || iCol) - mir_sntprintf(InsertThis, SIZEOF(InsertThis), (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; + if (iCol) + res.AppendFormat((iInd > 0) ? (bInsideColor ? _T("[/color][color=%s]") : _T("[color=%s]")) : (bInsideColor ? _T("[/color]") : _T("")), Utils::rtf_ctable[iInd - 1].szName); + + bInsideColor = iInd > 0; } - else if (!_tcsncmp(p1, _T("\\highlight"), 10)) { //background color + else if (!_tcsncmp(p, _T("\\highlight"), 10)) { //background color TCHAR szTemp[20]; - int iCol = _ttoi(p1 + 10); - bJustRemovedRTF = TRUE; - + int iCol = _ttoi(p + 10); mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), iCol); - iRemoveChars = 10 + mir_tstrlen(szTemp); - } - else if (!_tcsncmp(p1, _T("\\par"), 4)) { // newline - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 4; } - else if (!_tcsncmp(p1, _T("\\line"), 5)) { // soft line break; - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 5; - SETCHAR('\n'); + else if (!_tcsncmp(p, _T("\\line"), 5)) { // soft line break; + res.AppendChar('\n'); } - else if (!_tcsncmp(p1, _T("\\endash"), 7)) { - bTextHasStarted = bJustRemovedRTF = TRUE; - iRemoveChars = 7; - SETCHAR(0x2013); + else if (!_tcsncmp(p, _T("\\endash"), 7)) { + res.AppendChar(0x2013); } - else if (!_tcsncmp(p1, _T("\\emdash"), 7)) { - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 7; - SETCHAR(0x2014); + else if (!_tcsncmp(p, _T("\\emdash"), 7)) { + res.AppendChar(0x2014); } - else if (!_tcsncmp(p1, _T("\\bullet"), 7)) { - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 7; - SETCHAR(0x2022); + else if (!_tcsncmp(p, _T("\\bullet"), 7)) { + res.AppendChar(0x2022); } - else if (!_tcsncmp(p1, _T("\\ldblquote"), 10)) { - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 10; - SETCHAR(0x201C); + else if (!_tcsncmp(p, _T("\\ldblquote"), 10)) { + res.AppendChar(0x201C); } - else if (!_tcsncmp(p1, _T("\\rdblquote"), 10)) { - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 10; - SETCHAR(0x201D); + else if (!_tcsncmp(p, _T("\\rdblquote"), 10)) { + res.AppendChar(0x201D); } - else if (!_tcsncmp(p1, _T("\\lquote"), 7)) { - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 7; - SETCHAR(0x2018); + else if (!_tcsncmp(p, _T("\\lquote"), 7)) { + res.AppendChar(0x2018); } - else if (!_tcsncmp(p1, _T("\\rquote"), 7)) { - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 7; - SETCHAR(0x2019); + else if (!_tcsncmp(p, _T("\\rquote"), 7)) { + res.AppendChar(0x2019); } - else if (!_tcsncmp(p1, _T("\\b"), 2)) { //bold - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = (p1[2] != '0') ? 2 : 3; - if (!(lf.lfWeight == FW_BOLD)) { // only allow bold if the font itself isn't a bold one, otherwise just strip it.. + else if (!_tcsncmp(p, _T("\\b"), 2)) { //bold + if (!(lf.lfWeight == FW_BOLD)) // only allow bold if the font itself isn't a bold one, otherwise just strip it.. if (dat->SendFormat) - mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != '0') ? _T("[b]") : _T("[/b]")); - } + res.Append((p[2] != '0') ? _T("[b]") : _T("[/b]")); } - else if (!_tcsncmp(p1, _T("\\i"), 2)) { // italics - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = (p1[2] != '0') ? 2 : 3; - if (!lf.lfItalic) { // same as for bold - if (dat->SendFormat) - mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != '0') ? _T("[i]") : _T("[/i]")); - } + else if (!_tcsncmp(p, _T("\\i"), 2)) { // italics + if (!lf.lfItalic && dat->SendFormat) + res.Append((p[2] != '0') ? _T("[i]") : _T("[/i]")); } - else if (!_tcsncmp(p1, _T("\\strike"), 7)) { // strike-out - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = (p1[7] != '0') ? 7 : 8; - if (!lf.lfStrikeOut) { // same as for bold - if (dat->SendFormat) - mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[7] != '0') ? _T("[s]") : _T("[/s]")); - } + else if (!_tcsncmp(p, _T("\\strike"), 7)) { // strike-out + if (!lf.lfStrikeOut && dat->SendFormat) + res.Append((p[7] != '0') ? _T("[s]") : _T("[/s]")); } - else if (!_tcsncmp(p1, _T("\\ul"), 3)) { // underlined - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - if (p1[3] == 'n') - iRemoveChars = 7; - else if (p1[3] == '0') - iRemoveChars = 4; - else - iRemoveChars = 3; - if (!lf.lfUnderline) // same as for bold - if (dat->SendFormat) - mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[3] != '0' && p1[3] != 'n') ? _T("[u]") : _T("[/u]")); + else if (!_tcsncmp(p, _T("\\ul"), 3)) { // underlined + if (!lf.lfUnderline && dat->SendFormat) { + if (p[3] == '0') + res.Append(_T("[u]")); + else if (p[3] == '1') + res.Append(_T("[/u]")); + } } - else if (!_tcsncmp(p1, _T("\\tab"), 4)) { // tab - bTextHasStarted = TRUE; - bJustRemovedRTF = TRUE; - iRemoveChars = 4; - SETCHAR('\t'); + else if (!_tcsncmp(p, _T("\\tab"), 4)) { // tab + res.AppendChar('\t'); } - else if (p1[1] == '\\' || p1[1] == '{' || p1[1] == '}') { // escaped characters - bTextHasStarted = TRUE; - iRemoveChars = 2; - SETCHAR(p1[1]); + else if (p[1] == '\\' || p[1] == '{' || p[1] == '}') { // escaped characters + res.AppendChar(p[1]); } - else if (p1[1] == '~') { // non-breaking space - bTextHasStarted = TRUE; - iRemoveChars = 2; - SETCHAR(0xA0); + else if (p[1] == '~') { // non-breaking space + res.AppendChar(0xA0); } - else if (p1[1] == '\'') { // special character - bTextHasStarted = TRUE; - bJustRemovedRTF = FALSE; - if (p1[2] != ' ' && p1[2] != '\\') { - int iLame = 0; - TCHAR * p3; - TCHAR *stoppedHere; + else if (p[1] == '\'') { // special character + if (p[2] != ' ' && p[2] != '\\') { + TCHAR tmp[10]; - if (p1[3] != ' ' && p1[3] != '\\') { - _tcsncpy(InsertThis, p1 + 2, 3); - iRemoveChars = 4; - InsertThis[2] = 0; + if (p[3] != ' ' && p[3] != '\\') { + _tcsncpy(tmp, p + 2, 3); + tmp[3] = 0; } else { - _tcsncpy(InsertThis, p1 + 2, 2); - iRemoveChars = 3; - InsertThis[2] = 0; + _tcsncpy(tmp, p + 2, 2); + tmp[2] = 0; } + // convert string containing char in hex format to int. - p3 = InsertThis; - iLame = _tcstol(p3, &stoppedHere, 16); - SETCHAR(iLame); + TCHAR *stoppedHere; + res.AppendChar(_tcstol(tmp, &stoppedHere, 16)); } - else iRemoveChars = 2; - } - else { // remove unknown RTF command - int j = 1; - bJustRemovedRTF = TRUE; - while (!_tcschr(_T(" !$%()#*\"'"), p1[j]) && p1[j] != '§' && p1[j] != '\\' && p1[j] != '\0') - j++; - iRemoveChars = j; } + + p++; // skip initial slash + p += _tcscspn(p, _T(" \\")); + if (*p == ' ') + p++; break; case '{': // other RTF control characters case '}': - iRemoveChars = 1; - break; - - case ' ': // remove spaces following a RTF command - if (bJustRemovedRTF) - iRemoveChars = 1; - bJustRemovedRTF = FALSE; - bTextHasStarted = TRUE; + p++; break; default: // other text that should not be touched - bTextHasStarted = TRUE; - bJustRemovedRTF = FALSE; + res.AppendChar(*p++); break; } - - // move the memory and paste in new commands instead of the old RTF - if (InsertThis[0] || iRemoveChars) { - size_t cbLen = _tcslen(InsertThis); - memmove(p1 + cbLen, p1 + iRemoveChars, (mir_tstrlen(p1) - iRemoveChars + 1) * sizeof(TCHAR)); - memcpy(p1, InsertThis, cbLen * sizeof(TCHAR)); - p1 += cbLen; - } - else p1++; } + + pszText = res; return TRUE; } @@ -1145,7 +1048,7 @@ void TSAPI SetMessageLog(TWindowData *dat) CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); dat->hwndIEView = ieWindow.hwnd; Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE); - Utils::enableDlgControl(hwndDlg, IDC_LOG, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_LOG, false); } else if (iLogMode == WANT_HPP_LOG && dat->hwndHPP == 0) { IEVIEWWINDOW ieWindow; @@ -1161,7 +1064,7 @@ void TSAPI SetMessageLog(TWindowData *dat) CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); dat->hwndHPP = ieWindow.hwnd; Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE); - Utils::enableDlgControl(hwndDlg, IDC_LOG, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_LOG, false); } } @@ -1284,19 +1187,18 @@ void TSAPI PlayIncomingSound(const TWindowData *dat) // reads send format and configures the toolbar buttons // if mode == 0, int only configures the buttons and does not change send format -void TSAPI GetSendFormat(TWindowData *dat, int mode) +void TSAPI GetSendFormat(TWindowData *dat) { UINT controls[5] = { IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTSTRIKEOUT, IDC_FONTFACE }; - if (mode) { - dat->SendFormat = M.GetDword(dat->hContact, "sendformat", PluginConfig.m_SendFormat); - if (dat->SendFormat == -1) // per contact override to disable it.. - dat->SendFormat = 0; - else if (dat->SendFormat == 0) - dat->SendFormat = PluginConfig.m_SendFormat ? 1 : 0; - } + dat->SendFormat = M.GetDword(dat->hContact, "sendformat", PluginConfig.m_SendFormat); + if (dat->SendFormat == -1) // per contact override to disable it.. + dat->SendFormat = 0; + else if (dat->SendFormat == 0) + dat->SendFormat = PluginConfig.m_SendFormat ? 1 : 0; + for (int i = 0; i < 5; i++) - Utils::enableDlgControl(dat->hwnd, controls[i], dat->SendFormat != 0 ? TRUE : FALSE); + Utils::enableDlgControl(dat->hwnd, controls[i], dat->SendFormat != 0); return; } diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 4eb5d25a82..0503605e29 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -45,7 +45,7 @@ void TSAPI AdjustBottomAvatarDisplay(TWindowData *dat); void TSAPI SetDialogToType(HWND hwndDlg); void TSAPI FlashOnClist(HWND hwndDlg, TWindowData *dat, MEVENT hEvent, DBEVENTINFO *dbei); char* TSAPI Message_GetFromStream(HWND hwndDlg, const TWindowData *dat, DWORD dwPassedFlags); -BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat); +BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText); void TSAPI GetMYUIN(TWindowData *dat); void TSAPI SetMessageLog(TWindowData *dat); void TSAPI SwitchMessageLog(TWindowData *dat, int iMode); @@ -54,7 +54,7 @@ void TSAPI FindFirstEvent(TWindowData *dat); void TSAPI SaveSplitter(TWindowData *dat); void TSAPI LoadSplitter(TWindowData *dat); void TSAPI PlayIncomingSound(const TWindowData *dat); -void TSAPI GetSendFormat(TWindowData *dat, int mode); +void TSAPI GetSendFormat(TWindowData *dat); void TSAPI GetLocaleID(TWindowData *dat, const TCHAR *szKLName); void TSAPI LoadOwnAvatar(TWindowData *dat); void TSAPI LoadContactAvatar(TWindowData *dat); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index bf7317480a..1d37379afd 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -243,7 +243,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { bool fWindowsOpen = (pFirstContainer != 0 ? true : false); for (int i = 0; _ctrls[i]; i++) - Utils::enableDlgControl(hwndDlg, _ctrls[i], fWindowsOpen ? FALSE : TRUE); + Utils::enableDlgControl(hwndDlg, _ctrls[i], !fWindowsOpen); Utils::showDlgControl(hwndDlg, IDC_SKIN_WARN, fWindowsOpen ? SW_SHOW : SW_HIDE); Utils::showDlgControl(hwndDlg, IDC_SKIN_CLOSENOW, fWindowsOpen ? SW_SHOW : SW_HIDE); @@ -485,7 +485,7 @@ void TreeViewToDB(HWND hwndTree, UINT id, char *DBPath, DWORD *dwFlags) } } -BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM wParam, LPARAM lParam) +BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM, LPARAM lParam) { TVITEM item = { 0 }; TVHITTESTINFO hti; @@ -664,14 +664,14 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break; case LOADHISTORY_COUNT: CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED); - Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, TRUE); - Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, TRUE); + 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); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, true); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, true); + Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, true); break; } @@ -736,8 +736,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, 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(GetDlgItem(hwndDlg, IDC_MSGLOGDIDSPLAY), r != 0); + for (int i = 0; i < SIZEOF(__ctrls); i++) Utils::enableDlgControl(hwndDlg, __ctrls[i], r == 0 ? TRUE : FALSE); } return 0; @@ -745,17 +745,17 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, 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)); + Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM) != 0); + Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM) != 0); 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)); + Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT) != 0); + Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT) != 0); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME) != 0); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME) != 0); + Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME) != 0); break; case IDC_INDENTAMOUNT: case IDC_LOADCOUNTN: @@ -916,16 +916,16 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_NOTIFYPOPUP, M.GetByte(SRMSGMOD, "ShowTypingPopup", 0) ? BST_CHECKED : BST_UNCHECKED); - Utils::enableDlgControl(hwndDlg, IDC_TYPEWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); - Utils::enableDlgControl(hwndDlg, IDC_TYPENOWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); + Utils::enableDlgControl(hwndDlg, IDC_TYPEWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) != 0); + Utils::enableDlgControl(hwndDlg, IDC_TYPENOWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) != 0); 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) != 0); + Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP) != 0); if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, false); SetDlgItemText(hwndDlg, IDC_NOTIFYBALLOON, TranslateT("Show balloon popup (unsupported system)")); } @@ -935,7 +935,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_SETCURSEL, (WPARAM)M.GetByte("MTN_PopupMode", 0), 0); - if (!PluginConfig.g_PopupAvail) { + if (!PluginConfig.g_bPopupAvail) { Utils::showDlgControl(hwndDlg, IDC_NOTIFYPOPUP, SW_HIDE); Utils::showDlgControl(hwndDlg, IDC_STATIC111, SW_HIDE); Utils::showDlgControl(hwndDlg, IDC_MTN_POPUPMODE, SW_HIDE); @@ -945,15 +945,15 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam 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)); + Utils::enableDlgControl(hwndDlg, IDC_TYPEWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) != 0); + Utils::enableDlgControl(hwndDlg, IDC_TYPENOWIN, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) != 0); + Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY) != 0); break; case IDC_SHOWNOTIFY: - Utils::enableDlgControl(hwndDlg, IDC_TYPEFLASHWIN, IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); + Utils::enableDlgControl(hwndDlg, IDC_TYPEFLASHWIN, IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY) != 0); break; case IDC_NOTIFYPOPUP: - Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP)); + Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP) != 0); break; case IDC_TYPEWIN: case IDC_TYPENOWIN: @@ -1013,8 +1013,8 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETRANGE, 0, MAKELONG(20, 5)); SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETPOS, 0, (WPARAM)db_get_w(NULL, SRMSGMOD_T, "cut_at", 15)); - Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE)); - Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE)); + Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE) != 0); + Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE) != 0); SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Normal - close tab, if last tab is closed also close the window")); SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Minimize the window to the task bar")); @@ -1038,8 +1038,8 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar break; } case IDC_CUT_TABTITLE: - Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE)); - Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE)); + Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE) != 0); + Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE) != 0); break; } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -1090,7 +1090,7 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM 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)); + Utils::enableDlgControl(hwndDlg, IDC_TABLIMIT, IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS) != 0); CheckDlgButton(hwndDlg, IDC_SINGLEWINDOWMODE, M.GetByte("singlewinmode", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DEFAULTCONTAINERMODE, !(IsDlgButtonChecked(hwndDlg, IDC_CONTAINERGROUPMODE) || IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS) || IsDlgButtonChecked(hwndDlg, IDC_SINGLEWINDOWMODE)) ? BST_CHECKED : BST_UNCHECKED); @@ -1108,11 +1108,11 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM 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); + Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, PluginConfig.m_bIsVista); + Utils::enableDlgControl(hwndDlg, IDC_USEAERO, PluginConfig.m_bIsVista); + Utils::enableDlgControl(hwndDlg, IDC_USEAEROPEEK, PluginConfig.m_bIsWin7); if (PluginConfig.m_bIsVista) - Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0); + Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) != 0); return TRUE; case WM_COMMAND: @@ -1122,13 +1122,13 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM return TRUE; break; case IDC_USEAERO: - Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) ? 1 : 0); + Utils::enableDlgControl(hwndDlg, IDC_AEROEFFECT, IsDlgButtonChecked(hwndDlg, IDC_USEAERO) != 0); break; case IDC_LIMITTABS: case IDC_SINGLEWINDOWMODE: case IDC_CONTAINERGROUPMODE: case IDC_DEFAULTCONTAINERMODE: - Utils::enableDlgControl(hwndDlg, IDC_TABLIMIT, IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS)); + Utils::enableDlgControl(hwndDlg, IDC_TABLIMIT, IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS) != 0); break; case IDC_HELP_CONTAINERS: CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Containers"); @@ -1265,7 +1265,7 @@ struct { static int OptInitialise(WPARAM wParam, LPARAM lParam) { - if (PluginConfig.g_PopupAvail) + if (PluginConfig.g_bPopupAvail) TN_OptionsInitialize(wParam, lParam); OPTIONSDIALOGPAGE odp = { sizeof(odp) }; @@ -1508,14 +1508,14 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR break; case LOADHISTORY_COUNT: CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED); - Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, TRUE); - Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, TRUE); + 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); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, true); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, true); + Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, true); break; } @@ -1556,15 +1556,15 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR 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)); + Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT) != 0); + Utils::enableDlgControl(hwndDlg, IDC_LOADCOUNTSPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT) != 0); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMEN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME) != 0); + Utils::enableDlgControl(hwndDlg, IDC_LOADTIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME) != 0); + Utils::enableDlgControl(hwndDlg, IDC_STMINSOLD, IsDlgButtonChecked(hwndDlg, IDC_LOADTIME) != 0); break; case IDC_ALWAYSTRIM: - Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM)); - Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM)); + Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM) != 0); + Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM) != 0); break; case IDC_TRIM: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) @@ -1705,7 +1705,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, break; case IDC_ALWAYS: for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) - Utils::enableDlgControl(hwndDlg, i, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_ALWAYS)); + Utils::enableDlgControl(hwndDlg, i, !IsDlgButtonChecked(hwndDlg, IDC_ALWAYS)); break; } diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index b61a6bdd24..d13df65bc4 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -122,7 +122,7 @@ CSendLaterJob::~CSendLaterJob() /* * show a popup notification, unless they are disabled */ - if (PluginConfig.g_PopupAvail && fShowPopup) { + if (PluginConfig.g_bPopupAvail && fShowPopup) { TCHAR *tszName = pcli->pfnGetContactDisplayName(hContact, 0); POPUPDATAT ppd = {0}; @@ -713,7 +713,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_LABELTIP|LVS_EX_DOUBLEBUFFER); qMgrSetupColumns(); qMgrFillList(); - if (PluginConfig.g_PopupAvail) { + if (PluginConfig.g_bPopupAvail) { ::CheckDlgButton(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, m_fSuccessPopups ? BST_CHECKED : BST_UNCHECKED); ::CheckDlgButton(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, m_fErrorPopups ? BST_CHECKED : BST_UNCHECKED); } diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 7dfce4cc6f..c79e4e22ef 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -328,7 +328,7 @@ void CProxyWindow::sendPreview() POINT pt = {0}; RECT rcContainer, rcTemp, rcRich, rcLog; HDC hdc, dc; - int twips = (int)(15.0f / PluginConfig.g_DPIscaleY); + int twips = (int)(15.0f / PluginConfig.m_DPIscaleY); bool fIsChat = m_dat->bType != SESSIONTYPE_IM; HWND hwndRich = ::GetDlgItem(m_dat->hwnd, fIsChat ? IDC_CHAT_LOG : IDC_LOG); LONG cx, cy; diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 1a200b7c0b..7480ae94a2 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -45,7 +45,7 @@ static INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM) { Disabled = !Disabled; - if (PluginConfig.g_PopupAvail) { + if (PluginConfig.g_bPopupAvail) { CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON | CMIM_NAME; @@ -96,7 +96,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode) if (db_get_b(hContact, "CList", "Hidden", 0) || (db_get_dw(hContact, "Ignore", "Mask1", 0) & 1)) // 9 - online notification return; - if (!PluginConfig.g_PopupAvail || Disabled) + if (!PluginConfig.g_bPopupAvail || Disabled) return; TCHAR *szContactName = pcli->pfnGetContactDisplayName(hContact, 0); @@ -226,9 +226,9 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopup) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED); - Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PluginConfig.g_PopupAvail); - Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PluginConfig.g_PopupAvail); - Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PluginConfig.g_PopupAvail/*&&!ServiceExists(MS_POPUP_REGISTERNOTIFICATION)*/); + Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PluginConfig.g_bPopupAvail); + Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PluginConfig.g_bPopupAvail); + Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PluginConfig.g_bPopupAvail); newTimeout = Timeout; newTimeoutMode = TimeoutMode; @@ -249,15 +249,15 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (idCtrl) { case IDC_USEWINCOLORS: if (wNotifyCode == BN_CLICKED) { - BOOL bEnableOthers; + bool bEnableOthers; if (IsDlgButtonChecked(hwndDlg, IDC_USEWINCOLORS)) { newColorMode = COLOR_WINDOWS; - bEnableOthers = FALSE; + bEnableOthers = false; } else { newColorMode = COLOR_OWN; - bEnableOthers = TRUE; + bEnableOthers = true; } for (i = 0; i < SIZEOF(colorPicker); i++) @@ -271,15 +271,15 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_USEPOPUPCOLORS: if (wNotifyCode == BN_CLICKED) { - BOOL bEnableOthers; + bool bEnableOthers; if (IsDlgButtonChecked(hwndDlg, IDC_USEPOPUPCOLORS)) { newColorMode = COLOR_POPUP; - bEnableOthers = FALSE; + bEnableOthers = false; } else { newColorMode = COLOR_OWN; - bEnableOthers = TRUE; + bEnableOthers = true; } for (i = 0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) @@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case IDC_PREVIEW: - if (PluginConfig.g_PopupAvail) { + if (PluginConfig.g_bPopupAvail) { POPUPDATAT ppd = { 0 }; for (i = 0; i < 2; i++) { int notyping; @@ -542,7 +542,7 @@ int TN_ModuleInit() mir_sntprintf(szStart, SIZEOF(szStart), TranslateT("...is typing a message.")); mir_sntprintf(szStop, SIZEOF(szStop), TranslateT("...has stopped typing.")); - if (PluginConfig.g_PopupAvail && ShowMenu) { + if (PluginConfig.g_bPopupAvail && ShowMenu) { hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand); CLISTMENUITEM mi = { sizeof(mi) }; diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 9c89ba84a5..0548632126 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -140,8 +140,8 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_SETCURSEL, 0, 0); else { for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_GETCOUNT, 0, 0); i++) - if (SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_GETITEMDATA, (WPARAM)i, 0) == (LRESULT)sCodePage) - SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_SETCURSEL, (WPARAM)i, 0); + if (SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_GETITEMDATA, i, 0) == (LRESULT)sCodePage) + SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_SETCURSEL, i, 0); } CheckDlgButton(hwndDlg, IDC_FORCEANSI, M.GetByte(hContact, "forceansi", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_IGNORETIMEOUTS, M.GetByte(hContact, "no_ack", 0) ? BST_CHECKED : BST_UNCHECKED); @@ -153,32 +153,27 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_ALWAYSTRIM2: - Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM2)); - Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM2)); + Utils::enableDlgControl(hwndDlg, IDC_TRIMSPIN, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM2) != 0); + Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM2) != 0); break; case WM_USER + 100: TWindowData *dat = 0; DWORD *pdwActionToTake = (DWORD *)lParam; - int iIndex = CB_ERR, iMode = -1; - DWORD newCodePage; unsigned int iOldIEView = 0; HWND hWnd = M.FindWindow(hContact); DWORD sCodePage = M.GetDword(hContact, "ANSIcodepage", 0); - BYTE bInfoPanel, bOldInfoPanel = M.GetByte(hContact, "infopanel", 0); - BYTE bAvatarVisible = 0; + BYTE bOldInfoPanel = M.GetByte(hContact, "infopanel", 0); if (hWnd) { dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (dat) iOldIEView = GetIEViewMode(dat->hContact); } - iIndex = SendDlgItemMessage(hwndDlg, IDC_IEVIEWMODE, CB_GETCURSEL, 0, 0); - iMode = SendDlgItemMessage(hwndDlg, IDC_IEVIEWMODE, CB_GETITEMDATA, iIndex, 0); + int iIndex = SendDlgItemMessage(hwndDlg, IDC_IEVIEWMODE, CB_GETCURSEL, 0, 0); + int iMode = SendDlgItemMessage(hwndDlg, IDC_IEVIEWMODE, CB_GETITEMDATA, iIndex, 0); if (iIndex != CB_ERR && (iMode >= 0 && iMode <= 3)) { - unsigned int iNewIEView; - switch (iMode) { case 0: db_set_b(hContact, SRMSGMOD_T, "ieview", 0); @@ -198,7 +193,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, break; } if (hWnd && dat) { - iNewIEView = GetIEViewMode(dat->hContact); + unsigned int iNewIEView = GetIEViewMode(dat->hContact); if (iNewIEView != iOldIEView) { if (pdwActionToTake) *pdwActionToTake |= UPREF_ACTION_SWITCHLOGVIEWER; @@ -211,9 +206,11 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, else db_set_dw(hContact, SRMSGMOD_T, "sendformat", iIndex == 2 ? -1 : 1); } + iIndex = SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_GETCURSEL, 0, 0); - if ((newCodePage = (DWORD)SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_GETITEMDATA, (WPARAM)iIndex, 0)) != sCodePage) { - db_set_dw(hContact, SRMSGMOD_T, "ANSIcodepage", (DWORD)newCodePage); + DWORD newCodePage = (DWORD)SendDlgItemMessage(hwndDlg, IDC_CODEPAGES, CB_GETITEMDATA, iIndex, 0); + if (newCodePage != sCodePage) { + db_set_dw(hContact, SRMSGMOD_T, "ANSIcodepage", newCodePage); if (hWnd && dat) { dat->codePage = newCodePage; SendMessage(hWnd, DM_UPDATETITLE, 0, 1); @@ -228,8 +225,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, if (!M.GetByte(hContact, "isFavorite", 0)) AddContactToFavorites(hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuFavorites); } - else - DeleteMenu(PluginConfig.g_hMenuFavorites, (UINT_PTR)hContact, MF_BYCOMMAND); + else DeleteMenu(PluginConfig.g_hMenuFavorites, hContact, MF_BYCOMMAND); db_set_b(hContact, SRMSGMOD_T, "isFavorite", (WORD)(IsDlgButtonChecked(hwndDlg, IDC_ISFAVORITE) ? 1 : 0)); db_set_b(hContact, SRMSGMOD_T, "splitoverride", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PRIVATESPLITTER) ? 1 : 0)); @@ -237,13 +233,13 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(hContact, TEMPLATES_MODULE, "enabled", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_TEMPLOVERRIDE))); db_set_b(hContact, RTLTEMPLATES_MODULE, "enabled", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_RTLTEMPLOVERRIDE))); - bAvatarVisible = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SHOWAVATAR, CB_GETCURSEL, 0, 0); + BYTE bAvatarVisible = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SHOWAVATAR, CB_GETCURSEL, 0, 0); if (bAvatarVisible == 0) db_unset(hContact, SRMSGMOD_T, "hideavatar"); else db_set_b(hContact, SRMSGMOD_T, "hideavatar", (BYTE)(bAvatarVisible == 1 ? 1 : 0)); - bInfoPanel = (BYTE)SendDlgItemMessage(hwndDlg, IDC_INFOPANEL, CB_GETCURSEL, 0, 0); + BYTE bInfoPanel = (BYTE)SendDlgItemMessage(hwndDlg, IDC_INFOPANEL, CB_GETCURSEL, 0, 0); if (bInfoPanel != bOldInfoPanel) { db_set_b(hContact, SRMSGMOD_T, "infopanel", (BYTE)(bInfoPanel == 0 ? 0 : (bInfoPanel == 1 ? 1 : -1))); if (hWnd && dat) diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index d0c06d7821..5edd2a38b9 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -544,21 +544,21 @@ void Utils::RTF_ColorAdd(const TCHAR *tszColname, size_t length) rtf_ctable[rtf_ctable_size - 1].clr = (RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr))); } -void Utils::CreateColorMap(TCHAR *Text) +void Utils::CreateColorMap(CMString &Text) { - TCHAR *pszText = Text; + const TCHAR *pszText = Text; int iIndex = 1, i = 0; static const TCHAR *lpszFmt = _T("\\red%[^ \x5b\\]\\green%[^ \x5b\\]\\blue%[^ \x5b;];"); TCHAR szRed[10], szGreen[10], szBlue[10]; - TCHAR *p1 = _tcsstr(pszText, _T("\\colortbl")); + const TCHAR *p1 = _tcsstr(pszText, _T("\\colortbl")); if (!p1) return; - TCHAR *pEnd = _tcschr(p1, '}'); + const TCHAR *pEnd = _tcschr(p1, '}'); - TCHAR *p2 = _tcsstr(p1, _T("\\red")); + const TCHAR *p2 = _tcsstr(p1, _T("\\red")); for (i=0; i < RTF_CTABLE_DEFSIZE; i++) rtf_ctable[i].index = 0; @@ -577,7 +577,6 @@ void Utils::CreateColorMap(TCHAR *Text) p2 = _tcsstr(p1, _T("\\red")); } - return ; } int Utils::RTFColorToIndex(int iCol) @@ -880,7 +879,7 @@ int Utils::mustPlaySound(const TWindowData *dat) ///////////////////////////////////////////////////////////////////////////////////////// // enable or disable a dialog control -void Utils::enableDlgControl(const HWND hwnd, UINT id, BOOL fEnable) +void Utils::enableDlgControl(const HWND hwnd, UINT id, bool fEnable) { ::EnableWindow(::GetDlgItem(hwnd, id), fEnable); } diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index fd66f18cc5..f86e54b8b9 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -74,7 +74,7 @@ public: static LPCTSTR DoubleAmpersands(TCHAR *pszText); static void RTF_CTableInit(); static void RTF_ColorAdd(const TCHAR *tszColname, size_t length); - static void CreateColorMap(TCHAR *Text); + static void CreateColorMap(CMString &Text); static int RTFColorToIndex(int iCol); static int ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey = 0); static int WriteContainerSettingsToDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey = 0); @@ -87,7 +87,7 @@ public: static LRESULT CmdDispatcher(UINT uType, HWND hwndDlg, UINT cmd, WPARAM wParam, LPARAM lParam, TWindowData *dat = 0, TContainerData *pContainer = 0); static void addMenuItem(const HMENU& m, MENUITEMINFO& mii, HICON hIcon, const TCHAR *szText, UINT uID, UINT pos); - static void enableDlgControl(const HWND hwnd, UINT id, BOOL fEnable = 1); + static void enableDlgControl(const HWND hwnd, UINT id, bool fEnable = true); static void showDlgControl(const HWND hwnd, UINT id, int showCmd); static int mustPlaySound(const TWindowData *dat); static HICON iconFromAvatar(const TWindowData *dat); -- cgit v1.2.3