From 4347e469ab0a18edbc5b7bea431829fe16883054 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 29 Jul 2022 13:03:31 +0300 Subject: tabSRMM: fix for the perversion with private container settings --- plugins/TabSRMM/src/buttonsbar.cpp | 8 +- plugins/TabSRMM/src/chat_main.cpp | 2 +- plugins/TabSRMM/src/chat_tools.cpp | 14 +-- plugins/TabSRMM/src/container.cpp | 182 +++++++++++++--------------- plugins/TabSRMM/src/containeroptions.cpp | 42 +++---- plugins/TabSRMM/src/controls.cpp | 18 +-- plugins/TabSRMM/src/generic_msghandlers.cpp | 40 +++--- plugins/TabSRMM/src/infopanel.cpp | 24 ++-- plugins/TabSRMM/src/mim.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 46 +++---- plugins/TabSRMM/src/msgdlgother.cpp | 52 ++++---- plugins/TabSRMM/src/msgdlgutils.cpp | 2 +- plugins/TabSRMM/src/msgs.cpp | 12 +- plugins/TabSRMM/src/msgs.h | 19 ++- plugins/TabSRMM/src/sendqueue.cpp | 4 +- plugins/TabSRMM/src/sidebar.cpp | 18 +-- plugins/TabSRMM/src/tabctrl.cpp | 20 +-- plugins/TabSRMM/src/taskbar.cpp | 2 +- plugins/TabSRMM/src/themes.cpp | 4 +- plugins/TabSRMM/src/utils.cpp | 10 +- 20 files changed, 246 insertions(+), 275 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index c9f815b7b5..b81dfd7fbf 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -204,8 +204,8 @@ BOOL CMsgDialog::BB_SetButtonsPos() return 0; uint8_t gap = DPISCALEX_S(Srmm_GetButtonGap()); - bool showToolbar = !m_pContainer->m_flags.m_bHideToolbar; - bool bBottomToolbar = m_pContainer->m_flags.m_bBottomToolbar; + bool showToolbar = !m_pContainer->cfg.flags.m_bHideToolbar; + bool bBottomToolbar = m_pContainer->cfg.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_flags.m_bSideBar && (m_pContainer->m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT)) { + if (m_pContainer->cfg.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; @@ -274,7 +274,7 @@ BOOL CMsgDialog::BB_SetButtonsPos() mapHidden[cbd] = bAutoHidden; } - if (m_pContainer->m_flags.m_bSideBar && (m_pContainer->m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT)) { + if (m_pContainer->cfg.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 fa9346cabf..61a77f5c49 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(pContainer->m_hwndTabs, iTabId, &item); - if (pContainer->m_flags.m_bSideBar) + if (pContainer->cfg.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 7506931a8e..ec4b8541fa 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -164,14 +164,14 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) goto passed; return 0; } - if (pContainer->m_flags.m_bDontReport && IsIconic(pContainer->m_hwnd)) // in tray counts as "minimised" + if (pContainer->cfg.flags.m_bDontReport && IsIconic(pContainer->m_hwnd)) // in tray counts as "minimised" goto passed; - if (pContainer->m_flags.m_bDontReportUnfocused) { + if (pContainer->cfg.flags.m_bDontReportUnfocused) { if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive()) goto passed; } - if (pContainer->m_flags.m_bAlwaysReportInactive) { - if (pContainer->m_flags.m_bDontReportFocused) + if (pContainer->cfg.flags.m_bAlwaysReportInactive) { + if (pContainer->cfg.flags.m_bDontReportFocused) goto passed; if (pContainer->m_hwndActive == si->pDlg->GetHwnd()) @@ -324,14 +324,14 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight ShowWindow(dat->m_pContainer->m_hwndActive, SW_HIDE); dat->m_pContainer->m_hwndActive = dat->GetHwnd(); dat->m_pContainer->UpdateTitle(dat->m_hContact); - dat->m_pContainer->m_flags.m_bDeferredTabSelect = true; + dat->m_pContainer->cfg.flags.m_bDeferredTabSelect = true; } } } // flash window if it is not focused if (bMustFlash && bInactive) - if (!dat->m_pContainer->m_flags.m_bNoFlash) + if (!dat->m_pContainer->cfg.flags.m_bNoFlash) dat->m_pContainer->FlashContainer(1, 0); if (hNotifyIcon && bInactive && ((gce->iType & si->iLogTrayFlags) || bForcedIcon)) { @@ -349,7 +349,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight HICON hIcon = (HICON)SendMessage(dat->m_pContainer->m_hwnd, WM_GETICON, ICON_BIG, 0); if (hNotifyIcon == hIconHighlight || (hIcon != hIconMessage && hIcon != hIconHighlight)) { dat->m_pContainer->SetIcon(dat, hNotifyIcon); - dat->m_pContainer->m_flags.m_bNeedsUpdateTitle = true; + dat->m_pContainer->cfg.flags.m_bNeedsUpdateTitle = true; } } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 5ac39b8402..3f43d66d5c 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -89,8 +89,6 @@ TContainerData::~TContainerData() { delete m_pMenuBar; delete m_pSideBar; - if (m_pSettings != &PluginConfig.globalContainerSettings) - mir_free(m_pSettings); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -103,10 +101,10 @@ void TContainerData::ActivateExistingTab(CMsgDialog *dat) NMHDR nmhdr = {}; nmhdr.code = TCN_SELCHANGE; - if (TabCtrl_GetItemCount(m_hwndTabs) > 1 && !m_flags.m_bDeferredTabSelect) { + if (TabCtrl_GetItemCount(m_hwndTabs) > 1 && !cfg.flags.m_bDeferredTabSelect) { TabCtrl_SetCurSel(m_hwndTabs, GetTabIndexFromHWND(m_hwndTabs, dat->GetHwnd())); SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); // just select the tab and let WM_NOTIFY do the rest - if (m_flags.m_bSideBar) + if (cfg.flags.m_bSideBar) m_pSideBar->setActiveItem(dat, true); } if (!dat->isChat()) @@ -152,7 +150,7 @@ void TContainerData::AdjustTabClientRect(RECT &rc) RECT rcTab, rcTabOrig; GetClientRect(m_hwndTabs, &rcTab); - if (!m_flags.m_bSideBar && (m_iChilds > 1 || !m_flags.m_bHideTabs)) { + if (!cfg.flags.m_bSideBar && (m_iChilds > 1 || !cfg.flags.m_bHideTabs)) { rcTabOrig = rcTab; TabCtrl_AdjustRect(m_hwndTabs, FALSE, &rcTab); uint32_t dwTopPad = rcTab.top - rcTabOrig.top; @@ -161,7 +159,7 @@ void TContainerData::AdjustTabClientRect(RECT &rc) rc.right -= m_tBorder; if (dwStyle & TCS_BUTTONS) { - if (m_flags.m_bTabsBottom) { + if (cfg.flags.m_bTabsBottom) { int nCount = TabCtrl_GetItemCount(m_hwndTabs); if (nCount > 0) { RECT rcItem; @@ -175,7 +173,7 @@ void TContainerData::AdjustTabClientRect(RECT &rc) } } else { - if (m_flags.m_bTabsBottom) + if (cfg.flags.m_bTabsBottom) rc.bottom = rcTab.bottom + 2; else { rc.top += (dwTopPad - 2); @@ -225,7 +223,7 @@ void TContainerData::Configure() { uint32_t wsold, ws = wsold = GetWindowLong(m_hwnd, GWL_STYLE); if (!CSkin::m_frameSkins) { - ws = (m_flags.m_bNoTitle) ? + ws = (cfg.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); @@ -241,20 +239,20 @@ void TContainerData::Configure() BOOL fTransAllowed = !CSkin::m_skinEnabled || IsWinVerVistaPlus(); uint32_t ex = GetWindowLong(m_hwnd, GWL_EXSTYLE); - ex = (m_flags.m_bTransparent && (!CSkin::m_skinEnabled || fTransAllowed)) ? (ex | WS_EX_LAYERED) : (ex & ~WS_EX_LAYERED); + ex = (cfg.flags.m_bTransparent && (!CSkin::m_skinEnabled || fTransAllowed)) ? (ex | WS_EX_LAYERED) : (ex & ~WS_EX_LAYERED); SetWindowLong(m_hwnd, GWL_EXSTYLE, ex); - if (m_flags.m_bTransparent && fTransAllowed) { - uint32_t trans = LOWORD(m_pSettings->dwTransparency); - SetLayeredWindowAttributes(m_hwnd, Skin->getColorKey(), (uint8_t)trans, (/* m_bSkinned ? LWA_COLORKEY : */ 0) | (m_flags.m_bTransparent ? LWA_ALPHA : 0)); + if (cfg.flags.m_bTransparent && fTransAllowed) { + uint32_t trans = LOWORD(cfg.dwTransparency); + SetLayeredWindowAttributes(m_hwnd, Skin->getColorKey(), (uint8_t)trans, (/* m_bSkinned ? LWA_COLORKEY : */ 0) | (cfg.flags.m_bTransparent ? LWA_ALPHA : 0)); } HMENU hSysmenu = GetSystemMenu(m_hwnd, FALSE); if (!CSkin::m_frameSkins) - CheckMenuItem(hSysmenu, IDM_NOTITLE, (m_flags.m_bNoTitle) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hSysmenu, IDM_NOTITLE, (cfg.flags.m_bNoTitle) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(hSysmenu, IDM_STAYONTOP, m_flags.m_bSticky ? MF_CHECKED : 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); + CheckMenuItem(hSysmenu, IDM_STAYONTOP, cfg.flags.m_bSticky ? MF_CHECKED : MF_UNCHECKED); + SetWindowPos(m_hwnd, (cfg.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); @@ -268,11 +266,11 @@ void TContainerData::Configure() } } - m_flags.m_bSideBar = m_flagsEx.m_bTabSBarLeft || m_flagsEx.m_bTabSBarRight; + cfg.flags.m_bSideBar = cfg.flagsEx.m_bTabSBarLeft || cfg.flagsEx.m_bTabSBarRight; m_pSideBar->Init(); ws = wsold = GetWindowLong(m_hwndTabs, GWL_STYLE); - if (m_flags.m_bTabsBottom) + if (cfg.flags.m_bTabsBottom) ws |= TCS_BOTTOM; else ws &= ~TCS_BOTTOM; @@ -281,7 +279,7 @@ void TContainerData::Configure() RedrawWindow(m_hwndTabs, nullptr, nullptr, RDW_INVALIDATE); } - if (m_flags.m_bNoStatusBar) { + if (cfg.flags.m_bNoStatusBar) { if (m_hwndStatus) { DestroyWindow(m_hwndStatus); m_hwndStatus = nullptr; @@ -305,14 +303,6 @@ void TContainerData::Configure() BroadCastContainer(DM_CONFIGURETOOLBAR, 0, 1); } -void TContainerData::ContainerToSettings() -{ - m_pSettings->flags = m_flags; - m_pSettings->flagsEx = m_flagsEx; - m_pSettings->avatarMode = m_avatarMode; - m_pSettings->ownAvatarMode = m_ownAvatarMode; -} - ///////////////////////////////////////////////////////////////////////////////////////// // flashes the container // iMode != 0: turn on flashing @@ -320,7 +310,7 @@ void TContainerData::ContainerToSettings() void TContainerData::FlashContainer(int iMode, int iCount) { - if (m_flags.m_bNoFlash) // container should never flash + if (cfg.flags.m_bNoFlash) // container should never flash return; FLASHWINFO fwi; @@ -329,7 +319,7 @@ void TContainerData::FlashContainer(int iMode, int iCount) if (iMode) { fwi.dwFlags = FLASHW_ALL; - if (m_flags.m_bFlashAlways) + if (cfg.flags.m_bFlashAlways) fwi.dwFlags |= FLASHW_TIMER; else fwi.uCount = (iCount == 0) ? M.GetByte("nrflash", 4) : iCount; @@ -348,21 +338,21 @@ void TContainerData::InitDialog(HWND hwndDlg) m_hwnd = hwndDlg; m_hwndTabs = ::GetDlgItem(hwndDlg, IDC_MSGTABS); { - uint32_t dwCreateFlags = m_flags.dw; - m_isCloned = m_flags.m_bCreateCloned; + uint32_t dwCreateFlags = cfg.flags.dw; + m_isCloned = cfg.flags.m_bCreateCloned; m_fPrivateThemeChanged = FALSE; ::SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0); // set options... - m_flags.dw |= dwCreateFlags; + cfg.flags.dw |= dwCreateFlags; LoadOverrideTheme(); uint32_t ws = ::GetWindowLong(m_hwndTabs, GWL_STYLE); - if (m_flagsEx.m_bTabFlat) + if (cfg.flagsEx.m_bTabFlat) ws |= TCS_BUTTONS; ClearMargins(); - if (m_flagsEx.m_bTabSingleRow) { + if (cfg.flagsEx.m_bTabSingleRow) { ws &= ~TCS_MULTILINE; ws |= TCS_SINGLELINE; ws |= TCS_FIXEDWIDTH; @@ -377,7 +367,7 @@ void TContainerData::InitDialog(HWND hwndDlg) m_buttonItems = g_ButtonSet.items; - m_flags.m_bSideBar = m_flagsEx.m_bTabSBarLeft || m_flagsEx.m_bTabSBarRight; + cfg.flags.m_bSideBar = cfg.flagsEx.m_bTabSBarLeft || cfg.flagsEx.m_bTabSBarRight; m_pSideBar = new CSideBar(this); m_pMenuBar = new CMenuBar(this); @@ -402,11 +392,11 @@ void TContainerData::InitDialog(HWND hwndDlg) ws = ::GetWindowLong(m_hwndTabs, GWL_EXSTYLE); ::SetWindowLong(m_hwndTabs, GWL_EXSTYLE, ws | WS_EX_CONTROLPARENT); - LONG x_pad = M.GetByte("x-pad", 3) + (m_flagsEx.m_bTabCloseButton ? 7 : 0); - LONG y_pad = M.GetByte("y-pad", 3) + ((m_flags.m_bTabsBottom) ? 1 : 0); + LONG x_pad = M.GetByte("x-pad", 3) + (cfg.flagsEx.m_bTabCloseButton ? 7 : 0); + LONG y_pad = M.GetByte("y-pad", 3) + ((cfg.flags.m_bTabsBottom) ? 1 : 0); - if (m_flagsEx.m_bTabFlat) - y_pad++; //(m_flags.m_bTabsBottom ? 1 : 2); + if (cfg.flagsEx.m_bTabFlat) + y_pad++; //(cfg.flags.m_bTabsBottom ? 1 : 2); TabCtrl_SetPadding(m_hwndTabs, x_pad, y_pad); @@ -426,7 +416,7 @@ void TContainerData::InitDialog(HWND hwndDlg) } else m_hwndTip = nullptr; - if (m_flags.m_bCreateMinimized) { + if (cfg.flags.m_bCreateMinimized) { SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~WS_VISIBLE); ::ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE); RestoreWindowPos(); @@ -571,26 +561,27 @@ void TContainerData::ReadPrivateSettings(bool fForce) mir_snprintf(szCname, "%s%d", CNT_BASEKEYNAME, m_iContainerIndex); Utils::ReadContainerSettingsFromDB(0, &csTemp, szCname); if (csTemp.fPrivate || fForce) { - if (m_pSettings == nullptr || m_pSettings == &PluginConfig.globalContainerSettings) - m_pSettings = (TContainerSettings *)mir_alloc(sizeof(csTemp)); - memcpy(m_pSettings, &csTemp, sizeof(csTemp)); - m_pSettings->fPrivate = true; + cfg = csTemp; + cfg.fPrivate = true; } - else m_pSettings = &PluginConfig.globalContainerSettings; + else cfg = PluginConfig.globalContainerSettings; } void TContainerData::SaveSettings(const char *szSetting) { char szCName[50]; - auto &f = m_flags; + auto &f = cfg.flags; f.m_bDeferredConfigure = f.m_bCreateMinimized = f.m_bDeferredResize = f.m_bCreateCloned = false; - if (m_pSettings->fPrivate) { + if (cfg.fPrivate) { mir_snprintf(szCName, "%s%d", szSetting, m_iContainerIndex); - Utils::WriteContainerSettingsToDB(0, m_pSettings, szCName); + Utils::WriteContainerSettingsToDB(0, &cfg, szCName); + } + else { + PluginConfig.globalContainerSettings = cfg; + Utils::WriteContainerSettingsToDB(0, &cfg, nullptr); } - else Utils::WriteContainerSettingsToDB(0, m_pSettings, nullptr); mir_snprintf(szCName, "%s%d_theme", szSetting, m_iContainerIndex); if (mir_wstrlen(m_szRelThemeFile) > 1) { @@ -611,12 +602,12 @@ void TContainerData::ReflashContainer() if (IsActive()) // dont care about active windows return; - if (m_flags.m_bNoFlash || m_dwFlashingStarted == 0) + if (cfg.flags.m_bNoFlash || m_dwFlashingStarted == 0) return; // dont care about containers which should never flash uint32_t dwStartTime = m_dwFlashingStarted; - if (m_flags.m_bFlashAlways) + if (cfg.flags.m_bFlashAlways) FlashContainer(1, 0); else { // recalc the remaining flashes @@ -637,7 +628,7 @@ void TContainerData::ReflashContainer() // retrieve the container window geometry information from the database. void TContainerData::RestoreWindowPos() { - if (m_isCloned && m_hContactFrom != 0 && !m_flags.m_bGlobalSize) { + if (m_isCloned && m_hContactFrom != 0 && !cfg.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")) @@ -646,7 +637,7 @@ void TContainerData::RestoreWindowPos() } } else { - if (m_flags.m_bGlobalSize) { + if (cfg.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); @@ -687,7 +678,7 @@ void TContainerData::Resize(bool bRestored, int newWidth) m_pMenuBar->Resize(newWidth); LONG rebarHeight = m_pMenuBar->getHeight(); - m_pMenuBar->Show((m_flags.m_bNoMenuBar) ? SW_HIDE : SW_SHOW); + m_pMenuBar->Show((cfg.flags.m_bNoMenuBar) ? SW_HIDE : SW_SHOW); LONG sbarWidth = m_pSideBar->getWidth(); LONG sbarWidth_left = m_pSideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? sbarWidth : 0; @@ -831,7 +822,7 @@ void TContainerData::SetAeroMargins() LONG sbar_left, sbar_right; if (!m_pSideBar->isActive()) { - pt.y = rcWnd.bottom + ((m_iChilds > 1 || !m_flags.m_bHideTabs) ? m_tBorder : 0); + pt.y = rcWnd.bottom + ((m_iChilds > 1 || !cfg.flags.m_bHideTabs) ? m_tBorder : 0); sbar_left = 0, sbar_right = 0; } else { @@ -878,7 +869,7 @@ void TContainerData::SetIcon(CMsgDialog *pDlg, HICON hIcon) pDlg->m_hTaskbarIcon = nullptr; } - if (pDlg->m_pContainer->m_flags.m_bAvatarsOnTaskbar) + if (pDlg->m_pContainer->cfg.flags.m_bAvatarsOnTaskbar) pDlg->m_hTaskbarIcon = pDlg->IconFromAvatar(); if (pDlg->m_hTaskbarIcon) { @@ -911,7 +902,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_flags.m_bNeedsUpdateTitle) { + if (m_hIcon == STICK_ICON_MSG && hIcon != hIconMsg && cfg.flags.m_bNeedsUpdateTitle) { hIcon = hIconMsg; hIconBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true); } @@ -921,14 +912,6 @@ void TContainerData::SetIcon(CMsgDialog *pDlg, HICON hIcon) m_hIcon = (hIcon == hIconMsg) ? STICK_ICON_MSG : 0; } -void TContainerData::SettingsToContainer() -{ - m_flags = m_pSettings->flags; - m_flagsEx = m_pSettings->flagsEx; - m_avatarMode = m_pSettings->avatarMode; - m_ownAvatarMode = m_pSettings->ownAvatarMode; -} - void TContainerData::UpdateTabs() { int nTabs = TabCtrl_GetItemCount(m_hwndTabs); @@ -969,7 +952,7 @@ void TContainerData::UpdateTitle(MCONTACT hContact, CMsgDialog *pDlg) if (pDlg) { SetIcon(pDlg, pDlg->m_hXStatusIcon ? pDlg->m_hXStatusIcon : pDlg->m_hTabStatusIcon); CMStringW szTitle; - if (pDlg->FormatTitleBar(m_pSettings->szTitleFormat, szTitle)) + if (pDlg->FormatTitleBar(cfg.szTitleFormat, szTitle)) SetWindowText(m_hwnd, szTitle); } } @@ -1095,7 +1078,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_flags.m_bNoStatusBar && !sbaritem->IGNORED; + BOOL statusBarSkinnd = !pContainer->cfg.flags.m_bNoStatusBar && !sbaritem->IGNORED; LONG sbarDelta = statusBarSkinnd ? pContainer->m_statusBarHeight : 0; pContainer->m_oldDCSize.cx = width; @@ -1262,7 +1245,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; case WM_NCHITTEST: - if (pContainer && (pContainer->m_flags.m_bNoTitle)) { + if (pContainer && (pContainer->cfg.flags.m_bNoTitle)) { RECT r; GetWindowRect(hwndDlg, &r); @@ -1339,7 +1322,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_SIZE: if (IsIconic(hwndDlg)) - pContainer->m_flags.m_bDeferredResize = true; + pContainer->cfg.flags.m_bDeferredResize = true; else pContainer->Resize(wParam == SIZE_RESTORED, LOWORD(lParam)); break; @@ -1497,9 +1480,9 @@ panel_found: pContainer->m_pMenuBar->Cancel(); dat = (CMsgDialog*)GetWindowLongPtr(pContainer->m_hwndActive, GWLP_USERDATA); - uint32_t dwOldFlags = pContainer->m_flags.dw; + uint32_t dwOldFlags = pContainer->cfg.flags.dw; - auto &f = pContainer->m_flags; + auto &f = pContainer->cfg.flags; if (dat) { if (fProcessContactMenu) @@ -1744,7 +1727,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_flags.m_bVerticalMax || (GetKeyState(VK_CONTROL) & 0x8000)) { + if (pContainer->cfg.flags.m_bVerticalMax || (GetKeyState(VK_CONTROL) & 0x8000)) { RECT rcDesktop = { 0 }; BOOL fDesktopValid = FALSE; int monitorXOffset = 0; @@ -1783,9 +1766,9 @@ panel_found: case WM_TIMER: if (wParam == TIMERID_HEARTBEAT) { - if (GetForegroundWindow() != hwndDlg && (pContainer->m_pSettings->autoCloseSeconds > 0) && !pContainer->m_bHidden) { + if (GetForegroundWindow() != hwndDlg && (pContainer->cfg.autoCloseSeconds > 0) && !pContainer->m_bHidden) { BOOL fResult = TRUE; - pContainer->BroadCastContainer(DM_CHECKAUTOHIDE, (WPARAM)pContainer->m_pSettings->autoCloseSeconds, (LPARAM)&fResult); + pContainer->BroadCastContainer(DM_CHECKAUTOHIDE, (WPARAM)pContainer->cfg.autoCloseSeconds, (LPARAM)&fResult); if (fResult && nullptr == pContainer->m_hWndOptions) PostMessage(hwndDlg, WM_CLOSE, 1, 0); @@ -1804,19 +1787,19 @@ panel_found: case WM_SYSCOMMAND: switch (wParam) { case IDM_STAYONTOP: - 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_UNCHECKED : MF_CHECKED); + SetWindowPos(hwndDlg, (pContainer->cfg.flags.m_bSticky) ? HWND_NOTOPMOST : HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_STAYONTOP, (pContainer->cfg.flags.m_bSticky) ? MF_UNCHECKED : MF_CHECKED); - pContainer->m_flags.m_bSticky = !pContainer->m_flags.m_bSticky; + pContainer->cfg.flags.m_bSticky = !pContainer->cfg.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_flags.m_bNoTitle) ? MF_UNCHECKED : MF_CHECKED); + CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_NOTITLE, (pContainer->cfg.flags.m_bNoTitle) ? MF_UNCHECKED : MF_CHECKED); - pContainer->m_flags.m_bNoTitle = !pContainer->m_flags.m_bNoTitle; + pContainer->cfg.flags.m_bNoTitle = !pContainer->cfg.flags.m_bNoTitle; pContainer->ApplySetting(true); break; case IDM_MOREOPTIONS: @@ -1847,7 +1830,7 @@ panel_found: break; case WM_LBUTTONDOWN: - if (pContainer->m_flags.m_bNoTitle) { + if (pContainer->cfg.flags.m_bNoTitle) { GetCursorPos(&pt); return SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); } @@ -1869,8 +1852,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_flags.m_bTransparent && fTransAllowed) { - SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (uint8_t)HIWORD(pContainer->m_pSettings->dwTransparency), (pContainer->m_flags.m_bTransparent ? LWA_ALPHA : 0)); + if (pContainer->cfg.flags.m_bTransparent && fTransAllowed) { + SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (uint8_t)HIWORD(pContainer->cfg.dwTransparency), (pContainer->cfg.flags.m_bTransparent ? LWA_ALPHA : 0)); } } pContainer->m_hwndSaved = nullptr; @@ -1890,24 +1873,24 @@ panel_found: pContainer->FlashContainer(0, 0); pContainer->m_dwFlashingStarted = 0; pLastActiveContainer = pContainer; - if (pContainer->m_flags.m_bDeferredTabSelect) { - pContainer->m_flags.m_bDeferredTabSelect = false; + if (pContainer->cfg.flags.m_bDeferredTabSelect) { + pContainer->cfg.flags.m_bDeferredTabSelect = false; SendMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0); NMHDR nmhdr = { pContainer->m_hwndTabs, 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_flags.m_bDeferredResize) { - pContainer->m_flags.m_bDeferredResize = false; + if (pContainer->cfg.flags.m_bDeferredResize) { + pContainer->cfg.flags.m_bDeferredResize = false; SendMessage(hwndDlg, WM_SIZE, 0, 0); } - if (pContainer->m_flags.m_bTransparent && fTransAllowed) { - uint32_t trans = LOWORD(pContainer->m_pSettings->dwTransparency); - SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (uint8_t)trans, (pContainer->m_flags.m_bTransparent ? LWA_ALPHA : 0)); + if (pContainer->cfg.flags.m_bTransparent && fTransAllowed) { + uint32_t trans = LOWORD(pContainer->cfg.dwTransparency); + SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (uint8_t)trans, (pContainer->cfg.flags.m_bTransparent ? LWA_ALPHA : 0)); } - if (pContainer->m_flags.m_bNeedsUpdateTitle) { - pContainer->m_flags.m_bNeedsUpdateTitle = false; + if (pContainer->cfg.flags.m_bNeedsUpdateTitle) { + pContainer->cfg.flags.m_bNeedsUpdateTitle = false; if (pContainer->m_hwndActive) { hContact = 0; SendMessage(pContainer->m_hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact); @@ -1917,8 +1900,8 @@ panel_found: } HWND hDlg = GetTabWindow(pContainer->m_hwndTabs, TabCtrl_GetCurSel(pContainer->m_hwndTabs)); - if (pContainer->m_flags.m_bDeferredConfigure && hDlg) { - pContainer->m_flags.m_bDeferredConfigure = false; + if (pContainer->cfg.flags.m_bDeferredConfigure && hDlg) { + pContainer->cfg.flags.m_bDeferredConfigure = false; pContainer->m_hwndActive = hDlg; SendMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0); if (pContainer->m_hwndActive != nullptr && IsWindow(pContainer->m_hwndActive)) { @@ -1994,7 +1977,7 @@ panel_found: szTitleFormat[0] = 0; if (pContainer->m_isCloned && pContainer->m_hContactFrom != 0) { - pContainer->m_pSettings = &PluginConfig.globalContainerSettings; + pContainer->cfg = PluginConfig.globalContainerSettings; pContainer->m_szRelThemeFile[0] = pContainer->m_szAbsThemeFile[0] = 0; mir_snprintf(szCname, "%s_theme", CONTAINER_PREFIX); @@ -2009,7 +1992,6 @@ panel_found: szThemeName = dbv.pwszVal; } } - pContainer->SettingsToContainer(); if (szThemeName != nullptr) { PathToAbsoluteW(szThemeName, pContainer->m_szAbsThemeFile, M.getDataPath()); @@ -2037,7 +2019,7 @@ panel_found: case WM_DRAWITEM: { DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam; - if (dis->hwndItem == pContainer->m_hwndStatus && !pContainer->m_flags.m_bNoStatusBar) { + if (dis->hwndItem == pContainer->m_hwndStatus && !pContainer->cfg.flags.m_bNoStatusBar) { dat = (CMsgDialog*)GetWindowLongPtr(pContainer->m_hwndActive, GWLP_USERDATA); if (dat) dat->DrawStatusIcons(dis->hDC, dis->rcItem, 2); @@ -2052,7 +2034,7 @@ panel_found: case WM_MOUSEWHEEL: GetCursorPos(&pt); - if (pContainer->m_flags.m_bSideBar) { + if (pContainer->cfg.flags.m_bSideBar) { RECT rc1; GetWindowRect(GetDlgItem(hwndDlg, IDC_SIDEBARUP), &rc); GetWindowRect(GetDlgItem(hwndDlg, IDC_SIDEBARDOWN), &rc1); @@ -2134,7 +2116,7 @@ panel_found: } // save geometry information to the database... - if (!pContainer->m_flags.m_bGlobalSize) { + if (!pContainer->cfg.flags.m_bGlobalSize) { WINDOWPLACEMENT wp = { 0 }; wp.length = sizeof(wp); if (GetWindowPlacement(hwndDlg, &wp) != 0) { @@ -2171,7 +2153,7 @@ panel_found: // clear temp flags which should NEVER be saved... if (pContainer->m_isCloned && pContainer->m_hContactFrom != 0) { - pContainer->m_flags.m_bDeferredConfigure = pContainer->m_flags.m_bCreateMinimized = pContainer->m_flags.m_bDeferredResize = pContainer->m_flags.m_bCreateCloned = false; + pContainer->cfg.flags.m_bDeferredConfigure = pContainer->cfg.flags.m_bCreateMinimized = pContainer->cfg.flags.m_bDeferredResize = pContainer->cfg.flags.m_bCreateCloned = false; for (int i = 0; i < TabCtrl_GetItemCount(pContainer->m_hwndTabs); i++) { if (HWND hDlg = GetTabWindow(pContainer->m_hwndTabs, i)) { SendMessage(hDlg, DM_QUERYHCONTACT, 0, (LPARAM)&hContact); @@ -2252,10 +2234,10 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h } if (iTemp & CNT_CREATEFLAG_MINIMIZED) - pContainer->m_flags.m_bCreateMinimized = true; + pContainer->cfg.flags.m_bCreateMinimized = true; if (iTemp & CNT_CREATEFLAG_CLONED) { - pContainer->m_flags.m_bCreateCloned = true; + pContainer->cfg.flags.m_bCreateCloned = true; pContainer->m_hContactFrom = hContactFrom; } diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 67bf374183..21ebc9f7b6 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -36,8 +36,7 @@ static void MY_CheckDlgButton(HWND hWnd, UINT id, int iCheck) static void ReloadGlobalContainerSettings(bool fForceReconfig) { for (TContainerData *p = pFirstContainer; p; p = p->pNext) { - if (!p->m_pSettings->fPrivate) { - p->SettingsToContainer(); + if (!p->cfg.fPrivate) { if (fForceReconfig) p->Configure(); else @@ -52,9 +51,7 @@ static void ReloadGlobalContainerSettings(bool fForceReconfig) void TContainerData::ApplySetting(bool fForceResize) { - ContainerToSettings(); - - if (m_pSettings->fPrivate) + if (cfg.fPrivate) Configure(); else ReloadGlobalContainerSettings(fForceResize); @@ -128,7 +125,7 @@ static INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM w mir_snwprintf(szNewTitle, L"%s", !mir_wstrcmp(pContainer->m_wszName, L"default") ? TranslateT("Default container") : pContainer->m_wszName); SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle); Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins); - CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->m_pSettings->fPrivate ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->cfg.fPrivate ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top")); SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom")); @@ -147,11 +144,11 @@ static INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM w 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->flagsEx.dw & 0xff000000) >> 24), 0); + SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->cfg.flagsEx.dw & 0xff000000) >> 24), 0); - SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->m_pSettings); + SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)&pContainer->cfg); SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0); - SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->m_pSettings->szTitleFormat); + SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->cfg.szTitleFormat); SetDlgItemText(hwndDlg, IDC_THEME, pContainer->m_szRelThemeFile); for (int i = 0; i < _countof(o_pages); i++) { tvis.hParent = nullptr; @@ -204,19 +201,18 @@ static INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM w case IDC_CNTPRIVATE: if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) { pContainer->ReadPrivateSettings(true); - pContainer->m_pSettings->fPrivate = true; + pContainer->cfg.fPrivate = true; } else { - if (pContainer->m_pSettings != &PluginConfig.globalContainerSettings) { + if (pContainer->cfg.fPrivate) { char szCname[40]; mir_snprintf(szCname, "%s%d", CNT_BASEKEYNAME, pContainer->m_iContainerIndex); - Utils::WriteContainerSettingsToDB(0, pContainer->m_pSettings, szCname); - mir_free(pContainer->m_pSettings); + Utils::WriteContainerSettingsToDB(0, &pContainer->cfg, szCname); } - pContainer->m_pSettings = &PluginConfig.globalContainerSettings; - pContainer->m_pSettings->fPrivate = false; + pContainer->cfg = PluginConfig.globalContainerSettings; + pContainer->cfg.fPrivate = false; } - SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->m_pSettings); + SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)&pContainer->cfg); goto do_apply; case IDC_TRANSPARENCY: @@ -269,16 +265,16 @@ static INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM w case IDOK: case IDC_APPLY: - SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, (LPARAM)pContainer->m_pSettings); + SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, (LPARAM)&pContainer->cfg); - pContainer->m_pSettings->dwTransparency = MAKELONG((uint16_t)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_GETPOS, 0, 0), + pContainer->cfg.dwTransparency = MAKELONG((uint16_t)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_GETPOS, 0, 0), (uint16_t)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_GETPOS, 0, 0)); - pContainer->m_pSettings->avatarMode = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_GETCURSEL, 0, 0); - pContainer->m_pSettings->ownAvatarMode = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_GETCURSEL, 0, 0); + pContainer->cfg.avatarMode = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_GETCURSEL, 0, 0); + pContainer->cfg.ownAvatarMode = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_GETCURSEL, 0, 0); - GetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->m_pSettings->szTitleFormat, TITLE_FORMATLEN); - pContainer->m_pSettings->szTitleFormat[TITLE_FORMATLEN - 1] = 0; + GetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->cfg.szTitleFormat, TITLE_FORMATLEN); + pContainer->cfg.szTitleFormat[TITLE_FORMATLEN - 1] = 0; pContainer->m_szRelThemeFile[0] = pContainer->m_szAbsThemeFile[0] = 0; @@ -302,8 +298,6 @@ static INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM w pContainer->m_fPrivateThemeChanged = TRUE; } - pContainer->SettingsToContainer(); - if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) { ReloadGlobalContainerSettings(true); Utils::WriteContainerSettingsToDB(0, &PluginConfig.globalContainerSettings); diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 2e4499814d..11e6bc1215 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_flags.m_bNoMenuBar) ? 0 : m_size_y; + return (m_pContainer->cfg.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_flags.m_bNoTitle) { + if (m_pContainer->cfg.flags.m_bNoTitle) { POINT pt; ::GetCursorPos(&pt); return ::SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); @@ -445,7 +445,7 @@ void CMenuBar::updateState(const HMENU hMenu) const { CMsgDialog *dat = (CMsgDialog*)GetWindowLongPtr(m_pContainer->m_hwndActive, GWLP_USERDATA); if (dat) { - auto f = m_pContainer->m_flags; + auto f = m_pContainer->cfg.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); @@ -501,8 +501,8 @@ void CMenuBar::configureMenu() const void CMenuBar::autoShow(const int showcmd) { - if (m_mustAutoHide && !m_pContainer->m_flags.m_bNoMenuBar) { - m_pContainer->m_flags.m_bNoMenuBar = true; + if (m_mustAutoHide && !m_pContainer->cfg.flags.m_bNoMenuBar) { + m_pContainer->cfg.flags.m_bNoMenuBar = true; m_mustAutoHide = false; ::SendMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1); releaseHook(); @@ -513,9 +513,9 @@ void CMenuBar::autoShow(const int showcmd) return; } - if (m_pContainer->m_flags.m_bNoMenuBar) { + if (m_pContainer->cfg.flags.m_bNoMenuBar) { m_mustAutoHide = true; - m_pContainer->m_flags.m_bNoMenuBar = false; + m_pContainer->cfg.flags.m_bNoMenuBar = false; ::SendMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1); } else // do nothing, already visible @@ -921,7 +921,7 @@ LONG_PTR CALLBACK CMsgDialog::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM rcLastStatusBarClick.top = pt.y - 2; rcLastStatusBarClick.bottom = pt.y + 2; - if (pContainer->m_flags.m_bNoTitle) { + if (pContainer->cfg.flags.m_bNoTitle) { POINT pt1 = pt; ScreenToClient(hWnd, &pt1); @@ -958,7 +958,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_flags.m_bNoSound ? TranslateT("disabled") : TranslateT("enabled")); + pContainer->cfg.flags.m_bNoSound ? TranslateT("disabled") : TranslateT("enabled")); } else if (sid->dwId == MSG_ICON_UTN && dat->AllowTyping()) { int mtnStatus = g_plugin.getByte(dat->m_hContact, SRMSGSET_TYPING, g_plugin.bTypingNew); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 80f45fa886..b95734d3af 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -319,9 +319,9 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara case IDC_TOGGLETOOLBAR: if (lParam == 1) - m_pContainer->m_flags.m_bNoMenuBar = !m_pContainer->m_flags.m_bNoMenuBar; + m_pContainer->cfg.flags.m_bNoMenuBar = !m_pContainer->cfg.flags.m_bNoMenuBar; else - m_pContainer->m_flags.m_bHideToolbar = !m_pContainer->m_flags.m_bHideToolbar; + m_pContainer->cfg.flags.m_bHideToolbar = !m_pContainer->cfg.flags.m_bHideToolbar; m_pContainer->ApplySetting(true); break; @@ -633,7 +633,7 @@ void CMsgDialog::DM_ScrollToBottom(WPARAM wParam, LPARAM lParam) void CMsgDialog::DM_RecalcPictureSize() { - HBITMAP hbm = ((m_pPanel.isActive()) && m_pContainer->m_avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); + HBITMAP hbm = ((m_pPanel.isActive()) && m_pContainer->cfg.avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); if (hbm) { BITMAP bminfo; GetObject(hbm, sizeof(bminfo), &bminfo); @@ -661,12 +661,12 @@ void CMsgDialog::DM_UpdateLastMessage() const else { SendMessage(m_pContainer->m_hwndStatus, SB_SETICON, 0, 0); - if (m_pContainer->m_flags.m_bUinStatusBar) + if (m_pContainer->cfg.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_flags.m_bUinStatusBar && mir_wstrlen(date) > 6) + if (m_pContainer->cfg.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); @@ -853,7 +853,7 @@ void CMsgDialog::DM_OptionsApplied(bool bRemakeLog) LoadLocalFlags(); m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY); - m_bShowUIElements = (m_pContainer->m_flags.m_bHideToolbar) == 0; + m_bShowUIElements = (m_pContainer->cfg.flags.m_bHideToolbar) == 0; m_bSplitterOverride = M.GetByte(m_hContact, "splitoverride", 0) != 0; m_pPanel.getVisibility(); @@ -915,7 +915,7 @@ void CMsgDialog::DM_Typing(bool fForceOff) m_pContainer->UpdateTitle(0); else m_pContainer->UpdateTitle(0, dat_active); - if (!m_pContainer->m_flags.m_bNoFlash && PluginConfig.m_FlashOnMTN) + if (!m_pContainer->cfg.flags.m_bNoFlash && PluginConfig.m_FlashOnMTN) m_pContainer->ReflashContainer(); } } @@ -939,8 +939,8 @@ void CMsgDialog::DM_Typing(bool fForceOff) } if (IsIconic(hwndContainer) || !IsActive()) { SetWindowText(hwndContainer, m_wszStatusBar); - m_pContainer->m_flags.m_bNeedsUpdateTitle = true; - if (!m_pContainer->m_flags.m_bNoFlash && PluginConfig.m_FlashOnMTN) + m_pContainer->cfg.flags.m_bNeedsUpdateTitle = true; + if (!m_pContainer->cfg.flags.m_bNoFlash && PluginConfig.m_FlashOnMTN) m_pContainer->ReflashContainer(); } @@ -951,7 +951,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_flags.m_bHideTabs) + if (TabCtrl_GetItemCount(m_hwndParent) > 1 || !m_pContainer->cfg.flags.m_bHideTabs) HandleIconFeedback(this, PluginConfig.g_IconTypingEvent); } } @@ -971,7 +971,7 @@ int CMsgDialog::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) { CMsgDialog *srcDat = PluginConfig.lastSPlitterPos.pSrcDat; TContainerData *srcCnt = PluginConfig.lastSPlitterPos.pSrcContainer; - bool fCntGlobal = (!m_pContainer->m_pSettings->fPrivate ? true : false); + bool fCntGlobal = (!m_pContainer->cfg.fPrivate ? true : false); if (m_bIsAutosizingInput) return 0; @@ -994,7 +994,7 @@ int CMsgDialog::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) newPos = 0; if (this == srcDat) { - m_pContainer->m_pSettings->iSplitterY = m_iSplitterY; + m_pContainer->cfg.iSplitterY = m_iSplitterY; if (fCntGlobal) SaveSplitter(); return 0; @@ -1002,7 +1002,7 @@ int CMsgDialog::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) if (!fCntGlobal && m_pContainer != srcCnt) return 0; - if (srcCnt->m_pSettings->fPrivate && m_pContainer != srcCnt) + if (srcCnt->cfg.fPrivate && m_pContainer != srcCnt) return 0; // for inactive sessions, delay the splitter repositioning until they become @@ -1122,7 +1122,7 @@ void CMsgDialog::DM_EventAdded(WPARAM, LPARAM lParam) ShowWindow(m_pContainer->m_hwndActive, SW_HIDE); m_pContainer->m_hwndActive = m_hwnd; m_pContainer->UpdateTitle(m_hContact); - m_pContainer->m_flags.m_bDeferredTabSelect = true; + m_pContainer->cfg.flags.m_bDeferredTabSelect = true; } } } @@ -1131,10 +1131,10 @@ void CMsgDialog::DM_EventAdded(WPARAM, LPARAM lParam) // flash window if it is not focused if (!bDisableNotify && !bIsStatusChangeEvent) if (!IsActive() && !(dbei.flags & DBEF_SENT)) { - if (!m_pContainer->m_flags.m_bNoFlash && !m_pContainer->IsActive()) + if (!m_pContainer->cfg.flags.m_bNoFlash && !m_pContainer->IsActive()) m_pContainer->FlashContainer(1, 0); m_pContainer->SetIcon(this, Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); - m_pContainer->m_flags.m_bNeedsUpdateTitle = true; + m_pContainer->cfg.flags.m_bNeedsUpdateTitle = true; } // play a sound @@ -1174,7 +1174,7 @@ void CMsgDialog::DM_HandleAutoSizeRequest(REQRESIZE* rr) iNewHeight = (cy - panelHeight) / 2; m_dynaSplitter = iNewHeight - DPISCALEY_S(2); - if (m_pContainer->m_flags.m_bBottomToolbar) + if (m_pContainer->cfg.flags.m_bBottomToolbar) m_dynaSplitter += DPISCALEY_S(22); m_iSplitterY = m_dynaSplitter + DPISCALEY_S(34); DM_RecalcPictureSize(); @@ -1215,7 +1215,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_flags.m_bNoSound ? + DrawIconEx(hDC, x, y, m_pContainer->cfg.flags.m_bNoSound ? PluginConfig.g_iconOverlayDisabled : PluginConfig.g_iconOverlayEnabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } @@ -1265,12 +1265,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_flags.m_bNoSound = m_pContainer->m_flags.m_bNoSound; + p->cfg.flags.m_bNoSound = m_pContainer->cfg.flags.m_bNoSound; InvalidateRect(m_pContainer->m_hwndStatus, nullptr, TRUE); } } else { - m_pContainer->m_flags.m_bNoSound = !m_pContainer->m_flags.m_bNoSound; + m_pContainer->cfg.flags.m_bNoSound = !m_pContainer->cfg.flags.m_bNoSound; InvalidateRect(m_pContainer->m_hwndStatus, nullptr, TRUE); } } diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index ccb62717f8..2b394e14ba 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -79,8 +79,8 @@ void CInfoPanel::loadHeight() m_height = M.GetDword(m_dat->m_hContact, "panelheight", -1); if (m_height == -1 || HIWORD(m_height) == 0) { - if (m_dat->m_pContainer->m_pSettings->fPrivate) - m_height = m_dat->m_pContainer->m_pSettings->panelheight; + if (m_dat->m_pContainer->cfg.fPrivate) + m_height = m_dat->m_pContainer->cfg.panelheight; else m_height = bSync ? m_defaultHeight : (m_isChat ? m_defaultMUCHeight : m_defaultHeight); m_fPrivateHeight = false; @@ -106,8 +106,8 @@ void CInfoPanel::saveHeight(bool fFlush) if (m_height < 110 && m_height >= MIN_PANELHEIGHT) { // only save valid panel splitter positions if (!m_fPrivateHeight) { if (!m_isChat || bSync) { - if (m_dat->m_pContainer->m_pSettings->fPrivate) - m_dat->m_pContainer->m_pSettings->panelheight = m_height; + if (m_dat->m_pContainer->cfg.fPrivate) + m_dat->m_pContainer->cfg.panelheight = m_height; else { PluginConfig.m_panelHeight = m_height; m_defaultHeight = m_height; @@ -116,8 +116,8 @@ void CInfoPanel::saveHeight(bool fFlush) } } else if (m_isChat && !bSync) { - if (m_dat->m_pContainer->m_pSettings->fPrivate) - m_dat->m_pContainer->m_pSettings->panelheight = m_height; + if (m_dat->m_pContainer->cfg.fPrivate) + m_dat->m_pContainer->cfg.panelheight = m_height; else { PluginConfig.m_MUCpanelHeight = m_height; m_defaultMUCHeight = m_height; @@ -147,7 +147,7 @@ void CInfoPanel::setHeight(LONG newHeight, bool fBroadcast) if (fBroadcast) { if (!m_fPrivateHeight) { - if (!m_dat->m_pContainer->m_pSettings->fPrivate) + if (!m_dat->m_pContainer->cfg.fPrivate) Srmm_Broadcast(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)newHeight); else m_dat->m_pContainer->BroadCastContainer(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)newHeight); @@ -163,7 +163,7 @@ void CInfoPanel::Configure() const void CInfoPanel::showHide() const { - HBITMAP hbm = (m_active && m_dat->m_pContainer->m_avatarMode != 3) ? m_dat->m_hOwnPic : (m_dat->m_ace ? m_dat->m_ace->hbmPic : PluginConfig.g_hbmUnknown); + HBITMAP hbm = (m_active && m_dat->m_pContainer->cfg.avatarMode != 3) ? m_dat->m_hOwnPic : (m_dat->m_ace ? m_dat->m_ace->hbmPic : PluginConfig.g_hbmUnknown); HWND hwndDlg = m_dat->GetHwnd(); if (!m_isChat) { @@ -218,7 +218,7 @@ void CInfoPanel::showHide() const bool CInfoPanel::getVisibility() { - uint8_t bDefault = (m_dat->m_pContainer->m_flags.m_bInfoPanel) ? 1 : 0; + uint8_t bDefault = (m_dat->m_pContainer->cfg.flags.m_bInfoPanel) ? 1 : 0; uint8_t bContact = M.GetByte(m_dat->m_hContact, "infopanel", 0); uint8_t visible = (bContact == 0 ? bDefault : (bContact == (uint8_t)-1 ? 0 : 1)); @@ -1069,7 +1069,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L ::CheckDlgButton(hwnd, IDC_NOSYNC, M.GetByte("syncAllPanels", 0) ? BST_UNCHECKED : BST_CHECKED); - Utils::showDlgControl(hwnd, IDC_IPCONFIG_PRIVATECONTAINER, m_dat->m_pContainer->m_pSettings->fPrivate ? SW_SHOW : SW_HIDE); + Utils::showDlgControl(hwnd, IDC_IPCONFIG_PRIVATECONTAINER, m_dat->m_pContainer->cfg.fPrivate ? SW_SHOW : SW_HIDE); if (!m_isChat) { v = db_get_b(m_dat->m_hContact, SRMSGMOD_T, "hideavatar", -1); @@ -1184,13 +1184,13 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L db_set_b(0, SRMSGMOD_T, "syncAllPanels", ::IsDlgButtonChecked(hwnd, IDC_NOSYNC) ? 0 : 1); if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_NOSYNC)) { loadHeight(); - if (!m_dat->m_pContainer->m_pSettings->fPrivate) + if (!m_dat->m_pContainer->cfg.fPrivate) Srmm_Broadcast(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight); else m_dat->m_pContainer->BroadCastContainer(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight); } else { - if (!m_dat->m_pContainer->m_pSettings->fPrivate) + if (!m_dat->m_pContainer->cfg.fPrivate) Srmm_Broadcast(DM_SETINFOPANEL, (WPARAM)m_dat, 0); else m_dat->m_pContainer->BroadCastContainer(DM_SETINFOPANEL, (WPARAM)m_dat, 0); diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index e2ec82201a..e6957fbd0a 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -252,7 +252,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM nSecs) } else fShowOnClist = false; - if ((!foundWin || !pContainer->m_flags.m_bNoSound) && preTyping != (nSecs != 0)) + if ((!foundWin || !pContainer->cfg.flags.m_bNoSound) && preTyping != (nSecs != 0)) Skin_PlaySound(nSecs ? "TNStart" : "TNStop"); if (g_plugin.bPopups) { diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 6173ae5464..d2c89a5ec9 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -402,7 +402,7 @@ bool CMsgDialog::OnInitDialog() m_cache->updateUIN(); m_cache->setWindowData(this); - m_bIsAutosizingInput = m_pContainer->m_flags.m_bAutoSplitter && !m_bSplitterOverride; + m_bIsAutosizingInput = m_pContainer->cfg.flags.m_bAutoSplitter && !m_bSplitterOverride; m_szProto = const_cast(m_cache->getProto()); m_bIsMeta = m_cache->isMeta(); if (m_bIsMeta) @@ -448,7 +448,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_flags.m_bHideToolbar) == 0; + m_bShowUIElements = (m_pContainer->cfg.flags.m_bHideToolbar) == 0; if (M.GetByte(m_hContact, "no_ack", 0)) m_sendMode |= SMODE_NOACK; @@ -614,7 +614,7 @@ bool CMsgDialog::OnInitDialog() LoadSplitter(); ShowPicture(true); - if (m_pContainer->m_flags.m_bCreateMinimized || !m_bActivate || m_pContainer->m_flags.m_bDeferredTabSelect) { + if (m_pContainer->cfg.flags.m_bCreateMinimized || !m_bActivate || m_pContainer->cfg.flags.m_bDeferredTabSelect) { m_iFlashIcon = PluginConfig.g_IconMsgEvent; timerFlash.Start(TIMEOUT_FLASHWND); m_bCanFlashTab = true; @@ -625,7 +625,7 @@ bool CMsgDialog::OnInitDialog() if (!isChat()) m_pContainer->SetIcon(this, Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); - m_pContainer->m_flags.m_bNeedsUpdateTitle = true; + m_pContainer->cfg.flags.m_bNeedsUpdateTitle = true; m_bWasBackgroundCreate = m_bNeedCheckSize = m_bDeferredScroll = true; } @@ -639,11 +639,11 @@ bool CMsgDialog::OnInitDialog() SetActiveWindow(m_hwnd); SetForegroundWindow(m_hwnd); } - else if (m_pContainer->m_flags.m_bCreateMinimized) { + else if (m_pContainer->cfg.flags.m_bCreateMinimized) { m_bDeferredScroll = true; ShowWindow(m_hwnd, SW_SHOWNOACTIVATE); m_pContainer->m_hwndActive = m_hwnd; - m_pContainer->m_flags.m_bDeferredConfigure = true; + m_pContainer->cfg.flags.m_bDeferredConfigure = true; } m_pContainer->UpdateTitle(m_hContact); @@ -657,8 +657,8 @@ bool CMsgDialog::OnInitDialog() m_bInitMode = false; NotifyEvent(MSG_WINDOW_EVT_OPEN); - if (m_pContainer->m_flags.m_bCreateMinimized) { - m_pContainer->m_flags.m_bCreateMinimized = false; + if (m_pContainer->cfg.flags.m_bCreateMinimized) { + m_pContainer->cfg.flags.m_bCreateMinimized = false; m_pContainer->m_hwndActive = m_hwnd; } return true; @@ -673,7 +673,7 @@ void CMsgDialog::OnDestroy() m_cache->setWindowData(); m_pContainer->ClearMargins(); PostMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1); - if (m_pContainer->m_flags.m_bSideBar) + if (m_pContainer->cfg.flags.m_bSideBar) m_pContainer->m_pSideBar->removeSession(this); if (M.GetByte("deletetemp", 0)) @@ -819,7 +819,7 @@ void CMsgDialog::onClick_Ok(CCtrlButton *) m_si->pMI->idleTimeStamp = time(0); UpdateStatusBar(); if (m_pContainer) - if (fSound && !NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound) + if (fSound && !NEN::bNoSounds && !m_pContainer->cfg.flags.m_bNoSound) Skin_PlaySound("SendMsg"); } else { @@ -1104,10 +1104,10 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) bool bNick = false; bool bInfoPanel = m_pPanel.isActive(); - bool bShowToolbar = (m_pContainer->m_flags.m_bHideToolbar) == 0; - bool bBottomToolbar = (m_pContainer->m_flags.m_bBottomToolbar) != 0; + bool bShowToolbar = (m_pContainer->cfg.flags.m_bHideToolbar) == 0; + bool bBottomToolbar = (m_pContainer->cfg.flags.m_bBottomToolbar) != 0; - int iSplitterX = m_pContainer->m_pSettings->iSplitterX; + int iSplitterX = m_pContainer->cfg.iSplitterX; RECT rc, rcButton; GetClientRect(m_pLog->GetHwnd(), &rc); @@ -1603,7 +1603,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) } if (pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE) { - if (GetSendButtonState() != PBS_DISABLED && !m_pContainer->m_flags.m_bHideToolbar) + if (GetSendButtonState() != PBS_DISABLED && !m_pContainer->cfg.flags.m_bHideToolbar) SetFocus(GetDlgItem(m_hwnd, IDOK)); else SetFocus(m_pLog->GetHwnd()); @@ -1773,7 +1773,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_CHAR: KbdState(isShift, isCtrl, isAlt); - if (!isAlt && !isCtrl && !m_pContainer->m_flags.m_bNoSound && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab)) + if (!isAlt && !isCtrl && !m_pContainer->cfg.flags.m_bNoSound && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab)) Skin_PlaySound("SoundOnTyping"); break; @@ -1809,7 +1809,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_KEYDOWN: KbdState(isShift, isCtrl, isAlt); - if (!isAlt && !m_pContainer->m_flags.m_bNoSound && wParam == VK_DELETE) + if (!isAlt && !m_pContainer->cfg.flags.m_bNoSound && wParam == VK_DELETE) Skin_PlaySound("SoundOnTyping"); if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) { @@ -2258,7 +2258,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } if (m_si == nullptr) { - HBITMAP hbm = ((m_pPanel.isActive()) && m_pContainer->m_avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); + HBITMAP hbm = ((m_pPanel.isActive()) && m_pContainer->cfg.avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); if (hbm != nullptr) { BITMAP bminfo; GetObject(hbm, sizeof(bminfo), &bminfo); @@ -2277,7 +2277,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) LONG cx = rc.right; LONG panelHeight = m_pPanel.getHeight(); - HBITMAP hbm = (m_pContainer->m_avatarMode == 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); + HBITMAP hbm = (m_pContainer->cfg.avatarMode == 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); double dHeight = 0, dWidth = 0; Utils::scaleAvatarHeightLimited(hbm, dWidth, dHeight, panelHeight - 2); m_iPanelAvatarX = (int)dWidth; @@ -2468,7 +2468,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_flags.m_bHideToolbar ? 0 : 1; + m_bShowUIElements = m_pContainer->cfg.flags.m_bHideToolbar ? 0 : 1; SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); @@ -2566,7 +2566,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) replaceStrW(job->pwszErrorMsg, CMStringW(FORMAT, TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"))); job->iStatus = SendQueue::SQ_ERROR; - if (!NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound) + if (!NEN::bNoSounds && !m_pContainer->cfg.flags.m_bNoSound) Skin_PlaySound("SendError"); if (!m_bErrorState) sendQueue->handleError(this, iIndex); @@ -2609,7 +2609,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) PostMessage(m_hwnd, DM_UPDATEPICLAYOUT, 0, 0); SetFocus(m_message.GetHwnd()); - if (m_pContainer->m_flags.m_bSideBar) + if (m_pContainer->cfg.flags.m_bSideBar) m_pContainer->m_pSideBar->moveButtons(); } else { @@ -2878,7 +2878,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_flags.m_bUinStatusBar) + if (m_pContainer->cfg.flags.m_bUinStatusBar) tabUpdateStatusBar(); return 0; @@ -2990,7 +2990,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (srcDat->isChat() != isChat() && M.GetByte("syncAllPanels", 0) == 0) return 0; - if (m_pContainer->m_pSettings->fPrivate && srcDat->m_pContainer != m_pContainer) + if (m_pContainer->cfg.fPrivate && srcDat->m_pContainer != m_pContainer) return 0; m_pPanel.setHeight((LONG)lParam); diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index d8400eb92d..6387d37a2c 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -66,7 +66,7 @@ void CMsgDialog::AdjustBottomAvatarDisplay() GetAvatarVisibility(); bool bInfoPanel = m_pPanel.isActive(); - HBITMAP hbm = (bInfoPanel && m_pContainer->m_avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); + HBITMAP hbm = (bInfoPanel && m_pContainer->cfg.avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); if (hbm) { if (m_dynaSplitter == 0 || m_iSplitterY == 0) LoadSplitter(); @@ -88,14 +88,14 @@ void CMsgDialog::AdjustBottomAvatarDisplay() void CMsgDialog::CalcDynamicAvatarSize(BITMAP *bminfo) { - if (m_bWasBackgroundCreate || m_pContainer->m_flags.m_bDeferredConfigure || m_pContainer->m_flags.m_bCreateMinimized || IsIconic(m_pContainer->m_hwnd)) + if (m_bWasBackgroundCreate || m_pContainer->cfg.flags.m_bDeferredConfigure || m_pContainer->cfg.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_flags.m_bBottomToolbar; - BOOL bToolBar = m_pContainer->m_flags.m_bHideToolbar ? 0 : 1; + BOOL bBottomToolBar = m_pContainer->cfg.flags.m_bBottomToolbar; + BOOL bToolBar = m_pContainer->cfg.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); @@ -171,7 +171,7 @@ void CMsgDialog::DetermineMinHeight() { RECT rc; LONG height = (m_pPanel.isActive() ? m_pPanel.getHeight() + 2 : 0); - if (!m_pContainer->m_flags.m_bHideToolbar) + if (!m_pContainer->cfg.flags.m_bHideToolbar) height += DPISCALEY_S(24); // toolbar GetClientRect(m_message.GetHwnd(), &rc); height += rc.bottom; // input area @@ -550,7 +550,7 @@ void CMsgDialog::FlashTab(bool bInvertMode) TCITEM item = {}; item.mask = TCIF_IMAGE; TabCtrl_SetItem(m_hwndParent, m_iTabID, &item); - if (m_pContainer->m_flags.m_bSideBar) + if (m_pContainer->cfg.flags.m_bSideBar) m_pContainer->m_pSideBar->updateSession(this); } @@ -560,8 +560,8 @@ void CMsgDialog::FlashTab(bool bInvertMode) bool CMsgDialog::GetAvatarVisibility() { - uint8_t bAvatarMode = m_pContainer->m_avatarMode; - uint8_t bOwnAvatarMode = m_pContainer->m_ownAvatarMode; + uint8_t bAvatarMode = m_pContainer->cfg.avatarMode; + uint8_t bOwnAvatarMode = m_pContainer->cfg.ownAvatarMode; char hideOverride = (char)M.GetByte(m_hContact, "hideavatar", -1); // infopanel visible, consider own avatar display @@ -792,7 +792,7 @@ void CMsgDialog::LoadContactAvatar() AdjustBottomAvatarDisplay(); CalcDynamicAvatarSize(&bm); - if (!m_pPanel.isActive() || m_pContainer->m_avatarMode == 3) { + if (!m_pPanel.isActive() || m_pContainer->cfg.avatarMode == 3) { m_iRealAvatarHeight = 0; PostMessage(m_hwnd, WM_SIZE, 0, 0); } @@ -817,7 +817,7 @@ void CMsgDialog::LoadOwnAvatar() else m_hOwnPic = PluginConfig.g_hbmUnknown; - if (m_pPanel.isActive() && m_pContainer->m_avatarMode != 3) { + if (m_pPanel.isActive() && m_pContainer->cfg.avatarMode != 3) { BITMAP bm; m_iRealAvatarHeight = 0; @@ -841,7 +841,7 @@ void CMsgDialog::LoadSettings() void CMsgDialog::LoadSplitter() { if (m_bIsAutosizingInput) { - m_iSplitterY = (m_pContainer->m_flags.m_bBottomToolbar) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46); + m_iSplitterY = (m_pContainer->cfg.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); @@ -849,10 +849,10 @@ void CMsgDialog::LoadSplitter() } if (!m_bSplitterOverride) { - if (!m_pContainer->m_pSettings->fPrivate) + if (!m_pContainer->cfg.fPrivate) m_iSplitterY = (int)M.GetDword("splitsplity", 60); else - m_iSplitterY = m_pContainer->m_pSettings->iSplitterY; + m_iSplitterY = m_pContainer->cfg.iSplitterY; } else m_iSplitterY = (int)M.GetDword(m_hContact, "splitsplity", M.GetDword("splitsplity", 60)); @@ -1314,8 +1314,8 @@ void CMsgDialog::SaveSplitter() if (m_bSplitterOverride) db_set_dw(m_hContact, SRMSGMOD_T, "splitsplity", m_iSplitterY); else { - if (m_pContainer->m_pSettings->fPrivate) - m_pContainer->m_pSettings->iSplitterY = m_iSplitterY; + if (m_pContainer->cfg.fPrivate) + m_pContainer->cfg.iSplitterY = m_iSplitterY; else db_set_dw(0, SRMSGMOD_T, "splitsplity", m_iSplitterY); } @@ -1604,7 +1604,7 @@ void CMsgDialog::ShowPicture(bool showNewPic) m_pic.cy = m_pic.cx = DPISCALEY_S(60); if (showNewPic) { - if (m_pPanel.isActive() && m_pContainer->m_avatarMode != 3) { + if (m_pPanel.isActive() && m_pContainer->cfg.avatarMode != 3) { if (!m_hwndPanelPic) { InvalidateRect(m_hwnd, nullptr, TRUE); UpdateWindow(m_hwnd); @@ -1758,7 +1758,7 @@ void CMsgDialog::SplitterMoved(int coord, HWND hwnd) iSplitterX = 35; if (iSplitterX > rc.right - rc.left - 35) iSplitterX = rc.right - rc.left - 35; - m_pContainer->m_pSettings->iSplitterX = iSplitterX; + m_pContainer->cfg.iSplitterX = iSplitterX; } Resize(); break; @@ -1778,7 +1778,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_flags.m_bBottomToolbar) + if (m_pContainer->cfg.flags.m_bBottomToolbar) bottomtoolbarH = 22; if (m_iSplitterY < (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH)) { // min splitter size @@ -2297,7 +2297,7 @@ void CMsgDialog::UpdateTitle() } if (m_iTabID >= 0) { TabCtrl_SetItem(m_hwndParent, m_iTabID, &item); - if (m_pContainer->m_flags.m_bSideBar) + if (m_pContainer->cfg.flags.m_bSideBar) m_pContainer->m_pSideBar->updateSession(this); } if (m_pContainer->m_hwndActive == m_hwnd && bChanged) @@ -2311,7 +2311,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_flags.m_bUinStatusBar) + if (m_pContainer->cfg.flags.m_bUinStatusBar) DM_UpdateLastMessage(); } } @@ -2352,9 +2352,9 @@ void CMsgDialog::UpdateWindowState(UINT msg) return; if (msg == WM_ACTIVATE) { - if (m_pContainer->m_flags.m_bTransparent) { - uint32_t trans = LOWORD(m_pContainer->m_pSettings->dwTransparency); - SetLayeredWindowAttributes(m_pContainer->m_hwnd, CSkin::m_ContainerColorKey, (uint8_t)trans, (m_pContainer->m_flags.m_bTransparent ? LWA_ALPHA : 0)); + if (m_pContainer->cfg.flags.m_bTransparent) { + uint32_t trans = LOWORD(m_pContainer->cfg.dwTransparency); + SetLayeredWindowAttributes(m_pContainer->m_hwnd, CSkin::m_ContainerColorKey, (uint8_t)trans, (m_pContainer->cfg.flags.m_bTransparent ? LWA_ALPHA : 0)); } } @@ -2411,7 +2411,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_iFlashIcon = nullptr; } - m_pContainer->m_flags.m_bNeedsUpdateTitle = false; + m_pContainer->cfg.flags.m_bNeedsUpdateTitle = false; if (m_bNeedCheckSize) PostMessage(m_hwnd, DM_SAVESIZE, 0, 0); @@ -2433,7 +2433,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) g_clistApi.pfnRemoveEvent(m_hContact, m_hFlashingEvent); m_hFlashingEvent = 0; } - m_pContainer->m_flags.m_bNeedsUpdateTitle = false; + m_pContainer->cfg.flags.m_bNeedsUpdateTitle = false; if (m_bDeferredRemakeLog && !IsIconic(m_pContainer->m_hwnd)) { RemakeLog(); @@ -2475,7 +2475,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) if (M.isAero()) InvalidateRect(m_hwndParent, nullptr, FALSE); - if (m_pContainer->m_flags.m_bSideBar) + if (m_pContainer->cfg.flags.m_bSideBar) m_pContainer->m_pSideBar->setActiveItem(this, msg == WM_ACTIVATE); if (m_pWnd) diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 3cf7bd9dd5..daec4e8349 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -230,7 +230,7 @@ void TSAPI HandleIconFeedback(CMsgDialog *dat, HICON iIcon) item.iImage = 0; item.mask = TCIF_IMAGE; - if (dat->m_pContainer->m_flags.m_bSideBar) + if (dat->m_pContainer->cfg.flags.m_bSideBar) dat->m_pContainer->m_pSideBar->updateSession(dat); else TabCtrl_SetItem(dat->m_pContainer->m_hwndTabs, dat->m_iTabID, &item); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index c92dd843f0..c720434072 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -78,16 +78,16 @@ int TSAPI MessageWindowOpened(MCONTACT hContact, CMsgDialog *pDlg) TContainerData *pContainer = pDlg->m_pContainer; if (pContainer) { - if (pContainer->m_flags.m_bDontReport) { + if (pContainer->cfg.flags.m_bDontReport) { if (IsIconic(pContainer->m_hwnd)) return 0; } - if (pContainer->m_flags.m_bDontReportUnfocused) { + if (pContainer->cfg.flags.m_bDontReportUnfocused) { if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive()) return 0; } - if (pContainer->m_flags.m_bAlwaysReportInactive) { - if (pContainer->m_flags.m_bDontReportFocused) + if (pContainer->cfg.flags.m_bAlwaysReportInactive) { + if (pContainer->cfg.flags.m_bDontReportFocused) return 0; return pContainer->m_hwndActive == pDlg->GetHwnd(); @@ -329,7 +329,7 @@ void TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, pWindow->Create(); // switchbar support - if (pContainer->m_flags.m_bSideBar) + if (pContainer->cfg.flags.m_bSideBar) pContainer->m_pSideBar->addSession(pWindow, pContainer->m_iTabIndex); SendMessage(pContainer->m_hwnd, WM_SIZE, 0, 0); @@ -341,7 +341,7 @@ void TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, SetFocus(pContainer->m_hwndActive); } else { - if (pContainer->m_flags.m_bNoFlash) + if (pContainer->cfg.flags.m_bNoFlash) pContainer->SetIcon(0, Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); else pContainer->FlashContainer(1, 0); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index b2b09973bb..4afba2da19 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -268,12 +268,12 @@ struct TContainerSettings uint32_t dwTransparency; uint32_t panelheight; - int iSplitterX, iSplitterY; - wchar_t szTitleFormat[TITLE_FORMATLEN + 2]; - uint16_t avatarMode; - uint16_t ownAvatarMode; - uint16_t autoCloseSeconds; - bool fPrivate; + int iSplitterX, iSplitterY; + wchar_t szTitleFormat[TITLE_FORMATLEN + 2]; + uint16_t avatarMode; + uint16_t ownAvatarMode; + uint16_t autoCloseSeconds; + bool fPrivate; }; struct ButtonItem; @@ -284,8 +284,6 @@ struct TContainerData : public MZeroedObject ~TContainerData(); TContainerData *pNext; - TContainerFlags m_flags; - TContainerFlagsEx m_flagsEx; HWND m_hwndActive; // active message window HWND m_hwnd; // the container handle @@ -326,7 +324,6 @@ struct TContainerData : public MZeroedObject HBITMAP m_hbmToolbarBG, m_oldhbmToolbarBG; SIZE m_szOldToolbarSize; SIZE m_oldSize, m_preSIZE; - uint16_t m_avatarMode, m_ownAvatarMode; uint8_t m_bTBRenderingMode; TLogTheme m_theme; CMenuBar *m_pMenuBar; @@ -334,7 +331,7 @@ struct TContainerData : public MZeroedObject ButtonItem *m_buttonItems; TTemplateSet *m_ltr_templates, *m_rtl_templates; CTaskbarInteract *m_pTaskBar; - TContainerSettings *m_pSettings; + TContainerSettings cfg; wchar_t m_wszName[CONTAINER_NAMELEN + 4]; // container name wchar_t m_szRelThemeFile[MAX_PATH], m_szAbsThemeFile[MAX_PATH]; @@ -345,7 +342,6 @@ struct TContainerData : public MZeroedObject void BroadCastContainer(UINT message, WPARAM wParam, LPARAM lParam) const; void CloseTabByMouse(POINT *); void Configure(); - void ContainerToSettings(); void FlashContainer(int iMode, int iCount); void InitDialog(HWND); void InitRedraw(void); @@ -362,7 +358,6 @@ struct TContainerData : public MZeroedObject void SelectTab(int iCommand, int idx = 0); void SetAeroMargins(void); void SetIcon(CMsgDialog *pDlg, HICON hIcon); - void SettingsToContainer(); void UpdateTabs(void); void UpdateTitle(MCONTACT, CMsgDialog* = nullptr); diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 3b97e86559..0fb240111c 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -434,7 +434,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::bNoSounds && !dat->m_pContainer->m_flags.m_bNoSound) + if (!NEN::bNoSounds && !dat->m_pContainer->cfg.flags.m_bNoSound) Skin_PlaySound("SendError"); replaceStrW(job.pwszErrorMsg, CMStringW(FORMAT, TranslateT("Delivery failure: %s"), (wchar_t*)ack->lParam)); @@ -477,7 +477,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) MEVENT hNewEvent = db_event_add(job.hContact, &dbei); if (dat) - if (!NEN::bNoSounds && !dat->m_pContainer->m_flags.m_bNoSound) + if (!NEN::bNoSounds && !dat->m_pContainer->cfg.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 377865ba67..c3014aa210 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -147,7 +147,7 @@ const SIZE& CSideBarButton::measureItem() SIZE sz; ::GetTextExtentPoint32(dc, tszLabel, (int)mir_wstrlen(tszLabel), &sz); sz.cx += 28; - if (m_dat->m_pContainer->m_flagsEx.m_bTabCloseButton) + if (m_dat->m_pContainer->cfg.flagsEx.m_bTabCloseButton) sz.cx += 20; if (m_sideBarLayout->dwFlags & CSideBar::SIDEBARLAYOUT_VERTICALORIENTATION) @@ -247,7 +247,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const HICON hIcon = m_dat->m_cache->getIcon(iSize); RECT rc = *rcItem; - if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !pContainer->m_flagsEx.m_bTabFlashIcon) { + if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !pContainer->cfg.flagsEx.m_bTabFlashIcon) { uint32_t ix = rc.left + 4; uint32_t iy = (rc.bottom + rc.top - iSize) / 2; if (m_dat->m_bIsIdle && PluginConfig.m_bIdleDetect) @@ -259,7 +259,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const rc.left += (iSize + 7); // draw the close button if enabled - if (m_sideBar->getContainer()->m_flagsEx.m_bTabCloseButton) { + if (m_sideBar->getContainer()->cfg.flagsEx.m_bTabCloseButton) { if (m_sideBar->getHoveredClose() != this) CSkin::m_default_bf.SourceConstantAlpha = 150; @@ -271,7 +271,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_flagsEx.m_bTabFlashLabel) { + if (!m_dat->m_bCanFlashTab || (m_dat->m_bCanFlashTab == TRUE && m_dat->m_bTabFlash) || !pContainer->cfg.flagsEx.m_bTabFlashLabel) { bool fIsActive = (m_sideBar->getActiveItem() == this); COLORREF clr; @@ -297,7 +297,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_flagsEx.m_bTabCloseButton && !(getLayout()->dwFlags & CSideBar::SIDEBARLAYOUT_NOCLOSEBUTTONS)) { + if (m_sideBar->getContainer()->cfg.flagsEx.m_bTabCloseButton && !(getLayout()->dwFlags & CSideBar::SIDEBARLAYOUT_NOCLOSEBUTTONS)) { POINT pt; ::GetCursorPos(&pt); ::ScreenToClient(m_hwnd, &pt); @@ -373,17 +373,17 @@ void CSideBar::Init() m_firstVisibleOffset = 0; m_totalItemHeight = 0; - m_uLayout = (m_pContainer->m_flagsEx.dw & 0xff000000) >> 24; + m_uLayout = (m_pContainer->cfg.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_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); + m_dwFlags = (m_pContainer->cfg.flagsEx.m_bTabSBarLeft ? m_dwFlags | SIDEBARORIENTATION_LEFT : m_dwFlags & ~SIDEBARORIENTATION_LEFT); + m_dwFlags = (m_pContainer->cfg.flagsEx.m_bTabSBarRight ? m_dwFlags | SIDEBARORIENTATION_RIGHT : m_dwFlags & ~SIDEBARORIENTATION_RIGHT); - if (m_pContainer->m_flags.m_bSideBar) { + if (m_pContainer->cfg.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(5000), g_plugin.getInst(), this); diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index b3f4f17a29..0b92baff07 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -224,7 +224,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_flagsEx.m_bTabFlashIcon) { + if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !dat->m_pContainer->cfg.flagsEx.m_bTabFlashIcon) { uint32_t ix = rcItem->left + tabdat->xpad - 1; uint32_t iy = (rcItem->bottom + rcItem->top - iSize) / 2; if (dat->m_bIsIdle && PluginConfig.m_bIdleDetect) @@ -246,7 +246,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_flagsEx.m_bTabFlashLabel) { + if (!dat->m_bCanFlashTab || (dat->m_bCanFlashTab == TRUE && dat->m_bTabFlash) || !dat->m_pContainer->cfg.flagsEx.m_bTabFlashLabel) { uint32_t 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)) { @@ -640,7 +640,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_flagsEx.m_bTabCloseButton; + tabdat->bCloseButton = tabdat->pContainer->cfg.flagsEx.m_bTabCloseButton; tabdat->helperDat = nullptr; if (tabdat->bAeroTabs) { @@ -661,7 +661,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_flags.m_bSideBar) || (nCount == 1 && tabdat->pContainer->m_flags.m_bHideTabs)) { + if ((tabdat->pContainer->cfg.flags.m_bSideBar) || (nCount == 1 && tabdat->pContainer->cfg.flags.m_bHideTabs)) { if (nCount == 0) FillRect(hdcreal, &ps.rcPaint, GetSysColorBrush(COLOR_3DFACE)); // avoid flickering/ugly black background during container creation EndPaint(hwnd, &ps); @@ -690,7 +690,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) bmpOld = (HBITMAP)SelectObject(hdc, bmpMem); } - if (nCount == 1 && tabdat->pContainer->m_flags.m_bHideTabs) + if (nCount == 1 && tabdat->pContainer->cfg.flags.m_bHideTabs) rctClip = rctPage; if (CSkin::m_skinEnabled) @@ -722,7 +722,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) } } - if (nCount > 1 || !(tabdat->pContainer->m_flags.m_bHideTabs)) { + if (nCount > 1 || !(tabdat->pContainer->cfg.flags.m_bHideTabs)) { rctClip = rctPage; InflateRect(&rctClip, -tabdat->pContainer->m_tBorder, -tabdat->pContainer->m_tBorder); } @@ -850,7 +850,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_flags.m_bHideTabs)) ? tabdat->helperDat->m_pContainer->m_tBorder : 0); + rcPage.top = pt.y + ((nCount > 1 || !(tabdat->helperDat->m_pContainer->cfg.flags.m_bHideTabs)) ? tabdat->helperDat->m_pContainer->m_tBorder : 0); FillRect(hdc, &rcPage, CSkin::m_BrushBack); rcPage.top = 0; } @@ -1102,7 +1102,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_flags.m_bHideTabs)))) + if (tabdat->pContainer && (!tabdat->pContainer->m_pSideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->cfg.flags.m_bHideTabs)))) SetTimer(hwnd, TIMERID_HOVER_T, 750, nullptr); break; @@ -1111,7 +1111,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_flags.m_bHideTabs ? 1 : 0)) { + if (iTabs > (tabdat->pContainer->cfg.flags.m_bHideTabs ? 1 : 0)) { RECT rcClient, rc; GetClientRect(hwnd, &rcClient); TabCtrl_GetItemRect(hwnd, iTabs - 1, &rc); @@ -1139,7 +1139,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break; case WM_LBUTTONDBLCLK: - if (!tabdat->pContainer->m_pSettings->flagsEx.m_bTabCloseButton) { + if (!tabdat->pContainer->cfg.flagsEx.m_bTabCloseButton) { GetCursorPos(&pt); tabdat->pContainer->CloseTabByMouse(&pt); } diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 0ba354165d..a6eb6b8a2d 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_flags.m_bCreateMinimized ? 0 : DWM_SIT_DISPLAYFRAME); + CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap(m_hwndProxy, hbm, &pt, m_dat->m_pContainer->cfg.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 7e6eaba5eb..14a762cc0a 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2157,7 +2157,7 @@ void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc) void CMsgDialog::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const { - if (m_pContainer->m_flags.m_bHideToolbar) + if (m_pContainer->cfg.flags.m_bHideToolbar) return; bool bAero = M.isAero(); @@ -2167,7 +2167,7 @@ void CMsgDialog::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const RECT rc, rcToolbar; POINT pt; - if (!m_pContainer->m_flags.m_bBottomToolbar) { + if (!m_pContainer->cfg.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 0984e88794..926320e470 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -688,21 +688,21 @@ bool CMsgDialog::MustPlaySound() const if (m_pContainer->m_bHidden) // hidden container is treated as closed, so play the sound return true; - if (m_pContainer->m_flags.m_bNoSound || NEN::bNoSounds) + if (m_pContainer->cfg.flags.m_bNoSound || NEN::bNoSounds) return false; // window minimized, check if sound has to be played if (::IsIconic(m_pContainer->m_hwnd)) - return m_pContainer->m_flagsEx.m_bSoundMinimized; + return m_pContainer->cfg.flagsEx.m_bSoundMinimized; // window in foreground if (m_pContainer->m_hwnd != ::GetForegroundWindow()) - return m_pContainer->m_flagsEx.m_bSoundUnfocused; + return m_pContainer->cfg.flagsEx.m_bSoundUnfocused; if (m_pContainer->m_hwndActive == GetHwnd()) - return m_pContainer->m_flagsEx.m_bSoundFocused; + return m_pContainer->cfg.flagsEx.m_bSoundFocused; - return m_pContainer->m_flagsEx.m_bSoundInactive; + return m_pContainer->cfg.flagsEx.m_bSoundInactive; } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3