summaryrefslogtreecommitdiff
path: root/src/Plugins/ToolPalette/DefaultToolPalette
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-07-11 17:52:00 +0100
committerAsh Wolf <ninji@wuffs.org>2023-07-11 17:52:00 +0100
commit024306ccab5f6d51f3fce269fb1984fd02f3bb02 (patch)
tree8d359495d72bf4e7295c7eab4cb220edc2d4b60c /src/Plugins/ToolPalette/DefaultToolPalette
parent0f3cba6fcea0ffd511dfe3275d57a5b9e69be5be (diff)
downloadt2win-main.tar.gz
t2win-main.zip
add Floor, add DefaultToolPalettemain
Diffstat (limited to '')
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.clw16
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.cpp235
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.def9
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.dsp157
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.h44
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.rc132
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/Resource.h16
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.cpp6
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.h40
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.cpp863
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.h85
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.cpp262
-rw-r--r--src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.h49
13 files changed, 1903 insertions, 11 deletions
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.clw b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.clw
new file mode 100644
index 0000000..4ce1b5c
--- /dev/null
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.clw
@@ -0,0 +1,16 @@
+; CLW file contains information for the MFC ClassWizard
+
+[General Info]
+Version=1
+ClassCount=1
+Class1=CDefaultToolPaletteApp
+LastClass=CDefaultToolPaletteApp
+NewFileInclude2=#include "DefaultToolPalette.h"
+ResourceCount=0
+NewFileInclude1=#include "stdafx.h"
+
+[CLS:CDefaultToolPaletteApp]
+Type=0
+HeaderFile=DefaultToolPalette.h
+ImplementationFile=DefaultToolPalette.cpp
+Filter=N
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.cpp b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.cpp
index 6076d35..4f654e3 100644
--- a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.cpp
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.cpp
@@ -1,7 +1,242 @@
+// DefaultToolPalette.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+
+#define ATOI_KLUDGE
+#include "../../../T2DLL/UT2Utils.h"
+#include "../../../T2DLL/T2PaletteAnimeDef.h"
+#include "../../../T2DLL/LAttachment.h"
+#include "../../../T2DLL/LAttachable.h"
+#include "../../../T2DLL/CLink.h"
+#include "../../../T2DLL/LArray.h"
+#include "../../../T2DLL/LBroadcaster.h"
+#include "../../../T2DLL/LListener.h"
+#include "../../../T2DLL/T2BitImage.h"
+#include "../../../T2DLL/T2ImageObj.h"
+#include "../../../T2DLL/T2SpriteObj.h"
+#include "../../../T2DLL/Wave.h"
+#include "../../../T2DLL/T2SoundPlayer.h"
+#include "../../../T2DLL/T2Archive.h"
+#include "../../../T2DLL/T2FireWork.h"
+#include "../../../T2DLL/T2DlgItemButtonBase.h"
+#include "../../../T2DLL/T2DlgItemIButton.h"
+#include "../../../T2DLL/T2DlgItemOK.h"
+#include "../../../T2DLL/T2DlgItemCANCEL.h"
+#include "../../../T2DLL/T2DlgItemTButton.h"
+#include "../../../T2DLL/T2DlgItemICheck.h"
+#include "../../../T2DLL/T2DlgItemCheck.h"
+#include "../../../T2DLL/T2DlgItemScr.h"
+#include "../../../T2DLL/T2DlgItemHScr.h"
+#include "../../../T2DLL/T2DlgItemVScr.h"
+#include "../../../T2DLL/T2DlgItemBox.h"
+#include "../../../T2DLL/T2DlgItemText.h"
+#include "../../../T2DLL/T2DlgItemGageBase.h"
+#include "../../../T2DLL/T2DlgItemStressGage.h"
+#include "../../../T2DLL/T2DlgItemPPLEvalGage.h"
+#include "../../../T2DLL/T2DlgItemBelongGage.h"
+#include "../../../T2DLL/T2DlgItemCustomerGage.h"
+#include "../../../T2DLL/T2DlgItemProfitsGage.h"
+#include "../../../T2DLL/T2DlgItemImageTable.h"
+#include "../../../T2DLL/T2DlgItemImage.h"
+#include "../../../T2DLL/CToggleButtonDisabled.h"
+#include "../../../T2DLL/T2VerticalTable.h"
+#include "../../../T2DLL/T2MovieTable.h"
+#include "../../../T2DLL/T2GuestroomTable.h"
+#include "../../../T2DLL/T2HallEventTable.h"
+#include "../../../T2DLL/CTokenizer.h"
+#include "../../../T2DLL/T2Dialog.h"
+#include "../../../T2DLL/T2TowerMessage.h"
+#include "../../../T2DLL/T2DateTime.h"
+#include "../../../T2DLL/T2PluginSpecifier.h"
+#include "../../../T2DLL/CResFile.h"
+#include "../../../T2DLL/CPlugin.h"
+#include "../../../T2DLL/CFilePlugin.h"
+#include "../../../T2DLL/CFilePluginList.h"
+#include "../../../T2DLL/CFilePluginDB.h"
+#include "../../../T2DLL/CResourcePlugin.h"
+#include "../../../T2DLL/T2SubPlugin.h"
+#include "../../../T2DLL/T2AdvertiseTable.h"
+#include "../../../T2DLL/T2AdvertisePlugin.h"
+#include "../../../T2DLL/T2HallEventPlugin.h"
+#include "../../../T2DLL/T2MoviePlugin.h"
+#include "../../../T2DLL/T2EquipInfoDialog.h"
+#include "../../../T2DLL/T2TenantInfoDialog.h"
+#include "../../../T2DLL/T2Object.h"
+#include "../../../T2DLL/T2DrawableObject.h"
+#include "../../../T2DLL/T2ObjectArray.h"
+#include "../../../T2DLL/CDefRsrcPlugin.h"
+#include "../../../T2DLL/T2TemplatePlugin.h"
+#include "../../../T2DLL/T2HaveOutViewObject.h"
+#include "../../../T2DLL/T2TemplatePluginList.h"
+#include "../../../T2DLL/CProgramPlugin.h"
+#include "../../../T2DLL/T2TemplatePluginDB.h"
+#include "../../../T2DLL/T2ToolPlugin.h"
+#include "../../../T2DLL/T2EquipPlugin.h"
+#include "../../../T2DLL/T2TenantPlugin.h"
+#include "../../../T2DLL/T2MoverPlugin.h"
+#include "../../../T2DLL/T2OuterObjPlugin.h"
+#include "../../../T2DLL/UT2Coordinate.h"
+#include "../../../T2DLL/T2PeoplePtrList.h"
+#include "../../../T2DLL/T2ToolDef.h"
+#include "../../../T2DLL/T2EquipDef.h"
+#include "../../../T2DLL/T2TenantDef.h"
+#include "../../../T2DLL/T2MoverDef.h"
+#include "../../../T2DLL/T2OuterObjDef.h"
+#include "../../../T2DLL/T2SilhouetteDef.h"
+#include "../../../T2DLL/T2MatterDef.h"
+#include "../../../T2DLL/T2PeopleDef.h"
+#include "../../../T2DLL/T2Pool.h"
+#include "../../../T2DLL/T2PlaceParamDef.h"
+#include "../../../T2DLL/T2TenantMemberTableDef.h"
+#include "../../../T2DLL/T2TenantMemberDef.h"
+#include "../../../T2DLL/T2PeopleTypeArray.h"
+#include "../../../T2DLL/T2PeopleTimeZoneList.h"
+#include "../../../T2DLL/T2PeopleDemandList.h"
+#include "../../../T2DLL/T2PeopleType.h"
+#include "../../../T2DLL/T2Equip.h"
+#include "../../../T2DLL/T2Tenant.h"
+#include "../../../T2DLL/T2OutObj.h"
+#include "../../../T2DLL/T2Matter.h"
+#include "../../../T2DLL/T2People.h"
+#include "../../../T2DLL/T2PeopleArray.h"
+#include "../../../T2DLL/T2PeopleArrayList.h"
+#include "../../../T2DLL/T2Request.h"
+#include "../../../T2DLL/T2Mover.h"
+#include "../../../T2DLL/T2RegistedTenantDB.h"
+#include "../../../T2DLL/T2OuterObjList.h"
+#include "../../../T2DLL/T2RequestIDArray.h"
+#include "../../../T2DLL/T2RequestArray.h"
+#include "../../../T2DLL/T2RequestArrayList.h"
+#include "../../../T2DLL/T2MoverModule.h"
+#include "../../../T2DLL/T2MoverModuleList.h"
+#include "../../../T2DLL/T2StairModule.h"
+#include "../../../T2DLL/T2StairModuleList.h"
+#include "../../../T2DLL/T2ElevatorModule.h"
+#include "../../../T2DLL/T2ElvModuleList.h"
+#include "../../../T2DLL/T2CrossEquipArray.h"
+#include "../../../T2DLL/T2TenantCEArray.h"
+#include "../../../T2DLL/T2RouteCEArray.h"
+#include "../../../T2DLL/T2FloorCEArray.h"
+#include "../../../T2DLL/T2MoverCEArray.h"
+#include "../../../T2DLL/T2TenantArray.h"
+#include "../../../T2DLL/T2TenantArrayList.h"
+#include "../../../T2DLL/T2MoverArray.h"
+#include "../../../T2DLL/T2MoverArrayList.h"
+#include "../../../T2DLL/T2PeopleLinkIterator.h"
+#include "../../../T2DLL/T2UnitInfo.h"
+#include "../../../T2DLL/T2FloorInfo.h"
+#include "../../../T2DLL/T2FInfoAreaIterator.h"
+#include "../../../T2DLL/T2FInfoPtIterator.h"
+#include "../../../T2DLL/UT2BkgndInfo.h"
+#include "../../../T2DLL/T2EquipPtrList.h"
+#include "../../../T2DLL/T2FloorPtrList.h"
+#include "../../../T2DLL/T2RoutingTableElem.h"
+#include "../../../T2DLL/T2MoverRoutingTable.h"
+#include "../../../T2DLL/T2RoutingTable.h"
+#include "../../../T2DLL/T2RouteNavigator.h"
+#include "../../../T2DLL/T2WorldPlugin.h"
+#include "../../../T2DLL/T2WorldDef.h"
+#include "../../../T2DLL/T2TrafficInfo.h"
+#include "../../../T2DLL/T2NameList.h"
+#include "../../../T2DLL/T2PeopleLoader.h"
+#include "../../../T2DLL/T2MsgWindowCallback.h"
+#include "../../../T2DLL/T2Settlement.h"
+#include "../../../T2DLL/T2Name.h"
+#include "../../../T2DLL/T2EventItem.h"
+#include "../../../T2DLL/T2Maru_Reggae.h"
+#include "../../../T2DLL/T2RegistedTenantIterator.h"
+#include "../../../T2DLL/T2OptionPlugin.h"
+#include "../../../T2DLL/T2OptionPluginList.h"
+#include "../../../T2DLL/T2ToolWindow.h"
+#include "../../../T2DLL/T2ToolCallback.h"
+#include "../../../T2DLL/T2TowerEvent.h"
+#include "../../../T2DLL/T2MetroRailway.h"
+#include "../../../T2DLL/T2PaletteAnime.h"
+#include "../../../T2DLL/T2StewardDialog.h"
+#include "../../../T2DLL/T2ClassFactory.h"
+
#include "DefaultToolPalette.h"
+#include "ToolPalette.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+
+//
+// Note!
+//
+// If this DLL is dynamically linked against the MFC
+// DLLs, any functions exported from this DLL which
+// call into MFC must have the AFX_MANAGE_STATE macro
+// added at the very beginning of the function.
+//
+// For example:
+//
+// extern "C" BOOL PASCAL EXPORT ExportedFunction()
+// {
+// AFX_MANAGE_STATE(AfxGetStaticModuleState());
+// // normal function body here
+// }
+//
+// It is very important that this macro appear in each
+// function, prior to any calls into MFC. This means that
+// it must appear as the first statement within the
+// function, even before any object variable declarations
+// as their constructors may generate calls into the MFC
+// DLL.
+//
+// Please see MFC Technical Notes 33 and 58 for additional
+// details.
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CDefaultToolPaletteApp
+
+BEGIN_MESSAGE_MAP(CDefaultToolPaletteApp, CWinApp)
+ //{{AFX_MSG_MAP(CDefaultToolPaletteApp)
+ // NOTE - the ClassWizard will add and remove mapping macros here.
+ // DO NOT EDIT what you see in these blocks of generated code!
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDefaultToolPaletteApp construction
+
+CDefaultToolPaletteApp::CDefaultToolPaletteApp()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// The one and only CDefaultToolPaletteApp object
+
+CDefaultToolPaletteApp theApp;
+
+ToolPalette *sToolPalette;
+
+void *CALLBACK ConstructProgramPlugin(T2PluginSpecifier *inSpecifier) {
+ if (!sToolPalette) {
+#line 47
+ sToolPalette = new ToolPalette;
+ }
+
+ return sToolPalette;
+}
+
+void *CALLBACK DestructProgramPlugin() {
+ sToolPalette = NULL;
+ return NULL;
+}
+
+T2PluginSpecifier *GetAttr(T2PluginSpecifier *inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin) {
+#line 59
+ T2PluginSpecifier *specifier = new T2PluginSpecifier;
+ specifier->mPluginName = "Default Tool palette";
+ specifier->mType = 'TOPL';
+ specifier->mID = 1000;
+ specifier->mAttrib = 0xFFFFFFFF;
+ specifier->mGameLevel = 0;
+ return specifier;
+}
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.def b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.def
new file mode 100644
index 0000000..7164b21
--- /dev/null
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.def
@@ -0,0 +1,9 @@
+; DefaultToolPalette.def : Declares the module parameters for the DLL.
+
+LIBRARY "DEFAULTTOOLPALETTE"
+DESCRIPTION 'DEFAULTTOOLPALETTE Windows Dynamic Link Library'
+
+EXPORTS
+ ConstructProgramPlugin
+ DestructProgramPlugin
+ GetAttr
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.dsp b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.dsp
new file mode 100644
index 0000000..c110573
--- /dev/null
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.dsp
@@ -0,0 +1,157 @@
+# Microsoft Developer Studio Project File - Name="DefaultToolPalette" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=DefaultToolPalette - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "DefaultToolPalette.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "DefaultToolPalette.mak" CFG="DefaultToolPalette - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "DefaultToolPalette - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "DefaultToolPalette - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "DefaultToolPalette - Win32 Release"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /Yu"stdafx.h" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "DefaultToolPalette - Win32 Debug"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "Z:\Users\ash\src\t2-res\dx5\cdrom\sdk\inc" /I "Z:\Users\ash\src\t2-res\dxmedia51\DX51\dxmdev\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /Yu"stdafx.h" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ../../../T2DLL/Debug/T2DLL.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\..\DefaultToolPalette.t2p" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "DefaultToolPalette - Win32 Release"
+# Name "DefaultToolPalette - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\DefaultToolPalette.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ToolPalette.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ToolPaletteItem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\DefaultToolPalette.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\DefaultToolPalette.rc
+
+!IF "$(CFG)" == "DefaultToolPalette - Win32 Release"
+
+!ELSEIF "$(CFG)" == "DefaultToolPalette - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\DefaultToolPalette.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ToolPalette.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ToolPaletteItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\res\DefaultToolPalette.rc2
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.h b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.h
index e45dd5d..cb431ec 100644
--- a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.h
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.h
@@ -1,5 +1,45 @@
+// DefaultToolPalette.h : main header file for the DEFAULTTOOLPALETTE DLL
+//
+
+#if !defined(AFX_DEFAULTTOOLPALETTE_H__81154B54_BBFC_4E61_A2BC_BB53B98894B3__INCLUDED_)
+#define AFX_DEFAULTTOOLPALETTE_H__81154B54_BBFC_4E61_A2BC_BB53B98894B3__INCLUDED_
+
+#if _MSC_VER >= 1000
#pragma once
-#include "common.h"
+#endif // _MSC_VER >= 1000
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+/////////////////////////////////////////////////////////////////////////////
+// CDefaultToolPaletteApp
+// See DefaultToolPalette.cpp for the implementation of this class
+//
+
+class CDefaultToolPaletteApp : public CWinApp
+{
+public:
+ CDefaultToolPaletteApp();
-class DefaultToolPalette {
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CDefaultToolPaletteApp)
+ //}}AFX_VIRTUAL
+
+ //{{AFX_MSG(CDefaultToolPaletteApp)
+ // NOTE - the ClassWizard will add and remove member functions here.
+ // DO NOT EDIT what you see in these blocks of generated code !
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
};
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_DEFAULTTOOLPALETTE_H__81154B54_BBFC_4E61_A2BC_BB53B98894B3__INCLUDED_)
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.rc b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.rc
new file mode 100644
index 0000000..306f829
--- /dev/null
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/DefaultToolPalette.rc
@@ -0,0 +1,132 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+128 ATTR "res\\ATTR128_1.txt"
+
+128 DESC "res\\DESC128_1.txt"
+
+1000 OBJMAP "res\\OBJMAP1000_1.txt"
+
+1000 BITMAP "res\\BITMAP1000_1.bmp"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "#ifdef _WIN32\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#endif\r\n"
+ "#include ""res\\DefaultToolPalette.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif"
+ "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // APSTUDIO_INVOKED
+
+
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "DefaultToolPalette DLL\0"
+ VALUE "FileVersion", "1, 0, 0, 1\0"
+ VALUE "InternalName", "DefaultToolPalette\0"
+ VALUE "LegalCopyright", "Copyright (C) 1997\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename","DefaultToolPalette.DLL\0"
+ VALUE "ProductName", "DefaultToolPalette Dynamic Link Library\0"
+ VALUE "ProductVersion", "1, 0, 0, 1\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#endif
+#include "res\\DefaultToolPalette.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/Resource.h b/src/Plugins/ToolPalette/DefaultToolPalette/Resource.h
new file mode 100644
index 0000000..bc66dbf
--- /dev/null
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by DEFAULTTOOLPALETTE.RC
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.cpp b/src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.cpp
new file mode 100644
index 0000000..ef55339
--- /dev/null
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.cpp
@@ -0,0 +1,6 @@
+// stdafx.cpp : source file that includes just the standard includes
+// DefaultToolPalette.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.h b/src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.h
new file mode 100644
index 0000000..8eacd17
--- /dev/null
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/StdAfx.h
@@ -0,0 +1,40 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__AF935A55_9E17_4611_818A_EF6A4343861E__INCLUDED_)
+#define AFX_STDAFX_H__AF935A55_9E17_4611_818A_EF6A4343861E__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h> // MFC OLE classes
+#include <afxodlgs.h> // MFC OLE dialog classes
+#include <afxdisp.h> // MFC OLE automation classes
+#endif // _AFX_NO_OLE_SUPPORT
+
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h> // MFC ODBC database classes
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h> // MFC DAO database classes
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__AF935A55_9E17_4611_818A_EF6A4343861E__INCLUDED_)
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.cpp b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.cpp
index f290c82..53c032b 100644
--- a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.cpp
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.cpp
@@ -1,7 +1,860 @@
+#include "StdAfx.h"
#include "ToolPalette.h"
+#include "ToolPaletteItem.h"
+#include "../../../T2DLL/T2BitImage.h"
+#include "../../../T2DLL/T2ImageObj.h"
+#include "../../../T2DLL/T2PaletteAnimeDef.h"
+#include "../../../T2DLL/T2ToolDef.h"
+#include "../../../T2DLL/T2ToolHelpWnd.h"
+#include "../../../T2DLL/T2WorldDef.h"
+#include "../../../T2TowerDoc.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
+ToolPalette::ToolPalette() {
+ mSize130.cx = 26;
+ mSize130.cy = 26;
+
+ mSize138.cx = 76;
+ mSize138.cy = 13;
+
+ m140 = 16;
+ m144 = 3;
+ m148 = 4;
+ m124 = 0;
+
+ mImageObj = NULL;
+ mImage = NULL;
+ mToolHelpWnd = NULL;
+
+ _184 = -1;
+}
+
+/*virtual*/ ToolPalette::~ToolPalette() {
+ int i;
+
+ for (i = 0; i < kNumCommand; i++)
+ delete mCommands[i];
+
+ delete mCategoryTitle;
+ for (i = 0; i < kNumCategory; i++)
+ delete mCategories[i];
+ delete mCategoryScroll;
+
+ delete mToolTitle;
+ for (i = 0; i < kNumTool; i++)
+ delete mTools[i];
+ delete mToolScroll;
+
+ if (mImageObj)
+ delete mImageObj;
+ if (mImage)
+ delete mImage;
+
+ POSITION pos = mHistoryList.GetHeadPosition();
+ while (pos)
+ delete mHistoryList.GetNext(pos);
+}
+
+/*virtual*/ void ToolPalette::ItemCallbackDown(ToolPaletteItem *inItem) {
+ if (inItem->GetMode() != kTPIMode1)
+ return;
+
+ T2ToolIconItem *icon = inItem->GetIcon();
+ if (icon->mEnableCount > 0)
+ return;
+ if (icon->m30 == 0)
+ return;
+
+ T2ToolIconItem *changeIcon = ChangeIconItem(icon);
+ if (changeIcon && changeIcon->mToolCallback) {
+ T2ToolCallback *theToolCallback = changeIcon->mToolCallback;
+ theToolCallback->toolCallback_vf00(this, changeIcon);
+ }
+
+ T2ToolCallback *theToolCallback = icon->mToolCallback;
+ if (theToolCallback)
+ theToolCallback->toolCallback_vf00(this, icon);
+
+ mClickedItem = icon;
+ m15C = (T2ToolDef *) GetIconPlugin(mSel);
+ ShowHelpWindow();
+}
+
+/*virtual*/ void ToolPalette::ItemCallbackUp(ToolPaletteItem *inItem) {
+ if (mTimerID)
+ KillTimer(mTimerID);
+
+ HideHelpWindow();
+
+ if (inItem->GetMode() != kTPIMode1)
+ return;
+
+ T2ToolIconItem *icon = inItem->GetIcon();
+ if (icon->mEnableCount > 0)
+ return;
+ if (icon->m30 == 0)
+ return;
+
+ int i;
+ if (icon->m18) {
+ icon->m24 = false;
+
+ switch (icon->mOption) {
+ case kToolOption0:
+ for (i = 0; i < kNumCommand; i++)
+ mCommands[i]->InvalidateRect(NULL);
+ break;
+
+ case kToolOption4:
+ for (i = 0; i < kNumCategory; i++)
+ mCategories[i]->InvalidateRect(NULL);
+ break;
+
+ case kToolOption1:
+ case kToolOption2:
+ case kToolOption3:
+ for (i = 0; i < kNumTool; i++)
+ mTools[i]->InvalidateRect(NULL);
+ break;
+ }
+
+ T2ToolCallback *theToolCallback = icon->mToolCallback;
+ if (theToolCallback)
+ theToolCallback->toolCallback_vf00(this, icon);
+ }
+}
+
+T2ToolIconItem *ToolPalette::ChangeIconItem(T2ToolIconItem *inItem) {
+ T2ToolIconItem *result = NULL;
+
+ if (inItem->m18 != 0) {
+ inItem->m24 = true;
+
+ int i;
+ switch (inItem->mOption) {
+ case kToolOption0:
+ for (i = 0; i < kNumCommand; i++)
+ mCommands[i]->InvalidateRect(NULL);
+ break;
+ case kToolOption4:
+ for (i = 0; i < kNumCategory; i++)
+ mCategories[i]->InvalidateRect(NULL);
+ break;
+ case kToolOption1:
+ case kToolOption2:
+ case kToolOption3:
+ for (i = 0; i < kNumTool; i++)
+ mTools[i]->InvalidateRect(NULL);
+ break;
+ }
+ } else {
+ T2ToolIconItem *oldItem = GetItem(mSel);
+ ToolHistoryItem *history;
+
+ switch (inItem->mOption) {
+ case kToolOption0:
+ mSel = inItem->mID;
+ Updated();
+ break;
+
+ case kToolOption4: {
+ POSITION pos = mToolIconList->GetHeadPosition();
+ T2ToolIconItem *lowItem = NULL;
+ T2ToolIconItem *theItem;
+ while (pos) {
+ theItem = mToolIconList->GetNext(pos);
+ if (theItem->mOption == kToolOption1 || theItem->mOption == kToolOption2 || theItem->mOption == kToolOption3) {
+ if (((T2ToolDef *) theItem->mPlugin)->mCategoryNo == inItem->mValiation) {
+ if (lowItem) {
+ if (lowItem->mToolDef) {
+ if (theItem->mToolDef) {
+ if (theItem->mToolDef->GetSortKey() < lowItem->mToolDef->GetSortKey())
+ lowItem = theItem;
+ }
+ } else {
+ lowItem = theItem;
+ }
+ } else {
+ lowItem = theItem;
+ }
+ }
+ }
+ }
+
+#line 330
+ _ASSERT(lowItem != NULL);
+
+ theItem = lowItem;
+ mSel = theItem->mID;
+ history = GetToolHistory(((T2ToolDef *) GetIconPlugin(mSel))->mCategoryNo);
+
+ int theScrollPos = 0;
+ if (history->_C != -1) {
+ mSel = history->_C;
+ theScrollPos = history->_8;
+ } else {
+ history->_C = mSel;
+ history->_8 = theScrollPos;
+ }
+
+ _184 = mSel;
+ mToolScroll->SetScrollPos(theScrollPos);
+ Updated();
+ break;
+ }
+
+ case kToolOption1:
+ case kToolOption2:
+ case kToolOption3:
+ mSel = inItem->mID;
+ history = GetToolHistory(((T2ToolDef *) GetIconPlugin(mSel))->mCategoryNo);
+ history->_8 = mToolScroll->GetScrollPos();
+ history->_C = mSel;
+ Updated();
+ break;
+ }
+ }
+
+ return result;
+}
+
+/*virtual*/ T2ToolIconItem *ToolPalette::EnableIcon(unsigned short inMask) {
+ T2ToolIconItem *icon = T2ToolWindow::EnableIcon(inMask);
+ if (icon) {
+ ChangeIconItem(icon);
+ ListUpdated();
+ }
+ return icon;
+}
+
+/*virtual*/ int ToolPalette::OnCreateProc(LPCREATESTRUCT lpCreateStruct) {
+#pragma var_order(windowRect, y, rect2, x2, y2, i, clientRect, y3, rect1, x)
+ int i;
+
+ mImageObj = new T2ImageObj;
+ mImage = new T2BitImage(mModule, 1000, true);
+ mImageObj->AddObject(mModule, 1000, mImage);
+
+ for (i = 0; i < kNumCommand; i++)
+ mCommands[i] = new ToolPaletteItem(mDocument, kTPIMode1);
+
+ mCategoryTitle = new ToolPaletteItem(mDocument, kTPIMode0);
+ for (i = 0; i < kNumCategory; i++)
+ mCategories[i] = new ToolPaletteItem(mDocument, kTPIMode1);
+ mCategoryScroll = new ToolPaletteItem(mDocument, kTPIMode2);
+
+ mToolTitle = new ToolPaletteItem(mDocument, kTPIMode0);
+ for (i = 0; i < kNumTool; i++)
+ mTools[i] = new ToolPaletteItem(mDocument, kTPIMode1);
+ mToolScroll = new ToolPaletteItem(mDocument, kTPIMode2);
+
+ mWndClass = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW | CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH));
+
+ CRect rect1, rect2;
+ int x = 0, y = 0, x2, y2, y3;
+ m14C[kToolHelpMode0] = y + 5;
+
+ for (i = 0; i < kNumCommand; i++) {
+ x2 = (mSize130.cx - 1) * x + 3;
+ y2 = (mSize130.cy - 1) * y + 5;
+ rect1.SetRect(x2, y2, x2 + mSize130.cx, y2 + mSize130.cy);
+ rect2.UnionRect(rect2, rect1);
+ mCommands[i]->Create(mWndClass, "", WS_VISIBLE | WS_CHILD, rect1, this, i + 1000);
+
+ x++;
+ if (x >= 3) {
+ x = 0;
+ y++;
+ }
+ }
+
+ x2 = 3;
+ y = 3;
+ y2 += mSize130.cy + 4;
+ rect1.SetRect(x2, y2, x2 + mSize130.cx * 3 - 2, y2 + m140 + 2);
+ rect2.UnionRect(rect2, rect1);
+ mCategoryTitle->Create(mWndClass, "", WS_VISIBLE | WS_CHILD, rect1, this, 1100);
+
+ y2 += m140 + 2;
+ m14C[kToolHelpMode1] = y2;
+
+ x = 0;
+ y = 0;
+
+ for (i = 0; i < kNumCategory; i++) {
+ x2 = (mSize130.cx - 1) * x + 3;
+ y3 = y2 + (mSize130.cy - 1) * y;
+ rect1.SetRect(x2, y3, x2 + mSize130.cx, y3 + mSize130.cy);
+ rect2.UnionRect(rect2, rect1);
+ mCategories[i]->Create(mWndClass, "", WS_CHILD, rect1, this, i + 1200);
+
+ y++;
+ if (y >= 3) {
+ y = 0;
+ x++;
+ }
+ }
+ y = 3;
+
+ y2 += (mSize130.cy - 1) * y;
+ x2 = 3;
+ rect1.SetRect(x2, y2, x2 + mSize138.cx, y2 + mSize138.cy);
+ rect2.UnionRect(rect2, rect1);
+ mCategoryScroll->Create(mWndClass, "", WS_VISIBLE | WS_CHILD, rect1, this, 1300);
+
+ y = m140;
+ y2 += mSize138.cy + 6;
+ rect1.SetRect(x2, y2, x2 + mSize130.cx * 3 - 2, y2 + y + 2);
+ rect2.UnionRect(rect2, rect1);
+ mToolTitle->Create(mWndClass, "", WS_VISIBLE | WS_CHILD, rect1, this, 1400);
+
+ y2 += y + 2;
+ m14C[kToolHelpMode2] = y2;
+
+ x = 0;
+ y = 0;
+
+ for (i = 0; i < kNumTool; i++) {
+ x2 = (mSize130.cx - 1) * x + 3;
+ y3 = y2 + (mSize130.cy - 1) * y;
+ rect1.SetRect(x2, y3, x2 + mSize130.cx, y3 + mSize130.cy);
+ rect2.UnionRect(rect2, rect1);
+ mTools[i]->Create(mWndClass, "", WS_CHILD, rect1, this, i + 1500);
+
+ y++;
+ if (y >= 4) {
+ y = 0;
+ x++;
+ }
+ }
+ y = 4;
+
+ y2 += (mSize130.cy - 1) * y;
+ x2 = 3;
+ rect1.SetRect(x2, y2, x2 + mSize138.cx, y2 + mSize138.cy);
+ rect2.UnionRect(rect2, rect1);
+ mToolScroll->Create(mWndClass, "", WS_VISIBLE | WS_CHILD, rect1, this, 1600);
+
+ CRect windowRect;
+ GetWindowRect(windowRect);
+
+ CRect clientRect;
+ GetClientRect(clientRect);
+
+ SetWindowPos(
+ NULL,
+ 0,
+ 0,
+ rect2.Width() + (windowRect.Width() - clientRect.Width()) + 6,
+ rect2.Height() + (windowRect.Height() - clientRect.Height()) + 11,
+ SWP_NOMOVE | SWP_NOZORDER
+ );
+
+ m124 = true;
+ ListUpdated();
+ Updated();
+
+ return 0;
+}
+
+/*virtual*/ BOOL ToolPalette::OnEraseBkgndProc(CDC *pDC) {
+ int saved = pDC->SaveDC();
+ pDC->SelectPalette(mWorldDef->GetPalette(), false);
+ pDC->RealizePalette();
+
+ CBrush backBrush;
+ backBrush.CreateStockObject(LTGRAY_BRUSH);
+
+ CRect rect1;
+ GetClientRect(rect1);
+ pDC->FillRect(rect1, &backBrush);
+
+ CPen pen1;
+ pen1.CreatePen(PS_SOLID, 0, PALETTEINDEX(T2PaletteAnimeDef::GetCommonColor(0)));
+
+ CPen pen2;
+ pen2.CreatePen(PS_SOLID, 0, PALETTEINDEX(T2PaletteAnimeDef::GetCommonColor(3)));
+
+ CRect rect2, rect3;
+ GetClientRect(rect2);
+
+ pDC->SelectObject(pen1);
+ pDC->MoveTo(rect2.right - 1, rect2.top);
+ pDC->LineTo(rect2.left, rect2.top);
+ pDC->LineTo(rect2.left, rect2.bottom);
+
+ pDC->SelectObject(pen2);
+ pDC->MoveTo(rect2.right - 1, rect2.top + 1);
+ pDC->LineTo(rect2.right - 1, rect2.bottom - 1);
+ pDC->LineTo(rect2.left, rect2.bottom - 1);
+
+ mCategoryTitle->GetWindowRect(rect2);
+ ScreenToClient(rect2);
+
+ mCategoryScroll->GetWindowRect(rect3);
+ ScreenToClient(rect3);
+
+ pDC->SelectObject(pen2);
+ pDC->MoveTo(rect3.right, rect2.top - 1);
+ pDC->LineTo(rect2.left - 1, rect2.top - 1);
+ pDC->LineTo(rect2.left - 1, rect3.bottom + 1);
+
+ pDC->SelectObject(pen1);
+ pDC->MoveTo(rect3.right, rect2.top);
+ pDC->LineTo(rect3.right, rect3.bottom);
+ pDC->LineTo(rect3.left - 1, rect3.bottom);
+
+ mToolTitle->GetWindowRect(rect2);
+ ScreenToClient(rect2);
+
+ mToolScroll->GetWindowRect(rect3);
+ ScreenToClient(rect3);
+
+ pDC->SelectObject(pen2);
+ pDC->MoveTo(rect3.right, rect2.top - 1);
+ pDC->LineTo(rect2.left - 1, rect2.top - 1);
+ pDC->LineTo(rect2.left - 1, rect3.bottom + 1);
+
+ pDC->SelectObject(pen1);
+ pDC->MoveTo(rect3.right, rect2.top);
+ pDC->LineTo(rect3.right, rect3.bottom);
+ pDC->LineTo(rect3.left - 1, rect3.bottom);
+
+ pDC->RestoreDC(saved);
+ return true;
+}
+
+/*virtual*/ void ToolPalette::OnSizeProc(UINT nType, int cx, int cy) {
+}
+
+/*virtual*/ void ToolPalette::Updated() {
+ if (!m124)
+ return;
+
+ T2ToolDef *thePlugin;
+ T2ToolIconItem *icon;
+ int theCategoryNo;
+ POSITION pos;
+
+ int theOption = GetIconOption(mSel);
+ BYTE isChange = 0;
+
+ switch (theOption) {
+ case kToolOption1:
+ case kToolOption2:
+ case kToolOption3:
+ thePlugin = (T2ToolDef *) GetIconPlugin(mSel);
+#line 596
+ _ASSERT(thePlugin != NULL);
+
+ theCategoryNo = thePlugin->mCategoryNo;
+ pos = mToolIconList->GetHeadPosition();
+ while (pos) {
+ icon = mToolIconList->GetNext(pos);
+ switch (icon->mOption) {
+ case kToolOption4:
+ if (icon->mValiation == theCategoryNo) {
+ if (!icon->m24) {
+ icon->m24 = true;
+ isChange |= 1;
+ }
+ } else {
+ if (icon->m24) {
+ icon->m24 = false;
+ isChange |= 1;
+ }
+ }
+ break;
+
+ case kToolOption1:
+ case kToolOption2:
+ case kToolOption3:
+ if (icon->mID == mSel) {
+ ToolHistoryItem *history = GetToolHistory(((T2ToolDef *) GetIconPlugin(mSel))->mCategoryNo);
+ if (history->_C == -1) {
+ history->_C = mSel;
+ history->_8 = 0;
+ }
+ if (!icon->m24) {
+ icon->m24 = true;
+ isChange |= 2;
+ }
+
+ mCategoryTitle->SetText(thePlugin->mCategoryName);
+ mToolTitle->SetText(*thePlugin->mToolName[icon->mValiation]);
+ } else {
+ if (icon->m24) {
+ icon->m24 = false;
+ isChange |= 2;
+ }
+ }
+ break;
+
+ case kToolOption0:
+ if (icon->m24) {
+ icon->m24 = false;
+ isChange |= 4;
+ }
+ break;
+ }
+ }
+
+ if (isChange & 1) {
+ for (int i = 0; i < kNumCategory; i++)
+ mCategories[i]->InvalidateRect(NULL);
+ ChangeCategory(theCategoryNo);
+ }
+ if (isChange & 2) {
+ for (int i = 0; i < kNumTool; i++)
+ mTools[i]->InvalidateRect(NULL);
+ }
+ if (isChange & 4) {
+ for (int i = 0; i < kNumCommand; i++)
+ mCommands[i]->InvalidateRect(NULL);
+ }
+
+ mDocument->SetCursorType(kCursorDefault, false);
+ break;
+
+ case kToolOption0:
+ pos = mToolIconList->GetHeadPosition();
+ while (pos) {
+ icon = mToolIconList->GetNext(pos);
+ switch (icon->mOption) {
+ case kToolOption1:
+ case kToolOption2:
+ case kToolOption3:
+ if (icon->m24) {
+ icon->m24 = false;
+ isChange |= 1;
+ }
+ break;
+
+ case kToolOption4:
+ if (icon->m24) {
+ icon->m24 = false;
+ isChange |= 2;
+ }
+ break;
+
+ case kToolOption0:
+ if (icon->mID == mSel) {
+ if (!icon->m24) {
+ icon->m24 = true;
+ isChange |= 4;
+ }
+ } else {
+ if (icon->m24) {
+ icon->m24 = false;
+ isChange |= 4;
+ }
+ }
+ break;
+ }
+ }
+
+ if (isChange & 1) {
+ for (int i = 0; i < kNumCategory; i++)
+ mCategories[i]->InvalidateRect(NULL);
+ ChangeCategory();
+ }
+ if (isChange & 2) {
+ for (int i = 0; i < kNumTool; i++)
+ mTools[i]->InvalidateRect(NULL);
+ }
+
+ if (isChange && 4) {
+ for (int i = 0; i < kNumCommand; i++)
+ mCommands[i]->InvalidateRect(NULL);
+ }
+ if (isChange) {
+ mCategoryTitle->SetText("");
+ mToolTitle->SetText("");
+ }
+
+ mDocument->SetCursorType(mSel, false);
+ break;
+ }
+
+ if (isChange) {
+ mCategoryTitle->InvalidateRect(NULL);
+ mToolTitle->InvalidateRect(NULL);
+ }
+}
+
+/*virtual*/ void ToolPalette::ListUpdated() {
+ if (!m124)
+ return;
+
+ UpdateCommand();
+ UpdateCategory();
+ UpdateTool();
+}
+
+void ToolPalette::UpdateScroll(ToolPaletteItem *inItem) {
+ if (inItem == mCategoryScroll)
+ UpdateCategory();
+
+ if (inItem == mToolScroll) {
+ UpdateTool();
+ if (_184 != -1) {
+ ToolHistoryItem *history = GetToolHistory(((T2ToolDef *) GetIconPlugin(_184))->mCategoryNo);
+ history->_8 = mToolScroll->GetScrollPos();
+ }
+ }
+}
+
+static const char *commandNames[] = {
+ "ToolDestruct",
+ "ToolFinger",
+ "ToolInfo",
+ "ToolZoom",
+ "ToolHand",
+ "ToolMic",
+ "ToolRoot"
+};
+
+void ToolPalette::UpdateCommand() {
+ BOOL valid = true;
+ int i;
+
+ for (i = 0; i < kNumCommand; i++) {
+ if (GetID(commandNames[i], 0) == -1) {
+ valid = false;
+ break;
+ }
+ }
+
+ if (valid) {
+ for (i = 0; i < kNumCommand; i++)
+ mCommands[i]->SetIcon(GetItem(commandNames[i], 0));
+ }
+}
+
+void ToolPalette::UpdateCategory() {
+ int baseIndex = mCategoryScroll->GetScrollPos() * m144;
+ int currIndex = 0;
+ int numIcons = 0;
+ CList<T2ToolIconItem *, T2ToolIconItem *> iconList;
+
+ POSITION pos = mToolIconList->GetHeadPosition();
+ while (pos) {
+ T2ToolIconItem *icon = mToolIconList->GetNext(pos);
+ if (icon->mOption == kToolOption4) {
+ BOOL added = false;
+ if (icon->mToolDef) {
+ POSITION pos2 = iconList.GetHeadPosition();
+ while (pos2) {
+ POSITION prevPos2 = pos2;
+ T2ToolIconItem *icon2 = iconList.GetNext(pos2);
+ if (icon2->mToolDef && icon2->mToolDef->GetSortKey() > icon->mToolDef->GetSortKey()) {
+ iconList.InsertBefore(prevPos2, icon);
+ added = true;
+ break;
+ }
+ }
+ }
+
+ if (!added)
+ iconList.AddTail(icon);
+ }
+ }
+
+ pos = iconList.GetHeadPosition();
+ while (pos) {
+ T2ToolIconItem *icon = iconList.GetNext(pos);
+ if (currIndex >= baseIndex && numIcons < kNumCategory) {
+ mCategories[numIcons]->SetIcon(icon);
+ mCategories[numIcons]->ShowWindow(SW_SHOW);
+ numIcons++;
+ }
+ currIndex++;
+ }
+
+ for (; numIcons < kNumCategory; numIcons++)
+ mCategories[numIcons]->ShowWindow(SW_HIDE);
+
+ currIndex = ((currIndex + m144 - 1) / m144) - 3;
+ if (currIndex < 0)
+ currIndex = 0;
+ mCategoryScroll->SetScrollRange(currIndex);
+}
+
+void ToolPalette::UpdateTool() {
+ T2ToolIconItem *icon;
+ POSITION pos = mToolIconList->GetHeadPosition();
+
+ while (pos) {
+ icon = mToolIconList->GetNext(pos);
+ if (icon->mOption == kToolOption4 && icon->m24) {
+ ChangeCategory(icon->mValiation);
+ break;
+ }
+ }
+}
+
+void ToolPalette::ChangeCategory(int inCategory) {
+ if (!m124)
+ return;
+
+ int baseIndex = mToolScroll->GetScrollPos() * m148;
+ int currIndex = 0;
+ int numIcons = 0;
+ CList<T2ToolIconItem *, T2ToolIconItem *> iconList;
+
+ POSITION pos = mToolIconList->GetHeadPosition();
+ while (pos) {
+ T2ToolIconItem *icon = mToolIconList->GetNext(pos);
+ if (icon->mOption == kToolOption1 || icon->mOption == kToolOption2 || icon->mOption == kToolOption3) {
+ if (((T2ToolDef *) icon->mPlugin)->mCategoryNo == inCategory) {
+ BOOL added = false;
+ if (icon->mToolDef) {
+ POSITION pos2 = iconList.GetHeadPosition();
+ while (pos2) {
+ POSITION prevPos2 = pos2;
+ T2ToolIconItem *icon2 = iconList.GetNext(pos2);
+ if (icon2->mToolDef && icon2->mToolDef->GetSortKey() > icon->mToolDef->GetSortKey()) {
+ iconList.InsertBefore(prevPos2, icon);
+ added = true;
+ break;
+ }
+ }
+ }
+
+ if (!added)
+ iconList.AddTail(icon);
+ }
+ }
+ }
+
+ pos = iconList.GetHeadPosition();
+ while (pos) {
+ T2ToolIconItem *icon = iconList.GetNext(pos);
+ if (currIndex >= baseIndex && numIcons < kNumTool) {
+ mTools[numIcons]->SetIcon(icon);
+ mTools[numIcons]->ShowWindow(SW_SHOW);
+ numIcons++;
+ }
+ currIndex++;
+ }
+
+ for (; numIcons < kNumTool; numIcons++)
+ mTools[numIcons]->ShowWindow(SW_HIDE);
+
+ currIndex = ((currIndex + m148 - 1) / m148) - 3;
+ if (currIndex < 0)
+ currIndex = 0;
+ mToolScroll->SetScrollRange(currIndex);
+}
+
+void ToolPalette::ChangeCategory() {
+ if (!m124)
+ return;
+
+ for (int i = 0; i < kNumTool; i++)
+ mTools[i]->ShowWindow(SW_HIDE);
+ mToolScroll->SetScrollRange(0);
+}
+
+/*virtual*/ void ToolPalette::RedrawButton() {
+ if (!m124)
+ return;
+
+ int i;
+ for (i = 0; i < kNumCategory; i++)
+ mCategories[i]->InvalidateRect(NULL);
+ for (i = 0; i < kNumTool; i++)
+ mTools[i]->InvalidateRect(NULL);
+ for (i = 0; i < kNumCommand; i++)
+ mCommands[i]->InvalidateRect(NULL);
+}
+
+void ToolPalette::ShowHelpWindow() {
+ HideHelpWindow();
+
+ int mode;
+ switch (mClickedItem->mOption) {
+ case kToolOption0:
+ mode = kToolHelpMode0;
+ break;
+ case kToolOption4:
+ mode = kToolHelpMode1;
+ break;
+ default:
+ mode = kToolHelpMode2;
+ break;
+ }
+
+ RECT rect;
+ GetWindowRect(&rect);
+
+ mToolHelpPt.y = GetSystemMetrics(SM_CYSMSIZE);
+ mToolHelpPt.y += rect.top;
+ mToolHelpPt.x = rect.right + 8;
+ mToolHelpPt.y += m14C[mode];
+
+ CString text;
+ mToolHelpValiation = mClickedItem->mValiation;
+ mToolHelpMode = mode;
+
+ switch (mode) {
+ case kToolHelpMode0:
+ mToolHelpStr2 = mClickedItem->m2C;
+ break;
+ case kToolHelpMode1:
+ mToolHelpStr1 = m15C->mCategoryName;
+ mToolHelpStr2 = m15C->mCategoryCommentString;
+ break;
+ case kToolHelpMode2:
+ mToolHelpDef = m15C;
+ break;
+ }
+
+ mToolHelpWnd = new T2ToolHelpWnd;
+ StartTimer(500);
+}
+
+void ToolPalette::HideHelpWindow() {
+ if (mToolHelpWnd) {
+ mToolHelpWnd->CloseToolHelp();
+ mToolHelpWnd = NULL;
+ }
+ StopTimer();
+}
+
+/*virtual*/ void ToolPalette::OnTimerProc(UINT nIDEvent) {
+ mToolHelpWnd->OpenToolHelp(mToolHelpPt, mToolHelpMode, mToolHelpStr1, mToolHelpStr2, mToolHelpDef, mToolHelpValiation);
+ StopTimer();
+}
+
+ToolHistoryItem *ToolPalette::GetToolHistory(int inID) {
+ ToolHistoryItem *history;
+ POSITION pos = mHistoryList.GetHeadPosition();
+ while (pos) {
+ history = mHistoryList.GetNext(pos);
+ if (history->_4 == inID)
+ return history;
+ }
+
+ history = new ToolHistoryItem;
+ history->_4 = inID;
+ mHistoryList.AddTail(history);
+ return history;
+}
+
+
+ToolHistoryItem::ToolHistoryItem() {
+ _4 = -1;
+ _8 = 0;
+ _C = -1;
+}
+
+/*virtual*/ ToolHistoryItem::~ToolHistoryItem() {
+}
+
+
+
+ToolHistoryList::ToolHistoryList() {
+}
+
+/*virtual*/ ToolHistoryList::~ToolHistoryList() {
+}
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.h b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.h
index 70ecbcc..c36f8dd 100644
--- a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.h
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPalette.h
@@ -1,5 +1,86 @@
#pragma once
-#include "common.h"
+#include "../../../common.h"
+#include "../../../T2DLL/T2ToolWindow.h"
-class ToolPalette {
+class ToolPaletteItem;
+
+class AFX_CLASS_EXPORT ToolHistoryItem {
+public:
+ ToolHistoryItem();
+ virtual ~ToolHistoryItem();
+
+ int _4;
+ int _8;
+ int _C;
+};
+
+class AFX_CLASS_EXPORT ToolHistoryList : public CList<ToolHistoryItem *, ToolHistoryItem *> {
+public:
+ ToolHistoryList();
+ virtual ~ToolHistoryList();
+};
+
+class AFX_CLASS_EXPORT ToolPalette : public T2ToolWindow {
+public:
+ ToolPalette();
+ virtual ~ToolPalette();
+ T2ToolIconItem *ChangeIconItem(T2ToolIconItem *inItem);
+ virtual T2ToolIconItem *EnableIcon(unsigned short inMask);
+ virtual int OnCreateProc(LPCREATESTRUCT lpCreateStruct);
+ virtual BOOL OnEraseBkgndProc(CDC *pDC);
+ virtual void OnSizeProc(UINT nType, int cx, int cy);
+ void UpdateScroll(ToolPaletteItem *inItem);
+ void UpdateCommand();
+ void UpdateCategory();
+ void UpdateTool();
+ virtual void OnTimerProc(UINT nIDEvent);
+ virtual void RedrawButton();
+ virtual void ItemCallbackDown(ToolPaletteItem *inItem);
+ virtual void ItemCallbackUp(ToolPaletteItem *inItem);
+
+ enum {
+ kNumCommand = 7,
+ kNumCategory = 9,
+ kNumTool = 12
+ };
+
+ T2ImageObj *mImageObj;
+ BOOL m124;
+ T2BitImage *mImage;
+ CString mWndClass;
+ CSize mSize130;
+ CSize mSize138;
+ int m140;
+ int m144;
+ int m148;
+ int m14C[3];
+ T2ToolIconItem *mClickedItem;
+ T2ToolDef *m15C;
+ POINT mToolHelpPt;
+ ToolHistoryList mHistoryList;
+ int _184;
+ ToolPaletteItem *mCommands[kNumCommand];
+ ToolPaletteItem *mCategoryTitle;
+ ToolPaletteItem *mCategories[kNumCategory];
+ ToolPaletteItem *mCategoryScroll;
+ ToolPaletteItem *mToolTitle;
+ ToolPaletteItem *mTools[kNumTool];
+ ToolPaletteItem *mToolScroll;
+ T2ToolHelpWnd *mToolHelpWnd;
+ CString mToolHelpStr1;
+ CString mToolHelpStr2;
+ T2ToolDef *mToolHelpDef;
+ int mToolHelpValiation;
+ int mToolHelpMode;
+
+protected:
+ virtual void Updated();
+ virtual void ListUpdated();
+ ToolHistoryItem *GetToolHistory(int inID);
+
+private:
+ void ChangeCategory(int inCategory);
+ void ChangeCategory();
+ void ShowHelpWindow();
+ void HideHelpWindow();
};
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.cpp b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.cpp
index ad675b8..f4993fc 100644
--- a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.cpp
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.cpp
@@ -1,7 +1,269 @@
+#include "StdAfx.h"
+#include "ToolPalette.h"
#include "ToolPaletteItem.h"
+#include "../../../T2DLL/T2ImageObj.h"
+#include "../../../T2DLL/T2ToolWindow.h"
+#include "../../../T2DLL/T2WorldDef.h"
+#include "../../../T2TowerDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+
+ToolPaletteItem::ToolPaletteItem() {
+}
+
+ToolPaletteItem::ToolPaletteItem(T2TowerDoc *inDoc, int inMode) {
+ ToolPaletteItem();
+
+ mIcon = NULL;
+ mMode = inMode;
+ mDocument = inDoc;
+ mPalette = inDoc->mWorldDef->GetPalette();
+ mStatus = 0;
+ mScrollPos = 0;
+ mScrollRange = 0;
+ mOption = 0;
+
+ if (inMode == kTPIMode2)
+ mStatus = 22;
+}
+
+/*virtual*/ ToolPaletteItem::~ToolPaletteItem() {
+}
+
+BEGIN_MESSAGE_MAP(ToolPaletteItem, CWnd)
+ //{{AFX_MSG_MAP(ToolPaletteItem)
+ ON_WM_ERASEBKGND()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONUP()
+ ON_WM_MOUSEMOVE()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/*virtual*/ int ToolPaletteItem::GetScrollPos() {
+ return mScrollPos;
+}
+
+/*virtual*/ void ToolPaletteItem::SetScrollRange(int inRange) {
+ if (mScrollRange != inRange) {
+ mScrollRange = inRange;
+ SetScrollStatus(false, false);
+ if (mScrollPos > mScrollRange)
+ mScrollPos = mScrollRange;
+
+ ((ToolPalette *) GetParent())->ItemCallbackDown(this);
+ }
+}
+
+/*virtual*/ void ToolPaletteItem::SetScrollPos(int inPos) {
+ if (mScrollPos != inPos)
+ mScrollPos = inPos;
+}
+
+void ToolPaletteItem::SetScrollStatus(BOOL inLeftPressed, BOOL inRightPressed) {
+ int theStatusL = inLeftPressed ? 1 : 0;
+ int theStatusR = inRightPressed ? 1 : 0;
+ if (mScrollPos == 0)
+ theStatusL = 2;
+ if (mScrollPos == mScrollRange)
+ theStatusR = 2;
+ mStatus = theStatusL * 10 + theStatusR;
+ InvalidateRect(NULL);
+}
+
+/*virtual*/ void ToolPaletteItem::SetStatus(int inStatus) {
+ mStatus = inStatus;
+ InvalidateRect(NULL);
+}
+
+/*virtual*/ int ToolPaletteItem::GetOption() {
+ return mOption;
+}
+
+/*virtual*/ void ToolPaletteItem::SetOption(int inOption) {
+ mOption = inOption;
+}
+
+/*virtual*/ void ToolPaletteItem::SetIcon(T2ToolIconItem *inItem) {
+ mIcon = inItem;
+ InvalidateRect(NULL);
+}
+
+/*virtual*/ void ToolPaletteItem::SetText(const char *inText) {
+ SetWindowText(inText);
+}
+
+/*virtual*/ int ToolPaletteItem::GetMode() {
+ return mMode;
+}
+
+/*virtual*/ T2ToolIconItem *ToolPaletteItem::GetIcon() {
+ return mIcon;
+}
+
+BOOL ToolPaletteItem::OnEraseBkgnd(CDC *pDC) {
+ CRect clientRect;
+ GetClientRect(clientRect);
+
+ int save = pDC->SaveDC();
+ pDC->SelectPalette(mPalette, false);
+ pDC->RealizePalette();
+
+ CBrush brush;
+ CPen pen;
+ CFont font;
+
+ if (mMode == kTPIMode1 && mIcon->mName != "") {
+ int pattern = mIcon->mValiation * 10;
+ if (mIcon->m30) {
+ if (mIcon->mEnableCount > 0)
+ pattern += 2;
+ else
+ pattern += mIcon->m24 ? 1 : 0;
+ } else {
+ pattern += 2;
+ }
+
+ int index = mDocument->mWorldDef->m1D0->FindObject(mIcon->mName, pattern);
+ if (index < 0) {
+ if (mIcon->m30) {
+ if (mIcon->mEnableCount > 0) {
+ pattern -= 2;
+ index = mDocument->mWorldDef->m1D0->FindObject(mIcon->mName, pattern);
+ }
+ } else {
+ pattern -= 2;
+ index = mDocument->mWorldDef->m1D0->FindObject(mIcon->mName, pattern);
+ }
+ }
+
+#line 172
+ _ASSERT(index >= 0);
+
+ mDocument->mWorldDef->m1D0->DrawObject(pDC, index, clientRect);
+
+ } else if (mMode == kTPIMode0) {
+ brush.CreateSolidBrush(PALETTERGB(255, 255, 255));
+ pen.CreateStockObject(BLACK_PEN);
+
+ pDC->SelectObject(brush);
+ pDC->SelectObject(pen);
+ pDC->Rectangle(clientRect);
+
+ CString text;
+ GetWindowText(text);
+
+ int currWidth, width;
+ currWidth = width = clientRect.Width();
+
+ unsigned int textLen = strlen(text);
+ if (textLen > 8)
+ currWidth /= textLen;
+ else
+ currWidth = 7;
+
+ currWidth = -currWidth;
+
+ CRect theRect;
+ BOOL isWidthFinish = false;
+ while (!isWidthFinish) {
+ theRect = clientRect;
+ theRect.top += 1;
+ theRect.left += 1;
+ theRect.bottom -= 1;
+ theRect.right -= 1;
+
+ font.CreateFont(-15, currWidth, 0, 0, FW_DONTCARE, false, false, false, DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, DRAFT_QUALITY, FIXED_PITCH, "\x82\x6C\x82\x72 \x83\x53\x83\x56\x83\x62\x83\x4E");
+ pDC->SelectObject(font);
+ pDC->SetTextColor(RGB(0, 0, 0));
+ pDC->SetBkMode(TRANSPARENT);
+ pDC->DrawText(text, theRect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
+ if (width >= theRect.Width())
+ isWidthFinish = true;
+ else
+ currWidth++;
+ }
+
+ int textWidth = theRect.Width();
+ int textHeight = theRect.Height();
+
+ TEXTMETRIC textMetric;
+ pDC->GetTextMetrics(&textMetric);
+
+ CPoint textCenterPt = clientRect.CenterPoint();
+ theRect.top = textCenterPt.y - textHeight / 2;
+ theRect.bottom = theRect.top + textHeight;
+ theRect.left = textCenterPt.x - textWidth / 2;
+ theRect.right = theRect.left + textWidth;
+
+ pDC->DrawText(text, theRect, DT_CENTER | DT_WORDBREAK | DT_NOPREFIX);
+ } else if (mMode == kTPIMode2) {
+ T2ImageObj *theImageObj = ((ToolPalette *) GetParent())->mImageObj;
+ int index = theImageObj->FindObject("ScrollButton", mStatus);
+ theImageObj->DrawObject(pDC, index, clientRect);
+ } else {
+ brush.CreateSolidBrush(PALETTERGB(255, 255, 255));
+ pen.CreateStockObject(BLACK_PEN);
+
+ pDC->SelectObject(brush);
+ pDC->SelectObject(pen);
+ pDC->Rectangle(clientRect);
+ }
+
+ pDC->RestoreDC(save);
+ return true;
+}
+
+void ToolPaletteItem::OnLButtonDown(UINT nFlags, CPoint point) {
+ SetCapture();
+
+ switch (mMode) {
+ case kTPIMode1:
+ ((ToolPalette *) GetParent())->ItemCallbackDown(this);
+ break;
+ case kTPIMode2:
+ if (point.x < 38)
+ SetScrollStatus(true, false);
+ else
+ SetScrollStatus(false, true);
+ break;
+ }
+}
+
+void ToolPaletteItem::OnLButtonUp(UINT nFlags, CPoint point) {
+ if (mMode == kTPIMode1)
+ ((ToolPalette *) GetParent())->ItemCallbackUp(this);
+
+ if (mMode == kTPIMode2) {
+ BOOL changed = false;
+ if (point.x < 38) {
+ if (mScrollPos != 0) {
+ mScrollPos--;
+ changed = true;
+ }
+ } else {
+ if (mScrollPos < mScrollRange) {
+ mScrollPos++;
+ changed = true;
+ }
+ }
+
+ if (changed)
+ ((ToolPalette *) GetParent())->UpdateScroll(this);
+
+ SetScrollStatus(false, false);
+ }
+
+ if (::GetCapture() == m_hWnd)
+ ReleaseCapture();
+}
+
+void ToolPaletteItem::OnMouseMove(UINT nFlags, CPoint point) {
+ CWinApp *app = AfxGetApp();
+ HCURSOR cursorH = app->LoadStandardCursor(IDC_ARROW);
+ if (cursorH)
+ SetCursor(cursorH);
+}
diff --git a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.h b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.h
index bee9108..b119b17 100644
--- a/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.h
+++ b/src/Plugins/ToolPalette/DefaultToolPalette/ToolPaletteItem.h
@@ -1,5 +1,50 @@
#pragma once
-#include "common.h"
+#include "../../../common.h"
-class ToolPaletteItem {
+enum {
+ kTPIMode0 = 0,
+ kTPIMode1 = 1,
+ kTPIMode2 = 2
+};
+
+class AFX_CLASS_EXPORT ToolPaletteItem : public CWnd {
+protected:
+ ToolPaletteItem();
+public:
+ ToolPaletteItem(T2TowerDoc *inDoc, int inMode);
+ virtual ~ToolPaletteItem();
+
+ virtual void SetIcon(T2ToolIconItem *inItem);
+ virtual void SetText(const char *inText);
+ virtual void SetScrollRange(int inRange);
+ virtual void SetScrollPos(int inPos);
+ virtual void SetStatus(int inStatus);
+ virtual int GetOption();
+ virtual void SetOption(int inOption);
+ virtual int GetScrollPos();
+ virtual int GetMode();
+ virtual T2ToolIconItem *GetIcon();
+
+ int mMode;
+ T2TowerDoc *mDocument;
+ CPalette *mPalette;
+ T2ToolIconItem *mIcon;
+ int mStatus;
+ int mOption;
+ int mScrollPos;
+ int mScrollRange;
+
+ //{{AFX_VIRTUAL(ToolPaletteItem)
+ //}}AFX_VIRTUAL
+
+protected:
+ void SetScrollStatus(BOOL inLeftPressed, BOOL inRightPressed);
+
+ //{{AFX_MSG(ToolPaletteItem)
+ afx_msg BOOL OnEraseBkgnd(CDC *pDC);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
};