summaryrefslogtreecommitdiff
path: root/src/T2NewDlg.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-07-05 19:04:06 +0100
committerAsh Wolf <ninji@wuffs.org>2023-07-05 19:04:06 +0100
commit5e61c1280c15ab9969b94cd360cafd4a11b2dd30 (patch)
tree1fdb60d771c4351b5aa5dcf1a43376c0558625a4 /src/T2NewDlg.cpp
parentc2efba6907fab934a04959b9bb644cf7141cc955 (diff)
downloadt2win-5e61c1280c15ab9969b94cd360cafd4a11b2dd30.tar.gz
t2win-5e61c1280c15ab9969b94cd360cafd4a11b2dd30.zip
matched T2.exe
Diffstat (limited to '')
-rw-r--r--src/T2NewDlg.cpp765
1 files changed, 765 insertions, 0 deletions
diff --git a/src/T2NewDlg.cpp b/src/T2NewDlg.cpp
index 3f8284d..c08afe1 100644
--- a/src/T2NewDlg.cpp
+++ b/src/T2NewDlg.cpp
@@ -1,2 +1,767 @@
+#include "GlobalFunc.h"
+#include "T2BitImage.h"
#include "T2NewDlg.h"
+#include "T2NewDlgTmp.h"
+#include "T2PluginLoader.h"
+#include "T2PluginSpecifier.h"
+#include "T2TowerDoc.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#line 20
+IMPLEMENT_DYNCREATE(T2NewDlg, CFrameWnd)
+
+T2NewDlg::T2NewDlg() {
+ HRSRC rsrc = FindResource(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(100), "PALETTE");
+ HGLOBAL theHandle = LoadResource(AfxGetApp()->m_hInstance, rsrc);
+ void *resData = LockResource(theHandle);
+
+ LOGPALETTE *theLogPalette = ConvACTPalette((ACTPALETTEENTRY *) resData);
+ mPalette.CreatePalette(theLogPalette);
+
+ int i;
+
+ mPal1 = (short *) malloc(sizeof(short) * 256);
+ for (i = 0; i < 256; i++)
+ mPal1[i] = i;
+
+ mPal2 = (short *) malloc(sizeof(short) * 256);
+ for (i = 0; i < 256; i++) {
+ int r = theLogPalette->palPalEntry[i].peRed;
+ int g = theLogPalette->palPalEntry[i].peGreen;
+ int b = theLogPalette->palPalEntry[i].peBlue;
+ int index = mPalette.GetNearestPaletteIndex(RGB(r, g, b));
+
+ if (theLogPalette->palPalEntry[index].peRed == 1 && theLogPalette->palPalEntry[index].peGreen == 1 && theLogPalette->palPalEntry[index].peBlue == 1)
+ index = 255;
+
+ mPal2[i] = index;
+ }
+
+ free(theLogPalette);
+
+ mBitmap.LoadBitmap(170);
+ mBrush.CreatePatternBrush(&mBitmap);
+
+ mPlugins = NULL;
+ mScrollOffset = 0;
+ mSelectedPlugin = 0;
+}
+
+/*virtual*/ T2NewDlg::~T2NewDlg() {
+ if (mPlugins) {
+ for (int i = 0; i < mPluginCount; i++) {
+ delete mPlugins[i].preview;
+ delete mPlugins[i].icon;
+ delete mPlugins[i].mStr8;
+ delete mPlugins[i].mStr18;
+ }
+ free(mPlugins);
+ }
+
+ free(mPal1);
+ free(mPal2);
+
+ mBrush.DeleteObject();
+ mBitmap.DeleteObject();
+}
+
+BEGIN_MESSAGE_MAP(T2NewDlg, CFrameWnd)
+ ON_WM_CLOSE()
+ ON_WM_TIMER()
+ ON_WM_CREATE()
+ ON_WM_QUERYNEWPALETTE()
+ ON_WM_ERASEBKGND()
+ ON_WM_KEYDOWN()
+ ON_COMMAND(IDOK, OnCommandOK)
+ ON_COMMAND(IDCANCEL, OnCommandCancel)
+ ON_COMMAND(106, OnCommand106)
+ ON_COMMAND(107, OnCommand107)
+END_MESSAGE_MAP()
+
+void T2NewDlg::Setup(T2TowerDoc *inDoc, T2PluginLoader *inPluginLoader, BOOL inShowCancelButton) {
+ mDocument = inDoc;
+ mPluginLoader = inPluginLoader;
+ mShowCancelButton = inShowCancelButton;
+
+ POSITION pos;
+ T2PluginSpecifier *specifier;
+
+ mPluginLoader->SetTypeFilter(pos, 'WdPl');
+ mPluginCount = 0;
+
+ while ((specifier = mPluginLoader->GetNext(pos)))
+ mPluginCount++;
+
+ mPlugins = (PluginRecord *) malloc(mPluginCount * sizeof(PluginRecord));
+
+ mPluginLoader->SetTypeFilter(pos, 'WdPl');
+ int index = 0;
+
+ while ((specifier = mPluginLoader->GetNext(pos))) {
+ mPluginLoader->LoadPlugin(specifier);
+
+#line 112
+ mPlugins[index].preview = new T2BitImage(specifier->mInstance, 20000, true);
+ mPlugins[index].icon = new T2BitImage(specifier->mInstance, 20001, true);
+ mPlugins[index].mStr8 = new CString(specifier->mPluginName);
+
+ char *buf = (char *) malloc(10000);
+ strcpy(buf, "NO TEXT");
+ LoadString(specifier->mInstance, 20000, buf, 10000);
+
+#line 118
+ mPlugins[index].mStr18 = new CString(strtok(buf, "|"));
+ mPlugins[index].mStrC = new CString(strtok(NULL, "\r\n"));
+ mPlugins[index].mStr10 = new CString(strtok(NULL, "\r\n"));
+
+ free(buf);
+
+ mPluginLoader->UnloadPlugin(specifier);
+ index++;
+ }
+
+ CRect rect;
+ SetRect(&rect, 100, 100, 300, 300);
+ Create("#32770", "\x8C\x9A\x90\xDD\x92\x6E\x91\x49\x91\xF0", WS_SYSMENU | WS_CAPTION | WS_CLIPCHILDREN | WS_POPUP, rect, AfxGetMainWnd(), NULL, WS_EX_DLGMODALFRAME);
+
+ SetTimer(1, 100, NULL);
+}
+
+/*virtual*/ BOOL T2NewDlg::PreCreateWindow(CREATESTRUCT &cs) {
+ return CFrameWnd::PreCreateWindow(cs);
+}
+
+T2PluginSpecifier *T2NewDlg::GetSelectedPlugin() {
+ POSITION pos;
+ T2PluginSpecifier *specifier;
+ int index = mSelectedPlugin;
+
+ mPluginLoader->SetTypeFilter(pos, 'WdPl');
+
+ while ((specifier = mPluginLoader->GetNext(pos))) {
+ if (index == 0)
+ break;
+ index--;
+ }
+
+ return specifier;
+}
+
+void T2NewDlg::OnClose() {
+ OnCommandCancel();
+}
+
+void T2NewDlg::OnTimer(UINT nIDEvent) {
+ if (nIDEvent == 1) {
+ KillTimer(1);
+ ShowWindow(SW_SHOW);
+
+ CWnd *mainWindow = AfxGetMainWnd();
+ if (mainWindow)
+ mainWindow->EnableWindow(false);
+
+ EnableWindow(true);
+ mButton1.SetFocus();
+ }
+}
+
+int T2NewDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) {
+#pragma var_order(rect2, rect1, rect6, size, rect3, rect5, logFont, newDlgTmp, rect4)
+ if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ T2NewDlgTmp newDlgTmp(this);
+ newDlgTmp.Create(166);
+
+ CRect rect1, rect2, rect3, rect4;
+ newDlgTmp.GetWindowRect(rect1);
+ newDlgTmp.mStatic.GetWindowRect(rect3);
+
+ CSize size;
+ size.cx = 468;
+ size.cy = 314;
+ rect1.right += (size.cx - rect3.Width());
+ rect1.bottom += (size.cy - rect3.Height());
+
+ GetDesktopWindow()->GetClientRect(rect2);
+ SetWindowPos(
+ NULL,
+ (rect2.Width() - rect1.Width()) / 2,
+ (rect2.Height() - rect1.Height()) / 2,
+ rect1.Width(),
+ rect1.Height(),
+ SWP_NOZORDER
+ );
+
+ LOGFONT logFont;
+ newDlgTmp.GetFont()->GetLogFont(&logFont);
+ mFont.CreateFontIndirectA(&logFont);
+ SetFont(&mFont);
+
+ GetClientRect(rect3);
+ newDlgTmp.GetClientRect(rect4);
+
+ CRect rect5, rect6;
+ if (mShowCancelButton) {
+ newDlgTmp.mOKButton.GetWindowRect(rect5);
+ newDlgTmp.ScreenToClient(rect5);
+ rect5.OffsetRect(rect3.right - rect4.right, rect3.bottom - rect4.bottom);
+ mButton1.Create("\x82\x6E\x82\x6A", BS_DEFPUSHBUTTON | WS_CHILD, rect5, this, IDOK);
+ mButton1.SetFont(&mFont);
+ mButton1.ShowWindow(SW_SHOW);
+
+ newDlgTmp.mCancelButton.GetWindowRect(rect5);
+ newDlgTmp.ScreenToClient(rect5);
+ rect5.OffsetRect(rect3.right - rect4.right, rect3.bottom - rect4.bottom);
+ mButton2.Create("\x8E\xE6\x8F\xC1\x82\xB5", WS_CHILD, rect5, this, IDCANCEL);
+ mButton2.SetFont(&mFont);
+ mButton2.ShowWindow(SW_SHOW);
+ } else {
+ newDlgTmp.mCancelButton.GetWindowRect(rect5);
+ newDlgTmp.ScreenToClient(rect5);
+ rect5.OffsetRect(rect3.right - rect4.right, rect3.bottom - rect4.bottom);
+ mButton1.Create("\x82\x6E\x82\x6A", BS_DEFPUSHBUTTON | WS_CHILD, rect5, this, IDOK);
+ mButton1.SetFont(&mFont);
+ mButton1.ShowWindow(SW_SHOW);
+ }
+
+ newDlgTmp.mStatic.GetWindowRect(rect5);
+ newDlgTmp.ScreenToClient(rect5);
+
+ rect6 = rect5;
+
+ rect5.OffsetRect(rect3.right - rect4.right, rect3.bottom - rect4.bottom);
+ rect5.left = rect5.right - 18;
+ rect5.top = rect5.bottom - 68;
+
+ mButton4.Create(NULL, BS_ICON | WS_CHILD, rect5, this, 107);
+ mButton4.SetFont(&mFont);
+ mButton4.ShowWindow(SW_SHOW);
+ mButton4.SetIcon(AfxGetApp()->LoadIcon(169));
+
+ if (mPluginCount <= 6)
+ mButton4.EnableWindow(false);
+
+ mRect1.top = rect5.top;
+ mRect1.right = rect5.left;
+ mRect1.bottom = rect5.bottom;
+
+ mRect2.top = rect6.top;
+ mRect2.left = rect6.left;
+ mRect2.bottom = rect5.top - 15;
+ mRect2.right = rect5.right;
+
+ newDlgTmp.mStatic.GetWindowRect(rect5);
+ newDlgTmp.ScreenToClient(rect5);
+
+ rect6 = rect5;
+
+ rect5.OffsetRect(rect3.right - rect4.right, rect3.bottom - rect4.bottom);
+ rect5.top = rect5.bottom - 68;
+ rect5.left = rect6.left;
+ rect5.right = rect5.left + 18;
+
+ mButton3.Create(NULL, BS_ICON | WS_CHILD, rect5, this, 106);
+ mButton3.SetFont(&mFont);
+ mButton3.ShowWindow(SW_SHOW);
+ mButton3.SetIcon(AfxGetApp()->LoadIcon(168));
+
+ mButton3.EnableWindow(false);
+
+ mRect1.left = rect5.right;
+
+ GetClientRect(mRect3);
+
+ newDlgTmp.DestroyWindow();
+
+ return 0;
+}
+
+BOOL T2NewDlg::OnQueryNewPalette() {
+ CDC *pDC = GetDC();
+ int save = pDC->SaveDC();
+
+ pDC->SelectPalette(&mPalette, false);
+ pDC->RealizePalette();
+
+ pDC->RestoreDC(save);
+ ReleaseDC(pDC);
+ return true;
+}
+
+void T2NewDlg::OnCommandOK() {
+ mDocument->towerDoc_vfCC(GetSelectedPlugin(), false);
+ DestroyWindow();
+}
+
+void T2NewDlg::OnCommandCancel() {
+}
+
+void T2NewDlg::OnCommand106() {
+ GoLeft();
+}
+
+void T2NewDlg::OnCommand107() {
+ GoRight();
+}
+
+BOOL T2NewDlg::OnEraseBkgnd(CDC *pDC) {
+#pragma var_order(brush3, bitmap, newSave2, pen2, newSave, pen3, brush1, save, newDC, index, pen1, maxPlugin, brush2)
+ int save = pDC->SaveDC();
+ pDC->SelectPalette(&mPalette, false);
+ pDC->RealizePalette();
+
+ CBitmap bitmap;
+ bitmap.CreateCompatibleBitmap(pDC, mRect3.Width(), mRect3.Height());
+
+ CDC newDC;
+ newDC.CreateCompatibleDC(pDC);
+ int newSave = newDC.SaveDC();
+
+ newDC.SelectObject(bitmap);
+ newDC.SelectPalette(&mPalette, false);
+ newDC.RealizePalette();
+ newDC.SetStretchBltMode(COLORONCOLOR);
+
+ CBrush brush1, brush2, brush3;
+ brush1.CreateSysColorBrush(COLOR_BTNFACE);
+ brush2.CreateSolidBrush(PALETTERGB(255, 255, 255));
+ brush3.CreateSolidBrush(PALETTERGB(200, 0, 0));
+
+ CPen pen1, pen2, pen3;
+ pen1.CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNHIGHLIGHT));
+ pen2.CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNSHADOW));
+ pen3.CreatePen(PS_SOLID, 0, PALETTERGB(0, 0, 0));
+
+ newDC.FillRect(mRect3, &brush1);
+
+ newDC.SelectObject(brush2);
+ newDC.SelectObject(pen3);
+ newDC.Rectangle(mRect1.left + 1, mRect1.top + 1, mRect1.right - 1, mRect1.bottom - 1);
+
+ newDC.SelectObject(pen2);
+ newDC.MoveTo(mRect1.right - 1, mRect1.top);
+ newDC.LineTo(mRect1.left, mRect1.top);
+ newDC.LineTo(mRect1.left, mRect1.bottom);
+
+ newDC.SelectObject(pen1);
+ newDC.MoveTo(mRect1.left, mRect1.bottom - 1);
+ newDC.LineTo(mRect1.right - 1, mRect1.bottom - 1);
+ newDC.LineTo(mRect1.right - 1, mRect1.top);
+
+ int maxPlugin = min(mScrollOffset + 6, mPluginCount);
+ for (int index = mScrollOffset; index < maxPlugin; index++) {
+ int x = (index - mScrollOffset) * 70 + mRect1.left + 2;
+
+ CRect rect1;
+ rect1.SetRect(x, mRect1.top + 2, x + 70, mRect1.bottom - 2);
+
+ if (index == mSelectedPlugin) {
+ CRect rect2;
+ rect2.top = rect1.CenterPoint().y - mPlugins[index].icon->mBitmap.header.biHeight / 2;
+ rect2.left = rect1.CenterPoint().x - mPlugins[index].icon->mBitmap.header.biWidth / 2;
+ rect2.bottom = rect2.top + mPlugins[index].icon->mBitmap.header.biHeight;
+ rect2.right = rect2.left + mPlugins[index].icon->mBitmap.header.biWidth;
+
+ CRect rect3 = rect2;
+ rect3.top -= 2;
+ rect3.left -= 2;
+ rect3.bottom += 2;
+ rect3.right += 2;
+
+ newDC.FillRect(rect3, &brush3);
+
+ memcpy(&mPlugins[index].icon->mBitmap.palette, mPal1, sizeof(short) * 256);
+ StretchDIBits(
+ newDC.m_hDC,
+ rect2.left,
+ rect2.bottom - 1,
+ rect2.Width(),
+ -rect2.Height(),
+ 0,
+ 0,
+ mPlugins[index].icon->mBitmap.header.biWidth,
+ mPlugins[index].icon->mBitmap.header.biHeight,
+ mPlugins[index].icon->mData,
+ (const BITMAPINFO *) &mPlugins[index].icon->mBitmap,
+ DIB_PAL_COLORS,
+ SRCCOPY
+ );
+ } else {
+ CRect rect2;
+ rect2.top = rect1.CenterPoint().y - 25;
+ rect2.left = rect1.CenterPoint().x - 25;
+ rect2.bottom = rect2.top + 50;
+ rect2.right = rect2.left + 50;
+
+ memcpy(&mPlugins[index].icon->mBitmap.palette, mPal2, sizeof(short) * 256);
+
+ newDC.SelectObject(mBrush);
+ StretchDIBits(
+ newDC.m_hDC,
+ rect2.left,
+ rect2.bottom - 1,
+ rect2.Width(),
+ -rect2.Height(),
+ 0,
+ 0,
+ mPlugins[index].icon->mBitmap.header.biWidth,
+ mPlugins[index].icon->mBitmap.header.biHeight,
+ mPlugins[index].icon->mData,
+ (const BITMAPINFO *) &mPlugins[index].icon->mBitmap,
+ DIB_PAL_COLORS,
+ 0xCA0749
+ );
+ }
+ }
+
+ int newSave2 = newDC.SaveDC();
+ newDC.SetViewportOrg(mRect2.TopLeft());
+ newDC.SetViewportExt(mRect2.Width(), mRect2.Height());
+ DrawWorldPreview(&newDC);
+ newDC.RestoreDC(newSave2);
+
+ pDC->BitBlt(0, 0, mRect3.Width(), mRect3.Height(), &newDC, 0, 0, SRCCOPY);
+
+ newDC.RestoreDC(newSave);
+
+ pDC->RestoreDC(save);
+ return true;
+}
+
+void T2NewDlg::GoLeft() {
+#pragma var_order(bitmap, newSave, brush, save, newDC, i, left, pDC)
+ if (mSelectedPlugin <= 0)
+ return;
+
+ mSelectedPlugin--;
+ if (mSelectedPlugin < mScrollOffset)
+ mScrollOffset = mSelectedPlugin;
+
+ if (mSelectedPlugin == 0) {
+ mButton3.EnableWindow(false);
+ SetFocus();
+ } else {
+ mButton3.EnableWindow(true);
+ }
+
+ if (mSelectedPlugin < (mPluginCount - 1))
+ mButton4.EnableWindow(true);
+
+ InvalidateRect(mRect1);
+ UpdateWindow();
+
+ CDC *pDC = GetDC();
+ int save = pDC->SaveDC();
+
+ CBrush brush;
+ brush.CreateSysColorBrush(COLOR_BTNFACE);
+
+ CBitmap bitmap;
+ bitmap.CreateCompatibleBitmap(pDC, mRect3.Width(), mRect3.Height());
+
+ CDC newDC;
+ newDC.CreateCompatibleDC(pDC);
+ int newSave = newDC.SaveDC();
+
+ newDC.SelectObject(bitmap);
+ newDC.SelectPalette(&mPalette, false);
+ newDC.RealizePalette();
+ newDC.SetStretchBltMode(COLORONCOLOR);
+
+ DrawWorldPreview(&newDC);
+
+ int left = mRect2.left;
+ for (int i = 1; i <= 10; i++) {
+ int right = mRect2.left + ((mRect3.right - mRect2.left) * i) / 10;
+ pDC->BitBlt(right, mRect2.top, mRect2.Width(), mRect2.Height(), pDC, left, mRect2.top, SRCCOPY);
+
+ left = right;
+ pDC->BitBlt(mRect2.left, mRect2.top, right - mRect2.left, mRect2.Height(), &newDC, 0, 0, SRCCOPY);
+
+ if (right >= mRect2.right) {
+ CRect rect;
+ rect.SetRect(mRect2.right, mRect2.top, mRect3.right, mRect2.bottom);
+ pDC->FillRect(rect, &brush);
+ }
+
+ Sleep(30);
+ }
+
+ newDC.RestoreDC(newSave);
+
+ pDC->RestoreDC(save);
+ ReleaseDC(pDC);
+}
+
+void T2NewDlg::GoRight() {
+#pragma var_order(bitmap, newSave, brush, save, newDC, i, pDC)
+ if (mSelectedPlugin >= (mPluginCount - 1))
+ return;
+
+ mSelectedPlugin++;
+ if (mSelectedPlugin >= (mScrollOffset + 6))
+ mScrollOffset = mSelectedPlugin - 5;
+
+ if (mSelectedPlugin != 0)
+ mButton3.EnableWindow(true);
+
+ if (mSelectedPlugin < (mPluginCount - 1)) {
+ mButton4.EnableWindow(true);
+ } else {
+ mButton4.EnableWindow(false);
+ SetFocus();
+ }
+
+ InvalidateRect(mRect1);
+ UpdateWindow();
+
+ CDC *pDC = GetDC();
+ int save = pDC->SaveDC();
+
+ CBrush brush;
+ brush.CreateSysColorBrush(COLOR_BTNFACE);
+
+ CBitmap bitmap;
+ bitmap.CreateCompatibleBitmap(pDC, mRect3.Width(), mRect3.Height());
+
+ CDC newDC;
+ newDC.CreateCompatibleDC(pDC);
+ int newSave = newDC.SaveDC();
+
+ newDC.SelectObject(bitmap);
+ newDC.SelectPalette(&mPalette, false);
+ newDC.RealizePalette();
+ newDC.SetStretchBltMode(COLORONCOLOR);
+
+ DrawWorldPreview(&newDC);
+
+ for (int i = 1; i <= 10; i++) {
+ int x = mRect3.right - ((mRect3.right - mRect2.left) * i) / 10;
+ pDC->BitBlt(x, mRect2.top, mRect2.Width(), mRect2.Height(), &newDC, 0, 0, SRCCOPY);
+
+ x += mRect2.Width();
+
+ if (x < mRect3.right) {
+ CRect rect;
+ rect.SetRect(x, mRect2.top, mRect3.right, mRect2.bottom);
+ pDC->FillRect(rect, &brush);
+ }
+
+ Sleep(30);
+ }
+
+ newDC.RestoreDC(newSave);
+
+ pDC->RestoreDC(save);
+ ReleaseDC(pDC);
+}
+
+/*virtual*/ BOOL T2NewDlg::PreTranslateMessage(MSG *pMsg) {
+ if (pMsg->message == WM_KEYDOWN) {
+ BOOL shift = (GetAsyncKeyState(VK_SHIFT) < 0);
+ BOOL control = (GetAsyncKeyState(VK_CONTROL) < 0);
+
+ if (pMsg->wParam == VK_LEFT && !shift && !control) {
+ GoLeft();
+ return true;
+ }
+ if (pMsg->wParam == VK_RIGHT && !shift && !control) {
+ GoRight();
+ return true;
+ }
+ }
+
+ return CFrameWnd::PreTranslateMessage(pMsg);
+}
+
+void T2NewDlg::DrawWorldPreview(CDC *pDC) {
+#pragma var_order(pt2, clr1, str, brush3, rect1, pen2, clr2, rect3, pen3, brush1, font, previewWidth, rect2, clr3, save, x, previewHeight, pen4, pen1, pt, brush2)
+ CRect rect1 = mRect2;
+ rect1.OffsetRect(-rect1.left, -rect1.top);
+
+ int save = pDC->SaveDC();
+
+ CBrush brush1, brush2, brush3;
+ brush1.CreateSysColorBrush(COLOR_BTNFACE);
+ brush2.CreateSolidBrush(PALETTERGB(255, 255, 255));
+ brush3.CreateSolidBrush(PALETTERGB(200, 0, 0));
+
+ CPen pen1, pen2, pen3, pen4;
+ pen1.CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNHIGHLIGHT));
+ pen2.CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNSHADOW));
+ pen3.CreatePen(PS_SOLID, 0, PALETTERGB(0, 0, 0));
+ pen4.CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNTEXT));
+
+ COLORREF clr1 = GetSysColor(COLOR_BTNHIGHLIGHT);
+ COLORREF clr2 = GetSysColor(COLOR_BTNSHADOW);
+ COLORREF clr3 = GetSysColor(COLOR_BTNTEXT);
+
+ pDC->FillRect(rect1, &brush1);
+
+ pDC->SelectObject(pen1);
+
+ pDC->MoveTo(rect1.right - 1, rect1.top);
+ pDC->LineTo(rect1.left, rect1.top);
+ pDC->LineTo(rect1.left, rect1.bottom);
+
+ pDC->MoveTo(rect1.right - 1, rect1.top + 1);
+ pDC->LineTo(rect1.left + 1, rect1.top + 1);
+ pDC->LineTo(rect1.left + 1, rect1.bottom);
+
+ pDC->SelectObject(pen2);
+
+ pDC->MoveTo(rect1.right - 1, rect1.top + 1);
+ pDC->LineTo(rect1.right - 1, rect1.bottom - 1);
+ pDC->LineTo(rect1.left - 1, rect1.bottom - 1);
+
+ pDC->MoveTo(rect1.right - 2, rect1.top + 2);
+ pDC->LineTo(rect1.right - 2, rect1.bottom - 2);
+ pDC->LineTo(rect1.left, rect1.bottom - 2);
+
+ CRect rect2;
+ int previewWidth = mPlugins[mSelectedPlugin].preview->mBitmap.header.biWidth;
+ int previewHeight = mPlugins[mSelectedPlugin].preview->mBitmap.header.biHeight;
+
+ rect2.top = (rect1.Height() - previewHeight) / 2;
+ rect2.left = rect2.top - rect1.top;
+ rect2.bottom = rect2.top + previewHeight;
+ rect2.right = rect2.left + previewWidth;
+
+ pDC->SelectObject(pen2);
+
+ pDC->MoveTo(rect2.right, rect2.top - 1);
+ pDC->LineTo(rect2.left - 1, rect2.top - 1);
+ pDC->LineTo(rect2.left - 1, rect2.bottom + 1);
+
+ pDC->SelectObject(pen1);
+
+ pDC->MoveTo(rect2.right, rect2.top);
+ pDC->LineTo(rect2.right, rect2.bottom);
+ pDC->LineTo(rect2.left - 2, rect2.bottom);
+
+ StretchDIBits(
+ pDC->m_hDC,
+ rect2.left,
+ rect2.bottom - 1,
+ rect2.Width(),
+ -rect2.Height(),
+ 0,
+ 0,
+ previewWidth,
+ previewHeight,
+ mPlugins[mSelectedPlugin].preview->mData,
+ (const BITMAPINFO *) &mPlugins[mSelectedPlugin].preview->mBitmap,
+ DIB_PAL_COLORS,
+ SRCCOPY
+ );
+
+ CPoint pt;
+ pt.x = rect2.right + (rect2.left - rect1.left);
+ pt.y = rect2.left;
+
+ pDC->SetBkMode(TRANSPARENT);
+
+ CFont font;
+ font.CreateFont(-24, 0, 0, 0, FW_BOLD, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, DEFAULT_PITCH, "\x82\x6C\x82\x72 \x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E");
+
+ CString str = *mPlugins[mSelectedPlugin].mStr8;
+
+ pDC->SelectObject(font);
+
+ pDC->SetTextColor(clr1);
+ pDC->TextOut(pt.x - 1, pt.y - 1, str);
+ pDC->SetTextColor(clr2);
+ pDC->TextOut(pt.x + 1, pt.y + 1, str);
+ pDC->SetTextColor(clr3);
+ pDC->TextOut(pt.x, pt.y, str);
+
+ font.Detach();
+ font.CreateFont(-14, 0, 0, 0, FW_BOLD, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, DEFAULT_PITCH, "\x82\x6C\x82\x72 \x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E");
+ pDC->SelectObject(&font)->DeleteObject();
+
+ pt.y += 38;
+ pt.x += 12;
+
+ CPoint pt2 = pt;
+
+ str = "\x8F\x89\x8A\xFA\x8E\x91\x8B\xE0";
+ pDC->SetTextColor(clr1);
+ pDC->TextOut(pt.x + 1, pt.y + 1, str);
+ pDC->SetTextColor(clr3);
+ pDC->TextOut(pt.x, pt.y, str);
+
+ pt.y += 23;
+
+ str = "\x8D\x82\x82\xB3\x90\xA7\x8C\xC0";
+ pDC->SetTextColor(clr1);
+ pDC->TextOut(pt.x + 1, pt.y + 1, str);
+ pDC->SetTextColor(clr3);
+ pDC->TextOut(pt.x, pt.y, str);
+
+ pt.y += 23;
+
+ str = "\x89\xF0\x90\xE0";
+ pDC->SetTextColor(clr1);
+ pDC->TextOut(pt.x + 1, pt.y + 1, str);
+ pDC->SetTextColor(clr3);
+ pDC->TextOut(pt.x, pt.y, str);
+
+ CRect rect3;
+ rect3.left = pt.x + 15;
+ rect3.top = pt.y + 20;
+ rect3.right = rect1.right - (rect2.left - rect1.left);
+ rect3.bottom = rect1.bottom - (rect2.left - rect1.left);
+
+ pt = pt2;
+
+ pt.x += pDC->GetTextExtent("\x81\x97\x81\x97\x81\x97\x81\x97").cx + 3;
+
+ pt2 = pt;
+
+ int x = rect1.right - (rect2.left - rect1.left);
+
+ pDC->SelectObject(pen4);
+ pDC->MoveTo(pt.x, pt.y + 14);
+ pDC->LineTo(x, pt.y + 14);
+
+ pDC->SelectObject(pen1);
+ pDC->MoveTo(pt.x + 1, pt.y + 15);
+ pDC->LineTo(x + 1, pt.y + 15);
+
+ pt.y += 23;
+
+ pDC->SelectObject(pen4);
+ pDC->MoveTo(pt.x, pt.y + 14);
+ pDC->LineTo(x, pt.y + 14);
+
+ pDC->SelectObject(pen1);
+ pDC->MoveTo(pt.x + 1, pt.y + 15);
+ pDC->LineTo(x + 1, pt.y + 15);
+
+ font.Detach();
+ font.CreateFont(-14, 0, 0, 0, FW_DONTCARE, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, DEFAULT_PITCH, "\x82\x6C\x82\x72 \x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E");
+ pDC->SelectObject(&font)->DeleteObject();
+
+ pDC->SetTextColor(clr3);
+
+ pt = pt2;
+ pt.x = x;
+
+ str.Format("%d\x96\x9C\x89\x7E", mPlugins[mSelectedPlugin].mStrC);
+ pDC->TextOut(pt.x - pDC->GetTextExtent(str).cx, pt.y, str);
+
+ pt.y += 23;
+
+ str.Format("%d\x8A\x4B", mPlugins[mSelectedPlugin].mStr10);
+ pDC->TextOut(pt.x - pDC->GetTextExtent(str).cx, pt.y, str);
+
+ pDC->DrawText(*mPlugins[mSelectedPlugin].mStr18, rect3, DT_WORDBREAK);
+
+ pDC->RestoreDC(save);
+}