From bd276bf08cc7ae0c2c9be6b0c202047fede7c704 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 29 Dec 2014 09:19:14 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@11665 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/mim.cpp | 4 +- plugins/TabSRMM/src/msgdialog.cpp | 189 +++++++++++++++++++------------------- plugins/TabSRMM/src/msglog.cpp | 13 +-- 3 files changed, 102 insertions(+), 104 deletions(-) diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 03bac72347..9834df89ae 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -169,10 +169,10 @@ void CMimAPI::InitPaths() bool CMimAPI::getAeroState() { - BOOL result = FALSE; m_isAero = m_DwmActive = false; if (IsWinVerVistaPlus()) { - m_DwmActive = (m_pfnDwmIsCompositionEnabled && (m_pfnDwmIsCompositionEnabled(&result) == S_OK) && result) ? true : false; + BOOL result = FALSE; + m_DwmActive = (m_pfnDwmIsCompositionEnabled && (m_pfnDwmIsCompositionEnabled(&result) == S_OK) && result); m_isAero = (CSkin::m_skinEnabled == false) && GetByte("useAero", 1) && CSkin::m_fAeroSkinsValid && m_DwmActive; } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index b7ffc7873a..ef2e85a2d3 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -285,122 +285,123 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP static void MsgWindowUpdateState(TWindowData *dat, UINT msg) { - if (dat && dat->iTabID >= 0) { - HWND hwndDlg = dat->hwnd; - HWND hwndTab = GetParent(hwndDlg); + if (dat == NULL || dat->iTabID < 0) + return; - if (msg == WM_ACTIVATE) { - if (dat->pContainer->dwFlags & CNT_TRANSPARENCY) { - DWORD trans = LOWORD(dat->pContainer->settings->dwTransparency); - SetLayeredWindowAttributes(dat->pContainer->hwnd, 0, (BYTE)trans, (dat->pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); - } - } + HWND hwndDlg = dat->hwnd; + HWND hwndTab = GetParent(hwndDlg); - if (dat->bIsAutosizingInput && dat->iInputAreaHeight == -1) { - dat->iInputAreaHeight = 0; - SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0); + if (msg == WM_ACTIVATE) { + if (dat->pContainer->dwFlags & CNT_TRANSPARENCY) { + DWORD trans = LOWORD(dat->pContainer->settings->dwTransparency); + SetLayeredWindowAttributes(dat->pContainer->hwnd, 0, (BYTE)trans, (dat->pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); } + } - if (dat->pWnd) - dat->pWnd->activateTab(); - dat->Panel->dismissConfig(); - dat->dwUnread = 0; - if (dat->pContainer->hwndSaved == hwndDlg) - return; + if (dat->bIsAutosizingInput && dat->iInputAreaHeight == -1) { + dat->iInputAreaHeight = 0; + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0); + } - dat->pContainer->hwndSaved = hwndDlg; + if (dat->pWnd) + dat->pWnd->activateTab(); + dat->Panel->dismissConfig(); + dat->dwUnread = 0; + if (dat->pContainer->hwndSaved == hwndDlg) + return; - dat->dwTickLastEvent = 0; - dat->dwFlags &= ~MWF_DIVIDERSET; - if (KillTimer(hwndDlg, TIMERID_FLASHWND)) { - FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, FALSE, dat->hTabIcon); - dat->mayFlashTab = FALSE; - } - if (dat->pContainer->dwFlashingStarted != 0) { - FlashContainer(dat->pContainer, 0, 0); - dat->pContainer->dwFlashingStarted = 0; - } - if (dat->dwFlagsEx & MWF_SHOW_FLASHCLIST) { - dat->dwFlagsEx &= ~MWF_SHOW_FLASHCLIST; - if (dat->hFlashingEvent != 0) - CallService(MS_CLIST_REMOVEEVENT, dat->hContact, (LPARAM)dat->hFlashingEvent); - dat->hFlashingEvent = 0; - } - dat->pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE; + dat->pContainer->hwndSaved = hwndDlg; - if (dat->dwFlags & MWF_DEFERREDREMAKELOG) { - SendMessage(hwndDlg, DM_REMAKELOG, 0, 0); - dat->dwFlags &= ~MWF_DEFERREDREMAKELOG; - } + dat->dwTickLastEvent = 0; + dat->dwFlags &= ~MWF_DIVIDERSET; + if (KillTimer(hwndDlg, TIMERID_FLASHWND)) { + FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, FALSE, dat->hTabIcon); + dat->mayFlashTab = FALSE; + } + if (dat->pContainer->dwFlashingStarted != 0) { + FlashContainer(dat->pContainer, 0, 0); + dat->pContainer->dwFlashingStarted = 0; + } + if (dat->dwFlagsEx & MWF_SHOW_FLASHCLIST) { + dat->dwFlagsEx &= ~MWF_SHOW_FLASHCLIST; + if (dat->hFlashingEvent != 0) + CallService(MS_CLIST_REMOVEEVENT, dat->hContact, (LPARAM)dat->hFlashingEvent); + dat->hFlashingEvent = 0; + } + dat->pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE; - if (dat->dwFlags & MWF_NEEDCHECKSIZE) - PostMessage(hwndDlg, DM_SAVESIZE, 0, 0); + if (dat->dwFlags & MWF_DEFERREDREMAKELOG) { + SendMessage(hwndDlg, DM_REMAKELOG, 0, 0); + dat->dwFlags &= ~MWF_DEFERREDREMAKELOG; + } - if (PluginConfig.m_bAutoLocaleSupport) { - if (dat->hkl == 0) - DM_LoadLocale(dat); - else - SendMessage(hwndDlg, DM_SETLOCALE, 0, 0); - } + if (dat->dwFlags & MWF_NEEDCHECKSIZE) + PostMessage(hwndDlg, DM_SAVESIZE, 0, 0); + + if (PluginConfig.m_bAutoLocaleSupport) { + if (dat->hkl == 0) + DM_LoadLocale(dat); + else + SendMessage(hwndDlg, DM_SETLOCALE, 0, 0); + } - dat->pContainer->hIconTaskbarOverlay = 0; - SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0); + dat->pContainer->hIconTaskbarOverlay = 0; + SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0); - UpdateStatusBar(dat); - dat->dwLastActivity = GetTickCount(); - dat->pContainer->dwLastActivity = dat->dwLastActivity; + UpdateStatusBar(dat); + dat->dwLastActivity = GetTickCount(); + dat->pContainer->dwLastActivity = dat->dwLastActivity; - dat->pContainer->MenuBar->configureMenu(); - UpdateTrayMenuState(dat, FALSE); + dat->pContainer->MenuBar->configureMenu(); + UpdateTrayMenuState(dat, FALSE); - if (dat->pContainer->hwndActive == hwndDlg) - PostMessage(hwndDlg, DM_REMOVEPOPUPS, PU_REMOVE_ON_FOCUS, 0); + if (dat->pContainer->hwndActive == hwndDlg) + PostMessage(hwndDlg, DM_REMOVEPOPUPS, PU_REMOVE_ON_FOCUS, 0); - dat->Panel->Invalidate(); + dat->Panel->Invalidate(); - if (dat->dwFlags & MWF_DEFERREDSCROLL && dat->hwndIEView == 0 && dat->hwndHPP == 0) - DM_ScrollToBottom(dat, 0, 1); + if (dat->dwFlags & MWF_DEFERREDSCROLL && dat->hwndIEView == 0 && dat->hwndHPP == 0) + DM_ScrollToBottom(dat, 0, 1); - DM_SetDBButtonStates(hwndDlg, dat); + DM_SetDBButtonStates(hwndDlg, dat); - if (dat->hwndIEView) { - RECT rcRTF; - POINT pt; + if (dat->hwndIEView) { + RECT rcRTF; + POINT pt; - GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcRTF); - rcRTF.left += 20; - rcRTF.top += 20; - pt.x = rcRTF.left; - pt.y = rcRTF.top; - if (dat->hwndIEView) { - if (M.GetByte("subclassIEView", 0)) { - mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc); - SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME); - RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); - } + GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcRTF); + rcRTF.left += 20; + rcRTF.top += 20; + pt.x = rcRTF.left; + pt.y = rcRTF.top; + if (dat->hwndIEView) { + if (M.GetByte("subclassIEView", 0)) { + mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc); + SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME); + RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); } - dat->hwndIWebBrowserControl = WindowFromPoint(pt); - } - - if (dat->dwFlagsEx & MWF_EX_DELAYEDSPLITTER) { - dat->dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER; - ShowWindow(dat->pContainer->hwnd, SW_RESTORE); - PostMessage(hwndDlg, DM_SPLITTERGLOBALEVENT, dat->wParam, dat->lParam); - dat->wParam = dat->lParam = 0; } - if (dat->dwFlagsEx & MWF_EX_AVATARCHANGED) { - dat->dwFlagsEx &= ~MWF_EX_AVATARCHANGED; - PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0); - } - BB_SetButtonsPos(dat); - if (M.isAero()) - InvalidateRect(hwndTab, NULL, FALSE); - if (dat->pContainer->dwFlags & CNT_SIDEBAR) - dat->pContainer->SideBar->setActiveItem(dat); + dat->hwndIWebBrowserControl = WindowFromPoint(pt); + } - if (dat->pWnd) - dat->pWnd->Invalidate(); + if (dat->dwFlagsEx & MWF_EX_DELAYEDSPLITTER) { + dat->dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER; + ShowWindow(dat->pContainer->hwnd, SW_RESTORE); + PostMessage(hwndDlg, DM_SPLITTERGLOBALEVENT, dat->wParam, dat->lParam); + dat->wParam = dat->lParam = 0; + } + if (dat->dwFlagsEx & MWF_EX_AVATARCHANGED) { + dat->dwFlagsEx &= ~MWF_EX_AVATARCHANGED; + PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0); } + BB_SetButtonsPos(dat); + if (M.isAero()) + InvalidateRect(hwndTab, NULL, FALSE); + if (dat->pContainer->dwFlags & CNT_SIDEBAR) + dat->pContainer->SideBar->setActiveItem(dat); + + if (dat->pWnd) + dat->pWnd->Invalidate(); } void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state) diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index c9cd26d520..51ee2d523a 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1205,7 +1205,6 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp { TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CHARRANGE oldSel, sel; - POINT pt = { 0 }; // calc time limit for grouping HWND hwndrtf = dat->hwndIEView ? dat->hwndIWebBrowserControl : GetDlgItem(hwndDlg, IDC_LOG); @@ -1335,8 +1334,6 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp gtxl.codepage = 1200; gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS; - PARAFORMAT2 pf2; - memset(&pf2, 0, sizeof(PARAFORMAT2)); sel.cpMax = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); sel.cpMin = sel.cpMax - 1; SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel); @@ -1369,12 +1366,12 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp // NLS functions (for unicode version only) encoding stuff.. static BOOL CALLBACK LangAddCallback(LPTSTR str) { - int i, count; UINT cp = _ttoi(str); - count = SIZEOF(cpTable); - for (i = 0; i < count && cpTable[i].cpId != cp; i++); - if (i < count) - AppendMenu(PluginConfig.g_hMenuEncoding, MF_STRING, cp, TranslateTS(cpTable[i].cpName)); + for (int i = 0; i < SIZEOF(cpTable); i++) + if (cpTable[i].cpId == cp) { + AppendMenu(PluginConfig.g_hMenuEncoding, MF_STRING, cp, TranslateTS(cpTable[i].cpName)); + break; + } return TRUE; } -- cgit v1.2.3