diff options
author | George Hazan <ghazan@miranda.im> | 2019-10-29 15:27:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-10-29 15:27:58 +0300 |
commit | 386efd14b629c5d9cf383653936cce5861e6c7a9 (patch) | |
tree | 1c3e456a58afe9f2e9fc745382a7b0f97d9d3f59 /plugins/TabSRMM | |
parent | 3726509beeceda60e3e34d2d41db1f05c5dc46a7 (diff) |
tabSRMM: get rid of manual bit operations
Diffstat (limited to 'plugins/TabSRMM')
24 files changed, 442 insertions, 438 deletions
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 9406bca6c6..6056f0a1ee 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -204,8 +204,8 @@ BOOL CMsgDialog::BB_SetButtonsPos() return 0; BYTE gap = DPISCALEX_S(g_plugin.getByte("ButtonsBarGap", 1)); - bool showToolbar = !(m_pContainer->m_dwFlags & CNT_HIDETOOLBAR); - bool bBottomToolbar = (m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR) != 0; + bool showToolbar = !m_pContainer->m_flags.m_bHideToolbar; + bool bBottomToolbar = m_pContainer->m_flags.m_bBottomToolbar; HWND hwndToggleSideBar = GetDlgItem(m_hwnd, IDC_TOGGLESIDEBAR); ShowWindow(hwndToggleSideBar, (showToolbar && m_pContainer->m_pSideBar->isActive()) ? SW_SHOW : SW_HIDE); @@ -229,7 +229,7 @@ BOOL CMsgDialog::BB_SetButtonsPos() if ((rect.bottom - ptSplitter.y - (rcSplitter.bottom - rcSplitter.top) /*- DPISCALEY(2)*/ - (bBottomToolbar ? DPISCALEY_S(24) : 0) < m_pic.cy - DPISCALEY_S(2)) && m_bShowAvatar && !PluginConfig.m_bAlwaysFullToolbarWidth) foravatar = m_pic.cx + gap; - if ((m_pContainer->m_dwFlags & CNT_SIDEBAR) && (m_pContainer->m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT)) { + if (m_pContainer->m_flags.m_bSideBar && (m_pContainer->m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT)) { if (nullptr != hwndToggleSideBar) /* Wine fix. */ hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, nullptr, 4, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); lwidth += 10; @@ -280,7 +280,7 @@ BOOL CMsgDialog::BB_SetButtonsPos() } } - if ((m_pContainer->m_dwFlags & CNT_SIDEBAR) && (m_pContainer->m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT)) { + if (m_pContainer->m_flags.m_bSideBar && (m_pContainer->m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT)) { if (nullptr != hwndToggleSideBar) /* Wine fix. */ hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, nullptr, rect.right - foravatar - 10, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); rwidth += 12; diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index acd23cd324..883ae67149 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -296,7 +296,7 @@ void ShowRoom(TContainerData *pContainer, SESSION_INFO *si) item.lParam = (LPARAM)hwndNew;
TabCtrl_SetItem(hwndTab, iTabId, &item);
- if (pContainer->m_dwFlags & CNT_SIDEBAR)
+ if (pContainer->m_flags.m_bSideBar)
pContainer->m_pSideBar->addSession(pDlg, pContainer->m_iTabIndex);
SendMessage(pContainer->m_hwnd, WM_SIZE, 0, 0);
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 3fce611e01..492a4a4cf1 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -167,14 +167,14 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) goto passed;
return 0;
}
- if (pContainer->m_dwFlags & CNT_DONTREPORT && IsIconic(pContainer->m_hwnd)) // in tray counts as "minimised"
+ if (pContainer->m_flags.m_bDontReport && IsIconic(pContainer->m_hwnd)) // in tray counts as "minimised"
goto passed;
- if (pContainer->m_dwFlags & CNT_DONTREPORTUNFOCUSED) {
+ if (pContainer->m_flags.m_bDontReportUnfocused) {
if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
goto passed;
}
- if (pContainer->m_dwFlags & CNT_ALWAYSREPORTINACTIVE) {
- if (pContainer->m_dwFlags & CNT_DONTREPORTFOCUSED)
+ if (pContainer->m_flags.m_bAlwaysReportInactive) {
+ if (pContainer->m_flags.m_bDontReportFocused)
goto passed;
if (pContainer->m_hwndActive == si->pDlg->GetHwnd())
@@ -251,14 +251,14 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) ShowWindow(dat->m_pContainer->m_hwndActive, SW_HIDE);
dat->m_pContainer->m_hwndActive = si->pDlg->GetHwnd();
dat->m_pContainer->UpdateTitle(dat->m_hContact);
- dat->m_pContainer->m_dwFlags |= CNT_DEFERREDTABSELECT;
+ dat->m_pContainer->m_flags.m_bDeferredTabSelect = true;
}
}
}
// flash window if it is not focused
if (p->bMustFlash && p->bInactive)
- if (!(dat->m_pContainer->m_dwFlags & CNT_NOFLASH))
+ if (!dat->m_pContainer->m_flags.m_bNoFlash)
FlashContainer(dat->m_pContainer, 1, 0);
if (p->hNotifyIcon && p->bInactive && ((p->iEvent & si->iLogTrayFlags) || bForcedIcon)) {
@@ -276,7 +276,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) HICON hIcon = (HICON)SendMessage(dat->m_pContainer->m_hwnd, WM_GETICON, ICON_BIG, 0);
if (p->hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT] || (hIcon != g_chatApi.hIcons[ICON_MESSAGE] && hIcon != g_chatApi.hIcons[ICON_HIGHLIGHT])) {
dat->m_pContainer->SetIcon(dat, p->hNotifyIcon);
- dat->m_pContainer->m_dwFlags |= CNT_NEED_UPDATETITLE;
+ dat->m_pContainer->m_flags.m_bNeedsUpdateTitle = true;
}
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 1851652b61..cf69ba81a8 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -77,7 +77,7 @@ void TContainerData::Configure() {
DWORD wsold, ws = wsold = GetWindowLong(m_hwnd, GWL_STYLE);
if (!CSkin::m_frameSkins) {
- ws = (m_dwFlags & CNT_NOTITLE) ?
+ ws = (m_flags.m_bNoTitle) ?
((IsWindowVisible(m_hwnd) ? WS_VISIBLE : 0) | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_THICKFRAME | (CSkin::m_frameSkins ? WS_SYSMENU : WS_SYSMENU | WS_SIZEBOX)) :
ws | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
SetWindowLong(m_hwnd, GWL_STYLE, ws);
@@ -93,20 +93,20 @@ void TContainerData::Configure() BOOL fTransAllowed = !CSkin::m_skinEnabled || IsWinVerVistaPlus();
DWORD ex = GetWindowLong(m_hwnd, GWL_EXSTYLE);
- ex = (m_dwFlags & CNT_TRANSPARENCY && (!CSkin::m_skinEnabled || fTransAllowed)) ? (ex | WS_EX_LAYERED) : (ex & ~WS_EX_LAYERED);
+ ex = (m_flags.m_bTransparent && (!CSkin::m_skinEnabled || fTransAllowed)) ? (ex | WS_EX_LAYERED) : (ex & ~WS_EX_LAYERED);
SetWindowLong(m_hwnd, GWL_EXSTYLE, ex);
- if (m_dwFlags & CNT_TRANSPARENCY && fTransAllowed) {
+ if (m_flags.m_bTransparent && fTransAllowed) {
DWORD trans = LOWORD(m_pSettings->dwTransparency);
- SetLayeredWindowAttributes(m_hwnd, Skin->getColorKey(), (BYTE)trans, (/* m_bSkinned ? LWA_COLORKEY : */ 0) | (m_dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
+ SetLayeredWindowAttributes(m_hwnd, Skin->getColorKey(), (BYTE)trans, (/* m_bSkinned ? LWA_COLORKEY : */ 0) | (m_flags.m_bTransparent ? LWA_ALPHA : 0));
}
HMENU hSysmenu = GetSystemMenu(m_hwnd, FALSE);
if (!CSkin::m_frameSkins)
- CheckMenuItem(hSysmenu, IDM_NOTITLE, (m_dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
+ CheckMenuItem(hSysmenu, IDM_NOTITLE, (m_flags.m_bNoTitle) ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
- CheckMenuItem(hSysmenu, IDM_STAYONTOP, m_dwFlags & CNT_STICKY ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
- SetWindowPos(m_hwnd, (m_dwFlags & CNT_STICKY) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
+ CheckMenuItem(hSysmenu, IDM_STAYONTOP, m_flags.m_bSticky ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
+ SetWindowPos(m_hwnd, (m_flags.m_bSticky) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
if (ws != wsold) {
RECT rc;
GetWindowRect(m_hwnd, &rc);
@@ -120,16 +120,12 @@ void TContainerData::Configure() }
}
- if (m_dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT))
- m_dwFlags |= CNT_SIDEBAR;
- else
- m_dwFlags &= ~CNT_SIDEBAR;
-
+ m_flags.m_bSideBar = m_flagsEx.m_bTabSBarLeft || m_flagsEx.m_bTabSBarRight;
m_pSideBar->Init();
HWND hwndTab = GetDlgItem(m_hwnd, IDC_MSGTABS);
ws = wsold = GetWindowLong(hwndTab, GWL_STYLE);
- if (m_dwFlags & CNT_TABSBOTTOM)
+ if (m_flags.m_bTabsBottom)
ws |= TCS_BOTTOM;
else
ws &= ~TCS_BOTTOM;
@@ -138,7 +134,7 @@ void TContainerData::Configure() RedrawWindow(hwndTab, nullptr, nullptr, RDW_INVALIDATE);
}
- if (m_dwFlags & CNT_NOSTATUSBAR) {
+ if (m_flags.m_bNoStatusBar) {
if (m_hwndStatus) {
DestroyWindow(m_hwndStatus);
m_hwndStatus = nullptr;
@@ -267,7 +263,7 @@ void TContainerData::QueryPending() // retrieve the container window geometry information from the database.
void TContainerData::RestoreWindowPos()
{
- if (m_isCloned && m_hContactFrom != 0 && !(m_dwFlags & CNT_GLOBALSIZE)) {
+ if (m_isCloned && m_hContactFrom != 0 && !m_flags.m_bGlobalSize) {
if (Utils_RestoreWindowPosition(m_hwnd, m_hContactFrom, SRMSGMOD_T, "split")) {
if (Utils_RestoreWindowPositionNoMove(m_hwnd, m_hContactFrom, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPosition(m_hwnd, 0, SRMSGMOD_T, "split"))
@@ -276,7 +272,7 @@ void TContainerData::RestoreWindowPos() }
}
else {
- if (m_dwFlags & CNT_GLOBALSIZE) {
+ if (m_flags.m_bGlobalSize) {
if (Utils_RestoreWindowPosition(m_hwnd, 0, SRMSGMOD_T, "split"))
if (Utils_RestoreWindowPositionNoMove(m_hwnd, 0, SRMSGMOD_T, "split"))
SetWindowPos(m_hwnd, nullptr, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE);
@@ -356,7 +352,7 @@ void TContainerData::SetIcon(CMsgDialog *pDlg, HICON hIcon) pDlg->m_hTaskbarIcon = nullptr;
}
- if (pDlg->m_pContainer->m_dwFlags & CNT_AVATARSONTASKBAR)
+ if (pDlg->m_pContainer->m_flags.m_bAvatarsOnTaskbar)
pDlg->m_hTaskbarIcon = pDlg->IconFromAvatar();
if (pDlg->m_hTaskbarIcon) {
@@ -389,7 +385,7 @@ void TContainerData::SetIcon(CMsgDialog *pDlg, HICON hIcon) if (hIcon == hIconMsg)
hIconBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
- if (m_hIcon == STICK_ICON_MSG && hIcon != hIconMsg && m_dwFlags & CNT_NEED_UPDATETITLE) {
+ if (m_hIcon == STICK_ICON_MSG && hIcon != hIconMsg && m_flags.m_bNeedsUpdateTitle) {
hIcon = hIconMsg;
hIconBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
}
@@ -482,7 +478,7 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) LONG sbar_left, sbar_right;
if (!pContainer->m_pSideBar->isActive()) {
- pt.y = rcWnd.bottom + ((pContainer->m_iChilds > 1 || !(pContainer->m_dwFlags & CNT_HIDETABS)) ? pContainer->m_tBorder : 0);
+ pt.y = rcWnd.bottom + ((pContainer->m_iChilds > 1 || !pContainer->m_flags.m_bHideTabs) ? pContainer->m_tBorder : 0);
sbar_left = 0, sbar_right = 0;
}
else {
@@ -626,7 +622,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, int height = rcClient.bottom - rcClient.top;
if (width != pContainer->m_oldDCSize.cx || height != pContainer->m_oldDCSize.cy) {
CSkinItem *sbaritem = &SkinItems[ID_EXTBKSTATUSBAR];
- BOOL statusBarSkinnd = !(pContainer->m_dwFlags & CNT_NOSTATUSBAR) && !sbaritem->IGNORED;
+ BOOL statusBarSkinnd = !pContainer->m_flags.m_bNoStatusBar && !sbaritem->IGNORED;
LONG sbarDelta = statusBarSkinnd ? pContainer->m_statusBarHeight : 0;
pContainer->m_oldDCSize.cx = width;
@@ -793,7 +789,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_NCHITTEST:
- if (pContainer && (pContainer->m_dwFlags & CNT_NOTITLE)) {
+ if (pContainer && (pContainer->m_flags.m_bNoTitle)) {
RECT r;
GetWindowRect(hwndDlg, &r);
@@ -866,21 +862,21 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->m_hwnd = hwndDlg;
{
- DWORD dwCreateFlags = pContainer->m_dwFlags;
- pContainer->m_isCloned = (dwCreateFlags & CNT_CREATE_CLONED);
+ DWORD dwCreateFlags = pContainer->m_flags.dw;
+ pContainer->m_isCloned = pContainer->m_flags.m_bCreateCloned;
pContainer->m_fPrivateThemeChanged = FALSE;
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0); // set options...
- pContainer->m_dwFlags |= dwCreateFlags;
+ pContainer->m_flags.dw |= dwCreateFlags;
pContainer->LoadOverrideTheme();
DWORD ws = GetWindowLongPtr(hwndTab, GWL_STYLE);
- if (pContainer->m_dwFlagsEx & TCF_FLAT)
+ if (pContainer->m_flagsEx.m_bTabFlat)
ws |= TCS_BUTTONS;
pContainer->ClearMargins();
- if (pContainer->m_dwFlagsEx & TCF_SINGLEROWTABCONTROL) {
+ if (pContainer->m_flagsEx.m_bTabSingleRow) {
ws &= ~TCS_MULTILINE;
ws |= TCS_SINGLELINE;
ws |= TCS_FIXEDWIDTH;
@@ -895,12 +891,9 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->m_buttonItems = g_ButtonSet.items;
- if (pContainer->m_dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT))
- pContainer->m_dwFlags |= CNT_SIDEBAR;
- else
- pContainer->m_dwFlags &= ~CNT_SIDEBAR;
-
+ pContainer->m_flags.m_bSideBar = pContainer->m_flagsEx.m_bTabSBarLeft || pContainer->m_flagsEx.m_bTabSBarRight;
pContainer->m_pSideBar = new CSideBar(pContainer);
+
pContainer->m_pMenuBar = new CMenuBar(hwndDlg, pContainer);
SetClassLongPtr(hwndDlg, GCL_STYLE, GetClassLongPtr(hwndDlg, GCL_STYLE) & ~(CS_VREDRAW | CS_HREDRAW));
@@ -926,11 +919,11 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, ws = GetWindowLongPtr(hwndTab, GWL_EXSTYLE);
SetWindowLongPtr(hwndTab, GWL_EXSTYLE, ws | WS_EX_CONTROLPARENT);
- LONG x_pad = M.GetByte("x-pad", 3) + (pContainer->m_dwFlagsEx & TCF_CLOSEBUTTON ? 7 : 0);
- LONG y_pad = M.GetByte("y-pad", 3) + ((pContainer->m_dwFlags & CNT_TABSBOTTOM) ? 1 : 0);
+ LONG x_pad = M.GetByte("x-pad", 3) + (pContainer->m_flagsEx.m_bTabCloseButton ? 7 : 0);
+ LONG y_pad = M.GetByte("y-pad", 3) + ((pContainer->m_flags.m_bTabsBottom) ? 1 : 0);
- if (pContainer->m_dwFlagsEx & TCF_FLAT)
- y_pad++; //(pContainer->m_dwFlags & CNT_TABSBOTTOM ? 1 : 2);
+ if (pContainer->m_flagsEx.m_bTabFlat)
+ y_pad++; //(pContainer->m_flags.m_bTabsBottom ? 1 : 2);
TabCtrl_SetPadding(hwndTab, x_pad, y_pad);
@@ -950,7 +943,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, }
else pContainer->m_hwndTip = nullptr;
- if (pContainer->m_dwFlags & CNT_CREATE_MINIMIZED) {
+ if (pContainer->m_flags.m_bCreateMinimized) {
SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~WS_VISIBLE);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
pContainer->RestoreWindowPos();
@@ -979,7 +972,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_SIZE:
if (IsIconic(hwndDlg))
- pContainer->m_dwFlags |= CNT_DEFERREDSIZEREQUEST;
+ pContainer->m_flags.m_bDeferredResize = true;
else {
RECT rcClient, rcUnadjusted;
@@ -1002,7 +995,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->m_pMenuBar->Resize(LOWORD(lParam));
LONG rebarHeight = pContainer->m_pMenuBar->getHeight();
- pContainer->m_pMenuBar->Show((pContainer->m_dwFlags & CNT_NOMENUBAR) ? SW_HIDE : SW_SHOW);
+ pContainer->m_pMenuBar->Show((pContainer->m_flags.m_bNoMenuBar) ? SW_HIDE : SW_SHOW);
LONG sbarWidth = pContainer->m_pSideBar->getWidth();
LONG sbarWidth_left = pContainer->m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? sbarWidth : 0;
@@ -1228,7 +1221,9 @@ panel_found: pContainer->m_pMenuBar->Cancel();
dat = (CMsgDialog*)GetWindowLongPtr(pContainer->m_hwndActive, GWLP_USERDATA);
- DWORD dwOldFlags = pContainer->m_dwFlags;
+ DWORD dwOldFlags = pContainer->m_flags.dw;
+
+ auto &f = pContainer->m_flags;
if (dat) {
if (fProcessContactMenu)
@@ -1298,33 +1293,40 @@ panel_found: break;
case ID_VIEW_SHOWSTATUSBAR:
- ApplyContainerSetting(pContainer, CNT_NOSTATUSBAR, pContainer->m_dwFlags & CNT_NOSTATUSBAR ? 0 : 1, true);
+ f.m_bNoStatusBar = !f.m_bNoStatusBar;
+ pContainer->ApplySetting(true);
break;
case ID_VIEW_VERTICALMAXIMIZE:
- ApplyContainerSetting(pContainer, CNT_VERTICALMAX, pContainer->m_dwFlags & CNT_VERTICALMAX ? 0 : 1, false);
+ f.m_bVerticalMax = !f.m_bVerticalMax;
+ pContainer->ApplySetting();
break;
case ID_VIEW_BOTTOMTOOLBAR:
- ApplyContainerSetting(pContainer, CNT_BOTTOMTOOLBAR, pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR ? 0 : 1, false);
+ f.m_bBottomToolbar = !f.m_bBottomToolbar;
+ pContainer->ApplySetting();
Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1);
return 0;
case ID_VIEW_SHOWTOOLBAR:
- ApplyContainerSetting(pContainer, CNT_HIDETOOLBAR, pContainer->m_dwFlags & CNT_HIDETOOLBAR ? 0 : 1, false);
+ f.m_bHideToolbar = !f.m_bHideToolbar;
+ pContainer->ApplySetting();
Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1);
return 0;
case ID_VIEW_SHOWMENUBAR:
- ApplyContainerSetting(pContainer, CNT_NOMENUBAR, pContainer->m_dwFlags & CNT_NOMENUBAR ? 0 : 1, true);
+ f.m_bNoMenuBar = !f.m_bNoMenuBar;
+ pContainer->ApplySetting(true);
break;
case ID_VIEW_SHOWTITLEBAR:
- ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->m_dwFlags & CNT_NOTITLE ? 0 : 1, true);
+ f.m_bNoTitle = !f.m_bNoTitle;
+ pContainer->ApplySetting(true);
break;
case ID_VIEW_TABSATBOTTOM:
- ApplyContainerSetting(pContainer, CNT_TABSBOTTOM, pContainer->m_dwFlags & CNT_TABSBOTTOM ? 0 : 1, false);
+ f.m_bTabsBottom = !f.m_bTabsBottom;
+ pContainer->ApplySetting();
break;
case ID_VIEW_SHOWMULTISENDCONTACTLIST:
@@ -1340,37 +1342,45 @@ panel_found: break;
case ID_EVENTPOPUPS_DISABLEALLEVENTPOPUPS:
- ApplyContainerSetting(pContainer, (CNT_DONTREPORT | CNT_DONTREPORTUNFOCUSED | CNT_DONTREPORTFOCUSED | CNT_ALWAYSREPORTINACTIVE), 0, false);
+ f.m_bDontReport = f.m_bDontReportUnfocused = f.m_bDontReportFocused = f.m_bAlwaysReportInactive = false;
+ pContainer->ApplySetting();
return 0;
case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISMINIMIZED:
- ApplyContainerSetting(pContainer, CNT_DONTREPORT, pContainer->m_dwFlags & CNT_DONTREPORT ? 0 : 1, false);
+ f.m_bDontReport = !f.m_bDontReport;
+ pContainer->ApplySetting();
return 0;
case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISUNFOCUSED:
- ApplyContainerSetting(pContainer, CNT_DONTREPORTUNFOCUSED, pContainer->m_dwFlags & CNT_DONTREPORTUNFOCUSED ? 0 : 1, false);
+ f.m_bDontReportUnfocused = !f.m_bDontReportUnfocused;
+ pContainer->ApplySetting();
return 0;
case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISFOCUSED:
- ApplyContainerSetting(pContainer, CNT_DONTREPORTFOCUSED, pContainer->m_dwFlags & CNT_DONTREPORTFOCUSED ? 0 : 1, false);
+ f.m_bDontReportFocused = !f.m_bDontReportFocused;
+ pContainer->ApplySetting();
return 0;
case ID_EVENTPOPUPS_SHOWPOPUPSFORALLINACTIVESESSIONS:
- ApplyContainerSetting(pContainer, CNT_ALWAYSREPORTINACTIVE, pContainer->m_dwFlags & CNT_ALWAYSREPORTINACTIVE ? 0 : 1, false);
+ f.m_bAlwaysReportInactive = !f.m_bAlwaysReportInactive;
+ pContainer->ApplySetting();
return 0;
case ID_WINDOWFLASHING_DISABLEFLASHING:
- ApplyContainerSetting(pContainer, CNT_NOFLASH, 1, false);
- ApplyContainerSetting(pContainer, CNT_FLASHALWAYS, 0, false);
+ f.m_bNoFlash = true;
+ f.m_bFlashAlways = false;
+ pContainer->ApplySetting();
return 0;
case ID_WINDOWFLASHING_FLASHUNTILFOCUSED:
- ApplyContainerSetting(pContainer, CNT_NOFLASH, 0, false);
- ApplyContainerSetting(pContainer, CNT_FLASHALWAYS, 1, false);
+ f.m_bNoFlash = false;
+ f.m_bFlashAlways = true;
+ pContainer->ApplySetting();
return 0;
case ID_WINDOWFLASHING_USEDEFAULTVALUES:
- ApplyContainerSetting(pContainer, (CNT_NOFLASH | CNT_FLASHALWAYS), 0, false);
+ f.m_bNoFlash = f.m_bFlashAlways = false;
+ pContainer->ApplySetting();
return 0;
case ID_OPTIONS_SAVECURRENTWINDOWPOSITIONASDEFAULT:
@@ -1406,7 +1416,7 @@ panel_found: break;
}
- if (pContainer->m_dwFlags != dwOldFlags)
+ if (f.dw != dwOldFlags)
pContainer->Configure();
}
break;
@@ -1458,7 +1468,7 @@ panel_found: if (pContainer->m_hwndActive)
mmi->ptMinTrackSize.y = pContainer->m_uChildMinHeight + (pContainer->m_hwndActive ? ((rcWindow.bottom - rcWindow.top) - rcClient.bottom) : 0);
- if (pContainer->m_dwFlags & CNT_VERTICALMAX || (GetKeyState(VK_CONTROL) & 0x8000)) {
+ if (pContainer->m_flags.m_bVerticalMax || (GetKeyState(VK_CONTROL) & 0x8000)) {
RECT rcDesktop = { 0 };
BOOL fDesktopValid = FALSE;
int monitorXOffset = 0;
@@ -1518,16 +1528,20 @@ panel_found: case WM_SYSCOMMAND:
switch (wParam) {
case IDM_STAYONTOP:
- SetWindowPos(hwndDlg, (pContainer->m_dwFlags & CNT_STICKY) ? HWND_NOTOPMOST : HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_STAYONTOP, (pContainer->m_dwFlags & CNT_STICKY) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
- ApplyContainerSetting(pContainer, CNT_STICKY, pContainer->m_dwFlags & CNT_STICKY ? 0 : 1, false);
+ SetWindowPos(hwndDlg, (pContainer->m_flags.m_bSticky) ? HWND_NOTOPMOST : HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_STAYONTOP, (pContainer->m_flags.m_bSticky) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
+
+ pContainer->m_flags.m_bSticky = !pContainer->m_flags.m_bSticky;
+ pContainer->ApplySetting();
break;
case IDM_NOTITLE:
pContainer->m_oldSize.cx = 0;
pContainer->m_oldSize.cy = 0;
- CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_NOTITLE, (pContainer->m_dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
- ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->m_dwFlags & CNT_NOTITLE ? 0 : 1, true);
+ CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_NOTITLE, (pContainer->m_flags.m_bNoTitle) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
+
+ pContainer->m_flags.m_bNoTitle = !pContainer->m_flags.m_bNoTitle;
+ pContainer->ApplySetting(true);
break;
case IDM_MOREOPTIONS:
if (IsIconic(pContainer->m_hwnd))
@@ -1558,7 +1572,7 @@ panel_found: break;
case WM_LBUTTONDOWN:
- if (pContainer->m_dwFlags & CNT_NOTITLE) {
+ if (pContainer->m_flags.m_bNoTitle) {
GetCursorPos(&pt);
return SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
@@ -1580,8 +1594,8 @@ panel_found: if (LOWORD(wParam == WA_INACTIVE) && (HWND)lParam != PluginConfig.g_hwndHotkeyHandler && GetParent((HWND)lParam) != hwndDlg) {
BOOL fTransAllowed = !CSkin::m_skinEnabled || IsWinVerVistaPlus();
- if (pContainer->m_dwFlags & CNT_TRANSPARENCY && fTransAllowed) {
- SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->m_pSettings->dwTransparency), (pContainer->m_dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
+ if (pContainer->m_flags.m_bTransparent && fTransAllowed) {
+ SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->m_pSettings->dwTransparency), (pContainer->m_flags.m_bTransparent ? LWA_ALPHA : 0));
}
}
pContainer->m_hwndSaved = nullptr;
@@ -1601,24 +1615,24 @@ panel_found: FlashContainer(pContainer, 0, 0);
pContainer->m_dwFlashingStarted = 0;
pLastActiveContainer = pContainer;
- if (pContainer->m_dwFlags & CNT_DEFERREDTABSELECT) {
- pContainer->m_dwFlags &= ~CNT_DEFERREDTABSELECT;
+ if (pContainer->m_flags.m_bDeferredTabSelect) {
+ pContainer->m_flags.m_bDeferredTabSelect = false;
SendMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
NMHDR nmhdr = { hwndTab, IDC_MSGTABS, TCN_SELCHANGE };
SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&nmhdr); // do it via a WM_NOTIFY / TCN_SELCHANGE to simulate user-activation
}
- if (pContainer->m_dwFlags & CNT_DEFERREDSIZEREQUEST) {
- pContainer->m_dwFlags &= ~CNT_DEFERREDSIZEREQUEST;
+ if (pContainer->m_flags.m_bDeferredResize) {
+ pContainer->m_flags.m_bDeferredResize = false;
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
- if (pContainer->m_dwFlags & CNT_TRANSPARENCY && fTransAllowed) {
+ if (pContainer->m_flags.m_bTransparent && fTransAllowed) {
DWORD trans = LOWORD(pContainer->m_pSettings->dwTransparency);
- SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (pContainer->m_dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
+ SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (pContainer->m_flags.m_bTransparent ? LWA_ALPHA : 0));
}
- if (pContainer->m_dwFlags & CNT_NEED_UPDATETITLE) {
- pContainer->m_dwFlags &= ~CNT_NEED_UPDATETITLE;
+ if (pContainer->m_flags.m_bNeedsUpdateTitle) {
+ pContainer->m_flags.m_bNeedsUpdateTitle = false;
if (pContainer->m_hwndActive) {
hContact = 0;
SendMessage(pContainer->m_hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
@@ -1628,8 +1642,8 @@ panel_found: }
HWND hDlg = GetTabWindow(hwndTab, TabCtrl_GetCurSel(hwndTab));
- if (pContainer->m_dwFlags & CNT_DEFERREDCONFIGURE && hDlg) {
- pContainer->m_dwFlags &= ~CNT_DEFERREDCONFIGURE;
+ if (pContainer->m_flags.m_bDeferredConfigure && hDlg) {
+ pContainer->m_flags.m_bDeferredConfigure = false;
pContainer->m_hwndActive = hDlg;
SendMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
if (pContainer->m_hwndActive != nullptr && IsWindow(pContainer->m_hwndActive)) {
@@ -1748,7 +1762,7 @@ panel_found: case WM_DRAWITEM:
{
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- if (dis->hwndItem == pContainer->m_hwndStatus && !(pContainer->m_dwFlags & CNT_NOSTATUSBAR)) {
+ if (dis->hwndItem == pContainer->m_hwndStatus && !pContainer->m_flags.m_bNoStatusBar) {
dat = (CMsgDialog*)GetWindowLongPtr(pContainer->m_hwndActive, GWLP_USERDATA);
if (dat)
dat->DrawStatusIcons(dis->hDC, dis->rcItem, 2);
@@ -1842,7 +1856,7 @@ panel_found: }
// save geometry information to the database...
- if (!(pContainer->m_dwFlags & CNT_GLOBALSIZE)) {
+ if (!pContainer->m_flags.m_bGlobalSize) {
WINDOWPLACEMENT wp = { 0 };
wp.length = sizeof(wp);
if (GetWindowPlacement(hwndDlg, &wp) != 0) {
@@ -1879,8 +1893,7 @@ panel_found: // clear temp flags which should NEVER be saved...
if (pContainer->m_isCloned && pContainer->m_hContactFrom != 0) {
-
- pContainer->m_dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
+ pContainer->m_flags.m_bDeferredConfigure = pContainer->m_flags.m_bCreateMinimized = pContainer->m_flags.m_bDeferredResize = pContainer->m_flags.m_bCreateCloned = false;
for (int i = 0; i < TabCtrl_GetItemCount(hwndTab); i++) {
if (HWND hDlg = GetTabWindow(hwndTab, i)) {
SendMessage(hDlg, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
@@ -1961,11 +1974,13 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h }
if (iTemp & CNT_CREATEFLAG_MINIMIZED)
- pContainer->m_dwFlags = CNT_CREATE_MINIMIZED;
+ pContainer->m_flags.m_bCreateMinimized = true;
+
if (iTemp & CNT_CREATEFLAG_CLONED) {
- pContainer->m_dwFlags |= CNT_CREATE_CLONED;
+ pContainer->m_flags.m_bCreateCloned = true;
pContainer->m_hContactFrom = hContactFrom;
}
+
pContainer->m_hwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGCONTAINER), nullptr, DlgProcContainer, (LPARAM)pContainer);
return pContainer;
}
@@ -2116,7 +2131,7 @@ void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc) RECT rcTab, rcTabOrig;
GetClientRect(hwndTab, &rcTab);
- if (!(pContainer->m_dwFlags & CNT_SIDEBAR) && (pContainer->m_iChilds > 1 || !(pContainer->m_dwFlags & CNT_HIDETABS))) {
+ if (!pContainer->m_flags.m_bSideBar && (pContainer->m_iChilds > 1 || !pContainer->m_flags.m_bHideTabs)) {
rcTabOrig = rcTab;
TabCtrl_AdjustRect(hwndTab, FALSE, &rcTab);
DWORD dwTopPad = rcTab.top - rcTabOrig.top;
@@ -2125,7 +2140,7 @@ void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc) rc->right -= tBorder;
if (dwStyle & TCS_BUTTONS) {
- if (pContainer->m_dwFlags & CNT_TABSBOTTOM) {
+ if (pContainer->m_flags.m_bTabsBottom) {
int nCount = TabCtrl_GetItemCount(hwndTab);
if (nCount > 0) {
RECT rcItem;
@@ -2139,7 +2154,7 @@ void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc) }
}
else {
- if (pContainer->m_dwFlags & CNT_TABSBOTTOM)
+ if (pContainer->m_flags.m_bTabsBottom)
rc->bottom = rcTab.bottom + 2;
else {
rc->top += (dwTopPad - 2);
@@ -2268,7 +2283,7 @@ HMENU TSAPI BuildContainerMenu() void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iCount)
{
- if (pContainer->m_dwFlags & CNT_NOFLASH) // container should never flash
+ if (pContainer->m_flags.m_bNoFlash) // container should never flash
return;
FLASHWINFO fwi;
@@ -2277,7 +2292,7 @@ void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iCount) if (iMode) {
fwi.dwFlags = FLASHW_ALL;
- if (pContainer->m_dwFlags & CNT_FLASHALWAYS)
+ if (pContainer->m_flags.m_bFlashAlways)
fwi.dwFlags |= FLASHW_TIMER;
else
fwi.uCount = (iCount == 0) ? M.GetByte("nrflash", 4) : iCount;
@@ -2298,10 +2313,10 @@ void TSAPI ReflashContainer(TContainerData *pContainer) if (pContainer->IsActive()) // dont care about active windows
return;
- if (pContainer->m_dwFlags & CNT_NOFLASH || pContainer->m_dwFlashingStarted == 0)
+ if (pContainer->m_flags.m_bNoFlash || pContainer->m_dwFlashingStarted == 0)
return; // dont care about containers which should never flash
- if (pContainer->m_dwFlags & CNT_FLASHALWAYS)
+ if (pContainer->m_flags.m_bFlashAlways)
FlashContainer(pContainer, 1, 0);
else {
// recalc the remaining flashes
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 52599d5835..4c4ed28ad7 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -47,55 +47,26 @@ static void ReloadGlobalContainerSettings(bool fForceReconfig) }
}
-/**
- * Apply a container setting
- *
- * @param pContainer ContainerWindowData *: the container
- * @param flags DWORD: the flag values to set or clear
- * @param mode int: bit #0 set/clear, any bit from 16-31 indicates that dwFlagsEx should be affected
- * @param fForceResize
- */
-void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT mode, bool fForceResize)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Apply a container setting
+
+void TContainerData::ApplySetting(bool fForceResize)
{
- bool isEx = (mode & 0xffff0000) ? true : false;
- bool set = (mode & 0x01) ? true : false;
+ Utils::ContainerToSettings(this);
- if (!pContainer->m_pSettings->fPrivate) {
- if (!isEx)
- pContainer->m_dwFlags = (set ? pContainer->m_dwFlags | flags : pContainer->m_dwFlags & ~flags);
- else
- pContainer->m_dwFlagsEx = (set ? pContainer->m_dwFlagsEx | flags : pContainer->m_dwFlagsEx & ~flags);
-
- Utils::ContainerToSettings(pContainer);
- if (flags & CNT_INFOPANEL)
- BroadCastContainer(pContainer, DM_SETINFOPANEL, 0, 0);
- if (flags & CNT_SIDEBAR) {
- for (TContainerData *p = pFirstContainer; p; p = p->pNext)
- if (!p->m_pSettings->fPrivate)
- SendMessage(p->m_hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0);
- }
- else ReloadGlobalContainerSettings(fForceResize);
- }
- else {
- if (!isEx)
- pContainer->m_dwFlags = (set ? pContainer->m_dwFlags | flags : pContainer->m_dwFlags & ~flags);
- else
- pContainer->m_dwFlagsEx = (set ? pContainer->m_dwFlagsEx | flags : pContainer->m_dwFlagsEx & ~flags);
- Utils::ContainerToSettings(pContainer);
- if (flags & CNT_SIDEBAR)
- SendMessage(pContainer->m_hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0);
- else
- pContainer->Configure();
- if (flags & CNT_INFOPANEL)
- BroadCastContainer(pContainer, DM_SETINFOPANEL, 0, 0);
- }
+ if (m_pSettings->fPrivate)
+ Configure();
+ else
+ ReloadGlobalContainerSettings(fForceResize);
if (fForceResize)
- SendMessage(pContainer->m_hwnd, WM_SIZE, 0, 1);
+ SendMessage(m_hwnd, WM_SIZE, 0, 1);
- BroadCastContainer(pContainer, WM_CBD_UPDATED, 0, 0);
+ BroadCastContainer(this, WM_CBD_UPDATED, 0, 0);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
struct
{
const wchar_t *szTitle, *szDesc;
@@ -176,8 +147,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateW(sblayouts[i].szName));
/* bits 24 - 31 of dwFlagsEx hold the side bar layout id */
- SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->m_pSettings->dwFlagsEx & 0xff000000) >> 24), 0);
-
+ SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->m_pSettings->flagsEx.dw & 0xff000000) >> 24), 0);
SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->m_pSettings);
SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0);
@@ -375,9 +345,10 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); {
TContainerSettings* cs = (TContainerSettings *)lParam;
- DWORD dwFlags = cs->dwFlags;
+ auto flags = cs->flags;
+ auto flagsEx = cs->flagsEx;
+
DWORD dwTransparency = cs->dwTransparency;
- DWORD dwFlagsEx = cs->dwFlagsEx;
BOOL fAllowTrans = FALSE;
if (IsWinVerVistaPlus())
@@ -385,50 +356,50 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); else
fAllowTrans = !CSkin::m_skinEnabled;
- MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE);
- MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT);
- MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS);
- MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY);
- MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH);
- MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS);
- MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS)));
- MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY);
- MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED);
- MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED);
- MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE);
- MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR);
- MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR);
- MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR);
- MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR);
- MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR);
- MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX);
- MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER);
- MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR);
- MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL);
- MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE);
-
- MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON);
- MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL);
- MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON);
-
- MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL);
- MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT);
-
- MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND));
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED);
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED);
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS);
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED);
+ MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, flags.m_bNoTitle);
+ MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, flags.m_bDontReport);
+ MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, flags.m_bHideTabs);
+ MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, flags.m_bSticky);
+ MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, flags.m_bNoFlash);
+ MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, flags.m_bFlashAlways);
+ MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !flags.m_bNoFlash && !flags.m_bFlashAlways);
+ MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, flags.m_bTransparent);
+ MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, flags.m_bDontReportUnfocused);
+ MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, flags.m_bDontReportFocused);
+ MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, flags.m_bAlwaysReportInactive);
+ MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, flags.m_bNoStatusBar);
+ MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, flags.m_bNoMenuBar);
+ MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, flags.m_bHideToolbar);
+ MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, flags.m_bBottomToolbar);
+ MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, flags.m_bUinStatusBar);
+ MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, flags.m_bVerticalMax);
+ MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, flags.m_bAutoSplitter);
+ MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, flags.m_bAvatarsOnTaskbar);
+ MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, flags.m_bInfoPanel);
+ MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, flags.m_bGlobalSize);
+
+ MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, flagsEx.m_bTabFlashIcon);
+ MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, flagsEx.m_bTabFlashLabel);
+ MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, flagsEx.m_bTabCloseButton);
+
+ MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, flagsEx.m_bTabSingleRow);
+ MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, flagsEx.m_bTabFlat);
+
+ MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !flags.m_bNoSound);
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, flagsEx.m_bSoundMinimized);
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, flagsEx.m_bSoundUnfocused);
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, flagsEx.m_bSoundInactive);
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, flagsEx.m_bSoundFocused);
SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0);
- if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)))
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0);
+ if (!flagsEx.m_bTabSBarLeft && !flagsEx.m_bTabSBarRight)
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, flags.m_bTabsBottom ? 1 : 0, 0);
else
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0);
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, flagsEx.m_bTabSBarLeft ? 2 : 3, 0);
if (fAllowTrans)
- CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, (dwFlags & CNT_TRANSPARENCY) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, (flags.m_bTransparent) ? BST_CHECKED : BST_UNCHECKED);
else
CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED);
@@ -471,63 +442,67 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); case DM_SC_BUILDLIST:
{
- DWORD dwNewFlags = 0, dwNewFlagsEx = 0;
TContainerSettings* cs = (TContainerSettings *)lParam;
- dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) |
- (IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) |
- (CNT_NEWCONTAINERFLAGS);
+ TContainerFlags newFlags;
+ newFlags.dw = 0;
+ newFlags.m_bNoTitle = IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE);
+ newFlags.m_bDontReport = IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT);
+ newFlags.m_bHideTabs = IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS);
+ newFlags.m_bSticky = IsDlgButtonChecked(hwndDlg, IDC_O_STICKY);
+ newFlags.m_bFlashAlways = IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS);
+ newFlags.m_bNoFlash = IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER);
+ newFlags.m_bTransparent = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY);
+ newFlags.m_bDontReportUnfocused = IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2);
+ newFlags.m_bDontReportFocused = IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2);
+ newFlags.m_bAlwaysReportInactive = IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE);
+ newFlags.m_bNoStatusBar = IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR);
+ newFlags.m_bNoMenuBar = IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR);
+ newFlags.m_bHideToolbar = IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR);
+ newFlags.m_bBottomToolbar = IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR);
+ newFlags.m_bUinStatusBar = IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR);
+ newFlags.m_bGlobalSize = IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE);
+ newFlags.m_bInfoPanel = IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL);
+ newFlags.m_bNoSound = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS);
+ newFlags.m_bAvatarsOnTaskbar = IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR);
+ newFlags.m_bVerticalMax = IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX);
+ newFlags.m_bAutoSplitter = IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER);
+ newFlags.m_bNewContainerFlags = true;
LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0);
LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0);
- dwNewFlagsEx = 0;
+ TContainerFlagsEx newFlagsEx;
+ newFlagsEx.dw = 0;
if (iTabMode < 2)
- dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM));
+ newFlags.m_bTabsBottom = (iTabMode == 1);
else {
- dwNewFlags &= ~CNT_TABSBOTTOM;
- dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT;
+ newFlags.m_bTabsBottom = false;
+ if (iTabMode == 2)
+ newFlagsEx.m_bTabSBarLeft = true;
+ else
+ newFlagsEx.m_bTabSBarRight = true;
}
- dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0)
- );
+ newFlagsEx.m_bTabFlashIcon = IsDlgButtonChecked(hwndDlg, IDC_FLASHICON);
+ newFlagsEx.m_bTabFlashLabel = IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL);
+ newFlagsEx.m_bTabFlat = IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS);
+ newFlagsEx.m_bTabCloseButton = IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS);
+ newFlagsEx.m_bTabSingleRow = IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB);
+ newFlagsEx.m_bSoundMinimized = IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED);
+ newFlagsEx.m_bSoundUnfocused = IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED);
+ newFlagsEx.m_bSoundFocused = IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED);
+ newFlagsEx.m_bSoundInactive = IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE);
/* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */
- dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000));
+ newFlagsEx.dw |= ((int)((iTabLayout << 24) & 0xff000000));
if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT))
- dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH);
+ newFlags.m_bFlashAlways = newFlags.m_bNoFlash = false;
- cs->dwFlags = dwNewFlags;
- cs->dwFlagsEx = dwNewFlagsEx;
+ cs->flags = newFlags;
+ cs->flagsEx = newFlagsEx;
cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0);
}
break;
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index ff64611423..fffb0411e7 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -137,7 +137,7 @@ void CMenuBar::releaseHook() LONG CMenuBar::getHeight() const
{
- return((m_pContainer->m_dwFlags & CNT_NOMENUBAR) ? 0 : m_size_y);
+ return (m_pContainer->m_flags.m_bNoMenuBar) ? 0 : m_size_y;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -186,7 +186,7 @@ LONG_PTR CMenuBar::processMsg(const UINT msg, const WPARAM, const LPARAM lParam) }
}
else if (msg == WM_LBUTTONDOWN) {
- if (m_pContainer->m_dwFlags & CNT_NOTITLE) {
+ if (m_pContainer->m_flags.m_bNoTitle) {
POINT pt;
::GetCursorPos(&pt);
return ::SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
@@ -447,31 +447,32 @@ void CMenuBar::updateState(const HMENU hMenu) const {
CMsgDialog *dat = (CMsgDialog*)GetWindowLongPtr(m_pContainer->m_hwndActive, GWLP_USERDATA);
if (dat) {
- MY_CheckMenu(hMenu, ID_VIEW_SHOWMENUBAR, !(m_pContainer->m_dwFlags & CNT_NOMENUBAR) && !m_mustAutoHide);
- MY_CheckMenu(hMenu, ID_VIEW_SHOWSTATUSBAR, !(m_pContainer->m_dwFlags & CNT_NOSTATUSBAR));
+ auto f = m_pContainer->m_flags;
+ MY_CheckMenu(hMenu, ID_VIEW_SHOWMENUBAR, !f.m_bNoMenuBar && !m_mustAutoHide);
+ MY_CheckMenu(hMenu, ID_VIEW_SHOWSTATUSBAR, !f.m_bNoStatusBar);
MY_CheckMenu(hMenu, ID_VIEW_SHOWAVATAR, dat->m_bShowAvatar);
- MY_CheckMenu(hMenu, ID_VIEW_SHOWTITLEBAR, !(m_pContainer->m_dwFlags & CNT_NOTITLE));
+ MY_CheckMenu(hMenu, ID_VIEW_SHOWTITLEBAR, !f.m_bNoTitle);
::EnableMenuItem(hMenu, ID_VIEW_SHOWTITLEBAR, CSkin::m_skinEnabled && CSkin::m_frameSkins ? MF_GRAYED : MF_ENABLED);
- MY_CheckMenu(hMenu, ID_VIEW_TABSATBOTTOM, m_pContainer->m_dwFlags & CNT_TABSBOTTOM);
- MY_CheckMenu(hMenu, ID_VIEW_VERTICALMAXIMIZE, m_pContainer->m_dwFlags & CNT_VERTICALMAX);
- MY_CheckMenu(hMenu, ID_VIEW_SHOWTOOLBAR, !(m_pContainer->m_dwFlags & CNT_HIDETOOLBAR));
- MY_CheckMenu(hMenu, ID_VIEW_BOTTOMTOOLBAR, m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR);
+ MY_CheckMenu(hMenu, ID_VIEW_TABSATBOTTOM, f.m_bTabsBottom);
+ MY_CheckMenu(hMenu, ID_VIEW_VERTICALMAXIMIZE, f.m_bVerticalMax);
+ MY_CheckMenu(hMenu, ID_VIEW_SHOWTOOLBAR, !f.m_bHideToolbar);
+ MY_CheckMenu(hMenu, ID_VIEW_BOTTOMTOOLBAR, f.m_bBottomToolbar);
MY_CheckMenu(hMenu, ID_VIEW_SHOWMULTISENDCONTACTLIST, dat->m_sendMode & SMODE_MULTIPLE);
- MY_CheckMenu(hMenu, ID_VIEW_STAYONTOP, m_pContainer->m_dwFlags & CNT_STICKY);
+ MY_CheckMenu(hMenu, ID_VIEW_STAYONTOP, f.m_bSticky);
::EnableMenuItem(hMenu, 2, MF_BYPOSITION | (nen_options.bWindowCheck ? MF_GRAYED : MF_ENABLED));
- MY_CheckMenu(hMenu, ID_EVENTPOPUPS_DISABLEALLEVENTPOPUPS, !(m_pContainer->m_dwFlags & (CNT_DONTREPORT | CNT_DONTREPORTUNFOCUSED | CNT_DONTREPORTFOCUSED | CNT_ALWAYSREPORTINACTIVE)));
- MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISMINIMIZED, m_pContainer->m_dwFlags & CNT_DONTREPORT);
- MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSFORALLINACTIVESESSIONS, m_pContainer->m_dwFlags & CNT_ALWAYSREPORTINACTIVE);
- MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISUNFOCUSED, m_pContainer->m_dwFlags & CNT_DONTREPORTUNFOCUSED);
- MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISFOCUSED, m_pContainer->m_dwFlags & CNT_DONTREPORTFOCUSED);
-
- MY_CheckMenu(hMenu, ID_WINDOWFLASHING_USEDEFAULTVALUES, !(m_pContainer->m_dwFlags & (CNT_NOFLASH | CNT_FLASHALWAYS)));
- MY_CheckMenu(hMenu, ID_WINDOWFLASHING_DISABLEFLASHING, m_pContainer->m_dwFlags & CNT_NOFLASH);
- MY_CheckMenu(hMenu, ID_WINDOWFLASHING_FLASHUNTILFOCUSED, m_pContainer->m_dwFlags & CNT_FLASHALWAYS);
+ MY_CheckMenu(hMenu, ID_EVENTPOPUPS_DISABLEALLEVENTPOPUPS, !f.m_bDontReport && !f.m_bDontReportUnfocused && !f.m_bDontReportFocused && !f.m_bAlwaysReportInactive);
+ MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISMINIMIZED, f.m_bDontReport);
+ MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSFORALLINACTIVESESSIONS, f.m_bAlwaysReportInactive);
+ MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISUNFOCUSED, f.m_bDontReportUnfocused);
+ MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISFOCUSED, f.m_bDontReportFocused);
+
+ MY_CheckMenu(hMenu, ID_WINDOWFLASHING_USEDEFAULTVALUES, !f.m_bNoFlash && !f.m_bFlashAlways);
+ MY_CheckMenu(hMenu, ID_WINDOWFLASHING_DISABLEFLASHING, f.m_bNoFlash);
+ MY_CheckMenu(hMenu, ID_WINDOWFLASHING_FLASHUNTILFOCUSED, f.m_bFlashAlways);
}
}
@@ -502,8 +503,8 @@ void CMenuBar::configureMenu() const void CMenuBar::autoShow(const int showcmd)
{
- if (m_mustAutoHide && !(m_pContainer->m_dwFlags & CNT_NOMENUBAR)) {
- m_pContainer->m_dwFlags |= CNT_NOMENUBAR;
+ if (m_mustAutoHide && !m_pContainer->m_flags.m_bNoMenuBar) {
+ m_pContainer->m_flags.m_bNoMenuBar = true;
m_mustAutoHide = false;
::SendMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1);
releaseHook();
@@ -514,9 +515,9 @@ void CMenuBar::autoShow(const int showcmd) return;
}
- if (m_pContainer->m_dwFlags & CNT_NOMENUBAR) {
+ if (m_pContainer->m_flags.m_bNoMenuBar) {
m_mustAutoHide = true;
- m_pContainer->m_dwFlags &= ~CNT_NOMENUBAR;
+ m_pContainer->m_flags.m_bNoMenuBar = false;
::SendMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1);
}
else // do nothing, already visible
@@ -627,14 +628,13 @@ LRESULT CALLBACK CMenuBar::MessageHook(int nCode, WPARAM wParam, LPARAM lParam) break;
if (m_Owner->m_activeSubMenu && ::MenuItemFromPoint(nullptr, m_Owner->m_activeSubMenu, pt) >= 0)
break;
- else { // anywhere else, cancel the menu
- ::CallNextHookEx(m_hHook, nCode, wParam, lParam);
- m_Owner->Cancel();
- return 0;
- }
+
+ // anywhere else, cancel the menu
+ ::CallNextHookEx(m_hHook, nCode, wParam, lParam);
+ m_Owner->Cancel();
+ return 0;
- // allow hottracking by the toolbar control
- case WM_MOUSEMOVE:
+ case WM_MOUSEMOVE: // allow hottracking by the toolbar control
::GetCursorPos(&pt);
::ScreenToClient(m_Owner->m_hwndToolbar, &pt);
LPARAM newPos = MAKELONG(pt.x, pt.y);
@@ -923,7 +923,7 @@ LONG_PTR CALLBACK CMsgDialog::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM rcLastStatusBarClick.top = pt.y - 2;
rcLastStatusBarClick.bottom = pt.y + 2;
- if (pContainer->m_dwFlags & CNT_NOTITLE) {
+ if (pContainer->m_flags.m_bNoTitle) {
POINT pt1 = pt;
ScreenToClient(hWnd, &pt1);
@@ -960,7 +960,7 @@ LONG_PTR CALLBACK CMsgDialog::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) {
if (sid->dwId == MSG_ICON_SOUND)
mir_snwprintf(wBuf, TranslateT("Sounds are %s. Click to toggle status, hold Shift and click to set for all open containers"),
- pContainer->m_dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
+ pContainer->m_flags.m_bNoSound ? TranslateT("disabled") : TranslateT("enabled"));
else if (sid->dwId == MSG_ICON_UTN && (!dat->isChat() || dat->m_si->iType == GCW_PRIVMESS)) {
int mtnStatus = g_plugin.getByte(dat->m_hContact, SRMSGSET_TYPING, g_plugin.getByte(SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 9f0c80364e..3251d01776 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -757,15 +757,15 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi if (nen_options.bWindowCheck && windowOpen) // no popups at all for open windows... no exceptions
return 0;
- if (pContainer->m_dwFlags & CNT_DONTREPORT && (IsIconic(pContainer->m_hwnd))) // in tray counts as "minimised"
+ if (pContainer->m_flags.m_bDontReport && (IsIconic(pContainer->m_hwnd))) // in tray counts as "minimised"
goto passed;
- if (pContainer->m_dwFlags & CNT_DONTREPORTUNFOCUSED)
+ if (pContainer->m_flags.m_bDontReportUnfocused)
if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
goto passed;
- if (pContainer->m_dwFlags & CNT_ALWAYSREPORTINACTIVE) {
- if (pContainer->m_dwFlags & CNT_DONTREPORTFOCUSED)
+ if (pContainer->m_flags.m_bAlwaysReportInactive) {
+ if (pContainer->m_flags.m_bDontReportFocused)
goto passed;
if (pContainer->m_hwndActive != hwndChild)
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index dc0c9a27a8..c6e08bc581 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -92,7 +92,6 @@ void TSAPI DeleteContainer(int iIndex); void TSAPI RenameContainer(int iIndex, const wchar_t *newName);
void TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNameLen);
HMENU TSAPI BuildContainerMenu();
-void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT mode, bool fForceResize);
void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam);
void TSAPI SetAeroMargins(TContainerData *pContainer);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index cb5d1f4f03..243a3865e3 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -327,9 +327,10 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara case IDC_TOGGLETOOLBAR: if (lParam == 1) - ApplyContainerSetting(m_pContainer, CNT_NOMENUBAR, m_pContainer->m_dwFlags & CNT_NOMENUBAR ? 0 : 1, true); + m_pContainer->m_flags.m_bNoMenuBar = !m_pContainer->m_flags.m_bNoMenuBar; else - ApplyContainerSetting(m_pContainer, CNT_HIDETOOLBAR, m_pContainer->m_dwFlags & CNT_HIDETOOLBAR ? 0 : 1, true); + m_pContainer->m_flags.m_bHideToolbar = !m_pContainer->m_flags.m_bHideToolbar; + m_pContainer->ApplySetting(true); break; case IDC_INFOPANELMENU: @@ -702,12 +703,12 @@ void CMsgDialog::DM_UpdateLastMessage() const else { SendMessage(m_pContainer->m_hwndStatus, SB_SETICON, 0, 0); - if (m_pContainer->m_dwFlags & CNT_UINSTATUSBAR) + if (m_pContainer->m_flags.m_bUinStatusBar) mir_snwprintf(szBuf, L"UID: %s", m_cache->getUIN()); else if (m_lastMessage) { wchar_t date[64], time[64]; TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"d", date, _countof(date), 0); - if (m_pContainer->m_dwFlags & CNT_UINSTATUSBAR && mir_wstrlen(date) > 6) + if (m_pContainer->m_flags.m_bUinStatusBar && mir_wstrlen(date) > 6) date[mir_wstrlen(date) - 5] = 0; TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"t", time, _countof(time), 0); mir_snwprintf(szBuf, TranslateT("Last received: %s at %s"), date, time); @@ -761,7 +762,7 @@ LRESULT CMsgDialog::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam) if (PtInRect(&rc, pt)) return 1; - if (m_pContainer->m_dwFlags & CNT_SIDEBAR) { + if (m_pContainer->m_flags.m_bSideBar) { GetWindowRect(GetDlgItem(m_pContainer->m_hwnd, IDC_SIDEBARUP), &rc); GetWindowRect(GetDlgItem(m_pContainer->m_hwnd, IDC_SIDEBARDOWN), &rc1); rc.bottom = rc1.bottom; @@ -896,7 +897,7 @@ void CMsgDialog::DM_NotifyTyping(int mode) void CMsgDialog::DM_OptionsApplied(WPARAM, LPARAM lParam) { m_szMicroLf[0] = 0; - if (!(m_pContainer->m_theme.isPrivate)) { + if (!m_pContainer->m_theme.isPrivate) { m_pContainer->LoadThemeDefaults(); m_dwFlags = m_pContainer->m_theme.dwFlags; } @@ -904,7 +905,7 @@ void CMsgDialog::DM_OptionsApplied(WPARAM, LPARAM lParam) LoadLocalFlags(); m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY); - m_bShowUIElements = (m_pContainer->m_dwFlags & CNT_HIDETOOLBAR) == 0; + m_bShowUIElements = (m_pContainer->m_flags.m_bHideToolbar) == 0; m_dwFlagsEx = M.GetByte(m_hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0; m_pPanel.getVisibility(); @@ -963,7 +964,7 @@ void CMsgDialog::DM_Typing(bool fForceOff) m_pContainer->UpdateTitle(0); else m_pContainer->UpdateTitle(0, dat_active); - if (!(m_pContainer->m_dwFlags & CNT_NOFLASH) && PluginConfig.m_FlashOnMTN) + if (!m_pContainer->m_flags.m_bNoFlash && PluginConfig.m_FlashOnMTN) ReflashContainer(m_pContainer); } } @@ -986,8 +987,8 @@ void CMsgDialog::DM_Typing(bool fForceOff) } if (IsIconic(hwndContainer) || !IsActive()) { SetWindowText(hwndContainer, m_wszStatusBar); - m_pContainer->m_dwFlags |= CNT_NEED_UPDATETITLE; - if (!(m_pContainer->m_dwFlags & CNT_NOFLASH) && PluginConfig.m_FlashOnMTN) + m_pContainer->m_flags.m_bNeedsUpdateTitle = true; + if (!m_pContainer->m_flags.m_bNoFlash && PluginConfig.m_FlashOnMTN) ReflashContainer(m_pContainer); } @@ -998,7 +999,7 @@ void CMsgDialog::DM_Typing(bool fForceOff) } else { // active tab may show icon if status bar is disabled if (!hwndStatus) { - if (TabCtrl_GetItemCount(m_hwndParent) > 1 || !(m_pContainer->m_dwFlags & CNT_HIDETABS)) + if (TabCtrl_GetItemCount(m_hwndParent) > 1 || !m_pContainer->m_flags.m_bHideTabs) HandleIconFeedback(this, PluginConfig.g_IconTypingEvent); } } @@ -1183,7 +1184,7 @@ void CMsgDialog::DM_EventAdded(WPARAM hContact, LPARAM lParam) ShowWindow(m_pContainer->m_hwndActive, SW_HIDE); m_pContainer->m_hwndActive = m_hwnd; m_pContainer->UpdateTitle(m_hContact); - m_pContainer->m_dwFlags |= CNT_DEFERREDTABSELECT; + m_pContainer->m_flags.m_bDeferredTabSelect = true; } } } @@ -1192,10 +1193,10 @@ void CMsgDialog::DM_EventAdded(WPARAM hContact, LPARAM lParam) // flash window if it is not focused if (!bDisableNotify && !bIsStatusChangeEvent) if (!IsActive() && !(dbei.flags & DBEF_SENT)) { - if (!(m_pContainer->m_dwFlags & CNT_NOFLASH) && !m_pContainer->IsActive()) + if (!m_pContainer->m_flags.m_bNoFlash && !m_pContainer->IsActive()) FlashContainer(m_pContainer, 1, 0); m_pContainer->SetIcon(this, Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); - m_pContainer->m_dwFlags |= CNT_NEED_UPDATETITLE; + m_pContainer->m_flags.m_bNeedsUpdateTitle = true; } // play a sound @@ -1235,7 +1236,7 @@ void CMsgDialog::DM_HandleAutoSizeRequest(REQRESIZE* rr) iNewHeight = (cy - panelHeight) / 2; m_dynaSplitter = iNewHeight - DPISCALEY_S(2); - if (m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR) + if (m_pContainer->m_flags.m_bBottomToolbar) m_dynaSplitter += DPISCALEY_S(22); m_iSplitterY = m_dynaSplitter + DPISCALEY_S(34); DM_RecalcPictureSize(); @@ -1276,7 +1277,7 @@ void CMsgDialog::DrawStatusIcons(HDC hDC, const RECT &rc, int gap) DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_SOUNDS], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); - DrawIconEx(hDC, x, y, m_pContainer->m_dwFlags & CNT_NOSOUND ? + DrawIconEx(hDC, x, y, m_pContainer->m_flags.m_bNoSound ? PluginConfig.g_iconOverlayDisabled : PluginConfig.g_iconOverlayEnabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } @@ -1329,12 +1330,12 @@ void CMsgDialog::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int cod if (sid->dwId == MSG_ICON_SOUND && code != NM_RCLICK) { if (GetKeyState(VK_SHIFT) & 0x8000) { for (TContainerData *p = pFirstContainer; p; p = p->pNext) { - p->m_dwFlags = ((m_pContainer->m_dwFlags & CNT_NOSOUND) ? p->m_dwFlags | CNT_NOSOUND : p->m_dwFlags & ~CNT_NOSOUND); + p->m_flags.m_bNoSound = m_pContainer->m_flags.m_bNoSound; InvalidateRect(m_pContainer->m_hwndStatus, nullptr, TRUE); } } else { - m_pContainer->m_dwFlags ^= CNT_NOSOUND; + m_pContainer->m_flags.m_bNoSound = !m_pContainer->m_flags.m_bNoSound; InvalidateRect(m_pContainer->m_hwndStatus, nullptr, TRUE); } } diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index ecd013bad5..e6ab2be730 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -34,7 +34,7 @@ void CB_InitCustomButtons(); CGlobals PluginConfig;
-static TContainerSettings _cnt_default = { CNT_FLAGS_DEFAULT, CNT_FLAGSEX_DEFAULT, 255, CInfoPanel::DEGRADE_THRESHOLD, 60, 60, L"%n (%s)", 1, 0 };
+static TContainerSettings _cnt_default = { 0, 0, 255, CInfoPanel::DEGRADE_THRESHOLD, 60, 60, L"%n (%s)", 1, 0 };
wchar_t* CGlobals::m_default_container_name = L"default";
@@ -145,7 +145,6 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_bAlwaysFullToolbarWidth = M.GetBool("alwaysfulltoolbar", true);
m_LimitStaticAvatarHeight = M.GetDword("avatarheight", 96);
m_SendFormat = M.GetByte("sendformat", 0);
- m_TabAppearance = M.GetDword("tabconfig", TCF_FLASHICON | TCF_SINGLEROWTABCONTROL);
m_panelHeight = (DWORD)M.GetDword("panelheight", CInfoPanel::DEGRADE_THRESHOLD);
m_MUCpanelHeight = db_get_dw(0, CHAT_MODULE, "panelheight", CInfoPanel::DEGRADE_THRESHOLD);
m_bIdleDetect = M.GetBool("dimIconsForIdleContacts", true);
@@ -178,7 +177,11 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_genericTxtColor = db_get_dw(0, FONTMODULE, "genericTxtClr", GetSysColor(COLOR_BTNTEXT));
m_cRichBorders = db_get_dw(0, FONTMODULE, "cRichBorders", 0);
+ TContainerFlags f; f.dw = 0;
+ f.m_bDontReport = f.m_bDontReportUnfocused = f.m_bAlwaysReportInactive = f.m_bHideTabs = f.m_bNewContainerFlags = f.m_bNoMenuBar = f.m_bInfoPanel = true;
+
::memcpy(&globalContainerSettings, &_cnt_default, sizeof(TContainerSettings));
+ globalContainerSettings.flags = f;
Utils::ReadContainerSettingsFromDB(0, &globalContainerSettings);
globalContainerSettings.fPrivate = false;
if (fReloadSkins)
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 93856b9e4f..a105a9d155 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -109,7 +109,6 @@ public: double m_DPIscaleY;
HBITMAP m_hbmMsgArea;
HWND m_hwndClist;
- int m_TabAppearance;
myTabCtrl tabConfig;
int m_panelHeight, m_MUCpanelHeight;
int m_smcxicon, m_smcyicon;
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 638af4c505..672920aaeb 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -223,7 +223,7 @@ bool CInfoPanel::getVisibility() return false;
}
- BYTE bDefault = (m_dat->m_pContainer->m_dwFlags & CNT_INFOPANEL) ? 1 : 0;
+ BYTE bDefault = (m_dat->m_pContainer->m_flags.m_bInfoPanel) ? 1 : 0;
BYTE bContact = M.GetByte(m_dat->m_hContact, "infopanel", 0);
BYTE visible = (bContact == 0 ? bDefault : (bContact == (BYTE)-1 ? 0 : 1));
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index db31ddb128..63a577702d 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -252,7 +252,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) } else fShowOnClist = false; - if ((!foundWin || !(pContainer->m_dwFlags & CNT_NOSOUND)) && preTyping != (mode != 0)) + if ((!foundWin || !pContainer->m_flags.m_bNoSound) && preTyping != (mode != 0)) Skin_PlaySound(mode ? "TNStart" : "TNStop"); if (g_plugin.getByte("ShowTypingPopup", 0)) { diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 503ddf53cf..c316355f9f 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -412,7 +412,7 @@ bool CMsgDialog::OnInitDialog() m_cache->updateUIN();
m_cache->setWindowData(this);
- m_bIsAutosizingInput = (m_pContainer->m_dwFlags & CNT_AUTOSPLITTER) && !(m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE);
+ m_bIsAutosizingInput = (m_pContainer->m_flags.m_bAutoSplitter) && !(m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE);
m_szProto = const_cast<char *>(m_cache->getProto());
m_bIsMeta = m_cache->isMeta();
if (m_bIsMeta)
@@ -465,7 +465,7 @@ bool CMsgDialog::OnInitDialog() m_hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, L"Static", L"", SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, m_hwnd, (HMENU)6000, nullptr, nullptr);
mir_subclassWindow(m_hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
- m_bShowUIElements = (m_pContainer->m_dwFlags & CNT_HIDETOOLBAR) == 0;
+ m_bShowUIElements = (m_pContainer->m_flags.m_bHideToolbar) == 0;
m_sendMode |= m_hContact == 0 ? SMODE_MULTIPLE : 0;
m_sendMode |= M.GetByte(m_hContact, "no_ack", 0) ? SMODE_NOACK : 0;
@@ -638,7 +638,7 @@ bool CMsgDialog::OnInitDialog() LoadSplitter();
ShowPicture(true);
- if (m_pContainer->m_dwFlags & CNT_CREATE_MINIMIZED || !m_bActivate || m_pContainer->m_dwFlags & CNT_DEFERREDTABSELECT) {
+ if (m_pContainer->m_flags.m_bCreateMinimized || !m_bActivate || m_pContainer->m_flags.m_bDeferredTabSelect) {
m_iFlashIcon = PluginConfig.g_IconMsgEvent;
SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
m_bCanFlashTab = true;
@@ -649,7 +649,7 @@ bool CMsgDialog::OnInitDialog() if (!isChat())
m_pContainer->SetIcon(this, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
- m_pContainer->m_dwFlags |= CNT_NEED_UPDATETITLE;
+ m_pContainer->m_flags.m_bNeedsUpdateTitle = true;
m_dwFlags |= MWF_NEEDCHECKSIZE | MWF_WASBACKGROUNDCREATE | MWF_DEFERREDSCROLL;
}
@@ -663,11 +663,11 @@ bool CMsgDialog::OnInitDialog() SetActiveWindow(m_hwnd);
SetForegroundWindow(m_hwnd);
}
- else if (m_pContainer->m_dwFlags & CNT_CREATE_MINIMIZED) {
+ else if (m_pContainer->m_flags.m_bCreateMinimized) {
m_dwFlags |= MWF_DEFERREDSCROLL;
ShowWindow(m_hwnd, SW_SHOWNOACTIVATE);
m_pContainer->m_hwndActive = m_hwnd;
- m_pContainer->m_dwFlags |= CNT_DEFERREDCONFIGURE;
+ m_pContainer->m_flags.m_bDeferredConfigure = true;
}
m_pContainer->UpdateTitle(m_hContact);
@@ -681,8 +681,8 @@ bool CMsgDialog::OnInitDialog() m_dwFlags &= ~MWF_INITMODE;
NotifyEvent(MSG_WINDOW_EVT_OPEN);
- if (m_pContainer->m_dwFlags & CNT_CREATE_MINIMIZED) {
- m_pContainer->m_dwFlags &= ~CNT_CREATE_MINIMIZED;
+ if (m_pContainer->m_flags.m_bCreateMinimized) {
+ m_pContainer->m_flags.m_bCreateMinimized = false;
m_pContainer->m_hwndActive = m_hwnd;
}
return true;
@@ -695,7 +695,7 @@ void CMsgDialog::OnDestroy() m_cache->setWindowData();
m_pContainer->ClearMargins();
PostMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1);
- if (m_pContainer->m_dwFlags & CNT_SIDEBAR)
+ if (m_pContainer->m_flags.m_bSideBar)
m_pContainer->m_pSideBar->removeSession(this);
if (m_hContact && M.GetByte("deletetemp", 0))
@@ -849,7 +849,7 @@ void CMsgDialog::onClick_Ok(CCtrlButton *) m_si->pMI->idleTimeStamp = time(0);
UpdateStatusBar();
if (m_pContainer)
- if (fSound && !nen_options.iNoSounds && !(m_pContainer->m_dwFlags & CNT_NOSOUND))
+ if (fSound && !nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound)
Skin_PlaySound("ChatSent");
}
else {
@@ -1110,8 +1110,8 @@ 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_dwFlags & CNT_HIDETOOLBAR) == 0;
- bool bBottomToolbar = (m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR) != 0;
+ bool bShowToolbar = (m_pContainer->m_flags.m_bHideToolbar) == 0;
+ bool bBottomToolbar = (m_pContainer->m_flags.m_bBottomToolbar) != 0;
int iSplitterX = m_pContainer->m_pSettings->iSplitterX;
@@ -1606,7 +1606,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) }
if (pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE) {
- if (GetSendButtonState(m_hwnd) != PBS_DISABLED && !(m_pContainer->m_dwFlags & CNT_HIDETOOLBAR))
+ if (GetSendButtonState(m_hwnd) != PBS_DISABLED && !m_pContainer->m_flags.m_bHideToolbar)
SetFocus(GetDlgItem(m_hwnd, IDOK));
else
SetFocus(m_pLog->GetHwnd());
@@ -1912,7 +1912,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_CHAR:
KbdState(isShift, isCtrl, isAlt);
- if (!isAlt && !isCtrl && !(m_pContainer->m_dwFlags & CNT_NOSOUND) && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab))
+ if (!isAlt && !isCtrl && !m_pContainer->m_flags.m_bNoSound && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab))
Skin_PlaySound("SoundOnTyping");
if (isCtrl && !isAlt) {
@@ -1968,7 +1968,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_KEYDOWN:
KbdState(isShift, isCtrl, isAlt);
- if (!isAlt && !(m_pContainer->m_dwFlags & CNT_NOSOUND) && wParam == VK_DELETE)
+ if (!isAlt && !m_pContainer->m_flags.m_bNoSound && wParam == VK_DELETE)
Skin_PlaySound("SoundOnTyping");
if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
@@ -2666,7 +2666,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case DM_CONFIGURETOOLBAR:
// configures the toolbar only... if lParam != 0, then it also calls
// SetDialogToType() to reconfigure the message window
- m_bShowUIElements = m_pContainer->m_dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
+ m_bShowUIElements = m_pContainer->m_flags.m_bHideToolbar ? 0 : 1;
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
@@ -2775,7 +2775,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) KillTimer(m_hwnd, wParam);
mir_snwprintf(job->szErrorMsg, TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"));
job->iStatus = SendQueue::SQ_ERROR;
- if (!nen_options.iNoSounds && !(m_pContainer->m_dwFlags & CNT_NOSOUND))
+ if (!nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound)
Skin_PlaySound("SendError");
if (!(m_dwFlags & MWF_ERRORSTATE))
sendQueue->handleError(this, iIndex);
@@ -2829,7 +2829,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_iLogMode != WANT_IEVIEW_LOG)
SetFocus(m_message.GetHwnd());
- if (m_pContainer->m_dwFlags & CNT_SIDEBAR)
+ if (m_pContainer->m_flags.m_bSideBar)
m_pContainer->m_pSideBar->Layout();
}
else {
@@ -3098,7 +3098,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case DM_UPDATEUIN:
if (m_pPanel.isActive())
m_pPanel.Invalidate();
- if (m_pContainer->m_dwFlags & CNT_UINSTATUSBAR)
+ if (m_pContainer->m_flags.m_bUinStatusBar)
tabUpdateStatusBar();
return 0;
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 9e8ee1ad52..9d157111b2 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -89,14 +89,14 @@ void CMsgDialog::AdjustBottomAvatarDisplay() void CMsgDialog::CalcDynamicAvatarSize(BITMAP *bminfo) { - if (m_dwFlags & MWF_WASBACKGROUNDCREATE || m_pContainer->m_dwFlags & CNT_DEFERREDCONFIGURE || m_pContainer->m_dwFlags & CNT_CREATE_MINIMIZED || IsIconic(m_pContainer->m_hwnd)) + if (m_dwFlags & MWF_WASBACKGROUNDCREATE || 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; GetClientRect(m_hwnd, &rc); - BOOL bBottomToolBar = m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR; - BOOL bToolBar = m_pContainer->m_dwFlags & CNT_HIDETOOLBAR ? 0 : 1; + BOOL bBottomToolBar = m_pContainer->m_flags.m_bBottomToolbar; + BOOL bToolBar = m_pContainer->m_flags.m_bHideToolbar ? 0 : 1; int iSplitOffset = m_bIsAutosizingInput ? 1 : 0; double picAspect = (bminfo->bmWidth == 0 || bminfo->bmHeight == 0) ? 1.0 : (double)(bminfo->bmWidth / (double)bminfo->bmHeight); @@ -172,7 +172,7 @@ void CMsgDialog::DetermineMinHeight() { RECT rc; LONG height = (m_pPanel.isActive() ? m_pPanel.getHeight() + 2 : 0); - if (!(m_pContainer->m_dwFlags & CNT_HIDETOOLBAR)) + if (!m_pContainer->m_flags.m_bHideToolbar) height += DPISCALEY_S(24); // toolbar GetClientRect(m_message.GetHwnd(), &rc); height += rc.bottom; // input area @@ -560,7 +560,7 @@ void CMsgDialog::FlashTab(bool bInvertMode) TCITEM item = {}; item.mask = TCIF_IMAGE; TabCtrl_SetItem(m_hwndParent, m_iTabID, &item); - if (m_pContainer->m_dwFlags & CNT_SIDEBAR) + if (m_pContainer->m_flags.m_bSideBar) m_pContainer->m_pSideBar->updateSession(this); } @@ -835,7 +835,7 @@ void CMsgDialog::LoadSettings() void CMsgDialog::LoadSplitter() { if (m_bIsAutosizingInput) { - m_iSplitterY = (m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46); + m_iSplitterY = (m_pContainer->m_flags.m_bBottomToolbar) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46); if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKINPUTAREA].IGNORED) m_iSplitterY += (SkinItems[ID_EXTBKINPUTAREA].MARGIN_BOTTOM + SkinItems[ID_EXTBKINPUTAREA].MARGIN_TOP - 2); @@ -1650,7 +1650,7 @@ void CMsgDialog::SplitterMoved(int coord, HWND hwnd) // attempt to fix splitter troubles.. // hardcoded limits... better solution is possible, but this works for now int bottomtoolbarH = 0; - if (m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR) + if (m_pContainer->m_flags.m_bBottomToolbar) bottomtoolbarH = 22; if (m_iSplitterY < (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH)) { // min splitter size @@ -2128,7 +2128,7 @@ void CMsgDialog::UpdateTitle() } if (m_iTabID >= 0) { TabCtrl_SetItem(m_hwndParent, m_iTabID, &item); - if (m_pContainer->m_dwFlags & CNT_SIDEBAR) + if (m_pContainer->m_flags.m_bSideBar) m_pContainer->m_pSideBar->updateSession(this); } if (m_pContainer->m_hwndActive == m_hwnd && bChanged) @@ -2149,7 +2149,7 @@ void CMsgDialog::UpdateTitle() // care about MetaContacts and update the statusbar icon with the currently "most online" contact... if (m_bIsMeta) { PostMessage(m_hwnd, DM_OWNNICKCHANGED, 0, 0); - if (m_pContainer->m_dwFlags & CNT_UINSTATUSBAR) + if (m_pContainer->m_flags.m_bUinStatusBar) DM_UpdateLastMessage(); } } @@ -2190,9 +2190,9 @@ void CMsgDialog::UpdateWindowState(UINT msg) return; if (msg == WM_ACTIVATE) { - if (m_pContainer->m_dwFlags & CNT_TRANSPARENCY) { + if (m_pContainer->m_flags.m_bTransparent) { DWORD trans = LOWORD(m_pContainer->m_pSettings->dwTransparency); - SetLayeredWindowAttributes(m_pContainer->m_hwnd, CSkin::m_ContainerColorKey, (BYTE)trans, (m_pContainer->m_dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); + SetLayeredWindowAttributes(m_pContainer->m_hwnd, CSkin::m_ContainerColorKey, (BYTE)trans, (m_pContainer->m_flags.m_bTransparent ? LWA_ALPHA : 0)); } } @@ -2249,7 +2249,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_iFlashIcon = nullptr; } - m_pContainer->m_dwFlags &= ~CNT_NEED_UPDATETITLE; + m_pContainer->m_flags.m_bNeedsUpdateTitle = false; if (m_dwFlags & MWF_NEEDCHECKSIZE) PostMessage(m_hwnd, DM_SAVESIZE, 0, 0); @@ -2272,7 +2272,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) g_clistApi.pfnRemoveEvent(m_hContact, m_hFlashingEvent); m_hFlashingEvent = 0; } - m_pContainer->m_dwFlags &= ~CNT_NEED_UPDATETITLE; + m_pContainer->m_flags.m_bNeedsUpdateTitle = false; if ((m_dwFlags & MWF_DEFERREDREMAKELOG) && !IsIconic(m_pContainer->m_hwnd)) { RemakeLog(); @@ -2340,7 +2340,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) BB_SetButtonsPos(); if (M.isAero()) InvalidateRect(m_hwndParent, nullptr, FALSE); - if (m_pContainer->m_dwFlags & CNT_SIDEBAR) + if (m_pContainer->m_flags.m_bSideBar) m_pContainer->m_pSideBar->setActiveItem(this); if (m_pWnd) diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 65041b78e9..e369c32818 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -222,7 +222,7 @@ void TSAPI HandleIconFeedback(CMsgDialog *dat, HICON iIcon) item.iImage = 0;
item.mask = TCIF_IMAGE;
- if (dat->m_pContainer->m_dwFlags & CNT_SIDEBAR)
+ if (dat->m_pContainer->m_flags.m_bSideBar)
dat->m_pContainer->m_pSideBar->updateSession(dat);
else
TabCtrl_SetItem(GetDlgItem(dat->m_pContainer->m_hwnd, IDC_MSGTABS), dat->m_iTabID, &item);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 539b641a3a..611299f6e5 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -97,16 +97,16 @@ int TSAPI MessageWindowOpened(MCONTACT hContact, HWND _hwnd) SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
if (pContainer) {
- if (pContainer->m_dwFlags & CNT_DONTREPORT) {
+ if (pContainer->m_flags.m_bDontReport) {
if (IsIconic(pContainer->m_hwnd))
return 0;
}
- if (pContainer->m_dwFlags & CNT_DONTREPORTUNFOCUSED) {
+ if (pContainer->m_flags.m_bDontReportUnfocused) {
if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
return 0;
}
- if (pContainer->m_dwFlags & CNT_ALWAYSREPORTINACTIVE) {
- if (pContainer->m_dwFlags & CNT_DONTREPORTFOCUSED)
+ if (pContainer->m_flags.m_bAlwaysReportInactive) {
+ if (pContainer->m_flags.m_bDontReportFocused)
return 0;
return pContainer->m_hwndActive == hwnd;
@@ -271,7 +271,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) NMHDR nmhdr = {};
nmhdr.code = TCN_SELCHANGE;
- if (TabCtrl_GetItemCount(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS)) > 1 && !(pContainer->m_dwFlags & CNT_DEFERREDTABSELECT)) {
+ if (TabCtrl_GetItemCount(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS)) > 1 && !pContainer->m_flags.m_bDeferredTabSelect) {
TabCtrl_SetCurSel(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS), GetTabIndexFromHWND(GetDlgItem(pContainer->m_hwnd, IDC_MSGTABS), hwndChild));
SendMessage(pContainer->m_hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); // just select the tab and let WM_NOTIFY do the rest
}
@@ -397,7 +397,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, HWND hwndNew = pWindow->GetHwnd();
// switchbar support
- if (pContainer->m_dwFlags & CNT_SIDEBAR)
+ if (pContainer->m_flags.m_bSideBar)
pContainer->m_pSideBar->addSession(pWindow, pContainer->m_iTabIndex);
SendMessage(pContainer->m_hwnd, WM_SIZE, 0, 0);
@@ -409,7 +409,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, SetFocus(pContainer->m_hwndActive);
}
else {
- if (pContainer->m_dwFlags & CNT_NOFLASH)
+ if (pContainer->m_flags.m_bNoFlash)
pContainer->SetIcon(0, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
else
FlashContainer(pContainer, 1, 0);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index b03ca341eb..7c1ac4653d 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -153,10 +153,73 @@ struct TLogTheme bool isPrivate;
};
+union TContainerFlags
+{
+ DWORD dw;
+ struct {
+ bool m_bUnused1 : 1;
+ bool m_bNoTitle : 1;
+ bool m_bHideTabs : 1;
+ bool m_bSideBar : 1;
+ bool m_bNoFlash : 1;
+ bool m_bSticky : 1;
+ bool m_bDontReport : 1;
+ bool m_bFlashAlways : 1;
+ bool m_bTransparent : 1;
+ bool m_bAvatarsOnTaskbar : 1;
+ bool m_bDontReportFocused : 1;
+ bool m_bGlobalSize : 1;
+ bool m_bInfoPanel : 1;
+ bool m_bNoSound : 1;
+ bool m_bAutoSplitter : 1;
+ bool m_bDeferredConfigure : 1;
+ bool m_bCreateMinimized : 1;
+ bool m_bNeedsUpdateTitle : 1;
+ bool m_bDeferredResize : 1;
+ bool m_bDontReportUnfocused : 1;
+ bool m_bAlwaysReportInactive : 1;
+ bool m_bNewContainerFlags : 1;
+ bool m_bDeferredTabSelect : 1;
+ bool m_bCreateCloned : 1;
+ bool m_bNoStatusBar : 1;
+ bool m_bNoMenuBar : 1;
+ bool m_bTabsBottom : 1;
+ bool m_bUnused2 : 1;
+ bool m_bBottomToolbar : 1;
+ bool m_bHideToolbar : 1;
+ bool m_bUinStatusBar : 1;
+ bool m_bVerticalMax : 1;
+ };
+};
+
+union TContainerFlagsEx
+{
+ DWORD dw;
+ struct
+ {
+ bool m_bTabFlat : 1;
+ bool m_bUnused1 : 1;
+ bool m_bTabCloseButton : 1;
+ bool m_bTabFlashIcon : 1;
+ bool m_bTabFlashLabel : 1;
+ bool m_bTabSingleRow : 1;
+ bool m_bUnused2 : 1;
+ bool m_bUnused3 : 1;
+ bool m_bTabSBarLeft : 1;
+ bool m_bTabSBarRight : 1;
+
+ bool m_bSoundMinimized : 1;
+ bool m_bSoundUnfocused : 1;
+ bool m_bSoundInactive : 1;
+ bool m_bSoundFocused : 1;
+ };
+};
+
struct TContainerSettings
{
- DWORD dwFlags;
- DWORD dwFlagsEx;
+ TContainerFlags flags;
+ TContainerFlagsEx flagsEx;
+
DWORD dwTransparency;
DWORD panelheight;
int iSplitterX, iSplitterY;
@@ -175,8 +238,9 @@ struct TContainerData : public MZeroedObject ~TContainerData();
TContainerData *pNext;
+ TContainerFlags m_flags;
+ TContainerFlagsEx m_flagsEx;
- wchar_t m_wszName[CONTAINER_NAMELEN + 4]; // container name
HWND m_hwndActive; // active message window
HWND m_hwnd; // the container handle
int m_iTabIndex; // next tab id
@@ -185,8 +249,6 @@ struct TContainerData : public MZeroedObject bool m_bHidden;
HWND m_hwndTip; // tab - tooltips...
BOOL m_bDontSmartClose; // if set, do not search and select the next possible tab after closing one.
- DWORD m_dwFlags;
- DWORD m_dwFlagsEx;
LONG m_uChildMinHeight;
int m_tBorder;
int m_tBorder_outer_left, m_tBorder_outer_right, m_tBorder_outer_top, m_tBorder_outer_bottom;
@@ -200,7 +262,6 @@ struct TContainerData : public MZeroedObject DWORD m_dwFlashingStarted;
HWND m_hWndOptions;
BOOL m_bSizingLoop;
- wchar_t m_szRelThemeFile[MAX_PATH], m_szAbsThemeFile[MAX_PATH];
HDC m_cachedDC;
HBITMAP m_cachedHBM, m_oldHBM;
SIZE m_oldDCSize;
@@ -228,9 +289,13 @@ struct TContainerData : public MZeroedObject CTaskbarInteract *m_pTaskBar;
TContainerSettings *m_pSettings;
- void InitRedraw(void);
+ wchar_t m_wszName[CONTAINER_NAMELEN + 4]; // container name
+ wchar_t m_szRelThemeFile[MAX_PATH], m_szAbsThemeFile[MAX_PATH];
+
+ void ApplySetting(bool fForceResize = false);
void CloseTabByMouse(POINT *);
void Configure();
+ void InitRedraw(void);
void LoadOverrideTheme(void);
void LoadThemeDefaults(void);
void QueryPending();
@@ -546,7 +611,7 @@ public: void KbdState(bool &isShift, bool &isControl, bool &isAlt);
void LimitMessageText(int iLen);
int LoadLocalFlags(void);
- int MustPlaySound(void) const;
+ bool MustPlaySound(void) const;
void NotifyDeliveryFailure(void) const;
void RemakeLog(void);
void SaveSplitter(void);
@@ -649,63 +714,11 @@ struct TIconDescW * tab config flags
*/
-#define TCF_FLAT 1
-//#define TCF_STYLED 2
-#define TCF_CLOSEBUTTON 4
-#define TCF_FLASHICON 8
-#define TCF_FLASHLABEL 16
-#define TCF_SINGLEROWTABCONTROL 32
-//#define TCF_LABELUSEWINCOLORS 64
-//#define TCF_BKGUSEWINCOLORS 128
-#define TCF_SBARLEFT 256
-#define TCF_SBARRIGHT 512
-
-#define TCF_DEFAULT (TCF_FLASHICON)
-
#define MIN_PANELHEIGHT 20
-// flags for the container dwFlags
-#define CNT_MOUSEDOWN 1
-#define CNT_NOTITLE 2
-#define CNT_HIDETABS 4
-#define CNT_SIDEBAR 8
-#define CNT_NOFLASH 0x10
-#define CNT_STICKY 0x20
-#define CNT_DONTREPORT 0x40
-#define CNT_FLASHALWAYS 0x80
-#define CNT_TRANSPARENCY 0x100
-#define CNT_AVATARSONTASKBAR 0x200
-#define CNT_DONTREPORTFOCUSED 0x400
-#define CNT_GLOBALSIZE 0x800
-#define CNT_INFOPANEL 0x1000
-#define CNT_NOSOUND 0x2000
-#define CNT_AUTOSPLITTER 0x4000
-#define CNT_DEFERREDCONFIGURE 0x8000
-#define CNT_CREATE_MINIMIZED 0x10000
-#define CNT_NEED_UPDATETITLE 0x20000
-#define CNT_DEFERREDSIZEREQUEST 0x40000
-#define CNT_DONTREPORTUNFOCUSED 0x80000
-#define CNT_ALWAYSREPORTINACTIVE 0x100000
-#define CNT_NEWCONTAINERFLAGS 0x200000
-#define CNT_DEFERREDTABSELECT 0x400000
-#define CNT_CREATE_CLONED 0x800000
-#define CNT_NOSTATUSBAR 0x1000000
-#define CNT_NOMENUBAR 0x2000000
-#define CNT_TABSBOTTOM 0x4000000
-#define CNT_BOTTOMTOOLBAR 0x10000000
-#define CNT_HIDETOOLBAR 0x20000000
-#define CNT_UINSTATUSBAR 0x40000000
-#define CNT_VERTICALMAX 0x80000000
-
-#define CNT_EX_SOUNDS_MINIMIZED 1024
-#define CNT_EX_SOUNDS_UNFOCUSED 2048
-#define CNT_EX_SOUNDS_INACTIVETABS 4096
-#define CNT_EX_SOUNDS_FOCUSED 8192
-
-#define CNT_FLAGS_DEFAULT (CNT_DONTREPORT | CNT_DONTREPORTUNFOCUSED | CNT_ALWAYSREPORTINACTIVE | CNT_HIDETABS | CNT_NEWCONTAINERFLAGS | CNT_NOMENUBAR | CNT_INFOPANEL)
#define CNT_TRANS_DEFAULT 0x00ff00ff
-#define CNT_FLAGSEX_DEFAULT (TCF_FLASHICON | CNT_EX_SOUNDS_MINIMIZED | CNT_EX_SOUNDS_UNFOCUSED | CNT_EX_SOUNDS_INACTIVETABS | CNT_EX_SOUNDS_FOCUSED)
+#define CNT_FLAGSEX_DEFAULT (m_bTabFlashIcon | m_bSoundMinimized | m_bSoundUnfocused | m_bSoundInactive | m_bSoundFocused)
#define CNT_CREATEFLAG_CLONED 1
#define CNT_CREATEFLAG_MINIMIZED 2
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index d71d647ef6..d00e26df28 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -441,7 +441,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) if (dat) { // "hard" errors are handled differently in multisend. There is no option to retry - once failed, they // are discarded and the user is notified with a small log message. - if (!nen_options.iNoSounds && !(m_pContainer->m_dwFlags & CNT_NOSOUND)) + if (!nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound) Skin_PlaySound("SendError"); mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), (wchar_t*)ack->lParam); @@ -485,7 +485,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) db_event_setId(dbei.szModule, hNewEvent, (char*)ack->lParam); if (m_pContainer) - if (!nen_options.iNoSounds && !(m_pContainer->m_dwFlags & CNT_NOSOUND)) + if (!nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound) Skin_PlaySound("SendMsg"); Srmm_Broadcast(DM_APPENDMCEVENT, job.hContact, hNewEvent); diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 2943b6c801..a244a616a1 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -148,7 +148,7 @@ const SIZE& CSideBarButton::measureItem() ::GetTextExtentPoint32(dc, tszLabel, (int)mir_wstrlen(tszLabel), &sz);
sz.cx += 28;
- if (m_dat->m_pContainer->m_dwFlagsEx & TCF_CLOSEBUTTON)
+ if (m_dat->m_pContainer->m_flagsEx.m_bTabCloseButton)
sz.cx += 20;
if (m_sideBarLayout->dwFlags & CSideBar::SIDEBARLAYOUT_VERTICALORIENTATION)
@@ -255,7 +255,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const if (m_dat && pContainer) {
hIcon = m_dat->m_cache->getIcon(iSize);
- if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !(pContainer->m_dwFlagsEx & TCF_FLASHICON)) {
+ 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)
@@ -269,7 +269,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const /*
* draw the close button if enabled
*/
- if (m_sideBar->getContainer()->m_dwFlagsEx & TCF_CLOSEBUTTON) {
+ if (m_sideBar->getContainer()->m_flagsEx.m_bTabCloseButton) {
if (m_sideBar->getHoveredClose() != this)
CSkin::m_default_bf.SourceConstantAlpha = 150;
@@ -281,7 +281,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const ::SetBkMode(hdc, TRANSPARENT);
- if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !(pContainer->m_dwFlagsEx & TCF_FLASHLABEL)) {
+ if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !pContainer->m_flagsEx.m_bTabFlashLabel) {
bool fIsActive = (m_sideBar->getActiveItem() == this ? true : false);
COLORREF clr = 0;
dwTextFlags |= DT_WORD_ELLIPSIS;
@@ -307,7 +307,7 @@ int CSideBarButton::testCloseButton() const if (m_id == IDC_SIDEBARUP || m_id == IDC_SIDEBARDOWN) // scroller buttons don't have a close button
return -1;
- if (m_sideBar->getContainer()->m_dwFlagsEx & TCF_CLOSEBUTTON && !(getLayout()->dwFlags & CSideBar::SIDEBARLAYOUT_NOCLOSEBUTTONS)) {
+ if (m_sideBar->getContainer()->m_flagsEx.m_bTabCloseButton && !(getLayout()->dwFlags & CSideBar::SIDEBARLAYOUT_NOCLOSEBUTTONS)) {
POINT pt;
::GetCursorPos(&pt);
::ScreenToClient(m_hwnd, &pt);
@@ -379,17 +379,17 @@ void CSideBar::Init() m_firstVisibleOffset = 0;
m_totalItemHeight = 0;
- m_uLayout = (m_pContainer->m_dwFlagsEx & 0xff000000) >> 24;
+ m_uLayout = (m_pContainer->m_flagsEx.dw & 0xff000000) >> 24;
m_uLayout = ((m_uLayout < NR_LAYOUTS) ? m_uLayout : 0);
m_currentLayout = &m_layouts[m_uLayout];
m_dwFlags = m_currentLayout->dwFlags;
- m_dwFlags = (m_pContainer->m_dwFlagsEx & TCF_SBARLEFT ? m_dwFlags | SIDEBARORIENTATION_LEFT : m_dwFlags & ~SIDEBARORIENTATION_LEFT);
- m_dwFlags = (m_pContainer->m_dwFlagsEx & TCF_SBARRIGHT ? m_dwFlags | SIDEBARORIENTATION_RIGHT : m_dwFlags & ~SIDEBARORIENTATION_RIGHT);
+ m_dwFlags = (m_pContainer->m_flagsEx.m_bTabSBarLeft ? m_dwFlags | SIDEBARORIENTATION_LEFT : m_dwFlags & ~SIDEBARORIENTATION_LEFT);
+ m_dwFlags = (m_pContainer->m_flagsEx.m_bTabSBarRight ? m_dwFlags | SIDEBARORIENTATION_RIGHT : m_dwFlags & ~SIDEBARORIENTATION_RIGHT);
- if (m_pContainer->m_dwFlags & CNT_SIDEBAR) {
+ if (m_pContainer->m_flags.m_bSideBar) {
if (m_hwndScrollWnd == nullptr)
m_hwndScrollWnd = ::CreateWindowEx(0, L"TS_SideBarClass", L"", WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_CHILD,
0, 0, m_width, 40, m_pContainer->m_hwnd, reinterpret_cast<HMENU>(5000), g_plugin.getInst(), this);
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 714ddc826e..1356f16061 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -194,7 +194,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in hIcon = dat->m_hTabIcon;
}
- if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !(dat->m_pContainer->m_dwFlagsEx & TCF_FLASHICON)) {
+ 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)
@@ -216,7 +216,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in CSkin::m_default_bf.SourceConstantAlpha = 255;
}
- if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !(dat->m_pContainer->m_dwFlagsEx & TCF_FLASHLABEL)) {
+ if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !dat->m_pContainer->m_flagsEx.m_bTabFlashLabel) {
DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER;
HFONT oldFont = (HFONT)SelectObject(dc, (HFONT)SendMessage(tabdat->hwnd, WM_GETFONT, 0, 0));
if (tabdat->dwStyle & TCS_BUTTONS || !(tabdat->dwStyle & TCS_MULTILINE)) {
@@ -610,7 +610,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) tabdat->iHoveredTabIndex = hotItem;
tabdat->bAeroTabs = CSkin::m_fAeroSkinsValid && (isAero || PluginConfig.m_fillColor);
- tabdat->bCloseButton = (tabdat->pContainer->m_dwFlagsEx & TCF_CLOSEBUTTON) != 0;
+ tabdat->bCloseButton = tabdat->pContainer->m_flagsEx.m_bTabCloseButton;
tabdat->helperDat = nullptr;
if (tabdat->bAeroTabs) {
@@ -631,7 +631,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) // switchbar is active, don't paint a single pixel, the tab control won't be visible at all
// same when we have only ONE tab and do not want it to be visible because of the container
// option "Show tab bar only when needed".
- if ((tabdat->pContainer->m_dwFlags & CNT_SIDEBAR) || (nCount == 1 && tabdat->pContainer->m_dwFlags & CNT_HIDETABS)) {
+ if ((tabdat->pContainer->m_flags.m_bSideBar) || (nCount == 1 && tabdat->pContainer->m_flags.m_bHideTabs)) {
if (nCount == 0)
FillRect(hdcreal, &ps.rcPaint, GetSysColorBrush(COLOR_3DFACE)); // avoid flickering/ugly black background during container creation
EndPaint(hwnd, &ps);
@@ -660,7 +660,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) bmpOld = (HBITMAP)SelectObject(hdc, bmpMem);
}
- if (nCount == 1 && tabdat->pContainer->m_dwFlags & CNT_HIDETABS)
+ if (nCount == 1 && tabdat->pContainer->m_flags.m_bHideTabs)
rctClip = rctPage;
if (CSkin::m_skinEnabled)
@@ -692,7 +692,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) }
}
- if (nCount > 1 || !(tabdat->pContainer->m_dwFlags & CNT_HIDETABS)) {
+ if (nCount > 1 || !(tabdat->pContainer->m_flags.m_bHideTabs)) {
rctClip = rctPage;
InflateRect(&rctClip, -tabdat->pContainer->m_tBorder, -tabdat->pContainer->m_tBorder);
}
@@ -820,7 +820,7 @@ page_done: pt.y = rcLog.bottom;
pt.x = rcLog.left;
ScreenToClient(hwnd, &pt);
- rcPage.top = pt.y + ((nCount > 1 || !(tabdat->helperDat->m_pContainer->m_dwFlags & CNT_HIDETABS)) ? tabdat->helperDat->m_pContainer->m_tBorder : 0);
+ rcPage.top = pt.y + ((nCount > 1 || !(tabdat->helperDat->m_pContainer->m_flags.m_bHideTabs)) ? tabdat->helperDat->m_pContainer->m_tBorder : 0);
FillRect(hdc, &rcPage, CSkin::m_BrushBack);
rcPage.top = 0;
}
@@ -1043,7 +1043,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara tabdat->bTipActive = false;
}
KillTimer(hwnd, TIMERID_HOVER_T);
- if (tabdat->pContainer && (!tabdat->pContainer->m_pSideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->m_dwFlags & CNT_HIDETABS))))
+ if (tabdat->pContainer && (!tabdat->pContainer->m_pSideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->m_flags.m_bHideTabs))))
SetTimer(hwnd, TIMERID_HOVER_T, 750, nullptr);
break;
@@ -1052,7 +1052,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara int iTabs = TabCtrl_GetItemCount(hwnd);
if (!(tabdat->dwStyle & TCS_MULTILINE)) {
- if (iTabs > (tabdat->pContainer->m_dwFlags & CNT_HIDETABS ? 1 : 0)) {
+ if (iTabs > (tabdat->pContainer->m_flags.m_bHideTabs ? 1 : 0)) {
RECT rcClient, rc;
GetClientRect(hwnd, &rcClient);
TabCtrl_GetItemRect(hwnd, iTabs - 1, &rc);
@@ -1080,7 +1080,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break;
case WM_LBUTTONDBLCLK:
- if (!(tabdat->pContainer->m_pSettings->dwFlagsEx & TCF_CLOSEBUTTON)) {
+ if (!tabdat->pContainer->m_pSettings->flagsEx.m_bTabCloseButton) {
GetCursorPos(&pt);
tabdat->pContainer->CloseTabByMouse(&pt);
}
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index b4a8257695..e7e0f82811 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -370,7 +370,7 @@ void CProxyWindow::sendPreview() }
else pt.x = pt.y = 0;
- CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap(m_hwndProxy, hbm, &pt, m_dat->m_pContainer->m_dwFlags & CNT_CREATE_MINIMIZED ? 0 : DWM_SIT_DISPLAYFRAME);
+ CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap(m_hwndProxy, hbm, &pt, m_dat->m_pContainer->m_flags.m_bCreateMinimized ? 0 : DWM_SIT_DISPLAYFRAME);
::ReleaseDC(m_dat->GetHwnd(), dc);
::DeleteObject(hbm);
}
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 64bd4d7a18..1c66588e34 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2144,7 +2144,7 @@ void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc) void CMsgDialog::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const
{
- if (m_pContainer->m_dwFlags & CNT_HIDETOOLBAR)
+ if (m_pContainer->m_flags.m_bHideToolbar)
return;
bool bAero = M.isAero();
@@ -2154,7 +2154,7 @@ void CMsgDialog::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const RECT rc, rcToolbar;
POINT pt;
- if (!(m_pContainer->m_dwFlags & CNT_BOTTOMTOOLBAR)) {
+ if (!m_pContainer->m_flags.m_bBottomToolbar) {
::GetWindowRect(m_pLog->GetHwnd(), &rc);
pt.y = rc.bottom + 0;
::ScreenToClient(m_hwnd, &pt);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index a3f75b02a4..17fd247df8 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -484,8 +484,8 @@ int Utils::ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettin TOldContainerSettings oldBin = {};
if (dbv.type == DBVT_BLOB && dbv.cpbVal > 0 && dbv.cpbVal <= sizeof(oldBin)) {
::memcpy(&oldBin, (void*)dbv.pbVal, dbv.cpbVal);
- cs->dwFlags = oldBin.dwFlags;
- cs->dwFlagsEx = oldBin.dwFlagsEx;
+ cs->flags.dw = oldBin.dwFlags;
+ cs->flagsEx.dw = oldBin.dwFlagsEx;
cs->dwTransparency = oldBin.dwTransparency;
cs->panelheight = oldBin.panelheight;
if (szKey == nullptr)
@@ -508,8 +508,8 @@ int Utils::ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettin return 1;
}
- cs->dwFlags = db_get_dw(hContact, SRMSGMOD_T, szSetting + "_Flags", 0);
- cs->dwFlagsEx = db_get_dw(hContact, SRMSGMOD_T, szSetting + "_FlagsEx", 0);
+ cs->flags.dw = db_get_dw(hContact, SRMSGMOD_T, szSetting + "_Flags", 0);
+ cs->flagsEx.dw = db_get_dw(hContact, SRMSGMOD_T, szSetting + "_FlagsEx", 0);
cs->dwTransparency = db_get_dw(hContact, SRMSGMOD_T, szSetting + "_Transparency", 0);
cs->panelheight = db_get_dw(hContact, SRMSGMOD_T, szSetting + "_PanelY", 0);
cs->iSplitterX = iSplitterX;
@@ -525,8 +525,8 @@ int Utils::ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettin int Utils::WriteContainerSettingsToDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey)
{
CMStringA szSetting(szKey ? szKey : CNT_KEYNAME);
- db_set_dw(hContact, SRMSGMOD_T, szSetting + "_Flags", cs->dwFlags);
- db_set_dw(hContact, SRMSGMOD_T, szSetting + "_FlagsEx", cs->dwFlagsEx);
+ db_set_dw(hContact, SRMSGMOD_T, szSetting + "_Flags", cs->flags.dw);
+ db_set_dw(hContact, SRMSGMOD_T, szSetting + "_FlagsEx", cs->flagsEx.dw);
db_set_dw(hContact, SRMSGMOD_T, szSetting + "_Transparency", cs->dwTransparency);
db_set_dw(hContact, SRMSGMOD_T, szSetting + "_PanelY", cs->panelheight);
db_set_dw(hContact, SRMSGMOD_T, szSetting + "_SplitterX", cs->iSplitterX);
@@ -541,16 +541,16 @@ int Utils::WriteContainerSettingsToDB(const MCONTACT hContact, TContainerSetting void Utils::SettingsToContainer(TContainerData *pContainer)
{
- pContainer->m_dwFlags = pContainer->m_pSettings->dwFlags;
- pContainer->m_dwFlagsEx = pContainer->m_pSettings->dwFlagsEx;
+ pContainer->m_flags = pContainer->m_pSettings->flags;
+ pContainer->m_flagsEx = pContainer->m_pSettings->flagsEx;
pContainer->m_avatarMode = pContainer->m_pSettings->avatarMode;
pContainer->m_ownAvatarMode = pContainer->m_pSettings->ownAvatarMode;
}
void Utils::ContainerToSettings(TContainerData *pContainer)
{
- pContainer->m_pSettings->dwFlags = pContainer->m_dwFlags;
- pContainer->m_pSettings->dwFlagsEx = pContainer->m_dwFlagsEx;
+ pContainer->m_pSettings->flags = pContainer->m_flags;
+ pContainer->m_pSettings->flagsEx = pContainer->m_flagsEx;
pContainer->m_pSettings->avatarMode = pContainer->m_avatarMode;
pContainer->m_pSettings->ownAvatarMode = pContainer->m_ownAvatarMode;
}
@@ -582,7 +582,9 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett {
char szCName[50];
- pContainer->m_dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
+ auto &f = pContainer->m_flags;
+ f.m_bDeferredConfigure = f.m_bCreateMinimized = f.m_bDeferredResize = f.m_bCreateCloned = false;
+
if (pContainer->m_pSettings->fPrivate) {
mir_snprintf(szCName, "%s%d", szSetting, pContainer->m_iContainerIndex);
WriteContainerSettingsToDB(0, pContainer->m_pSettings, szCName);
@@ -741,29 +743,26 @@ void Utils::addMenuItem(const HMENU& m, MENUITEMINFO &mii, HICON hIcon, const wc // return != 0 when the sound effect must be played for the given
// session. Uses container sound settings
-int CMsgDialog::MustPlaySound() const
+bool CMsgDialog::MustPlaySound() const
{
if (m_pContainer->m_bHidden) // hidden container is treated as closed, so play the sound
- return 1;
+ return true;
- if (m_pContainer->m_dwFlags & CNT_NOSOUND || nen_options.iNoSounds)
- return 0;
-
- bool fActiveWindow = (m_pContainer->m_hwnd == ::GetForegroundWindow() ? true : false);
- bool fActiveTab = (m_pContainer->m_hwndActive == GetHwnd() ? true : false);
- bool fIconic = (::IsIconic(m_pContainer->m_hwnd) ? true : false);
+ if (m_pContainer->m_flags.m_bNoSound || nen_options.iNoSounds)
+ return false;
// window minimized, check if sound has to be played
- if (fIconic)
- return(m_pContainer->m_dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED ? 1 : 0);
+ if (::IsIconic(m_pContainer->m_hwnd))
+ return m_pContainer->m_flagsEx.m_bSoundMinimized;
// window in foreground
- if (!fActiveWindow)
- return(m_pContainer->m_dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED ? 1 : 0);
+ if (m_pContainer->m_hwnd != ::GetForegroundWindow())
+ return m_pContainer->m_flagsEx.m_bSoundUnfocused;
- if (fActiveTab)
- return(m_pContainer->m_dwFlagsEx & CNT_EX_SOUNDS_FOCUSED ? 1 : 0);
- return(m_pContainer->m_dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS ? 1 : 0);
+ if (m_pContainer->m_hwndActive == GetHwnd())
+ return m_pContainer->m_flagsEx.m_bSoundFocused;
+
+ return m_pContainer->m_flagsEx.m_bSoundInactive;
}
/////////////////////////////////////////////////////////////////////////////////////////
|