diff --git a/docs/Changelog.Rus.txt b/docs/Changelog.Rus.txt index 79ee3ee535..f75346ed36 100644 --- a/docs/Changelog.Rus.txt +++ b/docs/Changelog.Rus.txt @@ -20,6 +20,7 @@ MPCVideoDec Обновлены библиотеки: ffmpeg n7.1-dev-1688-ge0eff64ed1; + ResizableLib v1.5.3-8-g25a89da; vvdec v2.3.0-24-gad8f4bb. diff --git a/docs/Changelog.txt b/docs/Changelog.txt index aedc8b284f..8ad5fb8e9f 100644 --- a/docs/Changelog.txt +++ b/docs/Changelog.txt @@ -20,6 +20,7 @@ Updated Japanese translation (by tsubasanouta). Updated libraries: ffmpeg n7.1-dev-1688-ge0eff64ed1; + ResizableLib v1.5.3-8-g25a89da; vvdec v2.3.0-24-gad8f4bb. diff --git a/src/ExtLib/ui/ResizableLib/ResizableDialog.cpp b/src/ExtLib/ui/ResizableLib/ResizableDialog.cpp index 512f3156f9..7c95712be7 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableDialog.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableDialog.cpp @@ -5,7 +5,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -82,18 +82,19 @@ BOOL CResizableDialog::OnNcCreate(LPCREATESTRUCT lpCreateStruct) if (!CreateSizeGrip(!bChild)) return FALSE; + // Moved from behind if (!bChild) because user could resize the dialog smaller as in resource defined and that causes some static text to be clipped or disappear. + MakeResizable(lpCreateStruct); + if (!bChild) { // set the initial size as the min track size SetMinTrackSize(CSize(lpCreateStruct->cx, lpCreateStruct->cy)); } - - MakeResizable(lpCreateStruct); return TRUE; } -void CResizableDialog::OnDestroy() +void CResizableDialog::OnDestroy() { if (m_bEnableSaveRestore) SaveWindowRect(m_sSection, m_bRectOnly); @@ -106,10 +107,10 @@ void CResizableDialog::OnDestroy() __super::OnDestroy(); } -void CResizableDialog::OnSize(UINT nType, int cx, int cy) +void CResizableDialog::OnSize(UINT nType, int cx, int cy) { __super::OnSize(nType, cx, cy); - + if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW) return; // arrangement not needed @@ -123,7 +124,7 @@ void CResizableDialog::OnSize(UINT nType, int cx, int cy) ArrangeLayout(); } -void CResizableDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +void CResizableDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { MinMaxInfo(lpMMI); } @@ -141,7 +142,7 @@ void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly) LoadWindowRect(pszSection, bRectOnly); } -BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC) +BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC) { ClipChildren(pDC, FALSE); @@ -152,7 +153,7 @@ BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC) return bRet; } -LRESULT CResizableDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CResizableDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (message != WM_NCCALCSIZE || wParam == 0) return __super::WindowProc(message, wParam, lParam); diff --git a/src/ExtLib/ui/ResizableLib/ResizableDialog.h b/src/ExtLib/ui/ResizableLib/ResizableDialog.h index 153996790f..9173ce6a77 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableDialog.h +++ b/src/ExtLib/ui/ResizableLib/ResizableDialog.h @@ -12,7 +12,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 diff --git a/src/ExtLib/ui/ResizableLib/ResizableGrip.cpp b/src/ExtLib/ui/ResizableLib/ResizableGrip.cpp index e823a9460b..0071fdb737 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableGrip.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableGrip.cpp @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -61,7 +61,7 @@ void CResizableGrip::UpdateSizeGrip() | (IsSizeGripVisible() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW)); } -// pbStatus points to a variable, maintained by the caller, that +// pStatus points to a variable, maintained by the caller, that // holds its visibility status. Initialize the variable with 1 // to allow to temporarily hide the grip, 0 to allow to // temporarily show the grip (with respect to the dwMask bit). @@ -235,10 +235,8 @@ LRESULT CResizableGrip::CSizeGrip::WindowProc(UINT message, BeginPaint(&ps) : CDC::FromHandle((HDC)wParam); // select bitmaps - CBitmap *pOldGrip, *pOldMask; - - pOldGrip = m_dcGrip.SelectObject(&m_bmGrip); - pOldMask = m_dcMask.SelectObject(&m_bmMask); + CBitmap *pOldGrip = m_dcGrip.SelectObject(&m_bmGrip); + CBitmap *pOldMask = m_dcMask.SelectObject(&m_bmMask); // obtain original grip bitmap, make the mask and prepare masked bitmap CScrollBar::WindowProc(message, (WPARAM)m_dcGrip.GetSafeHdc(), lParam); diff --git a/src/ExtLib/ui/ResizableLib/ResizableGrip.h b/src/ExtLib/ui/ResizableLib/ResizableGrip.h index bfbb336eda..f0ae37da2a 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableGrip.h +++ b/src/ExtLib/ui/ResizableLib/ResizableGrip.h @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 diff --git a/src/ExtLib/ui/ResizableLib/ResizableLayout.cpp b/src/ExtLib/ui/ResizableLib/ResizableLayout.cpp index 826d22015b..3d1b7dcbf1 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableLayout.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableLayout.cpp @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -28,6 +28,19 @@ static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif +/*! + * Definition of the standard anchors + */ +const ANCHOR TOP_LEFT(0, 0); +const ANCHOR TOP_CENTER(50, 0); +const ANCHOR TOP_RIGHT(100, 0); +const ANCHOR MIDDLE_LEFT(0, 50); +const ANCHOR MIDDLE_CENTER(50, 50); +const ANCHOR MIDDLE_RIGHT(100, 50); +const ANCHOR BOTTOM_LEFT(0, 100); +const ANCHOR BOTTOM_CENTER(50, 100); +const ANCHOR BOTTOM_RIGHT(100, 100); + /*! * @internal Constant used to detect clipping and refresh properties * @@ -75,18 +88,13 @@ void CResizableLayout::AddAnchor(HWND hWnd, ANCHOR anchorTopLeft, ANCHOR anchorB // adjust position, if client area has been scrolled rectChild.OffsetRect(-rectParent.TopLeft()); - // go calculate margins - CSize marginTopLeft, marginBottomRight; - // calculate margin for the top-left corner - - marginTopLeft.cx = rectChild.left - rectParent.Width() * anchorTopLeft.cx / 100; - marginTopLeft.cy = rectChild.top - rectParent.Height() * anchorTopLeft.cy / 100; + CSize marginTopLeft(rectChild.left - rectParent.Width() * anchorTopLeft.cx / 100, + rectChild.top - rectParent.Height() * anchorTopLeft.cy / 100); // calculate margin for the bottom-right corner - - marginBottomRight.cx = rectChild.right - rectParent.Width() * anchorBottomRight.cx / 100; - marginBottomRight.cy = rectChild.bottom - rectParent.Height() * anchorBottomRight.cy / 100; + CSize marginBottomRight(rectChild.right - rectParent.Width() * anchorBottomRight.cx / 100, + rectChild.bottom - rectParent.Height() * anchorBottomRight.cy / 100); // prepare the structure LAYOUTINFO layout(hWnd, anchorTopLeft, marginTopLeft, @@ -128,19 +136,29 @@ void CResizableLayout::AddAllOtherAnchors(ANCHOR anchorTopLeft, ANCHOR anchorBot ASSERT(::IsWindow(hParent)); HWND hWnd = ::GetWindow(hParent, GW_CHILD); - while (hWnd != NULL) + for (; hWnd != NULL; hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT)) { + TCHAR szClassName[32]; + if (::GetClassName(hWnd, szClassName, _countof(szClassName))) + { + if (lstrcmp(szClassName, WC_SCROLLBAR) == 0) + { + // skip size grip (which is handled on its own) + DWORD dwStyle = ::GetWindowLong(hWnd, GWL_STYLE); + if ((dwStyle & (WS_CHILD | WS_CLIPSIBLINGS | SBS_SIZEGRIP)) == (WS_CHILD | WS_CLIPSIBLINGS | SBS_SIZEGRIP)) + continue; + } + } + POSITION pos; if (!m_mapLayout.Lookup(hWnd, pos)) AddAnchor(hWnd, anchorTopLeft, anchorBottomRight); - - hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT); } } /*! * This function adds a placeholder to the layout manager, that will be - * dinamically set by a callback function whenever required. + * dynamically set by a callback function whenever required. * * @return The return value is an integer used to distinguish between * different placeholders in the callback implementation. @@ -196,7 +214,7 @@ BOOL CResizableLayout::ArrangeLayoutCallback(LAYOUTINFO& layout) const * controls layout should be updated, usually after a resize operation. * * @remarks All the controls added to the layout are moved and resized at - * once for performace reasons, so all the controls are in their + * once for performance reasons, so all the controls are in their * old position when AddAnchorCallback is called. * To know where a control will be placed use GetAnchorPosition. * @@ -204,14 +222,12 @@ BOOL CResizableLayout::ArrangeLayoutCallback(LAYOUTINFO& layout) const */ void CResizableLayout::ArrangeLayout() const { - // common vars - UINT uFlags; - CRect rectParent, rectChild; const INT_PTR count = m_listLayout.GetCount() + m_listLayoutCB.GetCount(); - if (count <= 0) return; + CRect rectParent, rectChild; + // get parent window's rect GetTotalClientRect(&rectParent); @@ -223,6 +239,7 @@ void CResizableLayout::ArrangeLayout() const // get layout info const LAYOUTINFO layout = m_listLayout.GetNext(pos); + UINT uFlags; // calculate new child's position, size and flags for SetWindowPos CalcNewChildPosition(layout, rectParent, rectChild, &uFlags); @@ -245,6 +262,7 @@ void CResizableLayout::ArrangeLayout() const if (!ArrangeLayoutCallback(layout)) continue; + UINT uFlags; // calculate new child's position, size and flags for SetWindowPos CalcNewChildPosition(layout, rectParent, rectChild, &uFlags); @@ -345,7 +363,7 @@ void CResizableLayout::GetClippingRegion(CRgn* pRegion) const if (::IsWindowVisible(layout.hWnd)) ClipChildWindow(layout, pRegion); } - + for (POSITION pos = m_listLayoutCB.GetHeadPosition(); pos != NULL;) { // get layout info @@ -379,7 +397,7 @@ inline CWnd* GetRootParentWnd(CWnd* pWnd) * area to avoid flickering. * * @param pDC Pointer to the target device context - * @param bUndo Flag that specifies wether to restore the clipping region + * @param bUndo Flag that specifies whether to restore the clipping region * * @return The return value is @c TRUE if the clipping region has been * modified, @c FALSE otherwise @@ -594,7 +612,7 @@ BOOL CResizableLayout::LikesClipping(const LAYOUTINFO& layout) const return clipping.bLikesClipping; } - LONG_PTR style = ::GetWindowLongPtr(layout.hWnd, GWL_STYLE); + const LONG_PTR style = ::GetWindowLongPtr(layout.hWnd, GWL_STYLE); // skip windows that wants background repainted if (0 == lstrcmp(layout.sWndClass, WC_BUTTON)) @@ -684,7 +702,8 @@ void CResizableLayout::CalcNewChildPosition(const LAYOUTINFO& layout, NeedsRefresh(layout, rectChild, rectNew) : layout.properties.bCachedNeedsRefresh; // set flags - if (lpFlags) { + if (lpFlags) + { *lpFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION; if (bRefresh) *lpFlags |= SWP_NOCOPYBITS; @@ -721,10 +740,10 @@ BOOL CResizableLayout::GetAnchorMargins(HWND hWnd, const CSize &sizeChild, CRect const LAYOUTINFO& layout = m_listLayout.GetAt(pos); // augmented size, relative to anchor points - CSize size = sizeChild + layout.marginTopLeft - layout.marginBottomRight; + const CSize size = sizeChild + layout.marginTopLeft - layout.marginBottomRight; // percent of parent size occupied by this control - CSize percent(layout.anchorBottomRight.cx - layout.anchorTopLeft.cx, + const CSize percent(layout.anchorBottomRight.cx - layout.anchorTopLeft.cx, layout.anchorBottomRight.cy - layout.anchorTopLeft.cy); // calculate total margins @@ -755,10 +774,10 @@ BOOL CResizableLayout::GetAnchorMargins(HWND hWnd, const CSize &sizeChild, CRect * @c LikesClipping only once, and the @a refresh property as * dynamic, causing @c NeedsRefresh to be called every time. * @n This should be right for most situations, as the need for - * @a refresh usually depends on the size fo a control, while the + * @a refresh usually depends on the size of the control, while the * support for @a clipping is usually linked to the specific type * of control, which is unlikely to change at run-time, but you can - * still override this function if a different beahvior is needed. + * still override this function if a different behaviour is needed. * * @sa LikesClipping NeedsRefresh LAYOUTINFO RESIZEPROPERTIES */ @@ -827,7 +846,7 @@ void CResizableLayout::MakeResizable(LPCREATESTRUCT lpCreateStruct) const * This function should be called inside the parent window @c WM_NCCALCSIZE * message handler to help eliminate flickering. * - * @param bAfterDefault Flag that specifies wether the call is made before + * @param bAfterDefault Flag that specifies whether the call is made before * or after the default handler * @param lpncsp Pointer to the @c NCCALCSIZE_PARAMS structure that is * passed to the message handler diff --git a/src/ExtLib/ui/ResizableLib/ResizableLayout.h b/src/ExtLib/ui/ResizableLib/ResizableLayout.h index 6d2302d553..3ebb452063 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableLayout.h +++ b/src/ExtLib/ui/ResizableLib/ResizableLayout.h @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -54,27 +54,27 @@ typedef struct tagANCHOR } ANCHOR, *PANCHOR, *LPANCHOR; /*! @defgroup ConstAnchors Alignment Constants - * Define common layout alignment constants for anchor points. + * Declare common layout alignment constants for anchor points. * @{ */ //! Anchor to the top-left corner - inline const ANCHOR TOP_LEFT(0, 0); + extern const ANCHOR TOP_LEFT; //! Anchor to the top edge and center horizontally - inline const ANCHOR TOP_CENTER(50, 0); + extern const ANCHOR TOP_CENTER; //! Anchor to the top-right corner - inline const ANCHOR TOP_RIGHT(100, 0); + extern const ANCHOR TOP_RIGHT; //! Anchor to the left edge and center vertically - inline const ANCHOR MIDDLE_LEFT(0, 50); + extern const ANCHOR MIDDLE_LEFT; //! Anchor to the center - inline const ANCHOR MIDDLE_CENTER(50, 50); + extern const ANCHOR MIDDLE_CENTER; //! Anchor to the right edge and center vertically - inline const ANCHOR MIDDLE_RIGHT(100, 50); + extern const ANCHOR MIDDLE_RIGHT; //! Anchor to the bottom-left corner - inline const ANCHOR BOTTOM_LEFT(0, 100); + extern const ANCHOR BOTTOM_LEFT; //! Anchor to the bottom edge and center horizontally - inline const ANCHOR BOTTOM_CENTER(50, 100); + extern const ANCHOR BOTTOM_CENTER; //! Anchor to the bottom-right corner - inline const ANCHOR BOTTOM_RIGHT(100, 100); + extern const ANCHOR BOTTOM_RIGHT; // @} //! @brief Holds a control layout settings diff --git a/src/ExtLib/ui/ResizableLib/ResizableMinMax.cpp b/src/ExtLib/ui/ResizableLib/ResizableMinMax.cpp index 4001fa436a..59e3ea3778 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableMinMax.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableMinMax.cpp @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 diff --git a/src/ExtLib/ui/ResizableLib/ResizableMinMax.h b/src/ExtLib/ui/ResizableLib/ResizableMinMax.h index 31cc578bfa..74f7a59917 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableMinMax.h +++ b/src/ExtLib/ui/ResizableLib/ResizableMinMax.h @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 diff --git a/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.cpp b/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.cpp index 3426a4ba08..832cb6e9ad 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.cpp @@ -5,7 +5,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -27,7 +27,7 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // Registered message to communicate with the library -// static intializer must be called before user code +// static initializer must be called before user code #pragma warning(disable:4073) #pragma init_seg(lib) diff --git a/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.h b/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.h index ef21720457..009f35b4f5 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.h +++ b/src/ExtLib/ui/ResizableLib/ResizableMsgSupport.h @@ -5,7 +5,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -24,7 +24,7 @@ typedef struct tagRESIZEPROPERTIES { - // wether to ask for resizing properties every time + // whether to ask for resizing properties every time BOOL bAskClipping; BOOL bAskRefresh; // otherwise, use the cached properties diff --git a/src/ExtLib/ui/ResizableLib/ResizablePage.cpp b/src/ExtLib/ui/ResizableLib/ResizablePage.cpp index e2c8620aa6..9fd5932ee1 100644 --- a/src/ExtLib/ui/ResizableLib/ResizablePage.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizablePage.cpp @@ -5,7 +5,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -61,14 +61,14 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CResizablePage message handlers -void CResizablePage::OnSize(UINT nType, int cx, int cy) +void CResizablePage::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); - + ArrangeLayout(); } -BOOL CResizablePage::OnEraseBkgnd(CDC* pDC) +BOOL CResizablePage::OnEraseBkgnd(CDC* pDC) { ClipChildren(pDC, FALSE); @@ -79,25 +79,25 @@ BOOL CResizablePage::OnEraseBkgnd(CDC* pDC) return bRet; } -void CResizablePage::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +void CResizablePage::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { MinMaxInfo(lpMMI); } -BOOL CResizablePage::OnInitDialog() +BOOL CResizablePage::OnInitDialog() { CPropertyPage::OnInitDialog(); - + // set the initial size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE } -void CResizablePage::OnDestroy() +void CResizablePage::OnDestroy() { // remove child windows RemoveAllAnchors(); @@ -106,7 +106,7 @@ void CResizablePage::OnDestroy() CPropertyPage::OnDestroy(); } -LRESULT CResizablePage::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CResizablePage::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (message != WM_NCCALCSIZE || wParam == 0) return CPropertyPage::WindowProc(message, wParam, lParam); diff --git a/src/ExtLib/ui/ResizableLib/ResizablePage.h b/src/ExtLib/ui/ResizableLib/ResizablePage.h index 359ee8b3ad..e2133b2ef7 100644 --- a/src/ExtLib/ui/ResizableLib/ResizablePage.h +++ b/src/ExtLib/ui/ResizableLib/ResizablePage.h @@ -12,7 +12,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -40,15 +40,14 @@ class CResizablePage : public CPropertyPage, public CResizableLayout, explicit CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0); // Attributes -public: // Operations -public: // Overrides + virtual BOOL OnInitDialog(); // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CResizablePage) - protected: +protected: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); //}}AFX_VIRTUAL @@ -66,12 +65,10 @@ class CResizablePage : public CPropertyPage, public CResizableLayout, }; // Generated message map functions -protected: //{{AFX_MSG(CResizablePage) afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); - virtual BOOL OnInitDialog(); afx_msg void OnDestroy(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/src/ExtLib/ui/ResizableLib/ResizableSheet.cpp b/src/ExtLib/ui/ResizableLib/ResizableSheet.cpp index 7eccb329a5..d897101a60 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableSheet.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableSheet.cpp @@ -5,7 +5,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -50,13 +50,13 @@ CResizableSheet::CResizableSheet() } CResizableSheet::CResizableSheet(UINT nIDCaption, CWnd *pParentWnd, UINT iSelectPage) - : CPropertySheet(nIDCaption, pParentWnd, iSelectPage) + : CPropertySheet(nIDCaption, pParentWnd, iSelectPage) { PrivateConstruct(); } CResizableSheet::CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd, UINT iSelectPage) - : CPropertySheet(pszCaption, pParentWnd, iSelectPage) + : CPropertySheet(pszCaption, pParentWnd, iSelectPage) { PrivateConstruct(); } @@ -79,7 +79,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CResizableSheet message handlers -BOOL CResizableSheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct) +BOOL CResizableSheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct) { if (!CPropertySheet::OnNcCreate(lpCreateStruct)) return FALSE; @@ -93,11 +93,11 @@ BOOL CResizableSheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct) return FALSE; MakeResizable(lpCreateStruct); - + return TRUE; } -BOOL CResizableSheet::OnInitDialog() +BOOL CResizableSheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); @@ -108,7 +108,7 @@ BOOL CResizableSheet::OnInitDialog() return bResult; } -void CResizableSheet::OnDestroy() +void CResizableSheet::OnDestroy() { if (m_bEnableSaveRestore) { @@ -220,7 +220,7 @@ void CResizableSheet::PresetLayout() // grow tab to the available sheet space if (cyDiff > 0) rectSheet.bottom = rectPage.bottom + cyDiff; - + if (GetStyle() & WS_CHILD) GetTabControl()->MoveWindow(&rectSheet); @@ -263,15 +263,8 @@ BOOL CResizableSheet::ArrangeLayoutCallback(LAYOUTINFO &layout) const if (!GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage)) return FALSE; // no page yet - // temporarily resize the tab control to calc page size - CRect rectSave; - pTab->GetWindowRect(rectSave); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectSave, 2); - pTab->SetRedraw(FALSE); - pTab->MoveWindow(rectPage, FALSE); - pTab->AdjustRect(FALSE, &rectPage); - pTab->MoveWindow(rectSave, FALSE); - pTab->SetRedraw(TRUE); + // calculate page size/position from tab rect + AdjustTabRects(rectPage); // set margins layout.marginTopLeft = rectPage.TopLeft() - rectSheet.TopLeft(); @@ -286,10 +279,10 @@ BOOL CResizableSheet::ArrangeLayoutCallback(LAYOUTINFO &layout) const return TRUE; } -void CResizableSheet::OnSize(UINT nType, int cx, int cy) +void CResizableSheet::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); - + if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW) return; // arrangement not needed @@ -312,7 +305,7 @@ BOOL CResizableSheet::OnPageChanging(NMHDR* /*pNotifyStruct*/, LRESULT* /*pResul return FALSE; // continue routing } -BOOL CResizableSheet::OnEraseBkgnd(CDC* pDC) +BOOL CResizableSheet::OnEraseBkgnd(CDC* pDC) { ClipChildren(pDC, FALSE); @@ -334,9 +327,6 @@ BOOL CResizableSheet::CalcSizeExtra(HWND /*hWndChild*/, const CSize& sizeChild, if (!GetAnchorMargins(pTab->m_hWnd, sizeChild, rectMargins)) return FALSE; - // get margin caused by tabcontrol - CRect rectTabMargins(0,0,0,0); - // get tab position after resizing and calc page rect CRect rectPage, rectSheet; GetTotalClientRect(&rectSheet); @@ -344,49 +334,71 @@ BOOL CResizableSheet::CalcSizeExtra(HWND /*hWndChild*/, const CSize& sizeChild, if (!GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage)) return FALSE; // no page yet - // temporarily resize the tab control to calc page size - CRect rectSave; - pTab->GetWindowRect(rectSave); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectSave, 2); - pTab->SetRedraw(FALSE); - pTab->MoveWindow(rectPage, FALSE); - pTab->AdjustRect(TRUE, &rectTabMargins); - pTab->MoveWindow(rectSave, FALSE); - pTab->SetRedraw(TRUE); + // calculate tab margins + CRect rectTabMargins = AdjustTabRects(rectPage); // add non-client size - ::AdjustWindowRectEx(&rectTabMargins, GetStyle(), !(GetStyle() & WS_CHILD) && + const DWORD dwStyle = GetStyle(); + ::AdjustWindowRectEx(&rectTabMargins, dwStyle, !(dwStyle & WS_CHILD) && ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); - // compute extra size sizeExtra = rectMargins.TopLeft() + rectMargins.BottomRight() + rectTabMargins.Size(); return TRUE; } -void CResizableSheet::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +CRect CResizableSheet::AdjustTabRects(CRect &rectPage) const +{ + CTabCtrl* pTab = GetTabControl(); + CRect rectTabMargins; + if (m_rectLastPage == rectPage) + { + // use cached rects to avoid flickering while moving the window + rectPage = m_rectLastAjustedPage; + rectTabMargins = m_rectLastTabMargins; + } + else + { + m_rectLastPage = rectPage; + + // temporarily resize the tab control to calc page size + CRect rectSave; + pTab->GetWindowRect(rectSave); + ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectSave, 2); + pTab->SetRedraw(FALSE); + pTab->MoveWindow(rectPage, FALSE); + pTab->AdjustRect(FALSE, &rectPage); + pTab->AdjustRect(TRUE, &rectTabMargins); + pTab->MoveWindow(rectSave, FALSE); + pTab->SetRedraw(TRUE); + + m_rectLastAjustedPage = rectPage; + m_rectLastTabMargins = rectTabMargins; + } + return rectTabMargins; +} + +void CResizableSheet::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { MinMaxInfo(lpMMI); if (!GetTabControl()) return; - const int nCount = GetPageCount(); - for (int idx = 0; idx < nCount; ++idx) + int idx = GetPageCount(); + if (IsWizard()) // wizard mode { - if (IsWizard()) // wizard mode - { - // use pre-calculated margins - CRect rectExtra(-CPoint(m_sizePageTL), -CPoint(m_sizePageBR)); - // add non-client size - ::AdjustWindowRectEx(&rectExtra, GetStyle(), !(GetStyle() & WS_CHILD) && - ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); + CRect rectExtra(-CPoint(m_sizePageTL), -CPoint(m_sizePageBR)); + const DWORD dwStyle = GetStyle(); + ::AdjustWindowRectEx(&rectExtra, dwStyle, !(dwStyle & WS_CHILD) && + ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); + while (--idx >= 0) ChainMinMaxInfo(lpMMI, *GetPage(idx), rectExtra.Size()); - } - else // tab mode - { + } + else // tab mode + { + while (--idx >= 0) ChainMinMaxInfoCB(lpMMI, *GetPage(idx)); - } } } @@ -399,29 +411,29 @@ int CResizableSheet::GetMinWidth() int max = 0, min = rectSheet.Width(); // search for leftmost and rightmost button margins - for (int i = 0; i < 7; i++) + for (int i = 0; i < 7; ++i) { const CWnd* pWnd = GetDlgItem(_propButtons[i]); // exclude not present or hidden buttons - if (pWnd == NULL || !(pWnd->GetStyle() & WS_VISIBLE)) - continue; - - // left position is relative to the right border - // of the parent window (negative value) - pWnd->GetWindowRect(&rectWnd); - ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectWnd, 2); - const int left = rectSheet.right - rectWnd.left; - const int right = rectSheet.right - rectWnd.right; - - if (left > max) - max = left; - if (right < min) - min = right; + if (pWnd != NULL && (pWnd->GetStyle() & WS_VISIBLE)) + { + // left position is relative to the right border + // of the parent window (negative value) + pWnd->GetWindowRect(&rectWnd); + ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectWnd, 2); + const int left = rectSheet.right - rectWnd.left; + const int right = rectSheet.right - rectWnd.right; + + if (left > max) + max = left; + if (right < min) + min = right; + } } // sizing border width const int border = GetSystemMetrics(SM_CXSIZEFRAME); - + // compute total width return max + min + 2*border; } @@ -450,7 +462,7 @@ void CResizableSheet::RefreshLayout() SendMessage(WM_SIZE); } -LRESULT CResizableSheet::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CResizableSheet::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (message != WM_NCCALCSIZE || wParam == 0 || !m_bLayoutDone) return CPropertySheet::WindowProc(message, wParam, lParam); diff --git a/src/ExtLib/ui/ResizableLib/ResizableSheet.h b/src/ExtLib/ui/ResizableLib/ResizableSheet.h index 6638ab828b..faede2fb6e 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableSheet.h +++ b/src/ExtLib/ui/ResizableLib/ResizableSheet.h @@ -10,7 +10,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -59,18 +59,19 @@ class CResizableSheet : public CPropertySheet, public CResizableLayout, // internal status CString m_sSection; // section name (identifies a parent window) + // cached tab rects + mutable CRect m_rectLastPage, m_rectLastAjustedPage, m_rectLastTabMargins; + // Operations public: // Overrides + virtual BOOL OnInitDialog(); // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CResizableSheet) - public: - virtual BOOL OnInitDialog(); protected: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); //}}AFX_VIRTUAL - protected: // Implementation public: @@ -81,6 +82,7 @@ class CResizableSheet : public CPropertySheet, public CResizableLayout, void PrivateConstruct(); BOOL IsWizard() const; + CRect AdjustTabRects(CRect &rectPage) const; // callable from derived classes protected: diff --git a/src/ExtLib/ui/ResizableLib/ResizableSheetState.cpp b/src/ExtLib/ui/ResizableLib/ResizableSheetState.cpp index a1f566e836..ab9130cbb6 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableSheetState.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableSheetState.cpp @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -39,15 +39,15 @@ CResizableSheetState::~CResizableSheetState() // either in the registry or a private .INI file // depending on your application settings -#define ACTIVEPAGE_ENT _T("ActivePage") +#define ACTIVEPAGE_ENT _T("ActivePage") /*! * This function saves the current property sheet active page using the base * class persist method. * @sa CResizableState::WriteState - * + * * @param pszName String that identifies stored settings - * + * * @return Returns @a TRUE if successful, @a FALSE otherwise */ BOOL CResizableSheetState::SavePage(LPCTSTR pszName) @@ -59,10 +59,9 @@ BOOL CResizableSheetState::SavePage(LPCTSTR pszName) if (pSheet == NULL) return FALSE; - int page = pSheet->m_psh.nStartPage; const CTabCtrl *pTab = pSheet->GetTabControl(); - if (pTab != NULL) - page = pTab->GetCurSel(); + int page = (pTab != NULL) ? pTab->GetCurSel() : pSheet->m_psh.nStartPage; + if (page < 0) page = pSheet->m_psh.nStartPage; @@ -89,7 +88,7 @@ BOOL CResizableSheetState::LoadPage(LPCTSTR pszName) // MPC-BE custom code if (!ReadState(CString(pszName), ACTIVEPAGE_ENT, data)) return FALSE; - + CPropertySheet* pSheet = DYNAMIC_DOWNCAST(CPropertySheet, GetResizableWnd()); return (pSheet != NULL) && pSheet->SetActivePage(_ttoi(data)); diff --git a/src/ExtLib/ui/ResizableLib/ResizableSheetState.h b/src/ExtLib/ui/ResizableLib/ResizableSheetState.h index 3b391cc3e8..7abd41e864 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableSheetState.h +++ b/src/ExtLib/ui/ResizableLib/ResizableSheetState.h @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -38,14 +38,14 @@ * This class is used in the provided resizable counterparts of * the standard MFC property sheet classes. */ -class CResizableSheetState : public CResizableWndState +class CResizableSheetState : public CResizableWndState { protected: - //! @brief Load and set the active property page + //! @brief Load and set the active property page BOOL LoadPage(LPCTSTR pszName); - //! @brief Save the current active property page + //! @brief Save the current active property page BOOL SavePage(LPCTSTR pszName); //! @brief Override to provide the parent window diff --git a/src/ExtLib/ui/ResizableLib/ResizableState.cpp b/src/ExtLib/ui/ResizableLib/ResizableState.cpp index 84640ea261..ecf80382f5 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableState.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableState.cpp @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 diff --git a/src/ExtLib/ui/ResizableLib/ResizableState.h b/src/ExtLib/ui/ResizableLib/ResizableState.h index a022aca9d9..1546b0249c 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableState.h +++ b/src/ExtLib/ui/ResizableLib/ResizableState.h @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 diff --git a/src/ExtLib/ui/ResizableLib/ResizableVersion.cpp b/src/ExtLib/ui/ResizableLib/ResizableVersion.cpp index 969bcff39f..2f4d58f90b 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableVersion.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableVersion.cpp @@ -5,7 +5,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -21,7 +21,7 @@ ////////////////////////////////////////////////////////////////////// // Static initializer object (with macros to hide in ClassView) -// static intializer must be called before user code +// static initializer must be called before user code #pragma warning(disable:4073) #pragma init_seg(lib) @@ -52,6 +52,8 @@ static _VersionInitializer g_version; static DLLVERSIONINFO g_dviCommCtrls; static OSVERSIONINFOEX g_osviWindows; +#pragma warning(push) +#pragma warning(disable:4996) static void CheckOsVersion() { // Try calling GetVersionEx using the OSVERSIONINFOEX structure. @@ -59,7 +61,7 @@ static void CheckOsVersion() g_osviWindows.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if (GetVersionEx((LPOSVERSIONINFO)&g_osviWindows)) return; - + // If that fails, try using the OSVERSIONINFO structure. g_osviWindows.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (GetVersionEx((LPOSVERSIONINFO)&g_osviWindows)) @@ -72,6 +74,7 @@ static void CheckOsVersion() g_osviWindows.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS; g_osviWindows.szCSDVersion[0] = TEXT('\0'); } +#pragma warning(pop) static void CheckCommCtrlsVersion() { @@ -194,7 +197,7 @@ void InitThemeSettings() typedef BOOL (STDAPICALLTYPE * IS_APP_THEMED)(VOID); typedef DWORD (STDAPICALLTYPE * GET_THEME_APP_PROPERTIES)(VOID); - // check dll is in place, themes can't work without + // check DLL is in place, themes can't work without HMODULE hLib = GetModuleHandle(_T("uxtheme.dll")); if (hLib == NULL) return; diff --git a/src/ExtLib/ui/ResizableLib/ResizableVersion.h b/src/ExtLib/ui/ResizableLib/ResizableVersion.h index c5282dc374..1956871687 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableVersion.h +++ b/src/ExtLib/ui/ResizableLib/ResizableVersion.h @@ -5,7 +5,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 diff --git a/src/ExtLib/ui/ResizableLib/ResizableWndState.cpp b/src/ExtLib/ui/ResizableLib/ResizableWndState.cpp index 81f57e0b9b..30187bb96e 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableWndState.cpp +++ b/src/ExtLib/ui/ResizableLib/ResizableWndState.cpp @@ -3,7 +3,7 @@ // This file is part of ResizableLib // https://github.com/ppescher/resizablelib // -// Copyright (C) 2000-2015 by Paolo Messina +// Copyright (C) 2000-2024 by Paolo Messina // mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License 2.0 @@ -57,7 +57,8 @@ CResizableWndState::~CResizableWndState() */ BOOL CResizableWndState::SaveWindowRect(LPCTSTR pszName, BOOL bRectOnly) { - WINDOWPLACEMENT wp = {sizeof(WINDOWPLACEMENT)}; + WINDOWPLACEMENT wp; + wp.length = sizeof(WINDOWPLACEMENT); if (!GetResizableWnd()->GetWindowPlacement(&wp)) return FALSE; @@ -69,7 +70,7 @@ BOOL CResizableWndState::SaveWindowRect(LPCTSTR pszName, BOOL bRectOnly) if (bRectOnly) // save size/pos only (normal state) { data.Format(PLACEMENT_FMT, rc.left, rc.top, - rc.right, rc.bottom, SW_SHOWNORMAL, 0U, 0L, 0L); + rc.right, rc.bottom, (unsigned)SW_SHOWNORMAL, 0U, 0L, 0L); } else // save also min/max state { @@ -98,7 +99,8 @@ BOOL CResizableWndState::SaveWindowRect(LPCTSTR pszName, BOOL bRectOnly) BOOL CResizableWndState::LoadWindowRect(LPCTSTR pszName, BOOL bRectOnly) { CString data; - WINDOWPLACEMENT wp = {sizeof(WINDOWPLACEMENT)}; + WINDOWPLACEMENT wp; + wp.length = sizeof(WINDOWPLACEMENT); // MPC-BE custom code if (!ReadState(CString(pszName), PLACEMENT_ENT, data)) // never saved before diff --git a/src/ExtLib/ui/ResizableLib/ResizableWndState.h b/src/ExtLib/ui/ResizableLib/ResizableWndState.h index bfdd7ef1bf..e0985a609e 100644 --- a/src/ExtLib/ui/ResizableLib/ResizableWndState.h +++ b/src/ExtLib/ui/ResizableLib/ResizableWndState.h @@ -7,7 +7,7 @@ // http://www.geocities.com/ppescher - mailto:ppescher@hotmail.com // // The contents of this file are subject to the Artistic License (the "License"). -// You may not use this file except in compliance with the License. +// You may not use this file except in compliance with the License. // You may obtain a copy of the License at: // http://www.opensource.org/licenses/artistic-license.html //