From 6c6e60e8f81ec3f25b8ddcf1cff2e978165da34f Mon Sep 17 00:00:00 2001 From: fallenoak Date: Tue, 2 Dec 2025 22:51:57 -0600 Subject: [PATCH] feat(ui): implement CLayoutFrame::SetProtectFlag --- src/ui/CLayoutFrame.cpp | 24 ++++++++++++++++++++++-- src/ui/CLayoutFrame.hpp | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ui/CLayoutFrame.cpp b/src/ui/CLayoutFrame.cpp index 62a2572..d3de1ec 100644 --- a/src/ui/CLayoutFrame.cpp +++ b/src/ui/CLayoutFrame.cpp @@ -591,7 +591,7 @@ void CLayoutFrame::OnProtectedAttach(CLayoutFrame* frame) { frame->SetProtectFlag(0x400); } - if (this->m_flags & 0x300) { + if (this->m_flags & (0x100 | 0x200)) { frame->SetProtectFlag(0x200); } } @@ -821,7 +821,17 @@ void CLayoutFrame::SetPoint(FRAMEPOINT point, CLayoutFrame* relative, FRAMEPOINT } void CLayoutFrame::SetProtectFlag(uint32_t flag) { - // TODO + if (this->m_flags & (0x100 | 0x800)) { + return; + } + + this->m_flags &= ~0x200; + this->m_flags |= (flag & 0xF7FF | 0x800); + + // TODO this->PropagateProtectFlagToParent(flag); + this->Sub489190(flag); + + this->m_flags &= ~0x800; } void CLayoutFrame::SetWidth(float width) { @@ -876,6 +886,16 @@ int32_t CLayoutFrame::Sub488E40(const FRAMEPOINT* const pointarray, int32_t elem return 1; } +void CLayoutFrame::Sub489190(uint32_t flag) { + for (int32_t i = 0; i < FRAMEPOINT_NUMPOINTS; i++) { + auto point = this->m_points[i]; + + if (point && !(point->m_flags & 0x8)) { + point->m_relative->SetProtectFlag(flag); + } + } +} + float CLayoutFrame::Top() { if (this->m_guard.top) { return CFramePoint::UNDEFINED; diff --git a/src/ui/CLayoutFrame.hpp b/src/ui/CLayoutFrame.hpp index 5863eba..5e97ba6 100644 --- a/src/ui/CLayoutFrame.hpp +++ b/src/ui/CLayoutFrame.hpp @@ -86,6 +86,7 @@ class CLayoutFrame { void SetProtectFlag(uint32_t flag); int32_t Sub488DB0(const FRAMEPOINT* const pointarray, int32_t elements, float& x); int32_t Sub488E40(const FRAMEPOINT* const pointarray, int32_t elements, float& y); + void Sub489190(uint32_t flag); float Top(); void UnflattenFrame(CLayoutFrame* frame); void UnregisterResize(CLayoutFrame* frame, uint32_t dep);