From 7d4424c249762c3ace80975342009fccce60df2b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Mar 2017 21:35:38 +0300 Subject: tabSRMM: both window types to use the same spliiter Y --- plugins/TabSRMM/src/buttonsbar.cpp | 16 +++++++--------- plugins/TabSRMM/src/chat/window.cpp | 26 ++++++++++++++++---------- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/tabctrl.cpp | 36 ++++++++++++++++++------------------ 4 files changed, 42 insertions(+), 38 deletions(-) diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 8aaf17a9b3..b3a610fa71 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -206,26 +206,24 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (!m_hwnd || !IsWindowVisible(m_hwnd)) return 0; - HWND hwnd = m_hwnd; - RECT rect; HWND hwndButton = 0; BYTE gap = DPISCALEX_S(db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1)); bool showToolbar = !(m_pContainer->dwFlags & CNT_HIDETOOLBAR); bool bBottomToolbar = (m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0; - HWND hwndToggleSideBar = GetDlgItem(hwnd, IDC_TOGGLESIDEBAR); + HWND hwndToggleSideBar = GetDlgItem(m_hwnd, IDC_TOGGLESIDEBAR); ShowWindow(hwndToggleSideBar, (showToolbar && m_pContainer->SideBar->isActive()) ? SW_SHOW : SW_HIDE); HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount() + 1); RECT rcSplitter; - GetWindowRect(GetDlgItem(hwnd, (m_bType == SESSIONTYPE_IM) ? IDC_SPLITTERY : IDC_SPLITTERY), &rcSplitter); - + GetWindowRect(GetDlgItem(m_hwnd, IDC_SPLITTERY), &rcSplitter); POINT ptSplitter = { 0, rcSplitter.top }; - ScreenToClient(hwnd, &ptSplitter); + ScreenToClient(m_hwnd, &ptSplitter); - GetClientRect(hwnd, &rect); + RECT rect; + GetClientRect(m_hwnd, &rect); int splitterY = (!bBottomToolbar) ? ptSplitter.y - DPISCALEY_S(1) : rect.bottom; int tempL = m_bbLSideWidth, tempR = m_bbRSideWidth; @@ -249,7 +247,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() continue; if (((m_bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((m_bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { - hwndButton = GetDlgItem(hwnd, cbd->m_dwButtonCID); + hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (!showToolbar) { ShowWindow(hwndButton, SW_HIDE); @@ -299,7 +297,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() continue; if (((m_bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((m_bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { - hwndButton = GetDlgItem(hwnd, cbd->m_dwButtonCID); + hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (!showToolbar) { ShowWindow(hwndButton, SW_HIDE); diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 6ed393724d..0d725c26fa 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -252,7 +252,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) { bool bToolbar = !(m_pContainer->dwFlags & CNT_HIDETOOLBAR); - bool bBottomToolbar = m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 1 : 0; + bool bBottomToolbar = (m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0; bool bNick = si->iType != GCW_SERVER && si->bNicklistEnabled; bool bInfoPanel = m_pPanel.isActive(); int panelHeight = m_pPanel.getHeight() + 1; @@ -297,7 +297,9 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) urc->rcItem.top = 0; urc->rcItem.left = 0; urc->rcItem.right = bNick ? urc->dlgNewSize.cx - iSplitterX : urc->dlgNewSize.cx; - urc->rcItem.bottom = (bToolbar && !bBottomToolbar) ? (urc->dlgNewSize.cy - m_iSplitterY - (PluginConfig.m_DPIscaleY > 1.0 ? DPISCALEY_S(24) : DPISCALEY_S(23))) : (urc->dlgNewSize.cy - m_iSplitterY - DPISCALEY_S(2)); + urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; + if (!bToolbar || bBottomToolbar) + urc->rcItem.bottom += DPISCALEY_S(21); if (bInfoPanel) urc->rcItem.top += panelHeight; if (CSkin::m_skinEnabled) { @@ -315,7 +317,9 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) urc->rcItem.top = 0; urc->rcItem.right = urc->dlgNewSize.cx; urc->rcItem.left = urc->dlgNewSize.cx - iSplitterX + 2; - urc->rcItem.bottom = (bToolbar && !bBottomToolbar) ? (urc->dlgNewSize.cy - m_iSplitterY - DPISCALEY_S(23)) : (urc->dlgNewSize.cy - m_iSplitterY - DPISCALEY_S(2)); + urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; + if (!bToolbar || bBottomToolbar) + urc->rcItem.bottom += DPISCALEY_S(21); if (bInfoPanel) urc->rcItem.top += panelHeight; if (CSkin::m_skinEnabled) { @@ -332,7 +336,9 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) case IDC_SPLITTERX: urc->rcItem.right = urc->dlgNewSize.cx - iSplitterX + 2; urc->rcItem.left = urc->dlgNewSize.cx - iSplitterX; - urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY - ((bToolbar && !bBottomToolbar) ? DPISCALEY_S(23) : DPISCALEY_S(2)); + urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; + if (!bToolbar || bBottomToolbar) + urc->rcItem.bottom += DPISCALEY_S(21); urc->rcItem.top = 0; if (bInfoPanel) urc->rcItem.top += panelHeight; @@ -340,8 +346,8 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) case IDC_SPLITTERY: urc->rcItem.right = urc->dlgNewSize.cx; - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY; - urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY + DPISCALEY_S(2); + urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + DPISCALEY_S(23); + urc->rcItem.bottom = urc->rcItem.top + DPISCALEY_S(2); urc->rcItem.left = 0; urc->rcItem.bottom++; urc->rcItem.top++; @@ -349,14 +355,14 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) case IDC_MESSAGE: urc->rcItem.right = urc->dlgNewSize.cx; - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 3; - urc->rcItem.bottom = urc->dlgNewSize.cy; // - 1 ; + urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 3 + DPISCALEY_S(23); + urc->rcItem.bottom = urc->dlgNewSize.cy; + if (bBottomToolbar && bToolbar) + urc->rcItem.bottom -= DPISCALEY_S(22); if (m_bIsAutosizingInput) urc->rcItem.top -= DPISCALEY_S(1); - if (bBottomToolbar && bToolbar) - urc->rcItem.bottom -= DPISCALEY_S(22); if (CSkin::m_skinEnabled) { CSkinItem *item = &SkinItems[ID_EXTBKINPUTAREA]; if (!item->IGNORED) { diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index b6d3f2ddaf..1fe9cb4fb5 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2159,9 +2159,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } return 0; + case DM_CONFIGURETOOLBAR: // configures the toolbar only... if lParam != 0, then it also calls // SetDialogToType() to reconfigure the message window - case DM_CONFIGURETOOLBAR: m_bShowUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1; SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTERY), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index b57e66b3f1..f42d2c4d6a 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -29,7 +29,7 @@ #include "stdafx.h" -static WNDPROC OldTabControlClassProc; +static WNDPROC OldTabControlClassProc; #define FIXED_TAB_SIZE 100 @@ -940,23 +940,23 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara switch (msg) { case WM_NCCREATE: - { - WNDCLASSEX wcl = { 0 }; - wcl.cbSize = sizeof(wcl); - GetClassInfoEx(g_hInst, L"SysTabControl32", &wcl); - OldTabControlClassProc = wcl.lpfnWndProc; - - tabdat = (TabControlData*)mir_calloc(sizeof(TabControlData)); - SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tabdat); - tabdat->hwnd = hwnd; - tabdat->cx = GetSystemMetrics(SM_CXSMICON); - tabdat->cy = GetSystemMetrics(SM_CYSMICON); - tabdat->fTipActive = FALSE; - tabdat->iHoveredTabIndex = -1; - tabdat->iHoveredCloseIcon = -1; - SendMessage(hwnd, EM_THEMECHANGED, 0, 0); - } - return TRUE; + { + WNDCLASSEX wcl = { 0 }; + wcl.cbSize = sizeof(wcl); + GetClassInfoEx(g_hInst, L"SysTabControl32", &wcl); + OldTabControlClassProc = wcl.lpfnWndProc; + + tabdat = (TabControlData*)mir_calloc(sizeof(TabControlData)); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tabdat); + tabdat->hwnd = hwnd; + tabdat->cx = GetSystemMetrics(SM_CXSMICON); + tabdat->cy = GetSystemMetrics(SM_CYSMICON); + tabdat->fTipActive = FALSE; + tabdat->iHoveredTabIndex = -1; + tabdat->iHoveredCloseIcon = -1; + SendMessage(hwnd, EM_THEMECHANGED, 0, 0); + } + return TRUE; case EM_THEMECHANGED: tabdat->m_xpad = M.GetByte("x-pad", 3); -- cgit v1.2.3