diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-01 23:04:04 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-01 23:04:04 +0100 |
commit | c2efba6907fab934a04959b9bb644cf7141cc955 (patch) | |
tree | c047244f99870e44a7a5d7e733c2857434c03765 /src/T2DLL/T2DlgItemArrows.cpp | |
parent | 1eb8da84d77d0c865623421069ec38bfc7b0d461 (diff) | |
download | t2win-c2efba6907fab934a04959b9bb644cf7141cc955.tar.gz t2win-c2efba6907fab934a04959b9bb644cf7141cc955.zip |
matched T2DLL as well as i can
Diffstat (limited to 'src/T2DLL/T2DlgItemArrows.cpp')
-rw-r--r-- | src/T2DLL/T2DlgItemArrows.cpp | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/src/T2DLL/T2DlgItemArrows.cpp b/src/T2DLL/T2DlgItemArrows.cpp index 06cc7e8..a27fce6 100644 --- a/src/T2DLL/T2DlgItemArrows.cpp +++ b/src/T2DLL/T2DlgItemArrows.cpp @@ -18,34 +18,34 @@ T2DlgItemArrows::T2DlgItemArrows(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPal /*virtual*/ T2DlgItemArrows::~T2DlgItemArrows() { } -/*virtual*/ BOOL T2DlgItemArrows::Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId) { - CRect rectToUse = rect; - CRect imageRect; - T2BitImage *image = GetObjectImage(imageRect, "DLGITEM:Arrows"); - if (image) { - rectToUse.right = rectToUse.left + imageRect.Width(); - rectToUse.bottom = rectToUse.top + imageRect.Height(); +/*virtual*/ BOOL T2DlgItemArrows::Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId) { + CRect rect = inRect; + CRect theImageArea; + T2BitImage *theImage = GetObjectImage(theImageArea, "DLGITEM:Arrows"); + if (theImage) { + rect.right = rect.left + theImageArea.Width(); + rect.bottom = rect.top + theImageArea.Height(); } - return T2DlgItem::Create(windowName, style, rectToUse, parentWnd, nId); + return T2DlgItem::Create(windowName, style, rect, parentWnd, nId); } -/*virtual*/ void T2DlgItemArrows::OnT2DlgItemLButtonDown(UINT nFlags, CPoint pt) { - CRect clientRect; - GetClientRect(clientRect); +/*virtual*/ void T2DlgItemArrows::OnT2DlgItemLButtonDown(UINT inFlags, CPoint inPt) { + CRect rect; + GetClientRect(rect); CRect imageRect; if (GetObjectImage(imageRect, "DLGITEM:Arrows")) { CRect upRect = imageRect; - upRect.bottom = upRect.top + (imageRect.Height() / 2); - upRect.OffsetRect(-upRect.left + clientRect.left, -upRect.top + clientRect.top); + upRect.bottom = upRect.top + (upRect.Height() / 2); + upRect.OffsetRect(-upRect.left + rect.left, -upRect.top + rect.top); - CRect dnRect = imageRect; - dnRect.OffsetRect(-dnRect.left + clientRect.left, -dnRect.top + clientRect.top + upRect.Height() + 1); + CRect dnRect = upRect; + dnRect.OffsetRect(-dnRect.left + rect.left, -dnRect.top + rect.top + upRect.Height() + 1); - if (upRect.PtInRect(pt)) { + if (upRect.PtInRect(inPt)) { SetPattern(100); mMouseRect = upRect; - } else if (dnRect.PtInRect(pt)) { + } else if (dnRect.PtInRect(inPt)) { SetPattern(101); mMouseRect = dnRect; } @@ -90,25 +90,20 @@ T2DlgItemArrows::T2DlgItemArrows(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPal } /*virtual*/ BOOL T2DlgItemArrows::OnT2DlgItemEraseBkgnd(CDC* pDC) { - CRect clientRect; - GetClientRect(clientRect); + CRect theFrameRect; + GetClientRect(theFrameRect); int save = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); - CRect imageRect; - int pattern; - if (!m74) - pattern = 0; - else - pattern = GetPattern(); - T2BitImage *image = GetObjectImage(imageRect, "DLGITEM:Arrows", pattern); - - if (image) { - CRect drawRect = imageRect; - drawRect.OffsetRect(-drawRect.left + clientRect.left, -drawRect.top + clientRect.top); - image->CopyImage(pDC, imageRect, drawRect, 0, NULL); + CRect theImageArea; + T2BitImage *theImage = GetObjectImage(theImageArea, "DLGITEM:Arrows", !m74 ? 0 : GetPattern()); + + if (theImage) { + CRect drawRect = theImageArea; + drawRect.OffsetRect(-drawRect.left + theFrameRect.left, -drawRect.top + theFrameRect.top); + theImage->CopyImage(pDC, theImageArea, drawRect, 0, NULL); } pDC->RestoreDC(save); |