From 08d4acbb33f69c9bb0dcb4255785367f631c0e95 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 29 Oct 2019 18:54:58 +0300 Subject: rest of operational flags in tabSRMM moved to bool variables --- plugins/TabSRMM/src/contactcache.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 27 +++++----- plugins/TabSRMM/src/infopanel.cpp | 8 +-- plugins/TabSRMM/src/msgdialog.cpp | 78 ++++++++++++++--------------- plugins/TabSRMM/src/msgdlgother.cpp | 47 ++++++++--------- plugins/TabSRMM/src/msgdlgutils.cpp | 2 +- plugins/TabSRMM/src/msglog.cpp | 2 +- plugins/TabSRMM/src/msgs.h | 34 ++++--------- plugins/TabSRMM/src/sendqueue.cpp | 10 ++-- plugins/TabSRMM/src/sidebar.cpp | 2 +- plugins/TabSRMM/src/tabctrl.cpp | 4 +- plugins/TabSRMM/src/taskbar.cpp | 2 +- plugins/TabSRMM/src/themes.cpp | 4 +- 13 files changed, 100 insertions(+), 122 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 9298c79a03..b090a201b6 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -431,7 +431,7 @@ HICON CContactCache::getIcon(int &iSize) const if (!m_dat) return Skin_LoadProtoIcon(cc->szProto, getStatus()); - if (m_dat->m_dwFlags & MWF_ERRORSTATE) + if (m_dat->m_bErrorState) return PluginConfig.g_iconErr; if (m_dat->m_bCanFlashTab) return m_dat->m_iFlashIcon; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 243a3865e3..08c9ba6b91 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -257,8 +257,8 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara GetWindowRect(GetDlgItem(m_hwnd, IDC_PROTOCOL), &rc); - CheckMenuItem(submenu, ID_MODE_GLOBAL, MF_BYCOMMAND | (!(m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE) ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(submenu, ID_MODE_PRIVATE, MF_BYCOMMAND | (m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(submenu, ID_MODE_GLOBAL, MF_BYCOMMAND | (!m_bSplitterOverride ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(submenu, ID_MODE_PRIVATE, MF_BYCOMMAND | (m_bSplitterOverride ? MF_CHECKED : MF_UNCHECKED)); // formatting menu.. CheckMenuItem(submenu, ID_GLOBAL_BBCODE, MF_BYCOMMAND | ((PluginConfig.m_SendFormat) ? MF_CHECKED : MF_UNCHECKED)); @@ -271,7 +271,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); switch (iSelection) { case ID_MODE_GLOBAL: - m_dwFlagsEx &= ~(MWF_SHOW_SPLITTEROVERRIDE); + m_bSplitterOverride = false; db_set_b(m_hContact, SRMSGMOD_T, "splitoverride", 0); LoadSplitter(); AdjustBottomAvatarDisplay(); @@ -280,7 +280,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara break; case ID_MODE_PRIVATE: - m_dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE; + m_bSplitterOverride = true; db_set_b(m_hContact, SRMSGMOD_T, "splitoverride", 1); LoadSplitter(); AdjustBottomAvatarDisplay(); @@ -661,11 +661,11 @@ void CMsgDialog::DM_SetDBButtonStates() void CMsgDialog::DM_ScrollToBottom(WPARAM wParam, LPARAM lParam) { - if (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) + if (m_bScrollingDisabled) return; if (IsIconic(m_pContainer->m_hwnd)) - m_dwFlags |= MWF_DEFERREDSCROLL; + m_bDeferredScroll = true; if (m_iLogMode == 0) ((CLogWindow *)m_pLog)->ScrollToBottom(wParam != 0, lParam != 0); @@ -906,8 +906,7 @@ void CMsgDialog::DM_OptionsApplied(WPARAM, LPARAM lParam) m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY); m_bShowUIElements = (m_pContainer->m_flags.m_bHideToolbar) == 0; - - m_dwFlagsEx = M.GetByte(m_hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0; + m_bSplitterOverride = M.GetByte(m_hContact, "splitoverride", 0) != 0; m_pPanel.getVisibility(); // small inner margins (padding) for the text areas @@ -923,7 +922,7 @@ void CMsgDialog::DM_OptionsApplied(WPARAM, LPARAM lParam) InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); if (!lParam) { if (IsIconic(m_pContainer->m_hwnd)) - m_dwFlags |= MWF_DEFERREDREMAKELOG; + m_bDeferredRemakeLog = true; else RemakeLog(); } @@ -1029,7 +1028,7 @@ int CMsgDialog::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) LONG newPos; if (wParam == 0 && lParam == 0) { - if ((m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE) && this != srcDat) + if (m_bSplitterOverride && this != srcDat) return 0; if (srcDat->isChat() == isChat()) @@ -1056,7 +1055,7 @@ int CMsgDialog::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) // for inactive sessions, delay the splitter repositioning until they become // active (faster, avoid redraw/resize problems for minimized windows) if (IsIconic(m_pContainer->m_hwnd) || m_pContainer->m_hwndActive != m_hwnd) { - m_dwFlagsEx |= MWF_EX_DELAYEDSPLITTER; + m_bDelayedSplitter = true; m_wParam = newPos; m_lParam = PluginConfig.lastSPlitterPos.lParam; return 0; @@ -1134,7 +1133,7 @@ void CMsgDialog::DM_EventAdded(WPARAM hContact, LPARAM lParam) m_cache->updateStats(TSessionStats::UPDATE_WITH_LAST_RCV, 0); if (hDbEvent != m_hDbEventFirst) { - if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)) + if (!m_bScrollingDisabled) StreamEvents(hDbEvent, 1, 1); else { if (m_iNextQueuedEvent >= m_iEventQueueSize) { @@ -1366,7 +1365,7 @@ void CMsgDialog::DM_ErrorDetected(int type, int flag) switch (type) { case MSGERROR_CANCEL: case MSGERROR_SENDLATER: - if (m_dwFlags & MWF_ERRORSTATE) { + if (m_bErrorState) { m_cache->saveHistory(); if (type == MSGERROR_SENDLATER) sendQueue->doSendLater(m_iCurrentQueueError, this); // to be implemented at a later time @@ -1386,7 +1385,7 @@ void CMsgDialog::DM_ErrorDetected(int type, int flag) break; case MSGERROR_RETRY: - if (m_dwFlags & MWF_ERRORSTATE) { + if (m_bErrorState) { int resent = 0; m_cache->saveHistory(); diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 672920aaeb..8249f67bf9 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -775,7 +775,7 @@ void CInfoPanel::handleClick(const POINT& pt) if (!m_isChat) { ::KillTimer(m_dat->GetHwnd(), TIMERID_AWAYMSG); - m_dat->m_dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER; + m_dat->m_bAwayMsgTimer = false; } HMENU m = constructContextualMenu(); if (m) { @@ -845,15 +845,15 @@ void CInfoPanel::trackMouse(POINT &pt) } if (m_hoverFlags) { - if (!(m_dat->m_dwFlagsEx & MWF_SHOW_AWAYMSGTIMER)) { + if (!m_dat->m_bAwayMsgTimer) { ::SetTimer(m_dat->GetHwnd(), TIMERID_AWAYMSG, 1000, nullptr); - m_dat->m_dwFlagsEx |= MWF_SHOW_AWAYMSGTIMER; + m_dat->m_bAwayMsgTimer = true; } } if (dwOldHovering != m_hoverFlags) Invalidate(TRUE); if (m_hoverFlags == 0) - m_dat->m_dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER; + m_dat->m_bAwayMsgTimer = false; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index c316355f9f..f8143743a6 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -142,7 +142,7 @@ void CMsgDialog::SetDialogToType() m_message.Show(); - ShowMultipleControls(m_hwnd, errorControls, _countof(errorControls), m_dwFlags & MWF_ERRORSTATE ? SW_SHOW : SW_HIDE); + ShowMultipleControls(m_hwnd, errorControls, _countof(errorControls), m_bErrorState ? SW_SHOW : SW_HIDE); if (!m_SendFormat) ShowMultipleControls(m_hwnd, formatControls, _countof(formatControls), SW_HIDE); @@ -272,7 +272,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (selection) { case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY: - dat->m_dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE; + dat->m_bSplitterOverride = true; db_set_b(dat->m_hContact, SRMSGMOD_T, "splitoverride", 1); if (!dat->isChat()) dat->SaveSplitter(); @@ -412,7 +412,7 @@ bool CMsgDialog::OnInitDialog() m_cache->updateUIN(); m_cache->setWindowData(this); - m_bIsAutosizingInput = (m_pContainer->m_flags.m_bAutoSplitter) && !(m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE); + m_bIsAutosizingInput = m_pContainer->m_flags.m_bAutoSplitter && !m_bSplitterOverride; m_szProto = const_cast(m_cache->getProto()); m_bIsMeta = m_cache->isMeta(); if (m_bIsMeta) @@ -503,7 +503,7 @@ bool CMsgDialog::OnInitDialog() DM_InitTip(); - m_dwFlagsEx |= M.GetByte(m_hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0; + m_bSplitterOverride = M.GetByte(m_hContact, "splitoverride", 0) != 0; m_pPanel.getVisibility(); if (m_hContact) @@ -650,7 +650,7 @@ bool CMsgDialog::OnInitDialog() if (!isChat()) m_pContainer->SetIcon(this, Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); m_pContainer->m_flags.m_bNeedsUpdateTitle = true; - m_dwFlags |= MWF_NEEDCHECKSIZE | MWF_WASBACKGROUNDCREATE | MWF_DEFERREDSCROLL; + m_bWasBackgroundCreate = m_bNeedCheckSize = m_bDeferredScroll = true; } if (isChat()) { @@ -664,7 +664,7 @@ bool CMsgDialog::OnInitDialog() SetForegroundWindow(m_hwnd); } else if (m_pContainer->m_flags.m_bCreateMinimized) { - m_dwFlags |= MWF_DEFERREDSCROLL; + m_bDeferredScroll = true; ShowWindow(m_hwnd, SW_SHOWNOACTIVATE); m_pContainer->m_hwndActive = m_hwnd; m_pContainer->m_flags.m_bDeferredConfigure = true; @@ -678,7 +678,7 @@ bool CMsgDialog::OnInitDialog() if (m_iLogMode == WANT_HPP_LOG) mir_subclassWindow(m_pLog->GetHwnd(), HPPKFSubclassProc); - m_dwFlags &= ~MWF_INITMODE; + m_bInitMode = false; NotifyEvent(MSG_WINDOW_EVT_OPEN); if (m_pContainer->m_flags.m_bCreateMinimized) { @@ -926,7 +926,7 @@ void CMsgDialog::onClick_Add(CCtrlButton*) if (Contact_OnList(m_hContact)) { m_bNotOnList = false; ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_HIDE); - if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)) + if (!m_bScrollingDisabled) Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, SW_HIDE); Resize(); } @@ -1005,7 +1005,7 @@ void CMsgDialog::onClick_CancelAdd(CCtrlButton*) { m_bNotOnList = false; ShowMultipleControls(m_hwnd, addControls, _countof(addControls), SW_HIDE); - if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)) + if (!m_bScrollingDisabled) Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, SW_HIDE); Resize(); } @@ -1090,7 +1090,7 @@ void CMsgDialog::onChange_Message(CCtrlEdit*) m_nLastTyping = GetTickCount(); if (GetWindowTextLength(m_message.GetHwnd())) { if (m_nTypeMode == PROTOTYPE_SELFTYPING_OFF) { - if (!(m_dwFlags & MWF_INITMODE)) + if (!m_bInitMode) DM_NotifyTyping(PROTOTYPE_SELFTYPING_ON); } } @@ -1109,7 +1109,6 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) bool bNick = false; bool bInfoPanel = m_pPanel.isActive(); - bool bErrorState = (m_dwFlags & MWF_ERRORSTATE) != 0; bool bShowToolbar = (m_pContainer->m_flags.m_bHideToolbar) == 0; bool bBottomToolbar = (m_pContainer->m_flags.m_bBottomToolbar) != 0; @@ -1177,9 +1176,9 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; } - if (m_dwFlags & MWF_ERRORSTATE) + if (m_bErrorState) urc->rcItem.bottom -= ERRORPANEL_HEIGHT; - if (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || m_bNotOnList) + if (m_bScrollingDisabled || m_bNotOnList) urc->rcItem.bottom -= 20; if (m_sendMode & SMODE_MULTIPLE) urc->rcItem.right -= (m_iMultiSplit + 3); @@ -1353,9 +1352,9 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) case IDC_RETRY: case IDC_CANCELSEND: case IDC_MSGSENDLATER: - if (bErrorState) { - urc->rcItem.bottom = msgTop - 5 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0); - urc->rcItem.top = msgTop - 25 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0); + if (m_bErrorState) { + urc->rcItem.bottom = msgTop - 5 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_bScrollingDisabled) ? 20 : 0); + urc->rcItem.top = msgTop - 25 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_bScrollingDisabled) ? 20 : 0); } if (!bShowToolbar && !bBottomToolbar) { urc->rcItem.bottom += 21; @@ -1365,9 +1364,9 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) case IDC_STATICTEXT: case IDC_STATICERRORICON: - if (bErrorState) { - urc->rcItem.bottom = msgTop - 28 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0); - urc->rcItem.top = msgTop - 45 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0); + if (m_bErrorState) { + urc->rcItem.bottom = msgTop - 28 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_bScrollingDisabled) ? 20 : 0); + urc->rcItem.top = msgTop - 45 - (bBottomToolbar ? 0 : 28) - ((m_bNotOnList || m_bScrollingDisabled) ? 20 : 0); } if (!bShowToolbar && !bBottomToolbar) { urc->rcItem.bottom += 21; @@ -1581,11 +1580,11 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) if (msg == WM_KEYDOWN && wp == VK_F12) { if (isShift || isCtrl || isAlt) return _dlgReturn(m_hwnd, 1); - if (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) + if (m_bScrollingDisabled) ReplayQueue(); - m_dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED; - Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, (m_bNotOnList || m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? SW_SHOW : SW_HIDE); - if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)) + m_bScrollingDisabled = !m_bScrollingDisabled; + Utils::showDlgControl(m_hwnd, IDC_LOGFROZENTEXT, (m_bNotOnList || m_bScrollingDisabled) ? SW_SHOW : SW_HIDE); + if (!m_bScrollingDisabled) SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it...")); else SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, TranslateT("Auto scrolling is disabled (press F12 to enable it)")); @@ -2734,7 +2733,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case DM_FORCEDREMAKELOG: m_dwFlags &= ~(MWF_LOG_ALL); m_dwFlags |= (lParam & MWF_LOG_ALL); - m_dwFlags |= MWF_DEFERREDREMAKELOG; + m_bDeferredRemakeLog = true; return 0; case DM_APPENDMCEVENT: @@ -2762,7 +2761,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (wParam == TIMERID_AWAYMSG && m_pPanel.hitTest(pt) != CInfoPanel::HTNIRVANA) ActivateTooltip(0, 0); else - m_dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER; + m_bAwayMsgTimer = false; break; } @@ -2777,7 +2776,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) job->iStatus = SendQueue::SQ_ERROR; if (!nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound) Skin_PlaySound("SendError"); - if (!(m_dwFlags & MWF_ERRORSTATE)) + if (!m_bErrorState) sendQueue->handleError(this, iIndex); break; } @@ -2810,20 +2809,20 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case DM_SAVESIZE: - if (m_dwFlags & MWF_NEEDCHECKSIZE) + if (m_bNeedCheckSize) lParam = 0; - m_dwFlags &= ~MWF_NEEDCHECKSIZE; - if (m_dwFlags & MWF_WASBACKGROUNDCREATE) { - m_dwFlags &= ~MWF_INITMODE; + m_bNeedCheckSize = false; + if (m_bWasBackgroundCreate) { + m_bInitMode = false; if (m_lastMessage) DM_UpdateLastMessage(); } SendMessage(m_pContainer->m_hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient); MoveWindow(m_hwnd, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), TRUE); - if (m_dwFlags & MWF_WASBACKGROUNDCREATE) { - m_dwFlags &= ~MWF_WASBACKGROUNDCREATE; + if (m_bWasBackgroundCreate) { + m_bWasBackgroundCreate = false; Resize(); PostMessage(m_hwnd, DM_UPDATEPICLAYOUT, 0, 0); @@ -3066,7 +3065,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case WM_NEXTDLGCTL: - if (m_dwFlags & MWF_WASBACKGROUNDCREATE) + if (m_bWasBackgroundCreate) return 1; break; @@ -3186,7 +3185,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) // usual close, not forced if (wParam == 0 && lParam == 0) { // esc handles error controls if we are in error state (error controls visible) - if (m_dwFlags & MWF_ERRORSTATE) { + if (m_bErrorState) { DM_ErrorDetected(MSGERROR_CANCEL, 0); return TRUE; } @@ -3211,16 +3210,15 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } if (m_iOpenJobs > 0 && lParam != 2) { - if (m_dwFlags & MWF_ERRORSTATE) { + if (m_bErrorState) DM_ErrorDetected(MSGERROR_CANCEL, 1); - } else { - if (m_dwFlagsEx & MWF_EX_WARNCLOSE) + if (m_bWarnClose) return TRUE; - m_dwFlagsEx |= MWF_EX_WARNCLOSE; + m_bWarnClose = true; LRESULT result = SendQueue::WarnPendingJobs(0); - m_dwFlagsEx &= ~MWF_EX_WARNCLOSE; + m_bWarnClose = false; if (result == IDNO) return TRUE; } @@ -3286,7 +3284,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case DM_CHECKSIZE: - m_dwFlags |= MWF_NEEDCHECKSIZE; + m_bNeedCheckSize = true; return 0; case DM_CONTAINERSELECTED: diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 9d157111b2..4e4760bce7 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -89,7 +89,7 @@ void CMsgDialog::AdjustBottomAvatarDisplay() void CMsgDialog::CalcDynamicAvatarSize(BITMAP *bminfo) { - if (m_dwFlags & MWF_WASBACKGROUNDCREATE || m_pContainer->m_flags.m_bDeferredConfigure || m_pContainer->m_flags.m_bCreateMinimized || IsIconic(m_pContainer->m_hwnd)) + if (m_bWasBackgroundCreate || m_pContainer->m_flags.m_bDeferredConfigure || m_pContainer->m_flags.m_bCreateMinimized || IsIconic(m_pContainer->m_hwnd)) return; // at this stage, the layout is not yet ready... RECT rc; @@ -535,7 +535,7 @@ void CMsgDialog::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei) if (!PluginConfig.m_bFlashOnClist) return; - if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE && !(m_dwFlagsEx & MWF_SHOW_FLASHCLIST)) { + if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE && !m_bFlashClist) { CLISTEVENT cle = {}; cle.hContact = m_hContact; cle.hDbEvent = hEvent; @@ -543,7 +543,7 @@ void CMsgDialog::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei) cle.pszService = MS_MSG_READMESSAGE; g_clistApi.pfnAddEvent(&cle); - m_dwFlagsEx |= MWF_SHOW_FLASHCLIST; + m_bFlashClist = true; m_hFlashingEvent = hEvent; } } @@ -842,7 +842,7 @@ void CMsgDialog::LoadSplitter() return; } - if (!(m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE)) { + if (!m_bSplitterOverride) { if (!m_pContainer->m_pSettings->fPrivate) m_iSplitterY = (int)M.GetDword("splitsplity", 60); else @@ -1307,7 +1307,7 @@ void CMsgDialog::SaveSplitter() if (m_iSplitterY < DPISCALEY_S(MINSPLITTERY) || m_iSplitterY < 0) m_iSplitterY = DPISCALEY_S(MINSPLITTERY); - if (m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE) + if (m_bSplitterOverride) db_set_dw(m_hContact, SRMSGMOD_T, "splitsplity", m_iSplitterY); else { if (m_pContainer->m_pSettings->fPrivate) @@ -1529,7 +1529,7 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) if (pCtrl.GetCtrlId() == IDC_SRMM_LOG) { InsertMenuA(hSubMenu, 6, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr); - CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (m_bScrollingDisabled ? MF_CHECKED : MF_UNCHECKED)); } MessageWindowPopupData mwpd; @@ -1930,16 +1930,16 @@ void CMsgDialog::UpdateSaveAndSendButton() EnableSendButton(false); if (len) { // looks complex but avoids flickering on the button while typing. - if (!(m_dwFlags & MWF_SAVEBTN_SAV)) { + if (!m_bSaveBtn) { SendDlgItemMessage(m_hwnd, IDC_CLOSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_SAVE]); SendDlgItemMessage(m_hwnd, IDC_CLOSE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Save and close session"), BATF_UNICODE); - m_dwFlags |= MWF_SAVEBTN_SAV; + m_bSaveBtn = true; } } else { SendDlgItemMessage(m_hwnd, IDC_CLOSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]); SendDlgItemMessage(m_hwnd, IDC_CLOSE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Close session"), BATF_UNICODE); - m_dwFlags &= ~MWF_SAVEBTN_SAV; + m_bSaveBtn = false; } m_textLen = len; } @@ -2074,7 +2074,7 @@ void CMsgDialog::UpdateTitle() bool bHasName = (m_cache->getUIN()[0] != 0); m_idle = m_cache->getIdleTS(); - m_dwFlagsEx = m_idle ? m_dwFlagsEx | MWF_SHOW_ISIDLE : m_dwFlagsEx & ~MWF_SHOW_ISIDLE; + m_bIsIdle = m_idle != 0; m_wStatus = m_cache->getStatus(); wcsncpy_s(m_wszStatus, Clist_GetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE); @@ -2169,7 +2169,7 @@ void CMsgDialog::UpdateWindowIcon() if (M.GetByte("use_xicons", 1)) m_hXStatusIcon = GetXStatusIcon(); - SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BUTTONSETASDIMMED, (m_dwFlagsEx & MWF_SHOW_ISIDLE) != 0, 0); + SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BUTTONSETASDIMMED, m_bIsIdle, 0); SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(m_hXStatusIcon ? m_hXStatusIcon : GetMyContactIcon("MetaiconBar"))); if (m_pContainer->m_hwndActive == m_hwnd) @@ -2251,7 +2251,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_pContainer->m_flags.m_bNeedsUpdateTitle = false; - if (m_dwFlags & MWF_NEEDCHECKSIZE) + if (m_bNeedCheckSize) PostMessage(m_hwnd, DM_SAVESIZE, 0, 0); SetFocus(m_message.GetHwnd()); @@ -2266,20 +2266,20 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_bCanFlashTab = false; } - if (m_dwFlagsEx & MWF_SHOW_FLASHCLIST) { - m_dwFlagsEx &= ~MWF_SHOW_FLASHCLIST; + if (m_bFlashClist) { + m_bFlashClist = false; if (m_hFlashingEvent != 0) g_clistApi.pfnRemoveEvent(m_hContact, m_hFlashingEvent); m_hFlashingEvent = 0; } m_pContainer->m_flags.m_bNeedsUpdateTitle = false; - if ((m_dwFlags & MWF_DEFERREDREMAKELOG) && !IsIconic(m_pContainer->m_hwnd)) { + if (m_bDeferredRemakeLog && !IsIconic(m_pContainer->m_hwnd)) { RemakeLog(); - m_dwFlags &= ~MWF_DEFERREDREMAKELOG; + m_bDeferredRemakeLog = false; } - if (m_dwFlags & MWF_NEEDCHECKSIZE) + if (m_bNeedCheckSize) PostMessage(m_hwnd, DM_SAVESIZE, 0, 0); m_pContainer->m_hIconTaskbarOverlay = nullptr; @@ -2297,8 +2297,8 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_pPanel.Invalidate(); - if (m_dwFlags & MWF_DEFERREDSCROLL) { - m_dwFlags &= ~MWF_DEFERREDSCROLL; + if (m_bDeferredScroll) { + m_bDeferredScroll = false; DM_ScrollToBottom(0, 1); } @@ -2320,17 +2320,12 @@ void CMsgDialog::UpdateWindowState(UINT msg) RedrawWindow(hwndLog, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); } } - - if (m_dwFlagsEx & MWF_EX_AVATARCHANGED) { - m_dwFlagsEx &= ~MWF_EX_AVATARCHANGED; - PostMessage(m_hwnd, DM_UPDATEPICLAYOUT, 0, 0); - } } DM_SetDBButtonStates(); - if (m_dwFlagsEx & MWF_EX_DELAYEDSPLITTER) { - m_dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER; + if (m_bDelayedSplitter) { + m_bDelayedSplitter = false; ShowWindow(m_pContainer->m_hwnd, SW_RESTORE); PostMessage(m_hwnd, DM_SPLITTERGLOBALEVENT, m_wParam, m_lParam); PostMessage(m_hwnd, WM_SIZE, 0, 0); diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index e369c32818..dca0a1a8db 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -213,7 +213,7 @@ void TSAPI HandleIconFeedback(CMsgDialog *dat, HICON iIcon) TCITEM item = {}; if (iIcon == (HICON)-1) { // restore status image - if (dat->m_dwFlags & MWF_ERRORSTATE) + if (dat->m_bErrorState) dat->m_hTabIcon = PluginConfig.g_iconErr; else dat->m_hTabIcon = dat->m_hTabStatusIcon; diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index fe3b57a980..20df0dfbe8 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1625,7 +1625,7 @@ void CLogWindow::UpdateOptions() PARAFORMAT2 pf2; pf2.wEffects = PFE_RTLPARA; pf2.dwMask |= PFM_OFFSET; - if (m_pDlg.m_dwFlags & MWF_INITMODE) { + if (m_pDlg.m_bInitMode) { pf2.dwMask |= (PFM_RIGHTINDENT | PFM_OFFSETINDENT); pf2.dxStartIndent = 30; pf2.dxRightIndent = 30; diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 7c1ac4653d..792a4d83ff 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -40,14 +40,6 @@ #define CONTAINER_NAMELEN 25 #define TITLE_FORMATLEN 30 -#define MWF_SAVEBTN_SAV 2 - -#define MWF_DEFERREDSCROLL 4 -#define MWF_WASBACKGROUNDCREATE 16 -//#define MWF_MOUSEDOWN 32 -#define MWF_ERRORSTATE 128 -#define MWF_DEFERREDREMAKELOG 256 - #define MWF_LOG_NORMALTEMPLATES 512 #define MWF_LOG_SHOWTIME 1024 #define MWF_LOG_SHOWSECONDS 2048 @@ -66,26 +58,13 @@ #define MWF_LOG_SHOWICONS 262144 #define MWF_LOG_SYMBOLS 0x200000 -#define MWF_INITMODE 0x400000 -#define MWF_NEEDCHECKSIZE 0x800000 #define MWF_DIVIDERSET 0x1000000 #define MWF_LOG_TEXTFORMAT 0x2000000 #define MWF_LOG_GRID 0x4000000 -// #define MWF_LOG_INDIVIDUALBKG 0x8000000 * FREE * #define MWF_LOG_INOUTICONS 0x10000000 -#define MWF_SMBUTTONSELECTED 0x20000000 #define MWF_DIVIDERWANTED 0x40000000 #define MWF_LOG_GROUPMODE 0x80000000 -#define MWF_SHOW_FLASHCLIST 64 -#define MWF_SHOW_SPLITTEROVERRIDE 128 -#define MWF_SHOW_SCROLLINGDISABLED 256 -#define MWF_SHOW_ISIDLE 4096 -#define MWF_SHOW_AWAYMSGTIMER 8192 -#define MWF_EX_DELAYEDSPLITTER 32768 -#define MWF_EX_AVATARCHANGED 65536 -#define MWF_EX_WARNCLOSE 0x20000 - #define SMODE_DEFAULT 0 #define SMODE_MULTIPLE 1 #define SMODE_CONTAINER 2 @@ -440,11 +419,15 @@ class CMsgDialog : public CSrmmBaseDialog bool m_bStatusSet; bool m_bShowInfoAvatar, m_bShowUIElements; + bool m_bFlashClist, m_bScrollingDisabled, m_bAwayMsgTimer; + bool m_bDelayedSplitter, m_bWarnClose; bool m_bUseOffset; bool m_bkeyProcessed; bool m_fLimitedUpdate; bool m_bClrAdded; - bool m_bInsertMode; + bool m_bInsertMode, m_bInitMode = true; + bool m_bDeferredScroll, m_bDeferredRemakeLog; + bool m_bWasBackgroundCreate; MEVENT *m_hQueuedEvents; int m_iNextQueuedEvent; @@ -476,17 +459,20 @@ public: char *m_szProto; int m_iTabID; BYTE m_bShowTyping; - bool m_bIsHistory, m_bNotOnList; + bool m_bIsHistory, m_bNotOnList, m_bIsIdle; bool m_bActualHistory; bool m_bIsAutosizingInput; bool m_bCanFlashTab, m_bTabFlash; bool m_bEditNotesActive; bool m_bShowAvatar; + bool m_bSaveBtn, m_bNeedCheckSize; + bool m_bErrorState; + bool m_bSplitterOverride; int m_sendMode; HKL m_hkl; // keyboard layout identifier DWORD m_isAutoRTL; DWORD m_idle; - DWORD m_dwFlags = MWF_INITMODE, m_dwFlagsEx; + DWORD m_dwFlags; DWORD m_dwUnread; HANDLE m_hTheme, m_hThemeIP, m_hThemeToolbar; HICON m_hXStatusIcon, m_hTabStatusIcon, m_hTabIcon, m_iFlashIcon, m_hTaskbarIcon, m_hClientIcon; diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index d00e26df28..67436718c8 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -378,10 +378,10 @@ void SendQueue::showErrorControls(CMsgDialog *dat, const int showCmd) const item.mask = TCIF_IMAGE; item.iImage = 0; TabCtrl_SetItem(GetDlgItem(dat->m_pContainer->m_hwnd, IDC_MSGTABS), dat->m_iTabID, &item); - dat->m_dwFlags |= MWF_ERRORSTATE; + dat->m_bErrorState = true; } else { - dat->m_dwFlags &= ~MWF_ERRORSTATE; + dat->m_bErrorState = false; dat->m_hTabIcon = dat->m_hTabStatusIcon; } @@ -447,7 +447,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), (wchar_t*)ack->lParam); job.iStatus = SQ_ERROR; KillTimer(dat->GetHwnd(), TIMERID_MSGSEND + iFound); - if (!(dat->m_dwFlags & MWF_ERRORSTATE)) + if (!dat->m_bErrorState) handleError(dat, iFound); return 0; } @@ -505,7 +505,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) checkQueue(dat); int iNextFailed = findNextFailed(dat); - if (iNextFailed >= 0 && !(dat->m_dwFlags & MWF_ERRORSTATE)) + if (iNextFailed >= 0 && !dat->m_bErrorState) handleError(dat, iNextFailed); else { if (M.GetByte("AutoClose", 0)) { @@ -567,7 +567,7 @@ int SendQueue::doSendLater(int iJobIndex, CMsgDialog *dat, MCONTACT hContact, bo dat->UpdateReadChars(); SendDlgItemMessage(dat->GetHwnd(), IDC_CLOSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]); SendDlgItemMessage(dat->GetHwnd(), IDC_CLOSE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Close session"), BATF_UNICODE); - dat->m_dwFlags &= ~MWF_SAVEBTN_SAV; + dat->m_bSaveBtn = false; if (!fAvail) return 0; diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index a244a616a1..4a541e5763 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -258,7 +258,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !pContainer->m_flagsEx.m_bTabFlashIcon) { DWORD ix = rc.left + 4; DWORD iy = (rc.bottom + rc.top - iSize) / 2; - if (m_dat->m_dwFlagsEx & MWF_SHOW_ISIDLE && PluginConfig.m_bIdleDetect) + if (m_dat->m_bIsIdle && PluginConfig.m_bIdleDetect) CSkin::DrawDimmedIcon(hdc, ix, iy, iSize, iSize, hIcon, 180); else ::DrawIconEx(hdc, ix, iy, hIcon, iSize, iSize, 0, nullptr, DI_NORMAL | DI_COMPAT); diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 1356f16061..0c6088fab3 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -177,7 +177,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in int iSize = 16; HICON hIcon; - if (dat->m_dwFlags & MWF_ERRORSTATE) + if (dat->m_bErrorState) hIcon = PluginConfig.g_iconErr; else if (dat->m_bCanFlashTab) hIcon = dat->m_iFlashIcon; @@ -197,7 +197,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !dat->m_pContainer->m_flagsEx.m_bTabFlashIcon) { DWORD ix = rcItem->left + tabdat->xpad - 1; DWORD iy = (rcItem->bottom + rcItem->top - iSize) / 2; - if (dat->m_dwFlagsEx & MWF_SHOW_ISIDLE && PluginConfig.m_bIdleDetect) + if (dat->m_bIsIdle && PluginConfig.m_bIdleDetect) CSkin::DrawDimmedIcon(dc, ix, iy, iSize, iSize, hIcon, 180); else DrawIconEx(dc, ix, iy, hIcon, iSize, iSize, 0, nullptr, DI_NORMAL | DI_COMPAT); diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index e7e0f82811..29744d0009 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -278,7 +278,7 @@ void CProxyWindow::sendPreview() HWND hwndRich = m_dat->m_pLog->GetHwnd(); POINT ptOrigin = { 0 }, ptBottom; - if (m_dat->m_dwFlags & MWF_NEEDCHECKSIZE) { + if (m_dat->m_bNeedCheckSize) { RECT rcClient; ::SendMessage(m_dat->m_pContainer->m_hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient); ::MoveWindow(m_dat->GetHwnd(), rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), FALSE); diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 1c66588e34..4d37fb3a8f 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2163,9 +2163,9 @@ void CMsgDialog::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const rcToolbar.right = rcWindow.right; if (!isChat()) { - if (m_dwFlags & MWF_ERRORSTATE) + if (m_bErrorState) rcToolbar.top += ERRORPANEL_HEIGHT; - if (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || m_bNotOnList) { + if (m_bScrollingDisabled || m_bNotOnList) { rcToolbar.top += 20; RECT rcAdd; rcAdd.left = 0; rcAdd.right = rcToolbar.right - rcToolbar.left; -- cgit v1.2.3