summaryrefslogtreecommitdiff
path: root/src/T2GraphWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2GraphWindow.cpp')
-rw-r--r--src/T2GraphWindow.cpp144
1 files changed, 144 insertions, 0 deletions
diff --git a/src/T2GraphWindow.cpp b/src/T2GraphWindow.cpp
index 5e076b1..b1a8d14 100644
--- a/src/T2GraphWindow.cpp
+++ b/src/T2GraphWindow.cpp
@@ -1,2 +1,146 @@
+#include "GlobalFunc.h"
#include "T2GraphWindow.h"
+#include "T2HUnknown.h"
+#include "T2TowerDoc.h"
+#include "T2WorldDef.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#line 16
+IMPLEMENT_DYNCREATE(T2GraphWindow, CFrameWnd)
+
+T2GraphWindow::T2GraphWindow() {
+ mDocument = NULL;
+}
+
+T2GraphWindow::~T2GraphWindow() {
+}
+
+BEGIN_MESSAGE_MAP(T2GraphWindow, CFrameWnd)
+ ON_WM_ERASEBKGND()
+ ON_WM_HSCROLL()
+ ON_WM_SIZE()
+ ON_WM_QUERYNEWPALETTE()
+END_MESSAGE_MAP()
+
+BOOL T2GraphWindow::OnEraseBkgnd(CDC *pDC) {
+#pragma var_order(pen4, rect2, brush, i, pen2, save, pen3, font, newSave, newDC, x, y, pen1, clientRect, position, bitmap)
+ if (!mDocument || !mDocument->mWorldDef)
+ return CFrameWnd::OnQueryNewPalette();
+
+ int save = pDC->SaveDC();
+ pDC->SelectPalette(mDocument->mWorldDef->GetPalette(), false);
+ pDC->RealizePalette();
+
+ CDC newDC;
+ newDC.CreateCompatibleDC(pDC);
+ int newSave = newDC.SaveDC();
+ newDC.SelectPalette(mDocument->mWorldDef->GetPalette(), false);
+ newDC.RealizePalette();
+
+ CRect clientRect;
+ GetClientRect(clientRect);
+
+ HBITMAP bitmap = Create256DIBitmap(newDC.m_hDC, clientRect.Width(), clientRect.Height());
+ SelectObject(newDC.m_hDC, bitmap);
+
+ CBrush brush;
+
+ brush.CreateSysColorBrush(COLOR_BTNFACE);
+ newDC.FillRect(clientRect, &brush);
+ brush.DeleteObject();
+
+ brush.CreateSolidBrush(PALETTERGB(255, 255, 255));
+
+ CRect rect2 = clientRect;
+ rect2.top += 16;
+ rect2.left += 1;
+ rect2.right -= 1;
+ rect2.bottom -= 1;
+ newDC.FillRect(rect2, &brush);
+
+ CPen pen1;
+ pen1.CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNHIGHLIGHT));
+
+ CPen pen2;
+ pen2.CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNSHADOW));
+
+ CPen pen3;
+ pen3.CreatePen(PS_SOLID, 0, PALETTERGB(0, 0, 0));
+
+ newDC.SelectObject(pen2);
+ newDC.MoveTo(0, 16);
+ newDC.LineTo(clientRect.right, 16);
+
+ newDC.SelectObject(pen3);
+ newDC.MoveTo(0, 17);
+ newDC.LineTo(clientRect.right, 17);
+
+ CFont font;
+ font.CreateFont(-12, 0, 0, 0, FW_NORMAL, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, DRAFT_QUALITY, DEFAULT_PITCH, "\x82\x6C\x82\x72 \x83\x53\x83\x56\x83\x62\x83\x4E");
+ newDC.SelectObject(font);
+ newDC.SetBkMode(TRANSPARENT);
+
+ newDC.Draw3dRect(10, 4, 28, 9, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT));
+ newDC.TextOut(39, 2, "\x8E\x91\x8B\xE0");
+
+ newDC.Draw3dRect(80, 4, 28, 9, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT));
+ newDC.TextOut(109, 2, "\x90\x6C\x8C\xFB");
+
+ CPen pen4;
+ pen4.CreatePen(PS_SOLID, 0, PALETTERGB(255, 0, 0));
+ newDC.SelectObject(pen4);
+
+ int position = mDocument->_170->GetFirst();
+ int x = mDocument->_170->GetLength() - 1;
+ int y;
+ int i = 0;
+ while (position >= 0) {
+ y = clientRect.bottom - 4 - (mDocument->_170->GetNext(position) / 1000);
+ if (i == 0)
+ newDC.MoveTo(x, y);
+ else
+ newDC.LineTo(x, y);
+ x--;
+ i++;
+ }
+
+ pDC->BitBlt(0, 0, clientRect.Width(), clientRect.Height(), &newDC, 0, 0, SRCCOPY);
+
+ newDC.RestoreDC(newSave);
+ newDC.DeleteDC();
+ DeleteObject(bitmap);
+
+ pDC->RestoreDC(save);
+
+ return true;
+}
+
+void T2GraphWindow::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar) {
+}
+
+void T2GraphWindow::OnSize(UINT nType, int cx, int cy) {
+ CFrameWnd::OnSize(nType, cx, cy);
+}
+
+BOOL T2GraphWindow::OnQueryNewPalette() {
+ if (!mDocument || !mDocument->mWorldDef)
+ return CFrameWnd::OnQueryNewPalette();
+
+ CDC *pDC = GetDC();
+ pDC->SaveDC();
+ pDC->SelectPalette(mDocument->mWorldDef->GetPalette(), false);
+ pDC->RealizePalette();
+ pDC->RestoreDC(-1);
+ ReleaseDC(pDC);
+
+ return true;
+}
+
+void T2GraphWindow::SetDocument(T2TowerDoc *inDoc) {
+ mDocument = inDoc;
+}