summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemArrows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2DlgItemArrows.cpp')
-rw-r--r--src/T2DLL/T2DlgItemArrows.cpp57
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);