diff --git a/Src/BasicFlatStatusBar.h b/Src/BasicFlatStatusBar.h index 53fa65e55c2..ccbbe7df57d 100644 --- a/Src/BasicFlatStatusBar.h +++ b/Src/BasicFlatStatusBar.h @@ -15,19 +15,19 @@ class CBasicFlatStatusBar : public CStatusBar { DECLARE_DYNAMIC(CBasicFlatStatusBar) public: - CBasicFlatStatusBar(); + CBasicFlatStatusBar(); protected: CPoint CBasicFlatStatusBar::GetClientCursorPos() const; int GetIndexFromPoint(const CPoint& pt) const; static COLORREF LightenColor(COLORREF color, double amount); - afx_msg void OnPaint(); + afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC *pDC); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnMouseLeave(); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() bool m_bMouseTracking; int m_nTrackingPane; diff --git a/Src/Common/MDITabBar.cpp b/Src/Common/MDITabBar.cpp index eed049a5cee..689cbafb177 100644 --- a/Src/Common/MDITabBar.cpp +++ b/Src/Common/MDITabBar.cpp @@ -20,10 +20,10 @@ constexpr int RR_SHADOWWIDTH = 3; ///////////////////////////////////////////////////////////////////////////// // CMDITabBar -IMPLEMENT_DYNAMIC(CMDITabBar, CControlBar) +IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl) -BEGIN_MESSAGE_MAP(CMDITabBar, CControlBar) - //{{AFX_MSG_MAP(CMDITabBar) +BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl) + //{{AFX_MSG_MAP(CMyTabCtrl) ON_WM_MBUTTONDOWN() ON_WM_CONTEXTMENU() ON_WM_PAINT() @@ -37,79 +37,55 @@ BEGIN_MESSAGE_MAP(CMDITabBar, CControlBar) //}}AFX_MSG_MAP END_MESSAGE_MAP() +IMPLEMENT_DYNAMIC(CMDITabBar, CControlBar) + +BEGIN_MESSAGE_MAP(CMDITabBar, CControlBar) + //{{AFX_MSG_MAP(CMDITabBar) + ON_WM_SIZE() + ON_WM_NCHITTEST() + ON_WM_ERASEBKGND() + ON_WM_PAINT() + ON_WM_NCMOUSEMOVE() + ON_WM_NCMOUSELEAVE() + ON_WM_NCLBUTTONDBLCLK() + ON_WM_NCLBUTTONDOWN() + ON_WM_NCLBUTTONUP() + ON_WM_NCRBUTTONDOWN() + ON_WM_NCRBUTTONUP() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + static int determineIconSize() { return GetSystemMetrics(SM_CXSMICON); } -/** - * @brief Create tab bar. - * @param pParentWnd [in] main frame window pointer - */ -BOOL CMDITabBar::Create(CMDIFrameWnd* pMainFrame) +BOOL CMyTabCtrl::Create(CMDIFrameWnd* pMainFrame, CWnd* pParent) { - m_pMainFrame = pMainFrame; - m_dwStyle = CBRS_TOP; - - if (!CWnd::Create(WC_TABCONTROL, nullptr, WS_CHILD | WS_VISIBLE | TCS_OWNERDRAWFIXED, CRect(0, 0, 0, 0), pMainFrame, AFX_IDW_CONTROLBAR_FIRST+30)) + if (!CTabCtrl::Create(WS_CHILD | WS_VISIBLE | TCS_OWNERDRAWFIXED, CRect(0, 0, 0, 0), pParent, 0)) return FALSE; - CClientDC dc(this); - const int lpx = dc.GetDeviceCaps(LOGPIXELSX); - auto pointToPixel = [lpx](int point) { return MulDiv(point, lpx, 72); }; - const int r = pointToPixel(RR_RADIUS); - const int sw = pointToPixel(RR_SHADOWWIDTH); - TabCtrl_SetPadding(m_hWnd, sw + r * 2 + determineIconSize() / 2, sw + r); - - NONCLIENTMETRICS ncm = { sizeof NONCLIENTMETRICS }; - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof NONCLIENTMETRICS, &ncm, 0); - m_font.CreateFontIndirect(&ncm.lfMenuFont); - SetFont(&m_font); - + m_pMainFrame = pMainFrame; m_tooltips.Create(m_pMainFrame, TTS_NOPREFIX); m_tooltips.AddTool(this, _T("")); - return TRUE; } - /** * @brief Called before messages are translated. * Passes a mouse message to the ToolTip control for processing. * @param [in] pMsg Points to an MSG structure that contains the message to be chcecked */ -BOOL CMDITabBar::PreTranslateMessage(MSG* pMsg) +BOOL CMyTabCtrl::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_MOUSEMOVE) m_tooltips.RelayEvent(pMsg); // Call the parent method. - return CControlBar::PreTranslateMessage(pMsg); + return __super::PreTranslateMessage(pMsg); } -/** - * @brief This method calculates the horizontal size of a control bar. - */ -CSize CMDITabBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz) -{ - if (GetItemCount() == 0) - return CSize(SHRT_MAX, 0); - - TEXTMETRIC tm; - CClientDC dc(this); - CFont *pOldFont = dc.SelectObject(&m_font); - dc.GetTextMetrics(&tm); - dc.SelectObject(pOldFont); - - const int lpx = dc.GetDeviceCaps(LOGPIXELSX); - auto pointToPixel = [lpx](int point) { return MulDiv(point, lpx, 72); }; - const int r = pointToPixel(RR_RADIUS); - const int sw = pointToPixel(RR_SHADOWWIDTH); - - return CSize(SHRT_MAX, tm.tmHeight + (sw + r) * 2); -} - -void CMDITabBar::OnPaint() +void CMyTabCtrl::OnPaint() { CPaintDC dc(this); dc.SelectObject(GetFont()); @@ -120,8 +96,17 @@ void CMDITabBar::OnPaint() CRect rcClient; GetClientRect(&rcClient); + const int nCount = GetItemCount(); + if (nCount == 0) + { + dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT)); + TCHAR szBuf[256]; + AfxGetMainWnd()->GetWindowText(szBuf, sizeof(szBuf) / sizeof(szBuf[0])); + dc.DrawText(szBuf, -1, &rcClient, DT_LEFT | DT_VCENTER | DT_SINGLELINE); + } + int nCurSel = GetCurSel(); - for (int i = GetItemCount() - 1; i >= 0; --i) + for (int i = nCount - 1; i >= 0; --i) { GetItemRect(i, &dis.rcItem); dis.itemID = i; @@ -132,7 +117,7 @@ void CMDITabBar::OnPaint() } } -BOOL CMDITabBar::OnEraseBkgnd(CDC* pDC) +BOOL CMyTabCtrl::OnEraseBkgnd(CDC* pDC) { CRect rClient; GetClientRect(rClient); @@ -143,7 +128,7 @@ BOOL CMDITabBar::OnEraseBkgnd(CDC* pDC) /** * @brief Called when tab selection is changed. */ -BOOL CMDITabBar::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) +BOOL CMyTabCtrl::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) { TC_ITEM tci; tci.mask = TCIF_PARAM; @@ -158,7 +143,7 @@ BOOL CMDITabBar::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) /** * @brief Show context menu and handle user selection. */ -void CMDITabBar::OnContextMenu(CWnd *pWnd, CPoint point) +void CMyTabCtrl::OnContextMenu(CWnd *pWnd, CPoint point) { CPoint ptClient = point; ScreenToClient(&ptClient); @@ -225,7 +210,7 @@ void CMDITabBar::OnContextMenu(CWnd *pWnd, CPoint point) /** * @brief synchronize the tabs with all mdi client windows. */ -void CMDITabBar::UpdateTabs() +void CMyTabCtrl::UpdateTabs() { Invalidate(); @@ -329,7 +314,7 @@ void CMDITabBar::UpdateTabs() * @brief Called when middle mouse button is pressed. * This function closes the tab when the middle mouse button is pressed. */ -void CMDITabBar::OnMButtonDown(UINT nFlags, CPoint point) +void CMyTabCtrl::OnMButtonDown(UINT nFlags, CPoint point) { int index = GetItemIndexFromPoint(point); if (index < 0) @@ -342,7 +327,7 @@ void CMDITabBar::OnMButtonDown(UINT nFlags, CPoint point) pMDIChild->SendMessage(WM_SYSCOMMAND, SC_CLOSE); } -void CMDITabBar::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) +void CMyTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { TCHAR szBuf[256]; TCITEM item; @@ -351,7 +336,7 @@ void CMDITabBar::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) item.mask = TCIF_TEXT | TCIF_PARAM; item.pszText = szBuf; item.cchTextMax = sizeof(szBuf) / sizeof(TCHAR); - TabCtrl_GetItem(this->m_hWnd, lpDraw->itemID, &item); + GetItem(lpDraw->itemID, &item); const int lpx = ::GetDeviceCaps(lpDraw->hDC, LOGPIXELSX); auto pointToPixel = [lpx](int point) { return MulDiv(point, lpx, 72); }; @@ -364,13 +349,13 @@ void CMDITabBar::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) const COLORREF clrShadow = CEColor::GetIntermediateColor(GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DFACE), 0.5f); if (GetSysColor(COLOR_3DFACE) == GetSysColor(COLOR_WINDOW)) { - DrawRoundedRectWithShadow(lpDraw->hDC, rc.left + sw, sw - 1, rc.Width() - sw * 2, rc.top - sw * 2 + 2, r, sw, + DrawRoundedRectWithShadow(lpDraw->hDC, rc.left + sw, rc.top + sw - 1, rc.Width() - sw * 2, rc.top - sw * 2 + 2, r, sw, GetSysColor(COLOR_HIGHLIGHT), clrShadow, GetSysColor(COLOR_3DFACE)); SetTextColor(lpDraw->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); } else { - DrawRoundedRectWithShadow(lpDraw->hDC, rc.left + sw, sw - 1, rc.Width() - sw * 2, rc.Height() - sw * 2 + 2, r, sw, + DrawRoundedRectWithShadow(lpDraw->hDC, rc.left + sw, rc.top + sw - 1, rc.Width() - sw * 2, rc.Height() - sw * 2 + 2, r, sw, GetSysColor(COLOR_WINDOW), clrShadow, GetSysColor(COLOR_3DFACE)); SetTextColor(lpDraw->hDC, GetSysColor(COLOR_WINDOWTEXT)); } @@ -407,7 +392,7 @@ void CMDITabBar::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) } } -void CMDITabBar::OnMouseMove(UINT nFlags, CPoint point) +void CMyTabCtrl::OnMouseMove(UINT nFlags, CPoint point) { int nTabItemIndex = GetItemIndexFromPoint(point); CRect rc = GetCloseButtonRect(nTabItemIndex); @@ -444,7 +429,7 @@ void CMDITabBar::OnMouseMove(UINT nFlags, CPoint point) UpdateToolTips(nTabItemIndex); } -void CMDITabBar::OnMouseLeave() +void CMyTabCtrl::OnMouseLeave() { TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT) }; tme.dwFlags = TME_LEAVE | TME_CANCEL; @@ -456,13 +441,13 @@ void CMDITabBar::OnMouseLeave() m_bCloseButtonDown = false; } -void CMDITabBar::OnLButtonDown(UINT nFlags, CPoint point) +void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point) { m_bCloseButtonDown = !!m_rcCurrentCloseButtom.PtInRect(point); InvalidateRect(m_rcCurrentCloseButtom); if (!m_bCloseButtonDown) { - if (DragDetect(point)) + if (DragDetect(point)) { m_nDraggingTabItemIndex = GetItemIndexFromPoint(point); SetCapture(); @@ -471,7 +456,7 @@ void CMDITabBar::OnLButtonDown(UINT nFlags, CPoint point) } } -void CMDITabBar::OnLButtonUp(UINT nFlags, CPoint point) +void CMyTabCtrl::OnLButtonUp(UINT nFlags, CPoint point) { if (m_nDraggingTabItemIndex >= 0) { @@ -488,7 +473,7 @@ void CMDITabBar::OnLButtonUp(UINT nFlags, CPoint point) CWnd::OnLButtonUp(nFlags, point); } -CRect CMDITabBar::GetCloseButtonRect(int nItem) +CRect CMyTabCtrl::GetCloseButtonRect(int nItem) { CClientDC dc(this); const int lpx = dc.GetDeviceCaps(LOGPIXELSX); @@ -507,14 +492,14 @@ CRect CMDITabBar::GetCloseButtonRect(int nItem) return rc; } -int CMDITabBar::GetItemIndexFromPoint(CPoint point) const +int CMyTabCtrl::GetItemIndexFromPoint(CPoint point) const { TCHITTESTINFO hit; hit.pt = point; return HitTest(&hit); } -void CMDITabBar::SwapTabs(int nIndexA, int nIndexB) +void CMyTabCtrl::SwapTabs(int nIndexA, int nIndexB) { TC_ITEM tciA = {0}, tciB = {0}; TCHAR szTextA[256], szTextB[256]; @@ -543,7 +528,7 @@ void CMDITabBar::SwapTabs(int nIndexA, int nIndexB) /** * @brief Get the maximum length of the title. */ -int CMDITabBar::GetMaxTitleLength() const +int CMyTabCtrl::GetMaxTitleLength() const { int nMaxTitleLength = m_bAutoMaxWidth ? static_cast(MDITABBAR_MAXTITLELENGTH - (GetItemCount() - 1) * 6) : MDITABBAR_MAXTITLELENGTH; if (nMaxTitleLength < MDITABBAR_MINTITLELENGTH) @@ -556,7 +541,7 @@ int CMDITabBar::GetMaxTitleLength() const * @brief Update tooltip text. * @param [in] nTabItemIndex Index of the tab displaying tooltip. */ -void CMDITabBar::UpdateToolTips(int nTabItemIndex) +void CMyTabCtrl::UpdateToolTips(int nTabItemIndex) { TC_ITEM tci; tci.mask = TCIF_PARAM; @@ -572,6 +557,7 @@ void CMDITabBar::UpdateToolTips(int nTabItemIndex) return; for (CWnd* pFrame = pParentWnd->GetTopWindow(); pFrame; pFrame = pFrame->GetNextWindow()) + { if (reinterpret_cast(tci.lParam) == pFrame->m_hWnd) { HWND hFrameWnd = pFrame->m_hWnd; @@ -605,4 +591,145 @@ void CMDITabBar::UpdateToolTips(int nTabItemIndex) m_nTooltipTabItemIndex = nTabItemIndex; return; } + } +} + +BOOL CMDITabBar::Update(bool bOnTitleBar, bool bMaximized) +{ + m_bOnTitleBar = bOnTitleBar; + m_bMaximized = bMaximized; + CRect rc; + if (m_bMaximized) + AfxGetMainWnd()->GetWindowRect(&rc); + m_top = rc.top; + return true; +} + +/** + * @brief Create tab bar. + * @param pParentWnd [in] main frame window pointer + */ +BOOL CMDITabBar::Create(CMDIFrameWnd* pMainFrame) +{ + m_dwStyle = CBRS_TOP; + + m_titleBar.Init(this); + + CWnd::Create(nullptr, nullptr, WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), pMainFrame, AFX_IDW_CONTROLBAR_FIRST + 30); + + if (!m_tabCtrl.Create(pMainFrame, this)) + return FALSE; + + CClientDC dc(this); + const int lpx = dc.GetDeviceCaps(LOGPIXELSX); + auto pointToPixel = [lpx](int point) { return MulDiv(point, lpx, 72); }; + const int r = pointToPixel(RR_RADIUS); + const int sw = pointToPixel(RR_SHADOWWIDTH); + m_tabCtrl.SetPadding(CSize(sw + r * 2 + determineIconSize() / 2, sw + r)); + + NONCLIENTMETRICS ncm = { sizeof NONCLIENTMETRICS }; + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof NONCLIENTMETRICS, &ncm, 0); + m_font.CreateFontIndirect(&ncm.lfMenuFont); + m_tabCtrl.SetFont(&m_font); + + return TRUE; +} + +/** + * @brief This method calculates the horizontal size of a control bar. + */ +CSize CMDITabBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz) +{ + if (!m_bOnTitleBar && m_tabCtrl.GetItemCount() == 0) + return CSize(SHRT_MAX, 0); + + TEXTMETRIC tm; + CClientDC dc(this); + CFont *pOldFont = dc.SelectObject(&m_font); + dc.GetTextMetrics(&tm); + dc.SelectObject(pOldFont); + + const int lpx = dc.GetDeviceCaps(LOGPIXELSX); + auto pointToPixel = [lpx](int point) { return MulDiv(point, lpx, 72); }; + const int r = pointToPixel(RR_RADIUS); + const int sw = pointToPixel(RR_SHADOWWIDTH); + int my = m_bOnTitleBar ? (m_bMaximized ? (-m_top + 2) : 2) : 0; + CSize size(SHRT_MAX, my + tm.tmHeight + (sw + r) * 2); + return size; +} + +LRESULT CMDITabBar::OnNcHitTest(CPoint point) +{ + return m_titleBar.OnNcHitTest(point); +} + +void CMDITabBar::OnNcMouseMove(UINT nHitTest, CPoint point) +{ + m_titleBar.OnNcMouseMove(nHitTest, point); +} + +void CMDITabBar::OnNcMouseLeave() +{ + m_titleBar.OnNcMouseLeave(); +} + +void CMDITabBar::OnNcLButtonDblClk(UINT nHitTest, CPoint point) +{ + m_titleBar.OnNcLButtonDblClk(nHitTest, point); +} + +void CMDITabBar::OnNcLButtonDown(UINT nHitTest, CPoint point) +{ + m_titleBar.OnNcLButtonDown(nHitTest, point); +} + +void CMDITabBar::OnNcLButtonUp(UINT nHitTest, CPoint point) +{ + m_titleBar.OnNcLButtonUp(nHitTest, point); +} + +void CMDITabBar::OnNcRButtonDown(UINT nHitTest, CPoint point) +{ + m_titleBar.OnNcRButtonDown(nHitTest, point); +} + +void CMDITabBar::OnNcRButtonUp(UINT nHitTest, CPoint point) +{ + m_titleBar.OnNcRButtonUp(nHitTest, point); +} + +void CMDITabBar::OnSize(UINT nType, int cx, int cy) +{ + __super::OnSize(nType, cx, cy); + Invalidate(); + m_titleBar.OnSize(m_bMaximized, cx, cy); + if (m_tabCtrl.m_hWnd) + { + const int leftMargin = m_bOnTitleBar ? m_titleBar.GetLeftMargin() : 0; + const int rightMargin = m_bOnTitleBar ? m_titleBar.GetRightMargin() : 0; + const int topMargin = ((m_bMaximized && m_bOnTitleBar) ? -m_top : 0) + (m_bOnTitleBar ? 1 : 0); + const int bottomMargin = m_bOnTitleBar ? 1 : 0; + CSize size{ 0, cy - topMargin - bottomMargin }; + m_tabCtrl.MoveWindow(leftMargin, topMargin, cx - leftMargin - rightMargin, cy - topMargin - bottomMargin, true); + m_tabCtrl.SetItemSize(size); + } +} + +BOOL CMDITabBar::OnEraseBkgnd(CDC* pDC) +{ + CRect rClient; + GetClientRect(rClient); + pDC->FillSolidRect(rClient, GetSysColor(COLOR_3DFACE)); + return TRUE; +} + +void CMDITabBar::OnPaint() +{ + if (!m_bOnTitleBar) + return __super::OnPaint(); + CPaintDC dc(this); + CRect rcClient; + GetClientRect(&rcClient); + m_titleBar.DrawIcon(AfxGetMainWnd(), dc); + m_titleBar.DrawButtons(dc); } diff --git a/Src/Common/MDITabBar.h b/Src/Common/MDITabBar.h index 231e730282e..b6297911661 100644 --- a/Src/Common/MDITabBar.h +++ b/Src/Common/MDITabBar.h @@ -6,78 +6,124 @@ */ #pragma once -/** - * @brief Class for Tab bar. - */ -class CMDITabBar : public CControlBar +#include "TitleBarHelper.h" + +class CMyTabCtrl : public CTabCtrl { - DECLARE_DYNAMIC(CMDITabBar) + enum { MDITABBAR_MINTITLELENGTH = 8, MDITABBAR_MAXTITLELENGTH = 64 }; -private: - enum {MDITABBAR_MINTITLELENGTH = 8, MDITABBAR_MAXTITLELENGTH = 64}; + DECLARE_DYNAMIC(CMyTabCtrl) +public: + CMyTabCtrl() + : m_bMouseTracking(false) + , m_bAutoMaxWidth(true) + , m_pMainFrame(nullptr) + , m_bCloseButtonDown(false) + , m_nDraggingTabItemIndex(-1) + , m_bInSelchange(false) + , m_nTooltipTabItemIndex(-1) + {} +protected: bool m_bInSelchange; - CMDIFrameWnd *m_pMainFrame; + bool m_bAutoMaxWidth; bool m_bMouseTracking; bool m_bCloseButtonDown; CRect m_rcCurrentCloseButtom; - bool m_bAutoMaxWidth; int m_nDraggingTabItemIndex; - CFont m_font; - CToolTipCtrl m_tooltips; /**< Tooltip for the tab */ int m_nTooltipTabItemIndex; /**< Index of the tab displaying tooltip */ + CMDIFrameWnd *m_pMainFrame; + CToolTipCtrl m_tooltips; /**< Tooltip for the tab */ public: - CMDITabBar() : m_bInSelchange(false), m_pMainFrame(nullptr), m_bMouseTracking(false), m_bCloseButtonDown(false), m_bAutoMaxWidth(true), m_nDraggingTabItemIndex(-1), m_nTooltipTabItemIndex(-1){} - virtual ~CMDITabBar() {} - BOOL Create(CMDIFrameWnd* pParentWnd); - void UpdateTabs(); + BOOL Create(CMDIFrameWnd* pMainFrame, CWnd* pParent); bool GetAutoMaxWidth() const { return m_bAutoMaxWidth; } void SetAutoMaxWidth(bool bAutoMaxWidth) { m_bAutoMaxWidth = bAutoMaxWidth; } + void UpdateTabs(); - virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler) {} - virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz); - - int GetItemCount() const - { ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, TCM_GETITEMCOUNT, 0, 0L); } - BOOL GetItem(int nItem, TCITEM* pTabCtrlItem) const - { ASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, TCM_GETITEM, nItem, (LPARAM)pTabCtrlItem); } - BOOL SetItem(int nItem, TCITEM* pTabCtrlItem) - { ASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)pTabCtrlItem); } - BOOL InsertItem(int nItem, TCITEM* pTabCtrlItem) - { ASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)pTabCtrlItem); } - BOOL DeleteItem(int nItem) - { ASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, TCM_DELETEITEM, nItem, 0L); } - int GetCurSel() const - { ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, TCM_GETCURSEL, 0, 0L); } - int SetCurSel(int nItem) - { ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, TCM_SETCURSEL, nItem, 0L); } - int HitTest(TCHITTESTINFO* pHitTestInfo) const - { ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM) pHitTestInfo); } - BOOL GetItemRect(int nItem, LPRECT lpRect) const - { ASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, TCM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect); } +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMyTabCtrl) + //}}AFX_VIRTUAL +// Implementation +public: + virtual ~CMyTabCtrl() {} +// Generated message map functions protected: virtual BOOL PreTranslateMessage(MSG* pMsg); - //{{AFX_MSG(CMDITabBar) + //{{AFX_MSG(CMyTabCtrl) afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC *pDC); - afx_msg BOOL OnSelchange(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnMButtonDown(UINT nFlags, CPoint point); + afx_msg BOOL OnSelchange(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnMouseLeave(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); //}}AFX_MSG + DECLARE_MESSAGE_MAP() -private: CRect GetCloseButtonRect(int nItem); int GetItemIndexFromPoint(CPoint pt) const; void SwapTabs(int nIndexA, int nIndexB); int GetMaxTitleLength() const; void UpdateToolTips(int index); }; + +/** + * @brief Class for Tab bar. + */ +class CMDITabBar : public CControlBar +{ + DECLARE_DYNAMIC(CMDITabBar) + +private: + + bool m_bOnTitleBar; + bool m_bMaximized; + int m_top; + CMyTabCtrl m_tabCtrl; + CFont m_font; + CTitleBarHelper m_titleBar; + +public: + CMDITabBar() + : m_bOnTitleBar(true) + , m_bMaximized(false) + , m_top(0) + {} + virtual ~CMDITabBar() {} + BOOL Update(bool bOnTitleBar, bool bMaxmized); + BOOL Create(CMDIFrameWnd* pParentWnd); + void UpdateTabs() { m_tabCtrl.UpdateTabs(); } + bool GetAutoMaxWidth() const { return m_tabCtrl.GetAutoMaxWidth(); } + void SetAutoMaxWidth(bool bAutoMaxWidth) { m_tabCtrl.SetAutoMaxWidth(bAutoMaxWidth); } + int GetItemCount() const { return m_tabCtrl.GetItemCount(); } + + virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler) {} + virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz); + +protected: + + //{{AFX_MSG(CMDITabBar) + afx_msg LRESULT OnNcHitTest(CPoint point); + afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point); + afx_msg void OnNcMouseLeave(); + afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point); + afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point); + afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point); + afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point); + afx_msg void OnNcRButtonUp(UINT nHitTest, CPoint point); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnPaint(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: +}; diff --git a/Src/EditorFilepathBar.cpp b/Src/EditorFilepathBar.cpp index 511d7afd08e..ead9e5f6630 100644 --- a/Src/EditorFilepathBar.cpp +++ b/Src/EditorFilepathBar.cpp @@ -164,7 +164,7 @@ void CEditorFilePathBar::DoPaint(CDC* pDC) const COLORREF clrShadow = CEColor::GetIntermediateColor(clrBarBackcolor, GetSysColor(COLOR_3DSHADOW), m_Edit[pane].GetActive() ? 0.5f : 0.8f); rc.OffsetRect(-rcBar.left, -rcBar.top); - DrawRoundedRectWithShadow(pDC->m_hDC, rc.left - r, rc.top - 1, rc.right - rc.left + 2 * r, rc.bottom - rc.top + 1, r, sw, + DrawRoundedRectWithShadow(pDC->m_hDC, rc.left - r, rc.top, rc.right - rc.left + 2 * r, rc.bottom - rc.top, r, sw, clrBackcolor, clrShadow, clrBarBackcolor); if (pane == m_nPanes - 1) { diff --git a/Src/MainFrm.cpp b/Src/MainFrm.cpp index 4253363008b..fe1df9a05d3 100644 --- a/Src/MainFrm.cpp +++ b/Src/MainFrm.cpp @@ -69,6 +69,7 @@ #include "ClipboardHistory.h" #include "locality.h" #include "DirWatcher.h" +#include "Win_VersionHelper.h" using std::vector; using boost::begin; @@ -220,6 +221,8 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) ON_MESSAGE(WM_COPYDATA, OnCopyData) ON_MESSAGE(WM_USER+1, OnUser1) ON_WM_ACTIVATEAPP() + ON_WM_NCCALCSIZE() + ON_WM_SIZE() ON_UPDATE_COMMAND_UI_RANGE(CMenuBar::FIRST_MENUID, CMenuBar::FIRST_MENUID + 10, OnUpdateMenuBarMenuItem) // [File] menu ON_COMMAND(ID_FILE_NEW, (OnFileNew<2, ID_MERGE_COMPARE_TEXT>)) @@ -250,6 +253,8 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) ON_COMMAND(ID_VIEW_STATUS_BAR, OnViewStatusBar) ON_COMMAND(ID_VIEW_TAB_BAR, OnViewTabBar) ON_UPDATE_COMMAND_UI(ID_VIEW_TAB_BAR, OnUpdateViewTabBar) + ON_COMMAND(ID_VIEW_TAB_BAR_ON_TITLE_BAR, OnViewTabBarOnTitleBar) + ON_UPDATE_COMMAND_UI(ID_VIEW_TAB_BAR_ON_TITLE_BAR, OnUpdateViewTabBarOnTitleBar) ON_COMMAND(ID_VIEW_RESIZE_PANES, OnResizePanes) ON_UPDATE_COMMAND_UI(ID_VIEW_RESIZE_PANES, OnUpdateResizePanes) ON_COMMAND_RANGE(ID_TOOLBAR_NONE, ID_TOOLBAR_HUGE, OnToolbarSize) @@ -404,17 +409,29 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_wndMDIClient.SubclassWindow(m_hWndMDIClient); + if (IsWin10_OrGreater()) + m_bTabsOnTitleBar = GetOptionsMgr()->GetBool(OPT_TABBAR_ON_TITLEBAR); + + m_wndTabBar.Update(m_bTabsOnTitleBar.value_or(false), false); + + if (m_bTabsOnTitleBar.value_or(false) && !m_wndTabBar.Create(this)) + { + TRACE0("Failed to create tab bar\n"); + return -1; // fail to create + } + if (!CreateToolbar()) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } - if (!m_wndTabBar.Create(this)) + if (!m_bTabsOnTitleBar.value_or(false) && !m_wndTabBar.Create(this)) { TRACE0("Failed to create tab bar\n"); return -1; // fail to create } + m_wndTabBar.SetAutoMaxWidth(GetOptionsMgr()->GetBool(OPT_TABBAR_AUTO_MAXWIDTH)); if (!GetOptionsMgr()->GetBool(OPT_SHOW_TABBAR)) @@ -1580,6 +1597,17 @@ void CMainFrame::OnViewUsedefaultfont() UpdateFont(frame); } +void CMainFrame::UpdateTitleBarAndTabBar() +{ + CWnd* pWnd1 = &m_wndReBar, *pWnd2 = &m_wndTabBar; + if (m_bTabsOnTitleBar.value_or(false)) + std::swap(pWnd1, pWnd2); + pWnd1->SetWindowPos(pWnd2, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + pWnd2->SetWindowPos(pWnd1, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + RecalcLayout(); +} + /** * @brief Update any resources necessary after a GUI language change */ @@ -2235,6 +2263,29 @@ void CMainFrame::OnViewTabBar() GetOptionsMgr()->SaveOption(OPT_SHOW_TABBAR, bShow); __super::ShowControlBar(&m_wndTabBar, bShow, 0); + + UpdateTitleBarAndTabBar(); +} + +/** + * @brief Updates "Show Tabbar" menuitem. + */ +void CMainFrame::OnUpdateViewTabBarOnTitleBar(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(m_bTabsOnTitleBar.has_value()); + pCmdUI->SetCheck(GetOptionsMgr()->GetBool(OPT_TABBAR_ON_TITLEBAR)); +} + +/** + * @brief Show/hide tabbar. + */ +void CMainFrame::OnViewTabBarOnTitleBar() +{ + bool bOnTitleBar = !GetOptionsMgr()->GetBool(OPT_TABBAR_ON_TITLEBAR); + if (m_bTabsOnTitleBar.has_value()) + m_bTabsOnTitleBar = bOnTitleBar; + GetOptionsMgr()->SaveOption(OPT_TABBAR_ON_TITLEBAR, bOnTitleBar); + UpdateTitleBarAndTabBar(); } /** @@ -2481,6 +2532,20 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID) } } +void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) +{ + RECT rcWindow = lpncsp->rgrc[0]; + __super::OnNcCalcSize(bCalcValidRects, lpncsp); + if (m_bTabsOnTitleBar.value_or(false) && m_wndTabBar.IsVisible()) + lpncsp->rgrc[0].top = rcWindow.top + 0; +} + +void CMainFrame::OnSize(UINT nType, int cx, int cy) +{ + m_wndTabBar.Update(m_bTabsOnTitleBar.value_or(false), (nType == SIZE_MAXIMIZED)); + __super::OnSize(nType, cx, cy); +} + BOOL CMainFrame::CreateToolbar() { if (!m_wndMenuBar.Create(this)) diff --git a/Src/MainFrm.h b/Src/MainFrm.h index a1f274427ea..39ddafe2a6a 100644 --- a/Src/MainFrm.h +++ b/Src/MainFrm.h @@ -207,6 +207,7 @@ class CMainFrame : public CMDIFrameWnd const PackingInfo * infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr, const OpenWebPageParams *pOpenParams = nullptr); + void UpdateTitleBarAndTabBar(); void UpdateResources(); void ApplyDiffOptions(); void SelectFilter(); @@ -342,6 +343,7 @@ class CMainFrame : public CMDIFrameWnd std::vector m_tempFiles; /**< List of possibly needed temp files. */ DropHandler *m_pDropHandler; std::unique_ptr m_pDirWatcher; + std::optional m_bTabsOnTitleBar; // Generated message map functions protected: @@ -372,6 +374,8 @@ class CMainFrame : public CMDIFrameWnd afx_msg void OnViewStatusBar(); afx_msg void OnUpdateViewTabBar(CCmdUI* pCmdUI); afx_msg void OnViewTabBar(); + afx_msg void OnUpdateViewTabBarOnTitleBar(CCmdUI* pCmdUI); + afx_msg void OnViewTabBarOnTitleBar(); afx_msg void OnUpdateResizePanes(CCmdUI* pCmdUI); afx_msg void OnResizePanes(); afx_msg void OnFileOpenProject(); @@ -381,6 +385,8 @@ class CMainFrame : public CMDIFrameWnd afx_msg void OnUpdateWindowCloseAll(CCmdUI* pCmdUI); afx_msg void OnSaveProject(); afx_msg void OnActivateApp(BOOL bActive, DWORD dwThreadID); + afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp); + afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnToolbarSize(UINT id); afx_msg void OnUpdateToolbarSize(CCmdUI* pCmdUI); afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult); diff --git a/Src/MenuBar.cpp b/Src/MenuBar.cpp index 1f2b9b3b97b..2db2cc521ff 100644 --- a/Src/MenuBar.cpp +++ b/Src/MenuBar.cpp @@ -78,6 +78,9 @@ BOOL CMenuBar::Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID) bool CMenuBar::AttachMenu(CMenu* pMenu) { + if (!m_hWnd) + return false; + CToolBarCtrl& toolbar = GetToolBarCtrl(); toolbar.SetRedraw(false); @@ -334,6 +337,8 @@ LRESULT CMenuBar::OnShowPopupMenu(WPARAM wParam, LPARAM lParam) BOOL CMenuBar::PreTranslateMessage(MSG* pMsg) { + if (!m_hWnd) + return FALSE; if (pMsg->message == WM_SYSKEYDOWN || pMsg->message == WM_SYSKEYUP) { if (pMsg->wParam == VK_F10 || pMsg->wParam == VK_MENU) diff --git a/Src/Merge.rc b/Src/Merge.rc index 8eabb430b8c..fef2c08391c 100644 --- a/Src/Merge.rc +++ b/Src/Merge.rc @@ -347,6 +347,11 @@ BEGIN END POPUP "&View" BEGIN + POPUP "Ta&b Bar" + BEGIN + MENUITEM "&View Tab Bar" ID_VIEW_TAB_BAR + MENUITEM "&On Title Bar", ID_VIEW_TAB_BAR_ON_TITLE_BAR + END POPUP "&Toolbar" BEGIN MENUITEM "&None", ID_TOOLBAR_NONE @@ -355,7 +360,6 @@ BEGIN MENUITEM "&Huge", ID_TOOLBAR_HUGE END MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - MENUITEM "Ta&b Bar", ID_VIEW_TAB_BAR END POPUP "&Tools" BEGIN @@ -488,6 +492,11 @@ BEGIN MENUITEM "Swap 1st | &3rd", ID_SWAPPANES_SWAP13 END MENUITEM SEPARATOR + POPUP "Ta&b Bar" + BEGIN + MENUITEM "&View Tab Bar" ID_VIEW_TAB_BAR + MENUITEM "&On Title Bar", ID_VIEW_TAB_BAR_ON_TITLE_BAR + END POPUP "&Toolbar" BEGIN MENUITEM "&None", ID_TOOLBAR_NONE @@ -496,7 +505,6 @@ BEGIN MENUITEM "&Huge", ID_TOOLBAR_HUGE END MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - MENUITEM "Ta&b Bar", ID_VIEW_TAB_BAR MENUITEM SEPARATOR MENUITEM "Com&pare Statistics...", ID_VIEW_DIR_STATISTICS MENUITEM SEPARATOR @@ -724,6 +732,11 @@ BEGIN END MENUITEM "Split V&ertically", ID_VIEW_SPLITVERTICALLY MENUITEM SEPARATOR + POPUP "Ta&b Bar" + BEGIN + MENUITEM "&View Tab Bar" ID_VIEW_TAB_BAR + MENUITEM "&On Title Bar", ID_VIEW_TAB_BAR_ON_TITLE_BAR + END POPUP "&Toolbar" BEGIN MENUITEM "&None", ID_TOOLBAR_NONE @@ -732,7 +745,6 @@ BEGIN MENUITEM "&Huge", ID_TOOLBAR_HUGE END MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - MENUITEM "Ta&b Bar", ID_VIEW_TAB_BAR MENUITEM "Diff &Pane", ID_VIEW_DETAIL_BAR MENUITEM "Lo&cation Pane", ID_VIEW_LOCATION_BAR MENUITEM SEPARATOR diff --git a/Src/Merge.vcxproj b/Src/Merge.vcxproj index 17dc1c6a1bb..b8b16e8d6d3 100644 --- a/Src/Merge.vcxproj +++ b/Src/Merge.vcxproj @@ -1404,6 +1404,7 @@ $(IntDir)$(TargetName)2.pch + Use @@ -1647,6 +1648,7 @@ + diff --git a/Src/Merge.vcxproj.filters b/Src/Merge.vcxproj.filters index 7d185baf24c..74c14d6d5f3 100644 --- a/Src/Merge.vcxproj.filters +++ b/Src/Merge.vcxproj.filters @@ -735,6 +735,9 @@ MFCGui\Common\Source Files + + MFCGui\Common\Source Files + @@ -1406,6 +1409,9 @@ MFCGui\Common\Header Files + + MFCGui\Common\Header Files + diff --git a/Src/OptionsDef.h b/Src/OptionsDef.h index 397157726bb..fbf8d7a41db 100644 --- a/Src/OptionsDef.h +++ b/Src/OptionsDef.h @@ -301,6 +301,7 @@ inline const String OPT_PLUGINS_OPEN_IN_SAME_FRAME_TYPE {_T("Plugins/OpenInSameF inline const String OPT_SHOW_SELECT_FILES_AT_STARTUP {_T("Settings/ShowFileDialog"s)}; // MDI Tab Bar +inline const String OPT_TABBAR_ON_TITLEBAR {_T("Settings/TabBarOnTitleBar"s)}; inline const String OPT_TABBAR_AUTO_MAXWIDTH {_T("Settings/TabBarAutoMaxWidth"s)}; // MRU diff --git a/Src/OptionsInit.cpp b/Src/OptionsInit.cpp index c3c10defca4..81fdb0aa006 100644 --- a/Src/OptionsInit.cpp +++ b/Src/OptionsInit.cpp @@ -235,6 +235,7 @@ void Init(COptionsMgr *pOptions) pOptions->InitOption(OPT_PATCHCREATOR_INCLUDE_CMD_LINE, false); pOptions->InitOption(OPT_PATCHCREATOR_COPY_TO_CLIPBOARD, false); + pOptions->InitOption(OPT_TABBAR_ON_TITLEBAR, true); pOptions->InitOption(OPT_TABBAR_AUTO_MAXWIDTH, true); pOptions->InitOption(OPT_ACTIVE_FRAME_MAX, true); pOptions->InitOption(OPT_ACTIVE_PANE, 0, 0, 2); diff --git a/Src/TitleBarHelper.cpp b/Src/TitleBarHelper.cpp new file mode 100644 index 00000000000..1049fff7ece --- /dev/null +++ b/Src/TitleBarHelper.cpp @@ -0,0 +1,274 @@ +// Copyright (c) 2024 Takashi Sawanaka +// SPDX-License-Identifier: BSL-1.0 +/** + * @file TitleBarHelper.cpp + * + * @brief Implementation of the CTitleBarHelper class + */ + +#include "StdAfx.h" +#include "TitleBarHelper.h" + +CTitleBarHelper::CTitleBarHelper() + : m_pWnd(nullptr) + , m_maximized(false) + , m_dpi(96) + , m_leftMargin(32.f) + , m_rightMargin(35.f * 3) + , m_bMouseTracking(false) + , m_nTrackingButton(-1) + , m_nHitTest(HTNOWHERE) +{ +} + +void CTitleBarHelper::Init(CWnd *pWnd) +{ + m_pWnd = pWnd; +} + +void CTitleBarHelper::DrawIcon(CWnd* pWnd, CDC& dc) +{ + HICON hIcon = (HICON)pWnd->SendMessage(WM_GETICON, ICON_SMALL2, 0); + if (hIcon == nullptr) + hIcon = (HICON)GetClassLongPtr(pWnd->m_hWnd, GCLP_HICONSM); + if (hIcon == nullptr) + return; + const int topMargin = (m_maximized ? -m_rc.top : 0); + const int height = m_size.cy - topMargin; + const int cx = PointToPixel(12.f); + const int cy = PointToPixel(12.f); + const int x = (PointToPixel(m_leftMargin) - cx) / 2; + const int y = (height - cy) / 2 + topMargin; + DrawIconEx(dc.m_hDC, x, y, hIcon, + cx, cy, 0, nullptr, DI_NORMAL); +} + +static void DrawTopRightEdgeWithCurve(Gdiplus::Graphics& graphics, Gdiplus::Pen& pen, Gdiplus::Rect rect, int cornerRadius) +{ + Gdiplus::GraphicsPath path; + path.AddLine(rect.X, rect.Y, rect.X + rect.Width - cornerRadius, rect.Y); + path.AddArc(rect.X + rect.Width - cornerRadius, rect.Y, cornerRadius, cornerRadius, 270, 90); + path.AddLine(rect.X + rect.Width, rect.Y + cornerRadius, rect.X + rect.Width, rect.Y + rect.Height); + graphics.DrawPath(&pen, &path); +} + +static void DrawRoundedRectangle(Gdiplus::Graphics& graphics, Gdiplus::Pen& pen, Gdiplus::Rect rect, int cornerRadius) +{ + Gdiplus::GraphicsPath path; + path.AddArc(rect.X, rect.Y, cornerRadius, cornerRadius, 180, 90); + path.AddArc(rect.X + rect.Width - cornerRadius, rect.Y, cornerRadius, cornerRadius, 270, 90); + path.AddArc(rect.X + rect.Width - cornerRadius, rect.Y + rect.Height - cornerRadius, cornerRadius, cornerRadius, 0, 90); + path.AddArc(rect.X, rect.Y + rect.Height - cornerRadius, cornerRadius, cornerRadius, 90, 90); + path.CloseFigure(); + graphics.DrawPath(&pen, &path); +} + +void CTitleBarHelper::DrawButtons(CDC& dc) +{ + Gdiplus::Graphics graphics(dc.m_hDC); + CRect rcIcons[3], rcButtons[3]; + const float buttonWidth = PointToPixelF(m_rightMargin) / 3.f; + const int iconSize = PointToPixel(6.75); + for (int i = 0; i < 3; i++) + { + rcButtons[i] = GetButtonRect(i); + rcIcons[i] = rcButtons[i]; + rcIcons[i].left = static_cast(rcIcons[i].left + (buttonWidth - iconSize) / 2); + rcIcons[i].right = static_cast(rcIcons[i].left + iconSize); + rcIcons[i].top = static_cast(rcIcons[i].top + (rcButtons[i].Height() - iconSize) / 2); + rcIcons[i].bottom = static_cast(rcIcons[i].top + iconSize); + + COLORREF colorref; + Gdiplus::Color color; + if (m_nTrackingButton == i) + colorref = (i == 2) ? RGB(0xE9, 0x48, 0x56) : GetIntermediateColor(GetSysColor(COLOR_3DFACE), GetSysColor(COLOR_WINDOW), 0.66f); + else + colorref = GetSysColor(COLOR_3DFACE); + color.SetFromCOLORREF(colorref); + Gdiplus::SolidBrush brush(color); + graphics.FillRectangle(&brush, rcButtons[i].left, rcButtons[i].top, rcButtons[i].Width(), rcButtons[i].Height()); + } + + graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + + Gdiplus::Color penColor; + penColor.SetFromCOLORREF(GetSysColor(COLOR_WINDOWTEXT)); + Gdiplus::Pen pen(penColor, PointToPixelF(0.75)); + + // minimize button + const int y = (rcIcons[0].top + rcIcons[0].bottom) / 2; + graphics.DrawLine(&pen, Gdiplus::Point(rcIcons[0].left, y), Gdiplus::Point(rcIcons[0].right, y)); + + const int r = PointToPixel(0.75); + if (m_maximized) + { + // maxmize button + DrawTopRightEdgeWithCurve(graphics, pen, Gdiplus::Rect(rcIcons[1].left + r, rcIcons[1].top - r, rcIcons[1].Width() - 2 * r, rcIcons[1].Height() - 2 * r), r * 3); + DrawRoundedRectangle(graphics, pen, Gdiplus::Rect(rcIcons[1].left - r, rcIcons[1].top + r, rcIcons[1].Width() - 2 * r, rcIcons[1].Height() - 2 * r), r); + } + else + { + // restore button + DrawRoundedRectangle(graphics, pen, Gdiplus::Rect(rcIcons[1].left, rcIcons[1].top, rcIcons[1].Width(), rcIcons[1].Height()), r); + } + + // close button + penColor.SetFromCOLORREF(m_nTrackingButton != 2 ? GetSysColor(COLOR_WINDOWTEXT) : RGB(255, 255, 255)); + Gdiplus::Pen pen2(penColor, PointToPixelF(0.75)); + graphics.DrawLine(&pen2, Gdiplus::Point(rcIcons[2].left, rcIcons[2].top), Gdiplus::Point(rcIcons[2].right, rcIcons[2].bottom)); + graphics.DrawLine(&pen2, Gdiplus::Point(rcIcons[2].left, rcIcons[2].bottom), Gdiplus::Point(rcIcons[2].right, rcIcons[2].top)); +} + +CRect CTitleBarHelper::GetButtonRect(int button) const +{ + CRect rcPart; + const float buttonWidth = PointToPixelF(m_rightMargin) / 3.f; + const int topMargin = (m_maximized ? -m_rc.top : 0); + rcPart.top = topMargin; + rcPart.bottom = m_size.cy; + rcPart.left = static_cast(m_size.cx - (3 - button) * buttonWidth); + rcPart.right = static_cast(rcPart.left + buttonWidth); + return rcPart; +} + +void CTitleBarHelper::OnSize(bool maximized, int cx, int cy) +{ + m_size = CSize(cx, cy); + m_maximized = maximized; + CClientDC dc(m_pWnd); + m_dpi = dc.GetDeviceCaps(LOGPIXELSX); + m_pWnd->GetWindowRect(&m_rc); +} + +LRESULT CTitleBarHelper::OnNcHitTest(CPoint pt) +{ + if (!m_pWnd) + return HTNOWHERE; + CClientDC dc(m_pWnd); + const int leftMargin = PointToPixel(m_leftMargin); + const int rightMargin = PointToPixel(m_rightMargin); + const int borderWidth = PointToPixel(6); + CRect rc; + m_pWnd->GetWindowRect(&rc); + if (pt.y < rc.top + borderWidth) + { + if (pt.x < rc.left + borderWidth) + return HTTOPLEFT; + else if (rc.right - borderWidth <= pt.x) + return HTTOPRIGHT; + return HTTOP; + } + if (pt.x < rc.left + borderWidth) + return HTLEFT; + if (rc.right - borderWidth <= pt.x) + return HTRIGHT; + if (pt.x < rc.left + leftMargin) + return HTSYSMENU; + for (int i = 0; i < 3; i++) + { + static const int htbuttons[]{ HTMINBUTTON, HTMAXBUTTON, HTCLOSE }; + CRect rcButton = GetButtonRect(i); + m_pWnd->ClientToScreen(&rcButton); + if (PtInRect(&rcButton, pt)) + return htbuttons[i]; + } + return HTCAPTION; +} + +void CTitleBarHelper::OnNcMouseMove(UINT nHitTest, CPoint point) +{ + if (!m_bMouseTracking) + { + TRACKMOUSEEVENT tme = { sizeof TRACKMOUSEEVENT, TME_LEAVE | TME_NONCLIENT, m_pWnd->m_hWnd }; + TrackMouseEvent(&tme); + m_bMouseTracking = true; + } + int i = -1; + if (nHitTest == HTMINBUTTON) + i = 0; + else if (nHitTest == HTMAXBUTTON) + i = 1; + else if (nHitTest == HTCLOSE) + i = 2; + for (int button : {i, m_nTrackingButton}) + { + if (button != -1) + { + CRect rcPart = GetButtonRect(button); + m_pWnd->InvalidateRect(&rcPart, false); + } + } + m_nTrackingButton = i; +} + +void CTitleBarHelper::OnNcMouseLeave() +{ + TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT), TME_LEAVE | TME_CANCEL, m_pWnd->m_hWnd }; + TrackMouseEvent(&tme); + m_bMouseTracking = false; + if (m_nTrackingButton >= 0) + { + CRect rcPart = GetButtonRect(m_nTrackingButton); + m_pWnd->InvalidateRect(&rcPart, false); + } + m_nTrackingButton = -1; +} + +void CTitleBarHelper::OnNcLButtonDblClk(UINT nHitTest, CPoint point) +{ + if (nHitTest != HTMINBUTTON && nHitTest != HTMAXBUTTON && nHitTest != HTCLOSE && nHitTest != HTSYSMENU) + AfxGetMainWnd()->SendMessage(WM_NCLBUTTONDBLCLK, nHitTest, MAKELPARAM(point.x, point.y)); + else if (nHitTest == HTSYSMENU) + AfxGetMainWnd()->PostMessage(WM_CLOSE); +} + +void CTitleBarHelper::OnNcLButtonDown(UINT nHitTest, CPoint point) +{ + if (nHitTest != HTMINBUTTON && nHitTest != HTMAXBUTTON && nHitTest != HTCLOSE && nHitTest != HTSYSMENU) + AfxGetMainWnd()->SendMessage(WM_NCLBUTTONDOWN, nHitTest, MAKELPARAM(point.x, point.y)); + else if (nHitTest == HTSYSMENU) + ShowSysMenu(CPoint{ point.x + 1, point.y }); + else if (nHitTest == HTMINBUTTON || nHitTest == HTMAXBUTTON || nHitTest == HTCLOSE) + m_nHitTest = nHitTest; +} + +void CTitleBarHelper::OnNcLButtonUp(UINT nHitTest, CPoint point) +{ + if (nHitTest != HTMINBUTTON && nHitTest != HTMAXBUTTON && nHitTest != HTCLOSE && nHitTest != HTSYSMENU) + AfxGetMainWnd()->SendMessage(WM_NCLBUTTONUP, nHitTest, MAKELPARAM(point.x, point.y)); + else if (m_nHitTest != HTNOWHERE && m_nHitTest == nHitTest) + { + if (nHitTest == HTMINBUTTON) + AfxGetMainWnd()->ShowWindow(SW_MINIMIZE); + else if (nHitTest == HTMAXBUTTON) + AfxGetMainWnd()->ShowWindow(m_maximized ? SW_RESTORE : SW_MAXIMIZE); + else if (nHitTest == HTCLOSE) + AfxGetMainWnd()->PostMessage(WM_CLOSE); + } + m_nHitTest = HTNOWHERE; +} + +void CTitleBarHelper::OnNcRButtonDown(UINT nHitTest, CPoint point) +{ +} + +void CTitleBarHelper::OnNcRButtonUp(UINT nHitTest, CPoint point) +{ + ShowSysMenu(point); +} + +void CTitleBarHelper::ShowSysMenu(CPoint point) +{ + CMenu* pSysMenu = AfxGetMainWnd()->GetSystemMenu(FALSE); + BOOL cmd = pSysMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, point.x, point.y, AfxGetMainWnd(), nullptr); + if (cmd) + AfxGetMainWnd()->PostMessage(WM_SYSCOMMAND, cmd, 0); +} + +COLORREF CTitleBarHelper::GetIntermediateColor(COLORREF a, COLORREF b, float ratio) +{ + const uint8_t R = static_cast((GetRValue(a) - GetRValue(b)) * ratio) + GetRValue(b); + const uint8_t G = static_cast((GetGValue(a) - GetGValue(b)) * ratio) + GetGValue(b); + const uint8_t B = static_cast((GetBValue(a) - GetBValue(b)) * ratio) + GetBValue(b); + return RGB(R, G, B); +} diff --git a/Src/TitleBarHelper.h b/Src/TitleBarHelper.h new file mode 100644 index 00000000000..8f9b98a06e6 --- /dev/null +++ b/Src/TitleBarHelper.h @@ -0,0 +1,49 @@ +/** + * @file TitleBarHelper.h + * + * @brief Declaration file for CTitleBarHelper + * + */ +#pragma once + +#include +#include +#include + +class CTitleBarHelper { +public: + CTitleBarHelper(); + void Init(CWnd* pWnd); + void DrawIcon(CWnd* pWnd, CDC& dc); + void DrawButtons(CDC& dc); + int GetLeftMargin() const { return PointToPixel(m_leftMargin); } + int GetRightMargin() const { return PointToPixel(m_rightMargin); } + CRect GetButtonRect(int button) const; + void OnSize(bool maximized, int cx, int cy); + LRESULT OnNcHitTest(CPoint pt); + void OnNcMouseMove(UINT nHitTest, CPoint point); + void OnNcMouseLeave(); + void OnNcLButtonDblClk(UINT nHitTest, CPoint point); + void OnNcLButtonDown(UINT nHitTest, CPoint point); + void OnNcLButtonUp(UINT nHitTest, CPoint point); + void OnNcRButtonDown(UINT nHitTest, CPoint point); + void OnNcRButtonUp(UINT nHitTest, CPoint point); + +private: + float PointToPixelF(float point) const { return point * m_dpi / 72.f; } + int PointToPixel(float point) const { return static_cast(point * m_dpi / 72.f); } + + void ShowSysMenu(CPoint point); + COLORREF GetIntermediateColor(COLORREF a, COLORREF b, float ratio); + + CWnd* m_pWnd; + CSize m_size; + CRect m_rc; + bool m_maximized; + bool m_bMouseTracking; + int m_nTrackingButton; + int m_dpi; + unsigned m_nHitTest; + float m_leftMargin; + float m_rightMargin; +}; diff --git a/Src/Win_VersionHelper.h b/Src/Win_VersionHelper.h index 6b31fc670b5..5e458b8b432 100644 --- a/Src/Win_VersionHelper.h +++ b/Src/Win_VersionHelper.h @@ -29,6 +29,12 @@ IsWinVer_OrGreater(WORD wVersion, WORD wBuildNumber = 0) return !!VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, dwlConditionMask); } +inline bool +IsWin10_OrGreater() +{ + return IsWinVer_OrGreater( 0x0a00, 10240 ); +} + inline bool IsWin11_OrGreater() { diff --git a/Src/resource.h b/Src/resource.h index 7d79dcc47e9..e52ef35ef45 100644 --- a/Src/resource.h +++ b/Src/resource.h @@ -1201,6 +1201,7 @@ #define ID_PLUGIN_ADD_UNPACKER 35740 #define ID_PLUGIN_ADD_PREDIFFER 35741 #define ID_PLUGIN_DUPLICATE 35742 +#define ID_VIEW_TAB_BAR_ON_TITLE_BAR 35743 #define IDS_SPLASH_GPLTEXT 38977 #define IDS_MESSAGEBOX_OK 39001 #define IDS_MESSAGEBOX_CANCEL 39002 diff --git a/Translations/WinMerge/Arabic.po b/Translations/WinMerge/Arabic.po index 02570941147..ae75e99780b 100644 --- a/Translations/WinMerge/Arabic.po +++ b/Translations/WinMerge/Arabic.po @@ -356,6 +356,15 @@ msgstr "خ&يارات..." msgid "&View" msgstr "&عرض" +msgid "Ta&b Bar" +msgstr "شريط الت&بويب" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "&شريط الأدوات" @@ -371,9 +380,6 @@ msgstr "&ضخم" msgid "&Status Bar" msgstr "شريط ال&حالة" -msgid "Ta&b Bar" -msgstr "شريط الت&بويب" - msgid "&Tools" msgstr "أ&دوات" diff --git a/Translations/WinMerge/Basque.po b/Translations/WinMerge/Basque.po index 088f057f455..8de619cf2d6 100644 --- a/Translations/WinMerge/Basque.po +++ b/Translations/WinMerge/Basque.po @@ -399,6 +399,16 @@ msgstr "&Aukerak..." msgid "&View" msgstr "&Ikusi" +#, c-format +msgid "Ta&b Bar" +msgstr "&Fitxa Barra" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Tre&snabarra" @@ -419,10 +429,6 @@ msgstr "" msgid "&Status Bar" msgstr "&Egoera Barra" -#, c-format -msgid "Ta&b Bar" -msgstr "&Fitxa Barra" - #, c-format msgid "&Tools" msgstr "&Tresnak" diff --git a/Translations/WinMerge/Brazilian.po b/Translations/WinMerge/Brazilian.po index ade151d3ac5..0f562714b1c 100644 --- a/Translations/WinMerge/Brazilian.po +++ b/Translations/WinMerge/Brazilian.po @@ -355,6 +355,15 @@ msgstr "&Opções..." msgid "&View" msgstr "&Visualizar" +msgid "Ta&b Bar" +msgstr "Ba&rra das Abas" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "&Barra de ferramentas" @@ -370,9 +379,6 @@ msgstr "&Enorme" msgid "&Status Bar" msgstr "&Barra de Status" -msgid "Ta&b Bar" -msgstr "Ba&rra das Abas" - msgid "&Tools" msgstr "&Ferramentas" diff --git a/Translations/WinMerge/Bulgarian.po b/Translations/WinMerge/Bulgarian.po index d034d44c7a0..9de1504b0b2 100644 --- a/Translations/WinMerge/Bulgarian.po +++ b/Translations/WinMerge/Bulgarian.po @@ -352,6 +352,15 @@ msgstr "&Настройки…" msgid "&View" msgstr "И&зглед" +msgid "Ta&b Bar" +msgstr "Лента с &раздели" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Лента с &инструменти" @@ -367,9 +376,6 @@ msgstr "&Огромен" msgid "&Status Bar" msgstr "&Лента за състоянието" -msgid "Ta&b Bar" -msgstr "Лента с &раздели" - msgid "&Tools" msgstr "&Инструменти" diff --git a/Translations/WinMerge/Catalan.po b/Translations/WinMerge/Catalan.po index f9a18fd3152..5b3f9e5f62a 100644 --- a/Translations/WinMerge/Catalan.po +++ b/Translations/WinMerge/Catalan.po @@ -397,6 +397,16 @@ msgstr "O&pcions..." msgid "&View" msgstr "&Visualització" +#, c-format +msgid "Ta&b Bar" +msgstr "Barra de ta&bulacions" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Barra d'ei&nes" @@ -417,10 +427,6 @@ msgstr "&Immensa" msgid "&Status Bar" msgstr "Barra d'est&at" -#, c-format -msgid "Ta&b Bar" -msgstr "Barra de ta&bulacions" - #, c-format msgid "&Tools" msgstr "&Eines" diff --git a/Translations/WinMerge/ChineseSimplified.po b/Translations/WinMerge/ChineseSimplified.po index 9336048479d..6b99ba3591f 100644 --- a/Translations/WinMerge/ChineseSimplified.po +++ b/Translations/WinMerge/ChineseSimplified.po @@ -359,6 +359,15 @@ msgstr "选项(&O)..." msgid "&View" msgstr "视图(&V)" +msgid "Ta&b Bar" +msgstr "标签栏(&B)" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "工具栏(&T)" @@ -374,9 +383,6 @@ msgstr "特大(&H)" msgid "&Status Bar" msgstr "状态栏(&S)" -msgid "Ta&b Bar" -msgstr "标签栏(&B)" - msgid "&Tools" msgstr "工具(&T)" diff --git a/Translations/WinMerge/ChineseTraditional.po b/Translations/WinMerge/ChineseTraditional.po index 0d0d332d813..774a838c2aa 100644 --- a/Translations/WinMerge/ChineseTraditional.po +++ b/Translations/WinMerge/ChineseTraditional.po @@ -397,6 +397,16 @@ msgstr "選項 (&O)..." msgid "&View" msgstr "檢視 (&V)" +#, c-format +msgid "Ta&b Bar" +msgstr "頁籤列 (&B)" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "工具列 (&T)" @@ -417,10 +427,6 @@ msgstr "超大圖示 (&H)" msgid "&Status Bar" msgstr "狀態列 (&S)" -#, c-format -msgid "Ta&b Bar" -msgstr "頁籤列 (&B)" - #, c-format msgid "&Tools" msgstr "工具 (&T)" diff --git a/Translations/WinMerge/Corsican.po b/Translations/WinMerge/Corsican.po index 5a6835e6ac8..95267b343d8 100644 --- a/Translations/WinMerge/Corsican.po +++ b/Translations/WinMerge/Corsican.po @@ -357,6 +357,15 @@ msgstr "&Ozzioni…" msgid "&View" msgstr "&Vista" +msgid "Ta&b Bar" +msgstr "Barra d’&unghjette" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "&Barra d’attrezzi" @@ -372,9 +381,6 @@ msgstr "&Tamanta" msgid "&Status Bar" msgstr "Barra di s&tatu" -msgid "Ta&b Bar" -msgstr "Barra d’&unghjette" - msgid "&Tools" msgstr "&Attrezzi" diff --git a/Translations/WinMerge/Croatian.po b/Translations/WinMerge/Croatian.po index 5e8926f12ae..d0adef18a81 100644 --- a/Translations/WinMerge/Croatian.po +++ b/Translations/WinMerge/Croatian.po @@ -396,6 +396,16 @@ msgstr "Pos&tavke..." msgid "&View" msgstr "&Izgled" +#, c-format +msgid "Ta&b Bar" +msgstr "Traka &oznaka panela" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Traka &alata" @@ -416,10 +426,6 @@ msgstr "" msgid "&Status Bar" msgstr "Traka &statusa" -#, c-format -msgid "Ta&b Bar" -msgstr "Traka &oznaka panela" - #, c-format msgid "&Tools" msgstr "&Alati" diff --git a/Translations/WinMerge/Czech.po b/Translations/WinMerge/Czech.po index ddd29b5fe9d..21c01edc9f2 100644 --- a/Translations/WinMerge/Czech.po +++ b/Translations/WinMerge/Czech.po @@ -396,6 +396,16 @@ msgstr "Možnost&i..." msgid "&View" msgstr "&Zobrazit" +#, c-format +msgid "Ta&b Bar" +msgstr "Panel &záložek" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Panel &nástrojů" @@ -416,10 +426,6 @@ msgstr "" msgid "&Status Bar" msgstr "&Stavový řádek" -#, c-format -msgid "Ta&b Bar" -msgstr "Panel &záložek" - #, c-format msgid "&Tools" msgstr "&Nástroje" diff --git a/Translations/WinMerge/Danish.po b/Translations/WinMerge/Danish.po index c3767f78990..40467b615cd 100644 --- a/Translations/WinMerge/Danish.po +++ b/Translations/WinMerge/Danish.po @@ -397,6 +397,16 @@ msgstr "I&ndstillinger..." msgid "&View" msgstr "&Vis" +#, c-format +msgid "Ta&b Bar" +msgstr "Fa&nelinje" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "&Værktøjslinje" @@ -417,10 +427,6 @@ msgstr "" msgid "&Status Bar" msgstr "S&tatuslinje" -#, c-format -msgid "Ta&b Bar" -msgstr "Fa&nelinje" - #, c-format msgid "&Tools" msgstr "Værk&tøjer" diff --git a/Translations/WinMerge/Dutch.po b/Translations/WinMerge/Dutch.po index 6d344c39fd9..303225e8cf9 100644 --- a/Translations/WinMerge/Dutch.po +++ b/Translations/WinMerge/Dutch.po @@ -355,6 +355,15 @@ msgstr "Opties..." msgid "&View" msgstr "Beeld" +msgid "Ta&b Bar" +msgstr "Tab-balk" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Werkbalk" @@ -370,9 +379,6 @@ msgstr "Enorm" msgid "&Status Bar" msgstr "Statusbalk" -msgid "Ta&b Bar" -msgstr "Tab-balk" - msgid "&Tools" msgstr "Gereedschap" diff --git a/Translations/WinMerge/English.pot b/Translations/WinMerge/English.pot index 47868720efd..3c0e6783dc5 100644 --- a/Translations/WinMerge/English.pot +++ b/Translations/WinMerge/English.pot @@ -349,6 +349,15 @@ msgstr "" msgid "&View" msgstr "" +msgid "Ta&b Bar" +msgstr "" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "" @@ -364,9 +373,6 @@ msgstr "" msgid "&Status Bar" msgstr "" -msgid "Ta&b Bar" -msgstr "" - msgid "&Tools" msgstr "" diff --git a/Translations/WinMerge/Finnish.po b/Translations/WinMerge/Finnish.po index 9fe42a8046d..a0c25f9b5d4 100644 --- a/Translations/WinMerge/Finnish.po +++ b/Translations/WinMerge/Finnish.po @@ -355,6 +355,15 @@ msgstr "Asetukset..." msgid "&View" msgstr "Näkymä" +msgid "Ta&b Bar" +msgstr "Välilehdet" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Työkalurivi" @@ -370,9 +379,6 @@ msgstr "&Valtava" msgid "&Status Bar" msgstr "Tilarivi" -msgid "Ta&b Bar" -msgstr "Välilehdet" - msgid "&Tools" msgstr "Työkalut" diff --git a/Translations/WinMerge/French.po b/Translations/WinMerge/French.po index 7c4d26ada6b..46deda59e75 100644 --- a/Translations/WinMerge/French.po +++ b/Translations/WinMerge/French.po @@ -404,6 +404,16 @@ msgstr "&Préférences..." msgid "&View" msgstr "&Affichage" +#, c-format +msgid "Ta&b Bar" +msgstr "Barre d'&onglets" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Barre d'ou&tils" @@ -424,10 +434,6 @@ msgstr "&Énorme" msgid "&Status Bar" msgstr "Barre d'&état" -#, c-format -msgid "Ta&b Bar" -msgstr "Barre d'&onglets" - #, c-format msgid "&Tools" msgstr "&Outils" diff --git a/Translations/WinMerge/Galician.po b/Translations/WinMerge/Galician.po index 79c2badee9c..fd97821d2b3 100644 --- a/Translations/WinMerge/Galician.po +++ b/Translations/WinMerge/Galician.po @@ -356,6 +356,15 @@ msgstr "&C&onfiguración..." msgid "&View" msgstr "&Ver" +msgid "Ta&b Bar" +msgstr "&Barra de pestanas" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Barra de ferramen&tas" @@ -371,9 +380,6 @@ msgstr "&Enorme" msgid "&Status Bar" msgstr "Barra de e&stado" -msgid "Ta&b Bar" -msgstr "&Barra de pestanas" - msgid "&Tools" msgstr "Ferramen&tas" diff --git a/Translations/WinMerge/German.po b/Translations/WinMerge/German.po index e2d9011a57d..392dd05a03c 100644 --- a/Translations/WinMerge/German.po +++ b/Translations/WinMerge/German.po @@ -399,6 +399,16 @@ msgstr "Einstellunge&n..." msgid "&View" msgstr "&Ansicht" +#, c-format +msgid "Ta&b Bar" +msgstr "Ta&b-Leiste" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "&Symbolleiste" @@ -419,10 +429,6 @@ msgstr "&Riesig" msgid "&Status Bar" msgstr "S&tatusleiste" -#, c-format -msgid "Ta&b Bar" -msgstr "Ta&b-Leiste" - #, c-format msgid "&Tools" msgstr "&Tools" diff --git a/Translations/WinMerge/Greek.po b/Translations/WinMerge/Greek.po index 2c1168d0a2b..640fa875aa1 100644 --- a/Translations/WinMerge/Greek.po +++ b/Translations/WinMerge/Greek.po @@ -395,6 +395,16 @@ msgstr "Επιλ&ογές..." msgid "&View" msgstr "Πρ&οβολή" +#, c-format +msgid "Ta&b Bar" +msgstr "Γραμμή Σε&λιδοδεικτών" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Γραμμή Ε&ργαλείων" @@ -415,10 +425,6 @@ msgstr "" msgid "&Status Bar" msgstr "Γραμμή &Καταστάσεως" -#, c-format -msgid "Ta&b Bar" -msgstr "Γραμμή Σε&λιδοδεικτών" - #, c-format msgid "&Tools" msgstr "Εργα&λεία" diff --git a/Translations/WinMerge/Hungarian.po b/Translations/WinMerge/Hungarian.po index 5ff05a54c90..1fc27cb97fb 100644 --- a/Translations/WinMerge/Hungarian.po +++ b/Translations/WinMerge/Hungarian.po @@ -398,6 +398,16 @@ msgstr "&Beállítások..." msgid "&View" msgstr "&Nézet" +#, c-format +msgid "Ta&b Bar" +msgstr "Fülsáv" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Eszköztár" @@ -418,10 +428,6 @@ msgstr "Hatalmas" msgid "&Status Bar" msgstr "&Állapotsor" -#, c-format -msgid "Ta&b Bar" -msgstr "Fülsáv" - #, c-format msgid "&Tools" msgstr "&Eszközök" diff --git a/Translations/WinMerge/Italian.po b/Translations/WinMerge/Italian.po index 0fbea2b7224..c0a78a09046 100644 --- a/Translations/WinMerge/Italian.po +++ b/Translations/WinMerge/Italian.po @@ -356,6 +356,15 @@ msgstr "Op&zioni..." msgid "&View" msgstr "&Visualizza" +msgid "Ta&b Bar" +msgstr "&Barra schede" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Barra s&trumenti" @@ -371,9 +380,6 @@ msgstr "&Gigantesca" msgid "&Status Bar" msgstr "&Barra stato" -msgid "Ta&b Bar" -msgstr "&Barra schede" - msgid "&Tools" msgstr "&Strumenti" diff --git a/Translations/WinMerge/Japanese.po b/Translations/WinMerge/Japanese.po index 0da49228bc0..50dd2afcc3a 100644 --- a/Translations/WinMerge/Japanese.po +++ b/Translations/WinMerge/Japanese.po @@ -10,7 +10,7 @@ msgstr "" "Project-Id-Version: WinMerge\n" "Report-Msgid-Bugs-To: https://bugs.winmerge.org/\n" "POT-Creation-Date: 2020-12-05 22:07+0000\n" -"PO-Revision-Date: 2024-09-28 15:38+0900\n" +"PO-Revision-Date: 2024-09-28 15:49+0900\n" "Last-Translator: Takashi Sawanaka \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -354,6 +354,15 @@ msgstr "設定(&O)..." msgid "&View" msgstr "表示(&V)" +msgid "Ta&b Bar" +msgstr "タブ バー(&B)" + +msgid "&View Tab Bar" +msgstr "タブ バーを表示(&V)" + +msgid "&On Title Bar" +msgstr "タイトルバー上に配置(&O)" + msgid "&Toolbar" msgstr "ツールバー(&T)" @@ -369,9 +378,6 @@ msgstr "特大(&H)" msgid "&Status Bar" msgstr "ステータス バー(&S)" -msgid "Ta&b Bar" -msgstr "タブ バー(&B)" - msgid "&Tools" msgstr "ツール(&T)" @@ -4306,60 +4312,72 @@ msgstr "行" msgid "Character" msgstr "文字" -msgid "\n" +msgid "" +"\n" "Previous Difference (Alt+Up)\n" "(Right Button+Wheel Up)\n" "(Alt+Wheel Up)" -msgstr "\n" +msgstr "" +"\n" "前の差異(&P)\tAlt+Up\n" "(Right Button+Wheel Up)\n" "(Alt+Wheel Up)" -msgid "\n" +msgid "" +"\n" "Next Difference (Alt+Down)\n" "(Right Button+Wheel Down)\n" "(Alt+Wheel Down)" -msgstr "\n" +msgstr "" +"\n" "次の差異 (Alt+Down)\n" "(Right Button+Wheel Down)\n" "(Alt+Wheel Down)" -msgid "\n" +msgid "" +"\n" "Copy to Right (Alt+Right)\n" "(Right Button+Wheel Right)\n" "(Alt+Wheel Right)\n" "(Alt+Shift+Wheel Down)" -msgstr "\n" +msgstr "" +"\n" "右側にコピー (Alt+Right)\n" "(Right Button+Wheel Right)\n" "(Alt+Wheel Right)\n" "(Alt+Shift+Wheel Down)" -msgid "\n" +msgid "" +"\n" "Copy to Left (Alt+Left)\n" "(Right Button+Wheel Left)\n" "(Alt+Wheel Left)\n" "(Alt+Shift+Wheel Up)" -msgstr "\n" +msgstr "" +"\n" "左側へコピー (Alt+Left)\n" "(Right Button+Wheel Left)\n" "(Alt+Wheel Left)\n" "(Alt+Shift+Wheel Up)" -msgid "\n" +msgid "" +"\n" "Copy to Right and Advance (Ctrl+Alt+Right)\n" "(Ctrl+Alt+Wheel Right)\n" "(Ctrl+Alt+Shift+Wheel Down)" -msgstr "\n" +msgstr "" +"\n" "右側へコピーし次へ (Ctrl+Alt+Right)\n" "(Ctrl+Alt+Wheel Right)\n" "(Ctrl+Alt+Shift+Wheel Down)" -msgid "\n" +msgid "" +"\n" "Copy to Left and Advance (Ctrl+Alt+Left)\n" "(Ctrl+Alt+Wheel Left)\n" "(Ctrl+Alt+Shift+Wheel Up)" -msgstr "\n" +msgstr "" +"\n" "左側へコピーし次へ (Ctrl+Alt+Left)\n" "(Ctrl+Alt+Wheel Left)\n" "(Ctrl+Alt+Shift+Wheel Up)" diff --git a/Translations/WinMerge/Korean.po b/Translations/WinMerge/Korean.po index ee87b4afbe4..e01a524247e 100644 --- a/Translations/WinMerge/Korean.po +++ b/Translations/WinMerge/Korean.po @@ -405,6 +405,16 @@ msgstr "옵션(&O)..." msgid "&View" msgstr "보기(&V)" +#, c-format +msgid "Ta&b Bar" +msgstr "탭 표시줄(&B)" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "도구 모음(&T)" @@ -425,10 +435,6 @@ msgstr "매우 크게(&H)" msgid "&Status Bar" msgstr "상태 표시줄(&S)" -#, c-format -msgid "Ta&b Bar" -msgstr "탭 표시줄(&B)" - #, c-format msgid "&Tools" msgstr "도구(&T)" diff --git a/Translations/WinMerge/Lithuanian.po b/Translations/WinMerge/Lithuanian.po index cdbbc697877..716e11372b4 100644 --- a/Translations/WinMerge/Lithuanian.po +++ b/Translations/WinMerge/Lithuanian.po @@ -355,6 +355,15 @@ msgstr "Nu&ostatos..." msgid "&View" msgstr "&Vaizdas" +msgid "Ta&b Bar" +msgstr "&Kortelių juosta" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Mygtukų juos&ta" @@ -370,9 +379,6 @@ msgstr "&Milžiniški mygtukai" msgid "&Status Bar" msgstr "Bū&senos juosta" -msgid "Ta&b Bar" -msgstr "&Kortelių juosta" - msgid "&Tools" msgstr "Į&rankiai" diff --git a/Translations/WinMerge/Norwegian.po b/Translations/WinMerge/Norwegian.po index 4e224222344..0e3b5d28995 100644 --- a/Translations/WinMerge/Norwegian.po +++ b/Translations/WinMerge/Norwegian.po @@ -354,6 +354,15 @@ msgstr "&Innstillinger..." msgid "&View" msgstr "&Vis" +msgid "Ta&b Bar" +msgstr "F&anelinje" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Verkt&øylinje" @@ -369,9 +378,6 @@ msgstr "" msgid "&Status Bar" msgstr "Stat&uslinje" -msgid "Ta&b Bar" -msgstr "F&anelinje" - msgid "&Tools" msgstr "&Verktøy" diff --git a/Translations/WinMerge/Persian.po b/Translations/WinMerge/Persian.po index f47a16c6d91..59c23f7f4d2 100644 --- a/Translations/WinMerge/Persian.po +++ b/Translations/WinMerge/Persian.po @@ -397,6 +397,16 @@ msgstr "&O خيارات ... " msgid "&View" msgstr "&V نما " +#, c-format +msgid "Ta&b Bar" +msgstr "&b ميله جهش " + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "&T ميله ابزار " @@ -417,10 +427,6 @@ msgstr "" msgid "&Status Bar" msgstr "&S ميله وضعيت " -#, c-format -msgid "Ta&b Bar" -msgstr "&b ميله جهش " - #, c-format msgid "&Tools" msgstr "&T ابزارها " diff --git a/Translations/WinMerge/Polish.po b/Translations/WinMerge/Polish.po index 4cd1eeff277..5de5896eedb 100644 --- a/Translations/WinMerge/Polish.po +++ b/Translations/WinMerge/Polish.po @@ -356,6 +356,15 @@ msgstr "Opcje..." msgid "&View" msgstr "Widok" +msgid "Ta&b Bar" +msgstr "Pasek kart" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Pasek narzędzi" @@ -371,9 +380,6 @@ msgstr "Ogromny" msgid "&Status Bar" msgstr "Pasek stanu" -msgid "Ta&b Bar" -msgstr "Pasek kart" - msgid "&Tools" msgstr "Narzędzia" diff --git a/Translations/WinMerge/Portuguese.po b/Translations/WinMerge/Portuguese.po index 7ad5d69ff34..94f68cd8a96 100644 --- a/Translations/WinMerge/Portuguese.po +++ b/Translations/WinMerge/Portuguese.po @@ -356,6 +356,15 @@ msgstr "&Opções..." msgid "&View" msgstr "&Ver" +msgid "Ta&b Bar" +msgstr "Barra de separadores" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "&Barra de ferramentas" @@ -371,9 +380,6 @@ msgstr "&Enorme" msgid "&Status Bar" msgstr "Barra de esta&do" -msgid "Ta&b Bar" -msgstr "Barra de separadores" - msgid "&Tools" msgstr "&Ferramentas" diff --git a/Translations/WinMerge/Romanian.po b/Translations/WinMerge/Romanian.po index cdd89dc27eb..560566a14f4 100644 --- a/Translations/WinMerge/Romanian.po +++ b/Translations/WinMerge/Romanian.po @@ -354,6 +354,15 @@ msgstr "&Opțiuni..." msgid "&View" msgstr "&Vizualizare" +msgid "Ta&b Bar" +msgstr "&Bara de file" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Bară de unel&te" @@ -369,9 +378,6 @@ msgstr "Uriaș" msgid "&Status Bar" msgstr "Bară de &stare" -msgid "Ta&b Bar" -msgstr "&Bara de file" - msgid "&Tools" msgstr "Unel&te" diff --git a/Translations/WinMerge/Russian.po b/Translations/WinMerge/Russian.po index 8ff7c89b650..82650edac0e 100644 --- a/Translations/WinMerge/Russian.po +++ b/Translations/WinMerge/Russian.po @@ -357,6 +357,15 @@ msgstr "&Настройки..." msgid "&View" msgstr "&Вид" +msgid "Ta&b Bar" +msgstr "Панель вкладок" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Па&нель инструментов" @@ -372,9 +381,6 @@ msgstr "&Огромные значки" msgid "&Status Bar" msgstr "&Строка состояния" -msgid "Ta&b Bar" -msgstr "Панель вкладок" - msgid "&Tools" msgstr "&Инструменты" diff --git a/Translations/WinMerge/Serbian.po b/Translations/WinMerge/Serbian.po index 5c26f3f4b23..2b8dd59ecee 100644 --- a/Translations/WinMerge/Serbian.po +++ b/Translations/WinMerge/Serbian.po @@ -394,6 +394,16 @@ msgstr "Изб&ор..." msgid "&View" msgstr "При&каз" +#, c-format +msgid "Ta&b Bar" +msgstr "Тра&ка језичака" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "&Трака алата" @@ -414,10 +424,6 @@ msgstr "" msgid "&Status Bar" msgstr "&Статусна трака" -#, c-format -msgid "Ta&b Bar" -msgstr "Тра&ка језичака" - #, c-format msgid "&Tools" msgstr "Алатке" diff --git a/Translations/WinMerge/Sinhala.po b/Translations/WinMerge/Sinhala.po index f6acf61ea73..dd8d1880f7a 100644 --- a/Translations/WinMerge/Sinhala.po +++ b/Translations/WinMerge/Sinhala.po @@ -396,6 +396,16 @@ msgstr "&විකල්පයන්..." msgid "&View" msgstr "&බැලීම" +#, c-format +msgid "Ta&b Bar" +msgstr "Ta&b Bar" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "මෙවලම් තීරය" @@ -416,10 +426,6 @@ msgstr "" msgid "&Status Bar" msgstr "&Status Bar" -#, c-format -msgid "Ta&b Bar" -msgstr "Ta&b Bar" - #, c-format msgid "&Tools" msgstr "මෙවලම්" diff --git a/Translations/WinMerge/Slovak.po b/Translations/WinMerge/Slovak.po index 2c65caa5152..fc3ded26e89 100644 --- a/Translations/WinMerge/Slovak.po +++ b/Translations/WinMerge/Slovak.po @@ -355,6 +355,15 @@ msgstr "&Nastavenia..." msgid "&View" msgstr "&Zobraziť" +msgid "Ta&b Bar" +msgstr "Lišta &záložiek" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Lišta &nástrojov" @@ -370,9 +379,6 @@ msgstr "&Obrovská" msgid "&Status Bar" msgstr "&Stavový riadok" -msgid "Ta&b Bar" -msgstr "Lišta &záložiek" - msgid "&Tools" msgstr "&Nástroje" diff --git a/Translations/WinMerge/Slovenian.po b/Translations/WinMerge/Slovenian.po index ea13c343e82..5d855bf6105 100644 --- a/Translations/WinMerge/Slovenian.po +++ b/Translations/WinMerge/Slovenian.po @@ -355,6 +355,15 @@ msgstr "&Možnosti..." msgid "&View" msgstr "&Prikaz" +msgid "Ta&b Bar" +msgstr "Ta&bulatorska vrstica" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "&Orodna vrstica" @@ -370,9 +379,6 @@ msgstr "O&gromne" msgid "&Status Bar" msgstr "&Statusna vrstica" -msgid "Ta&b Bar" -msgstr "Ta&bulatorska vrstica" - msgid "&Tools" msgstr "&Orodja" diff --git a/Translations/WinMerge/Spanish.po b/Translations/WinMerge/Spanish.po index fa2cc4bb54d..367cfbbd7cd 100644 --- a/Translations/WinMerge/Spanish.po +++ b/Translations/WinMerge/Spanish.po @@ -358,6 +358,15 @@ msgstr "C&onfiguración..." msgid "&View" msgstr "&Ver" +msgid "Ta&b Bar" +msgstr "&Barra de pestañas" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Barra de herramien&tas" @@ -373,9 +382,6 @@ msgstr "&Enorme" msgid "&Status Bar" msgstr "Barra de e&stado" -msgid "Ta&b Bar" -msgstr "&Barra de pestañas" - msgid "&Tools" msgstr "&Herramientas" diff --git a/Translations/WinMerge/Swedish.po b/Translations/WinMerge/Swedish.po index 46deeb0b35c..6721d090754 100644 --- a/Translations/WinMerge/Swedish.po +++ b/Translations/WinMerge/Swedish.po @@ -357,6 +357,15 @@ msgstr "Alternativ..." msgid "&View" msgstr "Visa" +msgid "Ta&b Bar" +msgstr "Flikrad" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "Verktygsrad" @@ -372,9 +381,6 @@ msgstr "Enorm" msgid "&Status Bar" msgstr "Statusfält" -msgid "Ta&b Bar" -msgstr "Flikrad" - msgid "&Tools" msgstr "Verktyg" diff --git a/Translations/WinMerge/Tamil.po b/Translations/WinMerge/Tamil.po index 05cd913fd42..3583b8d378c 100644 --- a/Translations/WinMerge/Tamil.po +++ b/Translations/WinMerge/Tamil.po @@ -353,6 +353,15 @@ msgstr "&விருப்பங்கள்..." msgid "&View" msgstr "&பார்வை" +msgid "Ta&b Bar" +msgstr "Ta&b Bar" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "&கருவிப்பட்டி" @@ -368,9 +377,6 @@ msgstr "&பெரிய" msgid "&Status Bar" msgstr "&நிலைப் பட்டி" -msgid "Ta&b Bar" -msgstr "Ta&b Bar" - msgid "&Tools" msgstr "&கருவிகள்" diff --git a/Translations/WinMerge/Turkish.po b/Translations/WinMerge/Turkish.po index a592fb86d03..b173bab071b 100644 --- a/Translations/WinMerge/Turkish.po +++ b/Translations/WinMerge/Turkish.po @@ -354,6 +354,15 @@ msgstr "&Ayarlar..." msgid "&View" msgstr "&Görünüm" +msgid "Ta&b Bar" +msgstr "&Sekme çubuğu" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + msgid "&Toolbar" msgstr "&Araç çubuğu" @@ -369,9 +378,6 @@ msgstr "Çok &büyük" msgid "&Status Bar" msgstr "&Durum çubuğu" -msgid "Ta&b Bar" -msgstr "&Sekme çubuğu" - msgid "&Tools" msgstr "&Araçlar" diff --git a/Translations/WinMerge/Ukrainian.po b/Translations/WinMerge/Ukrainian.po index 9fd205aebc5..16595948e35 100644 --- a/Translations/WinMerge/Ukrainian.po +++ b/Translations/WinMerge/Ukrainian.po @@ -380,6 +380,16 @@ msgstr "&Налаштування..." msgid "&View" msgstr "Ви&гляд" +#, c-format +msgid "Ta&b Bar" +msgstr "Панель &закладок" + +msgid "&View Tab Bar" +msgstr "" + +msgid "&On Title Bar" +msgstr "" + #, c-format msgid "&Toolbar" msgstr "Пан&ель інструментів" @@ -400,10 +410,6 @@ msgstr "&Величезні піктограми" msgid "&Status Bar" msgstr "Ря&док стану" -#, c-format -msgid "Ta&b Bar" -msgstr "Панель &закладок" - #, c-format msgid "&Tools" msgstr "&Сервіс"