123
This commit is contained in:
28
CrySystem/LuaDebugger/AboutWnd.h
Normal file
28
CrySystem/LuaDebugger/AboutWnd.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef __ABOUT_WND_H__
|
||||
#define __ABOUT_WND_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
class CAboutWnd : public _TinyDialog
|
||||
{
|
||||
public:
|
||||
BOOL Create(_TinyWindow *pParent = NULL)
|
||||
{ return _TinyDialog::Create(MAKEINTRESOURCE(IDD_ABOUTBOX), pParent); };
|
||||
BOOL DoModal(_TinyWindow *pParent = NULL)
|
||||
{ return _TinyDialog::DoModal(MAKEINTRESOURCE(IDD_ABOUTBOX), pParent); };
|
||||
|
||||
protected:
|
||||
_BEGIN_DLG_MSG_MAP(_TinyDialog)
|
||||
_BEGIN_COMMAND_HANDLER()
|
||||
_COMMAND_HANDLER(IDOK, OnOk)
|
||||
_END_COMMAND_HANDLER()
|
||||
_END_DLG_MSG_MAP()
|
||||
|
||||
LRESULT OnOk(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyVerify(EndDialog(hWnd, 0));
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
2
CrySystem/LuaDebugger/FileTree.cpp
Normal file
2
CrySystem/LuaDebugger/FileTree.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "stdafx.h"
|
||||
#include "FileTree.h"
|
||||
85
CrySystem/LuaDebugger/FileTree.h
Normal file
85
CrySystem/LuaDebugger/FileTree.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifndef __FILE_TREE_H__
|
||||
#define __FILE_TREE_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "_TinyMain.h"
|
||||
#include "_TinyWindow.h"
|
||||
#include "_TinyFileEnum.h"
|
||||
#include "_TinyImageList.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "..\resource.h"
|
||||
|
||||
class CFileTree : public _TinyTreeView {
|
||||
public:
|
||||
CFileTree() { m_iID = 0; };
|
||||
virtual ~CFileTree() { };
|
||||
|
||||
BOOL Create(const _TinyRect& rcWnd, _TinyWindow *pParent = NULL, UINT iID = NULL) {
|
||||
m_iID = iID;
|
||||
_TinyVerify(_TinyTreeView::Create(iID, WS_CHILD | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT |
|
||||
WS_VISIBLE, WS_EX_CLIENTEDGE, &rcWnd, pParent));
|
||||
m_cTreeIcons.CreateFromBitmap(MAKEINTRESOURCE(IDB_TREE_VIEW), 16);
|
||||
SetImageList(m_cTreeIcons.GetHandle());
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void ScanFiles(char *pszRootPath) {
|
||||
HTREEITEM hRoot = _TinyTreeView::AddItemToTree(pszRootPath, NULL, NULL, 2);
|
||||
EnumerateScripts(hRoot, pszRootPath);
|
||||
Expand(hRoot);
|
||||
};
|
||||
|
||||
const char * GetCurItemFileName() {
|
||||
HTREEITEM hCurSel = NULL;
|
||||
LPARAM nIdx;
|
||||
hCurSel = _TinyTreeView::GetSelectedItem();
|
||||
if (!hCurSel)
|
||||
return NULL;
|
||||
nIdx = _TinyTreeView::GetItemUserData(hCurSel);
|
||||
if ((size_t) nIdx > m_vFileNameTbl.size() - 1)
|
||||
return NULL;
|
||||
return m_vFileNameTbl[nIdx].c_str();
|
||||
};
|
||||
|
||||
protected:
|
||||
_TinyImageList m_cTreeIcons;
|
||||
INT m_iID;
|
||||
std::vector<string> m_vFileNameTbl;
|
||||
|
||||
void EnumerateScripts(HTREEITEM hRoot, char *pszEnumPath) {
|
||||
_TinyFileEnum cScripts;
|
||||
__finddata64_t sCurFile;
|
||||
char szPath[_MAX_PATH];
|
||||
char szFullFilePath[_MAX_PATH];
|
||||
HTREEITEM hItem = NULL;
|
||||
|
||||
if (!cScripts.StartEnumeration(pszEnumPath, "*", &sCurFile))
|
||||
return;
|
||||
|
||||
while (cScripts.GetNextFile(&sCurFile)) {
|
||||
if (_stricmp(sCurFile.name, "..") == 0)
|
||||
continue;
|
||||
if (_stricmp(sCurFile.name, ".") == 0)
|
||||
continue;
|
||||
|
||||
sprintf(szFullFilePath, "%s%s", pszEnumPath, sCurFile.name);
|
||||
m_vFileNameTbl.push_back(szFullFilePath);
|
||||
|
||||
if (sCurFile.attrib & _A_SUBDIR) {
|
||||
hItem = AddItemToTree(sCurFile.name, (LPARAM) m_vFileNameTbl.size() - 1, hRoot, 0);
|
||||
sprintf(szPath, "%s%s\\", pszEnumPath, sCurFile.name);
|
||||
EnumerateScripts(hItem, szPath);
|
||||
} else {
|
||||
if (strstr(_strlwr(sCurFile.name), ".lua"))
|
||||
hItem = AddItemToTree(sCurFile.name, (LPARAM) m_vFileNameTbl.size() - 1, hRoot, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
761
CrySystem/LuaDebugger/LUADBG.cpp
Normal file
761
CrySystem/LuaDebugger/LUADBG.cpp
Normal file
@@ -0,0 +1,761 @@
|
||||
// LUADBG.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "LUADBG.h"
|
||||
#include "_TinyRegistry.h"
|
||||
#include "_TinyFileEnum.h"
|
||||
#include "_TinyBrowseFolder.h"
|
||||
#include "AboutWnd.h"
|
||||
#include <ICryPak.h>
|
||||
|
||||
#include <direct.h>
|
||||
#ifndef WIN64
|
||||
#include "Shlwapi.h"
|
||||
#pragma comment (lib, "Shlwapi.lib")
|
||||
#endif
|
||||
|
||||
_TINY_DECLARE_APP();
|
||||
|
||||
CLUADbg::CLUADbg()
|
||||
{
|
||||
m_pIScriptSystem = NULL;
|
||||
m_pIPak = NULL;
|
||||
m_pIVariable = NULL;
|
||||
m_hRoot = NULL;
|
||||
m_bDisabled = false;
|
||||
m_pTreeToAdd = NULL;
|
||||
}
|
||||
|
||||
CLUADbg::~CLUADbg()
|
||||
{
|
||||
_TinyRegistry cTReg;
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "MainHorzSplitter", m_wndMainHorzSplitter.GetSplitterPos()));
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "SrcEditSplitter", m_wndSrcEditSplitter.GetSplitterPos()));
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "WatchSplitter", m_wndWatchSplitter.GetSplitterPos()));
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "WatchCallstackSplitter", m_wndWatchCallstackSplitter.GetSplitterPos()));
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "Fullscreen", ::IsZoomed(m_hWnd) ? 1 : 0));
|
||||
}
|
||||
|
||||
TBBUTTON tbButtonsAdd [] =
|
||||
{
|
||||
{ 0, ID_DEBUG_RUN, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
{ 1, ID_DEBUG_BREAK, 0, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
{ 2, ID_DEBUG_STOP, 0, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
|
||||
{ 0, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0L, 0 },
|
||||
|
||||
{ 3, ID_DEBUG_STEPINTO, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
{ 4, ID_DEBUG_STEPOVER, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
{ 5, ID_DEBUG_TOGGLEBREAKPOINT, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
{ 6, ID_DEBUG_DISABLE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
|
||||
{ 0, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0L, 0 },
|
||||
|
||||
{ 7, IDM_ABOUT, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0L, 0 },
|
||||
};
|
||||
|
||||
|
||||
//! add a backslash if needed
|
||||
inline void MyPathAddBackslash( char* szPath )
|
||||
{
|
||||
if(szPath[0]==0)
|
||||
return;
|
||||
|
||||
size_t nLen = strlen(szPath);
|
||||
|
||||
if (szPath[nLen-1] == '\\')
|
||||
return;
|
||||
|
||||
if (szPath[nLen-1] == '/')
|
||||
{
|
||||
szPath[nLen-1] = '\\';
|
||||
return;
|
||||
}
|
||||
|
||||
szPath[nLen] = '\\';
|
||||
szPath[nLen+1] = '\0';
|
||||
}
|
||||
|
||||
|
||||
LRESULT CLUADbg::OnCreate(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyRect erect;
|
||||
_TinyRect lrect;
|
||||
_TinyRect wrect;
|
||||
_TinyRegistry cTReg;
|
||||
|
||||
DWORD dwXOrigin=0,dwYOrigin=0,dwXSize=800,dwYSize=600;
|
||||
if(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "XOrigin",dwXOrigin))
|
||||
{
|
||||
cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "YOrigin",dwYOrigin);
|
||||
cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "XSize",dwXSize);
|
||||
cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "YSize",dwYSize);
|
||||
}
|
||||
|
||||
SetWindowPos(dwXOrigin, dwYOrigin, dwXSize, dwYSize, SWP_NOZORDER | SWP_NOMOVE);
|
||||
// TODO: Make sure fullscreen flag is loaded and used
|
||||
// WS_MAXIMIZE
|
||||
// DWORD dwFullscreen = 0;
|
||||
// cTReg.ReadNumber("Software\\Tiny\\LuaDebugger\\", "Fullscreen", dwFullscreen);
|
||||
// if (dwFullscreen == 1)
|
||||
// ShowWindow(SW_MAXIMIZE);
|
||||
CenterOnScreen();
|
||||
GetClientRect(&wrect);
|
||||
|
||||
erect=wrect;
|
||||
erect.top=0;
|
||||
erect.bottom=32;
|
||||
m_wToolbar.Create((ULONG_PTR) GetMenu(m_hWnd), WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS, 0, &erect, this); //AMD Port
|
||||
m_wToolbar.AddButtons(IDC_LUADBG, tbButtonsAdd, 10);
|
||||
|
||||
m_wndStatus.Create(0, NULL, this);
|
||||
|
||||
// Client area window
|
||||
_TinyVerify(m_wndClient.Create(NULL, _T(""), WS_CHILD | WS_VISIBLE, 0, &wrect, this));
|
||||
m_wndClient.NotifyReflection(TRUE);
|
||||
|
||||
// Splitter dividing source/file and watch windows
|
||||
m_wndMainHorzSplitter.Create(&m_wndClient, NULL, NULL, true);
|
||||
|
||||
// Divides source and file view
|
||||
m_wndSrcEditSplitter.Create(&m_wndMainHorzSplitter);
|
||||
|
||||
// Divides two watch windows
|
||||
m_wndWatchSplitter.Create(&m_wndMainHorzSplitter);
|
||||
|
||||
// Divides the watch window and the cllstack
|
||||
m_wndWatchCallstackSplitter.Create(&m_wndWatchSplitter);
|
||||
|
||||
// Add all scripts to the file tree
|
||||
m_wFilesTree.Create(erect, &m_wndSrcEditSplitter, IDC_FILES);
|
||||
char szRootPath[_MAX_PATH];
|
||||
_getcwd(szRootPath, _MAX_PATH);
|
||||
MyPathAddBackslash(szRootPath);
|
||||
strcat(szRootPath, "SCRIPTS\\");
|
||||
m_wFilesTree.ScanFiles(szRootPath);
|
||||
|
||||
_TinyVerify(m_wScriptWindow.Create(WS_VISIBLE | WS_CHILD | ES_WANTRETURN | WS_HSCROLL | WS_VSCROLL |
|
||||
ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE, 0, &erect, &m_wndSrcEditSplitter));
|
||||
m_wScriptWindow.SendMessage(EM_SETEVENTMASK,0,ENM_SCROLL);
|
||||
|
||||
m_wndFileViewCaption.Create("Scripts", &m_wFilesTree, &m_wndSrcEditSplitter);
|
||||
m_wndSourceCaption.Create("Source", &m_wScriptWindow, &m_wndSrcEditSplitter);
|
||||
m_wndSrcEditSplitter.SetFirstPan(&m_wndFileViewCaption);
|
||||
m_wndSrcEditSplitter.SetSecondPan(&m_wndSourceCaption);
|
||||
|
||||
m_wLocals.Create(IDC_LOCALS,WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|WS_VISIBLE,WS_EX_CLIENTEDGE,&erect, &m_wndWatchSplitter);
|
||||
m_wWatch.Create(IDC_WATCH,WS_CHILD|WS_VISIBLE|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT,WS_EX_CLIENTEDGE,&erect, &m_wndWatchSplitter);
|
||||
m_wCallstack.Create(0,WS_CHILD|WS_VISIBLE|LVS_REPORT,WS_EX_CLIENTEDGE,&erect, &m_wndWatchSplitter);
|
||||
|
||||
m_wndLocalsCaption.Create("Locals", &m_wLocals, &m_wndWatchSplitter);
|
||||
m_wndWatchCaption.Create("Watch", &m_wWatch, &m_wndWatchCallstackSplitter);
|
||||
m_wndCallstackCaption.Create("Callstack", &m_wCallstack, &m_wndWatchCallstackSplitter);
|
||||
|
||||
m_wndWatchSplitter.SetFirstPan(&m_wndWatchCallstackSplitter);
|
||||
|
||||
m_wndWatchCallstackSplitter.SetFirstPan(&m_wndWatchCaption);
|
||||
m_wndWatchCallstackSplitter.SetSecondPan(&m_wndCallstackCaption);
|
||||
|
||||
m_wndWatchSplitter.SetSecondPan(&m_wndLocalsCaption);
|
||||
|
||||
m_wndMainHorzSplitter.SetFirstPan(&m_wndSrcEditSplitter);
|
||||
m_wndMainHorzSplitter.SetSecondPan(&m_wndWatchSplitter);
|
||||
|
||||
Reshape(wrect.right-wrect.left,wrect.bottom-wrect.top);
|
||||
|
||||
// Read splitter window locations from registry
|
||||
DWORD dwVal;
|
||||
cTReg.ReadNumber("Software\\Tiny\\LuaDebugger\\", "MainHorzSplitter", dwVal, 150);
|
||||
m_wndMainHorzSplitter.SetSplitterPos(dwVal);
|
||||
m_wndMainHorzSplitter.Reshape();
|
||||
cTReg.ReadNumber("Software\\Tiny\\LuaDebugger\\", "SrcEditSplitter", dwVal, 190);
|
||||
m_wndSrcEditSplitter.SetSplitterPos(dwVal);
|
||||
m_wndSrcEditSplitter.Reshape();
|
||||
cTReg.ReadNumber("Software\\Tiny\\LuaDebugger\\", "WatchSplitter", dwVal, wrect.right / 3 * 2);
|
||||
m_wndWatchSplitter.SetSplitterPos(dwVal);
|
||||
m_wndWatchSplitter.Reshape();
|
||||
cTReg.ReadNumber("Software\\Tiny\\LuaDebugger\\", "WatchCallstackSplitter", dwVal, wrect.right / 3);
|
||||
m_wndWatchCallstackSplitter.SetSplitterPos(dwVal);
|
||||
m_wndWatchCallstackSplitter.Reshape();
|
||||
|
||||
m_wCallstack.InsertColumn(0, "Function", 108, 0);
|
||||
m_wCallstack.InsertColumn(1, "Line", 40, 1);
|
||||
m_wCallstack.InsertColumn(2, "File", 108, 2);
|
||||
|
||||
//_TinyVerify(LoadFile("C:\\MASTERCD\\SCRIPTS\\Default\\Entities\\PLAYER\\BasicPlayer.lua"));
|
||||
//_TinyVerify(LoadFile("C:\\MASTERCD\\SCRIPTS\\Default\\Entities\\PLAYER\\player.lua"));
|
||||
// _TINY_CHECK_LAST_ERROR
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CLUADbg::LoadFile(const char *pszFile, bool bForceReload)
|
||||
{
|
||||
FILE *hFile = NULL;
|
||||
char *pszScript = NULL, *pszFormattedScript = NULL;
|
||||
UINT iLength, iCmpBufPos, iSrcBufPos, iDestBufPos, iNumChars, iStrStartPos, iCurKWrd, i;
|
||||
char szCmpBuf[2048];
|
||||
bool bIsKeyWord;
|
||||
string strLuaFormatFileName = "@";
|
||||
char szMasterCD[_MAX_PATH];
|
||||
|
||||
// Create lua specific filename and check if we already have that file loaded
|
||||
_getcwd(szMasterCD, _MAX_PATH);
|
||||
if (strncmp(szMasterCD, pszFile, strlen(szMasterCD) - 1) == 0)
|
||||
{
|
||||
strLuaFormatFileName += &pszFile[strlen(szMasterCD) + 1];
|
||||
for (i=0; i<strLuaFormatFileName.length(); i++)
|
||||
if (strLuaFormatFileName[i] == '\\')
|
||||
strLuaFormatFileName[i] = '/';
|
||||
std::transform(strLuaFormatFileName.begin(), strLuaFormatFileName.end(),
|
||||
strLuaFormatFileName.begin(), (int (*) (int)) tolower);
|
||||
}
|
||||
else
|
||||
strLuaFormatFileName += pszFile;
|
||||
|
||||
if (bForceReload == false && m_wScriptWindow.GetSourceFile() == strLuaFormatFileName)
|
||||
return true;
|
||||
|
||||
m_wScriptWindow.SetSourceFile(strLuaFormatFileName.c_str());
|
||||
|
||||
|
||||
// hFile = fopen(pszFile, "rb");
|
||||
hFile = m_pIPak->FOpen(pszFile, "rb");
|
||||
|
||||
if (!hFile)
|
||||
return false;
|
||||
|
||||
// set filename in window title
|
||||
{
|
||||
char str[_MAX_PATH];
|
||||
|
||||
sprintf(str,"Lua Debugger [%s]",pszFile);
|
||||
SetWindowText(str);
|
||||
}
|
||||
|
||||
// Get file size
|
||||
// fseek(hFile, 0, SEEK_END);
|
||||
m_pIPak->FSeek(hFile, 0, SEEK_END);
|
||||
// iLength = ftell(hFile);
|
||||
iLength = m_pIPak->FTell(hFile);
|
||||
// fseek(hFile, 0, SEEK_SET);
|
||||
m_pIPak->FSeek(hFile, 0, SEEK_SET);
|
||||
|
||||
pszScript = new char [iLength + 1];
|
||||
pszFormattedScript = new char [512 + iLength * 3];
|
||||
|
||||
// _TinyVerify(fread(pszScript, iLength, 1, hFile) == 1);
|
||||
_TinyVerify(m_pIPak->FRead(pszScript, iLength, 1, hFile) == 1);
|
||||
pszScript[iLength] = '\0';
|
||||
_TinyAssert(strlen(pszScript) == iLength);
|
||||
|
||||
// RTF text, font Courier, green comments and blue keyword
|
||||
strcpy(pszFormattedScript, "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033" \
|
||||
"{\\fonttbl{\\f0\\fmodern\\fprq1\\fcharset0 Courier(PS);}{\\f1\\fswiss\\fcharset0 Arial;}}" \
|
||||
"{\\colortbl ;\\red0\\green0\\blue255;\\red0\\green128\\blue0;\\red160\\green160\\blue160;}\\f0\\fs20");
|
||||
|
||||
const char szKeywords[][32] =
|
||||
{
|
||||
"function",
|
||||
"do",
|
||||
"for",
|
||||
"end",
|
||||
"and",
|
||||
"or",
|
||||
"not",
|
||||
"while",
|
||||
"return",
|
||||
"if",
|
||||
"then",
|
||||
"else",
|
||||
"elseif",
|
||||
"self",
|
||||
"local",
|
||||
"in",
|
||||
"nil",
|
||||
"repeat",
|
||||
"until",
|
||||
"break",
|
||||
};
|
||||
|
||||
// Format text with syntax coloring
|
||||
iDestBufPos = strlen(pszFormattedScript);
|
||||
|
||||
iSrcBufPos = 0;
|
||||
while (pszScript[iSrcBufPos] != '\0')
|
||||
{
|
||||
// Scan next token
|
||||
iNumChars = 1;
|
||||
iStrStartPos = iSrcBufPos;
|
||||
while (pszScript[iSrcBufPos] != ' ' &&
|
||||
pszScript[iSrcBufPos] != '\n' &&
|
||||
pszScript[iSrcBufPos] != '\r' &&
|
||||
pszScript[iSrcBufPos] != '\t' &&
|
||||
pszScript[iSrcBufPos] != '\0' &&
|
||||
pszScript[iSrcBufPos] != '(' &&
|
||||
pszScript[iSrcBufPos] != ')' &&
|
||||
pszScript[iSrcBufPos] != '[' &&
|
||||
pszScript[iSrcBufPos] != ']' &&
|
||||
pszScript[iSrcBufPos] != '{' &&
|
||||
pszScript[iSrcBufPos] != '}' &&
|
||||
pszScript[iSrcBufPos] != ',' &&
|
||||
pszScript[iSrcBufPos] != '.' &&
|
||||
pszScript[iSrcBufPos] != ';' &&
|
||||
pszScript[iSrcBufPos] != ':' &&
|
||||
pszScript[iSrcBufPos] != '=' &&
|
||||
pszScript[iSrcBufPos] != '==' &&
|
||||
pszScript[iSrcBufPos] != '*' &&
|
||||
pszScript[iSrcBufPos] != '+' &&
|
||||
pszScript[iSrcBufPos] != '/' &&
|
||||
pszScript[iSrcBufPos] != '~' &&
|
||||
pszScript[iSrcBufPos] != '"')
|
||||
{
|
||||
iSrcBufPos++;
|
||||
iNumChars++;
|
||||
|
||||
// Special treatment of '-' to allow parsing of '--'
|
||||
if (pszScript[iSrcBufPos - 1] == '-' && pszScript[iSrcBufPos] != '-')
|
||||
break;
|
||||
}
|
||||
if (iNumChars == 1)
|
||||
iSrcBufPos++;
|
||||
else
|
||||
iNumChars--;
|
||||
|
||||
// Copy token and add escapes
|
||||
iCmpBufPos = 0;
|
||||
for (i=iStrStartPos; i<iStrStartPos + iNumChars; i++)
|
||||
{
|
||||
_TinyAssert(i - iStrStartPos < sizeof(szCmpBuf));
|
||||
|
||||
if (pszScript[i] == '{' || pszScript[i] == '}' || pszScript[i] == '\\')
|
||||
{
|
||||
// Add \ to mark it as non-escape character
|
||||
szCmpBuf[iCmpBufPos++] = '\\';
|
||||
szCmpBuf[iCmpBufPos++] = pszScript[i];
|
||||
szCmpBuf[iCmpBufPos] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
szCmpBuf[iCmpBufPos++] = pszScript[i];
|
||||
szCmpBuf[iCmpBufPos] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
// Comment
|
||||
if (strncmp(szCmpBuf, "--", 2) == 0)
|
||||
{
|
||||
// Green
|
||||
strcat(pszFormattedScript, "\\cf2 ");
|
||||
|
||||
iDestBufPos += 5;
|
||||
|
||||
strcpy(&pszFormattedScript[iDestBufPos], szCmpBuf);
|
||||
iDestBufPos += strlen(szCmpBuf);
|
||||
|
||||
// Parse until newline
|
||||
while (pszScript[iSrcBufPos] != '\n' && pszScript[iSrcBufPos] != '\0')
|
||||
{
|
||||
pszFormattedScript[iDestBufPos++] = pszScript[iSrcBufPos++];
|
||||
}
|
||||
iSrcBufPos++;
|
||||
pszFormattedScript[iDestBufPos] = '\0';
|
||||
|
||||
// Add newline and restore color
|
||||
strcat(pszFormattedScript, "\\par\n");
|
||||
iDestBufPos += 5;
|
||||
strcat(pszFormattedScript, "\\cf0 ");
|
||||
iDestBufPos += 5;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// String
|
||||
if (strncmp(szCmpBuf, "\"", 2) == 0)
|
||||
{
|
||||
// Gray
|
||||
strcat(pszFormattedScript, "\\cf3 ");
|
||||
iDestBufPos += 5;
|
||||
|
||||
strcpy(&pszFormattedScript[iDestBufPos], szCmpBuf);
|
||||
iDestBufPos += strlen(szCmpBuf);
|
||||
|
||||
// Parse until end string / newline
|
||||
while (pszScript[iSrcBufPos] != '\n' && pszScript[iSrcBufPos] != '\0' && pszScript[iSrcBufPos] != '"')
|
||||
{
|
||||
pszFormattedScript[iDestBufPos++] = pszScript[iSrcBufPos++];
|
||||
}
|
||||
iSrcBufPos++;
|
||||
pszFormattedScript[iDestBufPos] = '\0';
|
||||
|
||||
// Add literal
|
||||
strcat(pszFormattedScript, "\"");
|
||||
iDestBufPos += 1;
|
||||
|
||||
// Restore color
|
||||
strcat(pszFormattedScript, "\\cf0 ");
|
||||
iDestBufPos += 5;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Have we parsed a keyword ?
|
||||
bIsKeyWord = false;
|
||||
for (iCurKWrd=0; iCurKWrd<sizeof(szKeywords) / sizeof(szKeywords[0]); iCurKWrd++)
|
||||
{
|
||||
if (strcmp(szKeywords[iCurKWrd], szCmpBuf) == 0)
|
||||
{
|
||||
strcat(pszFormattedScript, "\\cf1 ");
|
||||
strcat(pszFormattedScript, szKeywords[iCurKWrd]);
|
||||
strcat(pszFormattedScript, "\\cf0 ");
|
||||
iDestBufPos += 5 + 5 + strlen(szKeywords[iCurKWrd]);
|
||||
bIsKeyWord = true;
|
||||
}
|
||||
}
|
||||
if (bIsKeyWord)
|
||||
continue;
|
||||
|
||||
if (strcmp(szCmpBuf, "\n") == 0)
|
||||
{
|
||||
// Newline
|
||||
strcat(pszFormattedScript, "\\par ");
|
||||
iDestBufPos += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Anything else, just append
|
||||
iDestBufPos += strlen(szCmpBuf);
|
||||
strcat(pszFormattedScript, szCmpBuf);
|
||||
}
|
||||
}
|
||||
|
||||
if (hFile)
|
||||
// fclose(hFile);
|
||||
m_pIPak->FClose(hFile);
|
||||
|
||||
if (pszScript)
|
||||
{
|
||||
delete [] pszScript;
|
||||
pszScript = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
hFile = fopen("C:\\Debug.txt", "w");
|
||||
fwrite(pszFormattedScript, 1, strlen(pszFormattedScript), hFile);
|
||||
fclose(hFile);
|
||||
*/
|
||||
|
||||
m_wScriptWindow.SetText(pszFormattedScript);
|
||||
|
||||
if (pszFormattedScript)
|
||||
{
|
||||
delete [] pszFormattedScript;
|
||||
pszFormattedScript = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
LRESULT CLUADbg::OnEraseBkGnd(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern bool g_bDone; // From LuaDbgInterface.cpp
|
||||
LRESULT CLUADbg::OnClose(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// Quit();
|
||||
WINDOWINFO wi;
|
||||
if(::GetWindowInfo(m_hWnd,&wi))
|
||||
{
|
||||
_TinyRegistry cTReg;
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "XOrigin", wi.rcWindow.left));
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "YOrigin", wi.rcWindow.top));
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "XSize", wi.rcWindow.right-wi.rcWindow.left));
|
||||
_TinyVerify(cTReg.WriteNumber("Software\\Tiny\\LuaDebugger\\", "YSize", wi.rcWindow.bottom-wi.rcWindow.top));
|
||||
}
|
||||
g_bDone=true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CLUADbg::OnSize(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
int w=LOWORD(lParam);
|
||||
int h=HIWORD(lParam);
|
||||
Reshape(w,h);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CLUADbg::OnAbout(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CAboutWnd wndAbout;
|
||||
wndAbout.DoModal(this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CLUADbg::OnToggleBreakpoint(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_wScriptWindow.AddBreakpoint();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TOOLBAR_HEIGHT 28
|
||||
#define STATUS_BAR_HEIGHT 20
|
||||
|
||||
bool CLUADbg::Reshape(int w,int h)
|
||||
{
|
||||
/*
|
||||
int nWatchHeight=(((float)h)*WATCH_HEIGHT_MULTIPLIER);
|
||||
int nFilesWidth=(((float)h)*FILES_WIDTH_MULTIPLIER);
|
||||
m_wScriptWindow.SetWindowPos(nFilesWidth,TOOLBAR_HEIGHT,w-nFilesWidth,h-TOOLBAR_HEIGHT-nWatchHeight,SWP_DRAWFRAME);
|
||||
m_wLocals.SetWindowPos(0,h-nWatchHeight,w/2,nWatchHeight,SWP_DRAWFRAME);
|
||||
m_wFilesTree.SetWindowPos(nFilesWidth,TOOLBAR_HEIGHT,nFilesWidth,h-TOOLBAR_HEIGHT-nWatchHeight,SWP_DRAWFRAME);
|
||||
m_wWatch.SetWindowPos(w/2,h-nWatchHeight,w/2,nWatchHeight,SWP_DRAWFRAME);
|
||||
*/
|
||||
|
||||
m_wndClient.Reshape(w, h - TOOLBAR_HEIGHT - STATUS_BAR_HEIGHT);
|
||||
m_wndClient.SetWindowPos(0, TOOLBAR_HEIGHT, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
m_wndMainHorzSplitter.Reshape(w, h - TOOLBAR_HEIGHT - STATUS_BAR_HEIGHT);
|
||||
m_wToolbar.SetWindowPos(0,0,w,TOOLBAR_HEIGHT,0);
|
||||
m_wndStatus.SetWindowPos(0, h - STATUS_BAR_HEIGHT, w, STATUS_BAR_HEIGHT, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CLUADbg::PlaceLineMarker(UINT iLine)
|
||||
{
|
||||
m_wScriptWindow.SetLineMarker(iLine);
|
||||
m_wScriptWindow.ScrollToLine(iLine);
|
||||
}
|
||||
|
||||
void CLUADbg::SetStatusBarText(const char *pszText)
|
||||
{
|
||||
// TODO: Find out why setting the panel text using the
|
||||
// dedicated message doesn't work. For some reason the
|
||||
// text gets drawn once but never again.
|
||||
// m_wndStatus.SetPanelText(pszText);
|
||||
|
||||
m_wndStatus.SetWindowText(pszText);
|
||||
}
|
||||
|
||||
void CLUADbg::GetStackAndLocals()
|
||||
{
|
||||
///////////
|
||||
// Stack //
|
||||
///////////
|
||||
|
||||
{
|
||||
IScriptObject *pICallstack = m_pIScriptSystem->GetCallsStack();
|
||||
_SmartScriptObject pIEntry(m_pIScriptSystem, true);
|
||||
const char *pszText = NULL;
|
||||
int iItem=0;
|
||||
m_wCallstack.Clear();
|
||||
int i;
|
||||
for (i=pICallstack->Count() - 1; i>=1; i--)
|
||||
{
|
||||
pICallstack->GetAt(i, pIEntry);
|
||||
|
||||
pIEntry->GetValue("description", pszText);
|
||||
iItem = m_wCallstack.InsertItem(0, pszText, 0);
|
||||
|
||||
pIEntry->GetValue("line", pszText);
|
||||
m_wCallstack.SetItemText(iItem, 1, pszText);
|
||||
|
||||
if (pIEntry->GetValue("sourcefile", pszText))
|
||||
{
|
||||
if (_stricmp(pszText, "=C") == 0)
|
||||
m_wCallstack.SetItemText(iItem, 2, "Native C Function");
|
||||
else
|
||||
m_wCallstack.SetItemText(iItem, 2, &pszText[1]);
|
||||
}
|
||||
else
|
||||
m_wCallstack.SetItemText(iItem, 2, "No Source");
|
||||
|
||||
}
|
||||
if (pICallstack->Count() == 0)
|
||||
iItem = m_wCallstack.InsertItem(0, "No Callstack Available", 0);
|
||||
pICallstack->Release();
|
||||
pICallstack = NULL;
|
||||
}
|
||||
|
||||
////////////
|
||||
// Locals //
|
||||
////////////
|
||||
|
||||
m_wLocals.Clear();
|
||||
m_pIVariable = m_pIScriptSystem->GetLocalVariables(1);
|
||||
m_pTreeToAdd = &m_wLocals;
|
||||
if (m_pIVariable)
|
||||
{
|
||||
m_hRoot = NULL;
|
||||
m_iRecursionLevel = 0;
|
||||
m_pIVariable->Dump((IScriptObjectDumpSink *) this);
|
||||
m_pIVariable->Release();
|
||||
m_pIVariable = NULL;
|
||||
}
|
||||
else
|
||||
m_wLocals.AddItemToTree("No Locals Available");
|
||||
m_pTreeToAdd = NULL;
|
||||
|
||||
|
||||
///////////
|
||||
// Watch //
|
||||
///////////
|
||||
|
||||
const char *pszText = NULL;
|
||||
|
||||
m_wWatch.Clear();
|
||||
IScriptObject *pIScriptObj = m_pIScriptSystem->GetLocalVariables(1);
|
||||
|
||||
string strWatchVar = "self";
|
||||
|
||||
bool bVarFound = false;
|
||||
pIScriptObj->BeginIteration();
|
||||
while (pIScriptObj->MoveNext())
|
||||
{
|
||||
if (pIScriptObj->GetCurrentKey(pszText))
|
||||
{
|
||||
if (strWatchVar == pszText)
|
||||
{
|
||||
_SmartScriptObject pIEntry(m_pIScriptSystem, true);
|
||||
pIScriptObj->GetCurrent(pIEntry);
|
||||
|
||||
m_pIVariable = pIEntry;
|
||||
m_pTreeToAdd = &m_wWatch;
|
||||
|
||||
if (m_pIVariable)
|
||||
{
|
||||
bVarFound = true;
|
||||
|
||||
m_hRoot = NULL;
|
||||
m_iRecursionLevel = 0;
|
||||
|
||||
// Dump only works for tables, in case of values call the sink directly
|
||||
if (m_pIVariable->GetCurrentType() == svtObject)
|
||||
m_pIVariable->Dump((IScriptObjectDumpSink *) this);
|
||||
else
|
||||
{
|
||||
m_pIVariable = pIScriptObj; // Value needs to be retrieved from parent table
|
||||
OnElementFound(pszText, m_pIVariable->GetCurrentType());
|
||||
}
|
||||
|
||||
// No AddRef() !
|
||||
// m_pIVariable->Release();
|
||||
|
||||
m_pIVariable = NULL;
|
||||
}
|
||||
|
||||
m_pTreeToAdd = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
pIScriptObj->EndIteration();
|
||||
|
||||
if (!bVarFound)
|
||||
m_wWatch.AddItemToTree(const_cast<LPSTR>((strWatchVar + " = ?").c_str())); // TODO: Cast...
|
||||
|
||||
}
|
||||
|
||||
HTREEITEM CLUADbg::AddVariableToTree(const char *sName, ScriptVarType type, HTREEITEM hParent)
|
||||
{
|
||||
char szBuf[2048];
|
||||
char szType[32];
|
||||
const char *pszContent = NULL;
|
||||
bool bRetrieved = false;
|
||||
int iIdx;
|
||||
|
||||
if (m_pTreeToAdd == NULL)
|
||||
{
|
||||
_TinyAssert(m_pTreeToAdd != NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case svtNull:
|
||||
strcpy(szType, "[nil]");
|
||||
break;
|
||||
case svtString:
|
||||
strcpy(szType, "[string]");
|
||||
break;
|
||||
case svtNumber:
|
||||
strcpy(szType, "[numeric]");
|
||||
break;
|
||||
case svtFunction:
|
||||
strcpy(szType, "[function]");
|
||||
break;
|
||||
case svtObject:
|
||||
strcpy(szType, "[table]");
|
||||
break;
|
||||
case svtUserData:
|
||||
strcpy(szType, "[user data]");
|
||||
break;
|
||||
default:
|
||||
strcpy(szType, "[unknown]");
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == svtString || type == svtNumber)
|
||||
{
|
||||
if (sName[0] == '[')
|
||||
{
|
||||
strcpy(szBuf, &sName[1]);
|
||||
szBuf[strlen(szBuf) - 1] = '\0';
|
||||
iIdx = atoi(szBuf);
|
||||
bRetrieved = m_pIVariable->GetAt(iIdx, pszContent);
|
||||
}
|
||||
else
|
||||
bRetrieved = m_pIVariable->GetValue(sName, pszContent);
|
||||
|
||||
if (bRetrieved)
|
||||
sprintf(szBuf, "%s %s = %s", szType, sName, pszContent);
|
||||
else
|
||||
sprintf(szBuf, "%s %s = (Unknown)", szType, sName);
|
||||
}
|
||||
else
|
||||
sprintf(szBuf, "%s %s", szType, sName);
|
||||
|
||||
HTREEITEM hNewItem = m_pTreeToAdd->AddItemToTree(szBuf, NULL, hParent);
|
||||
TreeView_SortChildren(m_pTreeToAdd->m_hWnd, hNewItem, FALSE);
|
||||
|
||||
return hNewItem;
|
||||
}
|
||||
|
||||
void CLUADbg::OnElementFound(const char *sName, ScriptVarType type)
|
||||
{
|
||||
HTREEITEM hRoot = NULL;
|
||||
UINT iRecursionLevel = 0;
|
||||
_SmartScriptObject pTable(m_pIScriptSystem, true);
|
||||
IScriptObject *pIOldTbl = NULL;
|
||||
HTREEITEM hOldRoot = NULL;
|
||||
|
||||
if(!sName)sName="[table idx]";
|
||||
hRoot = AddVariableToTree(sName, type, m_hRoot);
|
||||
|
||||
if (type == svtObject && m_iRecursionLevel < 5)
|
||||
{
|
||||
if (m_pIVariable->GetValue(sName, pTable))
|
||||
{
|
||||
pIOldTbl = m_pIVariable;
|
||||
hOldRoot = m_hRoot;
|
||||
m_pIVariable = pTable;
|
||||
m_hRoot = hRoot;
|
||||
m_iRecursionLevel++;
|
||||
pTable->Dump((IScriptObjectDumpSink *) this);
|
||||
m_iRecursionLevel--;
|
||||
m_pIVariable = pIOldTbl;
|
||||
m_hRoot = hOldRoot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CLUADbg::OnElementFound(int nIdx,ScriptVarType type)
|
||||
{
|
||||
char szBuf[32];
|
||||
sprintf(szBuf, "[%i]", nIdx);
|
||||
OnElementFound(szBuf, type);
|
||||
}
|
||||
418
CrySystem/LuaDebugger/LUADBG.h
Normal file
418
CrySystem/LuaDebugger/LUADBG.h
Normal file
@@ -0,0 +1,418 @@
|
||||
#pragma once
|
||||
|
||||
#include "_TinyMain.h"
|
||||
#include "_TinySplitter.h"
|
||||
#include "_TinyStatusBar.h"
|
||||
#include "_TinyCaptionWindow.h"
|
||||
|
||||
#include "FileTree.h"
|
||||
|
||||
#include <IScriptSystem.h>
|
||||
|
||||
#include "..\resource.h"
|
||||
#include <stdio.h>
|
||||
#include <list>
|
||||
|
||||
#define IDC_SOURCE 666
|
||||
#define IDC_LOCALS 667
|
||||
#define IDC_WATCH 668
|
||||
#define IDC_FILES 669
|
||||
|
||||
#define BORDER_SIZE 50
|
||||
|
||||
class CSourceEdit : public _TinyWindow
|
||||
{
|
||||
public:
|
||||
CSourceEdit() { m_iLineMarkerPos = 1; };
|
||||
~CSourceEdit() { };
|
||||
|
||||
protected:
|
||||
_BEGIN_MSG_MAP(CSourceEdit)
|
||||
_MESSAGE_HANDLER(WM_SIZE,OnSize)
|
||||
_MESSAGE_HANDLER(WM_PAINT,OnPaint)
|
||||
_BEGIN_COMMAND_HANDLER()
|
||||
_BEGIN_CMD_EVENT_FILTER(IDC_SOURCE)
|
||||
_EVENT_FILTER(EN_VSCROLL,OnScroll)
|
||||
_EVENT_FILTER(EN_HSCROLL,OnScroll)
|
||||
_EVENT_FILTER(EN_UPDATE ,OnScroll)
|
||||
_END_CMD_EVENT_FILTER()
|
||||
_END_COMMAND_HANDLER()
|
||||
_END_MSG_MAP()
|
||||
|
||||
public:
|
||||
|
||||
void SetLineMarker(UINT iLine) { m_iLineMarkerPos = iLine; };
|
||||
|
||||
void SetScriptSystem(IScriptSystem *pIScriptSystem) { m_pIScriptSystem = pIScriptSystem; };
|
||||
|
||||
BOOL Create(DWORD dwStyle=WS_VISIBLE,DWORD dwExStyle=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL,ULONG nID=0)
|
||||
{
|
||||
_TinyRect erect;
|
||||
erect.left=BORDER_SIZE;
|
||||
erect.right=pRect->right;
|
||||
erect.top=0;
|
||||
erect.bottom=pRect->bottom;
|
||||
if(!_TinyWindow::Create(NULL,_T("asd"),WS_CHILD|WS_VISIBLE,0,pRect,pParentWnd,nID))
|
||||
return FALSE;
|
||||
if(!m_wEditWindow.Create(IDC_SOURCE,WS_VISIBLE|WS_CHILD|ES_WANTRETURN|WS_HSCROLL|WS_VSCROLL|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE|ES_NOHIDESEL,WS_EX_CLIENTEDGE,&erect,this))
|
||||
return FALSE;
|
||||
m_wEditWindow.SetFont((HFONT) GetStockObject(ANSI_FIXED_FONT));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL SetText(char *pszText)
|
||||
{
|
||||
EDITSTREAM strm;
|
||||
char ***pppText = new char **;
|
||||
*pppText = &pszText;
|
||||
strm.dwCookie = (DWORD_PTR) pppText;
|
||||
strm.dwError = 0;
|
||||
strm.pfnCallback = EditStreamCallback;
|
||||
m_wEditWindow.SendMessage(EM_LIMITTEXT, 0x7FFFFFF, 0);
|
||||
return m_wEditWindow.SendMessage(EM_STREAMIN, SF_RTF, (LPARAM) &strm);
|
||||
};
|
||||
|
||||
friend DWORD CALLBACK EditStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
||||
{
|
||||
char ***pppText = reinterpret_cast<char ***> (dwCookie);
|
||||
char **ppText = *pppText;
|
||||
LONG iLen = (LONG)strlen(* ppText) /*- 1*/;
|
||||
*pcb = __min(cb, iLen);
|
||||
if (*pcb == 0)
|
||||
{
|
||||
delete pppText;
|
||||
return 0;
|
||||
}
|
||||
memcpy(pbBuff, (* ppText), *pcb);
|
||||
*ppText += *pcb;
|
||||
return 0;
|
||||
};
|
||||
|
||||
void SetSourceFile(const char *pszFileName)
|
||||
{
|
||||
m_strSourceFile = pszFileName;
|
||||
};
|
||||
|
||||
const char * GetSourceFile() { return m_strSourceFile.c_str(); };
|
||||
|
||||
void AddBreakpoint()
|
||||
{
|
||||
// Adds a breakpoint for the current file in the current line
|
||||
_TinyAssert(m_pIScriptSystem);
|
||||
HBREAKPOINT hBreakPt = m_pIScriptSystem->AddBreakPoint(m_strSourceFile.c_str(),
|
||||
m_wEditWindow.LineFromChar(m_wEditWindow.GetSel()));
|
||||
_TinyVerify(::InvalidateRect(m_wEditWindow.m_hWnd, NULL, FALSE));
|
||||
}
|
||||
|
||||
void ScrollToLine(UINT iLine)
|
||||
{
|
||||
m_wEditWindow.ScrollToLine(iLine);
|
||||
};
|
||||
|
||||
private:
|
||||
LRESULT OnEraseBkGnd(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam){return 1;};
|
||||
LRESULT OnPaint(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyRect rect;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC;
|
||||
BeginPaint(m_hWnd,&ps);
|
||||
hDC=::GetDC(m_hWnd);
|
||||
int w,h;
|
||||
UINT i;
|
||||
int iLine;
|
||||
const char *pszFile = NULL;
|
||||
/////////////////////////////
|
||||
GetClientRect(&rect);
|
||||
w=rect.right-rect.left;
|
||||
h=rect.bottom-rect.top;
|
||||
_TinyRect rc(0,0,BORDER_SIZE,h);
|
||||
::DrawFrameControl(hDC, &rc, DFC_BUTTON, DFCS_BUTTONPUSH | DFCS_PUSHED);
|
||||
::SetBkMode(hDC,TRANSPARENT);
|
||||
POINT pt;
|
||||
m_wEditWindow.GetScrollPos(&pt);
|
||||
int iFirstLine = m_wEditWindow.GetFirstVisibleLine() + 1;
|
||||
TEXTMETRIC tm;
|
||||
m_wEditWindow.GetTextMetrics(&tm);
|
||||
|
||||
|
||||
int iFontY=tm.tmHeight-tm.tmDescent;
|
||||
int y=-pt.y%iFontY+3;
|
||||
char sTemp[10];
|
||||
HRGN hOldRgn=::CreateRectRgn(0,0,0,0);
|
||||
HRGN hClippedRgn=::CreateRectRgn(0,0,BORDER_SIZE,h - 1);
|
||||
::GetWindowRgn(m_hWnd,hOldRgn);
|
||||
::SelectClipRgn(hDC,hClippedRgn);
|
||||
::SelectObject(hDC, GetStockObject(ANSI_FIXED_FONT));
|
||||
while(y<h)
|
||||
{
|
||||
sprintf(sTemp,"%d",iFirstLine);
|
||||
::TextOut(hDC,2,y,sTemp,(int)strlen(sTemp));
|
||||
y+=iFontY;
|
||||
iFirstLine++;
|
||||
}
|
||||
|
||||
// Draw current line marker
|
||||
HBRUSH brsh = ::CreateSolidBrush(0x00FFFF00);
|
||||
::SelectObject(hDC, brsh);
|
||||
POINT sTriangle[4];
|
||||
sTriangle[0].x = 36;
|
||||
sTriangle[0].y = 0;
|
||||
sTriangle[1].x = 46;
|
||||
sTriangle[1].y = 5;
|
||||
sTriangle[2].x = 36;
|
||||
sTriangle[2].y = 10;
|
||||
sTriangle[3].x = 36;
|
||||
sTriangle[3].y = 0;
|
||||
iFirstLine = m_wEditWindow.GetFirstVisibleLine();
|
||||
for (i=0; i<4; i++)
|
||||
sTriangle[i].y += (-pt.y % iFontY + 3) + (m_iLineMarkerPos - iFirstLine - 1) * iFontY + 2;
|
||||
Polygon(hDC, sTriangle, 4);
|
||||
|
||||
|
||||
// Breakpoints
|
||||
::DeleteObject(brsh);
|
||||
brsh = ::CreateSolidBrush(0x0000007F);
|
||||
::SelectObject(hDC, brsh);
|
||||
/*
|
||||
std::list<UINT>::iterator it;
|
||||
for (it=m_lBreakPoints.begin(); it!=m_lBreakPoints.end(); it++)
|
||||
{
|
||||
INT iY = (-pt.y % iFontY + 3) + ((* it) - iFirstLine - 1) * iFontY + 7;
|
||||
Ellipse(hDC, 41 - 5, iY - 5, 41 + 5, iY + 5);
|
||||
}
|
||||
*/
|
||||
IScriptObject *pIBreakPoints = m_pIScriptSystem->GetBreakPoints();
|
||||
if (pIBreakPoints)
|
||||
{
|
||||
for (i=0; i<(UINT) pIBreakPoints->Count(); i++)
|
||||
{
|
||||
_SmartScriptObject pIBreakPt(m_pIScriptSystem, true);
|
||||
pIBreakPoints->GetAt(i + 1, pIBreakPt);
|
||||
if (pIBreakPt->GetValue("line", iLine))
|
||||
{
|
||||
if (pIBreakPt->GetValue("sourcefile", pszFile))
|
||||
{
|
||||
if (pszFile == m_strSourceFile)
|
||||
{
|
||||
INT iY = (-pt.y % iFontY + 3) + (iLine - iFirstLine - 1) * iFontY + 7;
|
||||
Ellipse(hDC, 41 - 5, iY - 5, 41 + 5, iY + 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pIBreakPoints->Release();
|
||||
pIBreakPoints = NULL;
|
||||
}
|
||||
::DeleteObject(brsh);
|
||||
|
||||
|
||||
::SelectClipRgn(hDC,hOldRgn);
|
||||
::DeleteObject(hOldRgn);
|
||||
::DeleteObject(hClippedRgn);
|
||||
//::DeleteObject(hBrush);
|
||||
/////////////////////////////
|
||||
EndPaint(m_hWnd,&ps);
|
||||
return 0;
|
||||
}
|
||||
LRESULT OnSize(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int w=LOWORD(lParam);
|
||||
int h=HIWORD(lParam);
|
||||
_TinyRect erect;
|
||||
erect.left=BORDER_SIZE;
|
||||
erect.right=w-BORDER_SIZE;
|
||||
erect.top=0;
|
||||
erect.bottom=h;
|
||||
m_wEditWindow.SetWindowPos(BORDER_SIZE,0,w-BORDER_SIZE,h,0);
|
||||
return 0;
|
||||
}
|
||||
LRESULT OnScroll(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyRect rect;
|
||||
GetClientRect(&rect);
|
||||
|
||||
rect.top=0;
|
||||
rect.left=0;
|
||||
rect.right=BORDER_SIZE;
|
||||
return InvalidateRect(&rect);
|
||||
}
|
||||
|
||||
protected:
|
||||
_TinyRichEdit m_wEditWindow;
|
||||
UINT m_iLineMarkerPos;
|
||||
IScriptSystem *m_pIScriptSystem;
|
||||
string m_strSourceFile;
|
||||
|
||||
};
|
||||
|
||||
class CLUADbg : public _TinyFrameWindow, IScriptObjectDumpSink
|
||||
{
|
||||
public:
|
||||
CLUADbg();
|
||||
virtual ~CLUADbg();
|
||||
|
||||
bool LoadFile(const char *pszFile, bool bForceReload = false);
|
||||
void PlaceLineMarker(UINT iLine);
|
||||
void SetStatusBarText(const char *pszText);
|
||||
void GetStackAndLocals();
|
||||
|
||||
void SetSystem(ISystem *pISystem)
|
||||
{
|
||||
SetScriptSystem(pISystem->GetIScriptSystem());
|
||||
m_pIPak = pISystem->GetIPak();
|
||||
};
|
||||
IScriptSystem * GetScriptSystem() { return m_pIScriptSystem; };
|
||||
|
||||
bool IsUserDisabled() const { return m_bDisabled; };
|
||||
|
||||
// For callback use byIScriptObjectDumpSink only, don't call directly
|
||||
void OnElementFound(const char *sName,ScriptVarType type);
|
||||
void OnElementFound(int nIdx,ScriptVarType type);
|
||||
|
||||
protected:
|
||||
_BEGIN_MSG_MAP(CMainWindow)
|
||||
_MESSAGE_HANDLER(WM_CLOSE,OnClose)
|
||||
_MESSAGE_HANDLER(WM_SIZE,OnSize)
|
||||
_MESSAGE_HANDLER(WM_CREATE,OnCreate)
|
||||
_MESSAGE_HANDLER(WM_ERASEBKGND,OnEraseBkGnd)
|
||||
_BEGIN_COMMAND_HANDLER()
|
||||
_COMMAND_HANDLER(IDM_EXIT, OnClose)
|
||||
_COMMAND_HANDLER(IDM_ABOUT, OnAbout)
|
||||
_COMMAND_HANDLER(ID_DEBUG_RUN, OnDebugRun)
|
||||
_COMMAND_HANDLER(ID_DEBUG_TOGGLEBREAKPOINT, OnToggleBreakpoint)
|
||||
_COMMAND_HANDLER(ID_DEBUG_STEPINTO, OnDebugStepInto)
|
||||
_COMMAND_HANDLER(ID_DEBUG_STEPOVER, OnDebugStepOver)
|
||||
_COMMAND_HANDLER(ID_DEBUG_DISABLE, OnDebugDisable)
|
||||
_COMMAND_HANDLER(ID_FILE_RELOAD, OnFileReload)
|
||||
_END_COMMAND_HANDLER()
|
||||
_MESSAGE_HANDLER(WM_NOTIFY,OnNotify)
|
||||
|
||||
_END_MSG_MAP()
|
||||
|
||||
//
|
||||
LRESULT OnClose(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnCreate(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnSize(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnEraseBkGnd(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnAbout(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnToggleBreakpoint(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnDebugStepInto(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_pIScriptSystem->DebugStepInto();
|
||||
OnClose(hWnd,message,wParam,lParam);
|
||||
return 1;
|
||||
};
|
||||
LRESULT OnDebugStepOver(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_pIScriptSystem->DebugStepNext();
|
||||
OnClose(hWnd,message,wParam,lParam);
|
||||
return 1;
|
||||
};
|
||||
LRESULT OnDebugRun(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (m_pIScriptSystem->GetBreakState() == bsStepNext ||
|
||||
m_pIScriptSystem->GetBreakState() == bsStepInto)
|
||||
{
|
||||
// Leave step-by-step debugging
|
||||
m_pIScriptSystem->DebugContinue();
|
||||
}
|
||||
OnClose(hWnd,message,wParam,lParam);
|
||||
return 1;
|
||||
};
|
||||
LRESULT OnDebugDisable(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// This doesn't completely disable debugging, errors will still cause the debugger to pop up
|
||||
m_pIScriptSystem->DebugDisable();
|
||||
|
||||
m_bDisabled = true;
|
||||
OnClose(hWnd,message,wParam,lParam);
|
||||
return 1;
|
||||
}
|
||||
LRESULT OnNotify(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
NMHDR *n = (NMHDR *) lParam;
|
||||
if (n->code == NM_DBLCLK) {
|
||||
if(n->hwndFrom == m_wFilesTree.m_hWnd)
|
||||
{
|
||||
const char *pszFileName = m_wFilesTree.GetCurItemFileName();
|
||||
LoadFile(pszFileName);
|
||||
}
|
||||
if(n->hwndFrom == m_wCallstack.m_hWnd)
|
||||
{
|
||||
char temp[512];
|
||||
int sel=m_wCallstack.GetSelection();
|
||||
if(sel!=-1)
|
||||
{
|
||||
m_wCallstack.GetItemText(sel,1,temp,sizeof(temp));
|
||||
int linenum=atoi(temp);
|
||||
if(linenum!=-1){
|
||||
m_wCallstack.GetItemText(sel,2,temp,sizeof(temp));
|
||||
LoadFile(temp);
|
||||
PlaceLineMarker(linenum);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//jumping in the carrect func
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnFileReload(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
string strFileName = m_wScriptWindow.GetSourceFile();
|
||||
|
||||
if ((* strFileName.begin()) == '@')
|
||||
strFileName.erase(strFileName.begin());
|
||||
|
||||
LoadFile(strFileName.c_str(), true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool Reshape(int w, int h);
|
||||
HTREEITEM AddVariableToTree(const char *sName, ScriptVarType type, HTREEITEM hParent = NULL);
|
||||
void DumpTable(HTREEITEM hParent, IScriptObject *pITable, UINT& iRecursionLevel);
|
||||
|
||||
void SetScriptSystem(IScriptSystem *pIScriptSystem)
|
||||
{
|
||||
m_pIScriptSystem = pIScriptSystem;
|
||||
m_wScriptWindow.SetScriptSystem(pIScriptSystem);
|
||||
};
|
||||
|
||||
CSourceEdit m_wScriptWindow;
|
||||
_TinyToolbar m_wToolbar;
|
||||
_TinyTreeView m_wLocals;
|
||||
_TinyTreeView m_wWatch;
|
||||
_TinyListView m_wCallstack;
|
||||
|
||||
CFileTree m_wFilesTree;
|
||||
|
||||
_TinyWindow m_wndClient;
|
||||
|
||||
_TinyStatusBar m_wndStatus;
|
||||
|
||||
_TinyCaptionWindow m_wndLocalsCaption;
|
||||
_TinyCaptionWindow m_wndWatchCaption;
|
||||
_TinyCaptionWindow m_wndCallstackCaption;
|
||||
_TinyCaptionWindow m_wndFileViewCaption;
|
||||
_TinyCaptionWindow m_wndSourceCaption;
|
||||
|
||||
_TinySplitter m_wndMainHorzSplitter;
|
||||
_TinySplitter m_wndWatchSplitter;
|
||||
_TinySplitter m_wndWatchCallstackSplitter;
|
||||
_TinySplitter m_wndSrcEditSplitter;
|
||||
|
||||
IScriptSystem *m_pIScriptSystem;
|
||||
ICryPak *m_pIPak;
|
||||
|
||||
bool m_bDisabled;
|
||||
|
||||
// Used to let the enumeration function access it
|
||||
IScriptObject *m_pIVariable;
|
||||
HTREEITEM m_hRoot;
|
||||
UINT m_iRecursionLevel;
|
||||
_TinyTreeView *m_pTreeToAdd;
|
||||
|
||||
};
|
||||
BIN
CrySystem/LuaDebugger/LUADBG.ico
Normal file
BIN
CrySystem/LuaDebugger/LUADBG.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
80
CrySystem/LuaDebugger/LuaDbgInterface.cpp
Normal file
80
CrySystem/LuaDebugger/LuaDbgInterface.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
#include "stdafx.h"
|
||||
#include "LuaDbgInterface.h"
|
||||
#include "LUADBG.h"
|
||||
|
||||
bool g_bDone = false;
|
||||
|
||||
bool InvokeDebugger(CLUADbg *pDebugger, const char *pszSourceFile, int iLine, const char *pszReason)
|
||||
{
|
||||
HACCEL hAccelerators = NULL;
|
||||
MSG msg;
|
||||
IScriptSystem *pIScriptSystem = NULL;
|
||||
|
||||
if (pDebugger == NULL)
|
||||
return false;
|
||||
|
||||
// TODO: Would be better to handle this with a console variable since this
|
||||
// would give the user a chance to reactivate it. Or maybe using the
|
||||
// m_bsBreakState of the scripting sytem, but I'm not sure how to add it there
|
||||
if (pDebugger->IsUserDisabled())
|
||||
return true;
|
||||
|
||||
pIScriptSystem = pDebugger->GetScriptSystem();
|
||||
|
||||
// Debugger not inititalized
|
||||
if (pDebugger == NULL)
|
||||
return false;
|
||||
if (!::IsWindow(pDebugger->m_hWnd))
|
||||
return false;
|
||||
|
||||
if ((hAccelerators = LoadAccelerators(_Tiny_GetResourceInstance(), MAKEINTRESOURCE(IDR_LUADGB_ACCEL))) == NULL)
|
||||
{
|
||||
// No accelerators
|
||||
}
|
||||
|
||||
// Make sure the debugger is displayed maximized when it was left like that last time
|
||||
// TODO: Maybe serialize this with the other window settings
|
||||
if (::IsZoomed(pDebugger->m_hWnd))
|
||||
::ShowWindow(pDebugger->m_hWnd, SW_MAXIMIZE);
|
||||
else
|
||||
::ShowWindow(pDebugger->m_hWnd, SW_NORMAL);
|
||||
::SetForegroundWindow(pDebugger->m_hWnd);
|
||||
|
||||
if (pszSourceFile && pszSourceFile[0] == '@')
|
||||
{
|
||||
pDebugger->LoadFile(&pszSourceFile[1]);
|
||||
iLine = __max(0, iLine);
|
||||
pDebugger->PlaceLineMarker(iLine);
|
||||
}
|
||||
|
||||
if (pszReason)
|
||||
pDebugger->SetStatusBarText(pszReason);
|
||||
|
||||
pDebugger->GetStackAndLocals();
|
||||
|
||||
g_bDone = false;
|
||||
while (GetMessage(&msg, NULL, 0, 0) && !g_bDone)
|
||||
{
|
||||
if (hAccelerators == NULL || TranslateAccelerator(pDebugger->m_hWnd, hAccelerators, &msg) == 0)
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsWindow(pDebugger->m_hWnd))
|
||||
DebugBreak();
|
||||
|
||||
// Don't hide the window when the debugger will be triggered next frame anyway
|
||||
if (pIScriptSystem->GetBreakState() != bsStepNext &&
|
||||
pIScriptSystem->GetBreakState() != bsStepInto)
|
||||
{
|
||||
::ShowWindow(pDebugger->m_hWnd, SW_HIDE);
|
||||
}
|
||||
|
||||
DestroyAcceleratorTable(hAccelerators);
|
||||
|
||||
return (int) msg.wParam == 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
10
CrySystem/LuaDebugger/LuaDbgInterface.h
Normal file
10
CrySystem/LuaDebugger/LuaDbgInterface.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __LUA_DBG_INTERFACE_H__
|
||||
#define __LUA_DBG_INTERFACE_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
class CLUADbg;
|
||||
|
||||
bool InvokeDebugger(CLUADbg *pDebugger, const char *pszSourceFile = NULL, int iLine = 0, const char *pszReason = NULL);
|
||||
|
||||
#endif
|
||||
55
CrySystem/LuaDebugger/_TinyBrowseFolder.h
Normal file
55
CrySystem/LuaDebugger/_TinyBrowseFolder.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef _TINY_BROWSE_FOLDER_H_
|
||||
#define _TINY_BROWSE_FOLDER_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __TINY_MAIN_H__
|
||||
#error "_TinyBrowseFolder require <_TinyMain.h>"
|
||||
#endif
|
||||
|
||||
#include <Shlobj.h>
|
||||
#include <windows.h>
|
||||
|
||||
// TODO
|
||||
|
||||
BOOL _TinyBrowseForFolder(char szPathOut[_MAX_PATH], _TinyWindow *pParent = NULL)
|
||||
{
|
||||
BROWSEINFO sInfo;
|
||||
char szDisplayName[_MAX_PATH];
|
||||
ITEMIDLIST *pList = NULL;
|
||||
|
||||
szPathOut[0] = '\0';
|
||||
|
||||
sInfo.hwndOwner = (pParent == NULL) ? NULL : pParent->m_hWnd;
|
||||
sInfo.pidlRoot = NULL;
|
||||
sInfo.pszDisplayName = szDisplayName;
|
||||
sInfo.ulFlags = BIF_RETURNONLYFSDIRS;
|
||||
sInfo.lpfn = NULL;
|
||||
sInfo.lParam = 0;
|
||||
sInfo.iImage = 0;
|
||||
|
||||
__try
|
||||
{
|
||||
if (FAILED(CoInitialize(NULL)))
|
||||
__leave;
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
SHBrowseForFolder(&sInfo);
|
||||
if ((pList = SHBrowseForFolder(&sInfo)) == NULL)
|
||||
__leave;
|
||||
|
||||
// SHGetPathFromIDList
|
||||
}
|
||||
__finally
|
||||
{
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// char szTmp[_MAX_PATH];
|
||||
// extern BOOL g_bTest = _TinyBrowseForFolder(szTmp);
|
||||
|
||||
#endif
|
||||
70
CrySystem/LuaDebugger/_TinyCaptionWindow.h
Normal file
70
CrySystem/LuaDebugger/_TinyCaptionWindow.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef _TINY_CAPTION_WINDOW_H_
|
||||
#define _TINY_CAPTION_WINDOW_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "_TinyWindow.h"
|
||||
|
||||
class _TinyCaptionWindow : public _TinyWindow
|
||||
{
|
||||
public:
|
||||
_TinyCaptionWindow() { m_pContent = NULL; };
|
||||
~_TinyCaptionWindow() { };
|
||||
|
||||
BOOL Create(const char *pszTitle, _TinyWindow *pContent, _TinyWindow *pParent)
|
||||
{
|
||||
m_strCaption = pszTitle;
|
||||
if (!_TinyWindow::Create(_T("_default_TinyWindowClass"), pszTitle, WS_VISIBLE | WS_CHILD, 0, NULL, pParent))
|
||||
return FALSE;
|
||||
m_pContent = pContent;
|
||||
m_pContent->MakeChild();
|
||||
m_pContent->SetParent(this);
|
||||
NotifyReflection(TRUE);
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
bool Reshape(int iCX, int iCY)
|
||||
{
|
||||
_TinyRect rcClient;
|
||||
_TinyAssert(m_pContent);
|
||||
_TinyWindow::Reshape(iCX, iCY);
|
||||
GetClientRect(&rcClient);
|
||||
m_pContent->SetWindowPos(0, iTitleBarHeight, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
|
||||
m_pContent->Reshape(rcClient.right, rcClient.bottom - iTitleBarHeight);
|
||||
return true;
|
||||
};
|
||||
|
||||
protected:
|
||||
_TinyWindow *m_pContent;
|
||||
string m_strCaption;
|
||||
|
||||
enum { iTitleBarHeight = 13 };
|
||||
|
||||
_BEGIN_MSG_MAP(_TinyCaptionWindow)
|
||||
_MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
_END_MSG_MAP()
|
||||
|
||||
LRESULT OnPaint(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyRect rcClient;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC;
|
||||
|
||||
::BeginPaint(m_hWnd, &ps);
|
||||
hDC = ::GetDC(m_hWnd);
|
||||
GetClientRect(&rcClient);
|
||||
rcClient.bottom = iTitleBarHeight;
|
||||
rcClient.right -= 1;
|
||||
::FillRect(hDC, &rcClient, GetSysColorBrush(COLOR_ACTIVECAPTION));
|
||||
::SelectObject(hDC, GetStockObject(ANSI_VAR_FONT));
|
||||
_TinyVerify(::SetTextColor(hDC, GetSysColor(COLOR_CAPTIONTEXT)) != CLR_INVALID);
|
||||
::SetBkMode(hDC, TRANSPARENT);
|
||||
::DrawText(hDC, m_strCaption.c_str(), -1, &rcClient, DT_CENTER | DT_VCENTER);
|
||||
EndPaint(m_hWnd, &ps);
|
||||
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
20
CrySystem/LuaDebugger/_TinyCoolEdit.h
Normal file
20
CrySystem/LuaDebugger/_TinyCoolEdit.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef _TINYCOOLEDIT_H_
|
||||
#define _TINYCOOLEDIT_H_
|
||||
|
||||
#ifndef _TINY_WINDOW_H_
|
||||
#error "_TinyCoolEdit require <_TinyWindow.h>"
|
||||
#endif
|
||||
|
||||
class _TinyCoolEdit : public _TinyRichEdit
|
||||
{
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_VISIBLE,DWORD dwExStyle=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL){
|
||||
BOOL bRes=_TinyEdit::Create(nID,dwStyle,dwExStyle,pRect,pParentWnd);
|
||||
if(!bRes)return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
bool Reshape(int w,int h)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_TINYCOOLEDIT_H_
|
||||
57
CrySystem/LuaDebugger/_TinyFileEnum.h
Normal file
57
CrySystem/LuaDebugger/_TinyFileEnum.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef __TINY_FILE_ENUM_H__
|
||||
#define __TINY_FILE_ENUM_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <io.h>
|
||||
|
||||
class _TinyFileEnum {
|
||||
public:
|
||||
_TinyFileEnum() { m_hEnumFile = -1L; };
|
||||
|
||||
virtual ~_TinyFileEnum() {
|
||||
if (m_hEnumFile != -1L) {
|
||||
_findclose(m_hEnumFile);
|
||||
m_hEnumFile = -1L;
|
||||
}
|
||||
};
|
||||
|
||||
bool GetNextFile(struct __finddata64_t *pFile) {
|
||||
if (_findnext64(m_hEnumFile, pFile) == -1L) {
|
||||
_findclose(m_hEnumFile);
|
||||
m_hEnumFile = -1L;
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StartEnumeration(const char *pszEnumPathAndPattern, __finddata64_t *pFile) {
|
||||
if (m_hEnumFile != -1L) {
|
||||
_findclose(m_hEnumFile);
|
||||
m_hEnumFile = -1L;
|
||||
}
|
||||
if ((m_hEnumFile = _findfirst64(pszEnumPathAndPattern, pFile)) == -1L) {
|
||||
_findclose(m_hEnumFile);
|
||||
m_hEnumFile = -1L;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StartEnumeration(char *pszEnumPath, char *pszEnumPattern, __finddata64_t *pFile) {
|
||||
char szPath[_MAX_PATH];
|
||||
strcpy(szPath, pszEnumPath);
|
||||
if (szPath[strlen(szPath)] != '\\' &&
|
||||
szPath[strlen(szPath)] != '/') {
|
||||
strcat(szPath, "\\");
|
||||
}
|
||||
strcat(szPath, pszEnumPattern);
|
||||
m_hEnumFile = _findfirst64(szPath, pFile);
|
||||
return m_hEnumFile != -1;
|
||||
}
|
||||
|
||||
protected:
|
||||
intptr_t m_hEnumFile;
|
||||
};
|
||||
|
||||
#endif
|
||||
65
CrySystem/LuaDebugger/_TinyImageList.h
Normal file
65
CrySystem/LuaDebugger/_TinyImageList.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef __TINY_IMAGE_LIST_H__
|
||||
#define __TINY_IMAGE_LIST_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __TINY_MAIN_H__
|
||||
#error "_TinyImageList requires <_TinyMain.h>"
|
||||
#endif
|
||||
|
||||
class _TinyImageList
|
||||
{
|
||||
public:
|
||||
_TinyImageList() { m_hImgLst = NULL; };
|
||||
~_TinyImageList()
|
||||
{
|
||||
if (m_hImgLst)
|
||||
_TinyVerify(ImageList_Destroy(m_hImgLst));
|
||||
};
|
||||
|
||||
BOOL Create(UINT iFlags = ILC_COLOR, UINT iCX = 16, UINT iCY = 16, UINT iMaxItems = 32)
|
||||
{
|
||||
_TinyAssert(m_hImgLst == NULL);
|
||||
m_hImgLst = ImageList_Create(iCX, iCY, iFlags, 0, iMaxItems);
|
||||
if (m_hImgLst == NULL)
|
||||
{
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
BOOL CreateFromBitmap(const char *pszBitmap, UINT iCX)
|
||||
{
|
||||
_TinyAssert(m_hImgLst == NULL);
|
||||
m_hImgLst = ImageList_LoadBitmap(_Tiny_GetResourceInstance(), pszBitmap, iCX, 32, 0x00FF00FF);
|
||||
if (m_hImgLst == NULL)
|
||||
{
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
BOOL AddImage(DWORD dwResource)
|
||||
{
|
||||
_TinyAssert(m_hImgLst);
|
||||
HBITMAP hBmp = LoadBitmap(_Tiny_GetResourceInstance(), MAKEINTRESOURCE(dwResource));
|
||||
if (hBmp == NULL)
|
||||
{
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return FALSE;
|
||||
}
|
||||
ImageList_Add(m_hImgLst, hBmp, NULL);
|
||||
_TinyVerify(DeleteObject(hBmp));
|
||||
};
|
||||
|
||||
HIMAGELIST GetHandle() { return m_hImgLst; };
|
||||
|
||||
UINT GetImageCount() const { return ImageList_GetImageCount(m_hImgLst); };
|
||||
|
||||
protected:
|
||||
HIMAGELIST m_hImgLst;
|
||||
};
|
||||
|
||||
#endif
|
||||
200
CrySystem/LuaDebugger/_TinyMain.h
Normal file
200
CrySystem/LuaDebugger/_TinyMain.h
Normal file
@@ -0,0 +1,200 @@
|
||||
/******************************************************************************************
|
||||
TINY WINDOWS LIBRARY
|
||||
copyright by Alberto Demichelis 2001
|
||||
email: albertodemichelis@hotmail.com
|
||||
right now this code is not GPL or LGPL in any way
|
||||
******************************************************************************************/
|
||||
|
||||
#ifndef __TINY_MAIN_H__
|
||||
#define __TINY_MAIN_H__
|
||||
|
||||
#pragma once
|
||||
#include "CryLibrary.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#pragma comment (lib , "comctl32.lib")
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Common includes
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper macros
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define _TINY_SIGNED_LOWORD(l) ((int16)((int32)(l) & 0xffff))
|
||||
#define _TINY_SIGNED_HIWORD(l) ((int16)((int32)(l) >> 16))
|
||||
#define _T
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Debug functions / macros
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(WIN64) || defined(LINUX64)
|
||||
#define _TinyVerify(x) { if (!(x)) assert(0); }
|
||||
#else
|
||||
#define _TinyVerify(x) { if (!(x)) { DEBUG_BREAK; }; }
|
||||
#endif
|
||||
|
||||
#if defined(_DEBUG) && !defined(WIN64) && !defined(LINUX64)
|
||||
#define _TinyAssert(x) { if (!(x)) { DEBUG_BREAK; }; }
|
||||
#else
|
||||
#define _TinyAssert(x) __noop(x);
|
||||
#endif
|
||||
|
||||
__inline void __cdecl _TinyTrace(const char *sFormat, ...)
|
||||
{
|
||||
va_list vl;
|
||||
static char sTraceString[1024];
|
||||
|
||||
va_start(vl, sFormat);
|
||||
vsprintf(sTraceString, sFormat, vl);
|
||||
va_end(vl);
|
||||
|
||||
strcat(sTraceString, "\n");
|
||||
|
||||
::OutputDebugString(sTraceString);
|
||||
}
|
||||
|
||||
#define _TINY_CHECK_LAST_ERROR _TinyCheckLastError(__FILE__, __LINE__);
|
||||
__inline void _TinyCheckLastError(const char *pszFile, int iLine)
|
||||
{
|
||||
if (GetLastError() != ERROR_SUCCESS)
|
||||
{
|
||||
// Format an error message
|
||||
char szMessageBuf[2048];
|
||||
char szLineFileInfo[_MAX_PATH + 256];
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ARGUMENT_ARRAY |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
szMessageBuf,
|
||||
2048,
|
||||
NULL
|
||||
);
|
||||
sprintf(szLineFileInfo, "Error catched in file %s line %i", pszFile, iLine);
|
||||
strcat(szMessageBuf, szLineFileInfo);
|
||||
|
||||
#ifdef _DEBUG
|
||||
MessageBox(NULL, szMessageBuf, "Tiny Framework Error", MB_OK | MB_ICONERROR);
|
||||
#else
|
||||
_TinyTrace(szMessageBuf);
|
||||
#endif
|
||||
|
||||
// Error processed
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Gobal variables and acessors
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define _TINY_DECLARE_APP() \
|
||||
LPTSTR g_lpCmdLine; \
|
||||
HINSTANCE g_hResourceInstance;
|
||||
|
||||
extern LPTSTR g_lpCmdLine;
|
||||
extern HINSTANCE g_hResourceInstance;
|
||||
|
||||
inline HINSTANCE _Tiny_GetInstance()
|
||||
{
|
||||
return (HINSTANCE) GetModuleHandle(NULL);
|
||||
}
|
||||
|
||||
inline HINSTANCE _Tiny_GetResourceInstance()
|
||||
{
|
||||
return g_hResourceInstance;
|
||||
}
|
||||
|
||||
inline LPCTSTR _Tiny_GetCommandLine()
|
||||
{
|
||||
return g_lpCmdLine;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Global structures
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyRect: public RECT{
|
||||
public:
|
||||
_TinyRect(){
|
||||
left=0;
|
||||
right=0;
|
||||
top=0;
|
||||
bottom=0;
|
||||
}
|
||||
_TinyRect(RECT &rect){
|
||||
left=rect.left;
|
||||
right=rect.right;
|
||||
top=rect.top;
|
||||
bottom=rect.bottom;
|
||||
}
|
||||
_TinyRect(int w,int h){
|
||||
left=0;
|
||||
right=w;
|
||||
top=0;
|
||||
bottom=h;
|
||||
}
|
||||
_TinyRect(int x,int y,int w,int h){
|
||||
left=x;
|
||||
right=x+w;
|
||||
top=y;
|
||||
bottom=y+h;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Main window include
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include "_TinyWindow.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Inititalization
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline BOOL _Tiny_InitApp(HINSTANCE hInstance,HINSTANCE hResourceInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,DWORD nIcon=0)
|
||||
{
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
g_lpCmdLine=lpCmdLine;
|
||||
g_hResourceInstance=hResourceInstance;
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
icc.dwSize=sizeof(INITCOMMONCONTROLSEX);
|
||||
icc.dwICC=ICC_TREEVIEW_CLASSES |ICC_BAR_CLASSES |ICC_LISTVIEW_CLASSES|ICC_COOL_CLASSES|ICC_WIN95_CLASSES ;
|
||||
CryLoadLibrary("Riched20.dll");
|
||||
::InitCommonControlsEx(&icc);
|
||||
BOOL bRet = __RegisterSmartClass(hInstance,nIcon) ? TRUE : FALSE;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/*
|
||||
if (!TranslateAccelerator(
|
||||
hwndMain, // handle to receiving window
|
||||
haccel, // handle to active accelerator table
|
||||
&msg)) // message data
|
||||
{
|
||||
*/
|
||||
inline int _Tiny_MainLoop(HACCEL hAccelTable = NULL, HWND hAccelTarget = NULL)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
//_TinyAssert((hAccelTable == NULL && hAccelTarget == NULL) ||
|
||||
// (hAccelTable != NULL && hAccelTarget != NULL));
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
if (hAccelTable == NULL || TranslateAccelerator(hAccelTarget, hAccelTable, &msg) == 0)
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
return (int) msg.wParam;
|
||||
}
|
||||
|
||||
#endif
|
||||
73
CrySystem/LuaDebugger/_TinyRegistry.h
Normal file
73
CrySystem/LuaDebugger/_TinyRegistry.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#ifndef __TINY_REGISTRY_H__
|
||||
#define __TINY_REGISTRY_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
class _TinyRegistry {
|
||||
public:
|
||||
_TinyRegistry() {};
|
||||
virtual ~_TinyRegistry() {};
|
||||
|
||||
bool WriteNumber(const char *pszKey, const char *pszValueName,
|
||||
DWORD dwValue, HKEY hRoot = HKEY_CURRENT_USER) {
|
||||
HKEY hKey = _RegCreateKeyEx(pszKey, hRoot);
|
||||
if (hKey == NULL)
|
||||
return false;
|
||||
if (RegSetValueEx(hKey, pszValueName, 0, REG_DWORD,
|
||||
(CONST BYTE *) &dwValue, sizeof(DWORD)) != ERROR_SUCCESS) {
|
||||
RegCloseKey(hKey);
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return false;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
return true;
|
||||
};
|
||||
bool WriteString(const char *pszKey, const char *pszValueName,
|
||||
const char *pszString, HKEY hRoot = HKEY_CURRENT_USER) {
|
||||
HKEY hKey = _RegCreateKeyEx(pszKey, hRoot);
|
||||
if (hKey == NULL)
|
||||
return false;
|
||||
if (RegSetValueEx(hKey, pszValueName, 0, REG_SZ,
|
||||
(CONST BYTE *) pszString, strlen(pszString) + 1) != ERROR_SUCCESS) {
|
||||
RegCloseKey(hKey);
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return false;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool ReadNumber(const char *pszKey, const char *pszValueName, DWORD& dwValOut,
|
||||
DWORD dwValDefault = 0, HKEY hRoot = HKEY_CURRENT_USER) {
|
||||
HKEY hKey = _RegCreateKeyEx(pszKey, hRoot);
|
||||
DWORD dwType, dwSize = sizeof(DWORD);
|
||||
LONG lRet;
|
||||
if (hKey == NULL)
|
||||
return false;
|
||||
dwValOut = dwValDefault;
|
||||
lRet = RegQueryValueEx(hKey, pszValueName, NULL, &dwType,
|
||||
(LPBYTE) &dwValOut, &dwSize);
|
||||
if (lRet != ERROR_SUCCESS || dwType != REG_DWORD) {
|
||||
RegCloseKey(hKey);
|
||||
return false;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
HKEY _RegCreateKeyEx(const char *pszKey, HKEY hRoot = HKEY_CURRENT_USER) {
|
||||
LONG lRes;
|
||||
HKEY hKey;
|
||||
DWORD dwDisp;
|
||||
lRes = RegCreateKeyEx(hRoot, pszKey, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp);
|
||||
if (lRes != ERROR_SUCCESS) {
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return NULL;
|
||||
}
|
||||
return hKey;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
219
CrySystem/LuaDebugger/_TinySplitter.h
Normal file
219
CrySystem/LuaDebugger/_TinySplitter.h
Normal file
@@ -0,0 +1,219 @@
|
||||
#ifndef _TINYSPLITTER_H_
|
||||
#define _TINYSPLITTER_H_
|
||||
|
||||
#ifndef _TINY_WINDOW_H_
|
||||
#error "_TinySplitter require <_TinyWindow.h>"
|
||||
#endif
|
||||
|
||||
#define SPLITTER_WIDTH 3
|
||||
#define DRAW_RAISED_SPLITTER
|
||||
|
||||
class _TinySplitter : public _TinyWindow
|
||||
{
|
||||
public:
|
||||
virtual BOOL Create(_TinyWindow *pParentWnd=NULL, _TinyWindow *pPan0=NULL,_TinyWindow *pPan1=NULL,bool bVertical=false, const RECT* pRect=NULL){
|
||||
BOOL bRes=_TinyWindow::Create(_T("_default_TinyWindowClass"),_T(""),WS_VISIBLE|WS_CHILD|WS_CLIPCHILDREN,NULL,pRect,pParentWnd);
|
||||
if(!bRes)return FALSE;
|
||||
m_bVertical = bVertical;
|
||||
m_bDragging = false;
|
||||
SetFirstPan(pPan0);
|
||||
SetSecondPan(pPan1);
|
||||
CenterSplitter();
|
||||
NotifyReflection(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SetFirstPan(_TinyWindow *pWnd)
|
||||
{
|
||||
m_pPan0 = pWnd;
|
||||
if (m_pPan0 != NULL) {
|
||||
m_pPan0->SetParent(this);
|
||||
m_pPan0->MakeChild();
|
||||
m_pPan0->NotifyReflection(TRUE);
|
||||
}
|
||||
};
|
||||
void SetSecondPan(_TinyWindow *pWnd)
|
||||
{
|
||||
m_pPan1 = pWnd;
|
||||
if (m_pPan1) {
|
||||
m_pPan1->SetParent(this);
|
||||
m_pPan1->MakeChild();
|
||||
m_pPan1->NotifyReflection(TRUE);
|
||||
}
|
||||
};
|
||||
|
||||
bool Reshape(int w,int h)
|
||||
{
|
||||
if (m_pPan0 == NULL || m_pPan1 == NULL)
|
||||
return false;
|
||||
const int iHlfSplitterWdh = SPLITTER_WIDTH / 2;
|
||||
SetWindowPos(0, 0, w, h, SWP_NOZORDER | SWP_NOMOVE);
|
||||
|
||||
if (m_bVertical) {
|
||||
int iEndUpper = ReverseYAxis(m_iSplitterPos) - iHlfSplitterWdh;
|
||||
m_pPan0->Reshape(w, iEndUpper);
|
||||
m_pPan0->SetWindowPos(0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
m_pPan1->Reshape(w, h - (iEndUpper + iHlfSplitterWdh) - 2);
|
||||
m_pPan1->SetWindowPos(0, iEndUpper + iHlfSplitterWdh * 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
}
|
||||
else {
|
||||
int iEndLeft = m_iSplitterPos - iHlfSplitterWdh;
|
||||
m_pPan0->Reshape(iEndLeft , h);
|
||||
m_pPan0->SetWindowPos(0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
m_pPan1->Reshape(w - (iEndLeft + iHlfSplitterWdh) - 2, h);
|
||||
m_pPan1->SetWindowPos(iEndLeft + iHlfSplitterWdh * 2, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Reshape()
|
||||
{
|
||||
_TinyRect rc;
|
||||
GetClientRect(&rc);
|
||||
return Reshape(rc.right, rc.bottom);
|
||||
}
|
||||
|
||||
void CenterSplitter() {
|
||||
if (IsCreated()) {
|
||||
HWND hWndParent = GetParent(m_hWnd);
|
||||
if (IsWindow(hWndParent)) {
|
||||
_TinyRect rc;
|
||||
::GetClientRect(hWndParent, &rc);
|
||||
m_iSplitterPos = m_bVertical ? rc.bottom / 2 : rc.right / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UINT GetSplitterPos() const { return m_iSplitterPos; };
|
||||
void SetSplitterPos(UINT iPos) { m_iSplitterPos = iPos; };
|
||||
|
||||
protected:
|
||||
_BEGIN_MSG_MAP(CSourceEdit)
|
||||
_MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
_MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||
_MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave)
|
||||
_MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
_MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||
_END_MSG_MAP()
|
||||
|
||||
void ObtainSplitterRect(_TinyRect &rcOut)
|
||||
{
|
||||
const int iHlfSplitterWdh = SPLITTER_WIDTH / 2;
|
||||
GetClientRect(&rcOut);
|
||||
if (m_bVertical) {
|
||||
rcOut.top = ReverseYAxis(m_iSplitterPos) - iHlfSplitterWdh - 2;
|
||||
rcOut.bottom = ReverseYAxis(m_iSplitterPos) + iHlfSplitterWdh + 2;
|
||||
}
|
||||
else {
|
||||
rcOut.left = m_iSplitterPos - iHlfSplitterWdh;
|
||||
rcOut.right = m_iSplitterPos + iHlfSplitterWdh;
|
||||
}
|
||||
}
|
||||
|
||||
void EnableMouseTracking()
|
||||
{
|
||||
// Enable hover / leave messages
|
||||
TRACKMOUSEEVENT evt;
|
||||
evt.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||
evt.dwFlags = TME_HOVER | TME_LEAVE;
|
||||
evt.hwndTrack = m_hWnd;
|
||||
evt.dwHoverTime = 1;
|
||||
_TrackMouseEvent(&evt);
|
||||
}
|
||||
|
||||
LRESULT OnMouseMove(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// To receive the leave message
|
||||
EnableMouseTracking();
|
||||
|
||||
HCURSOR hCur = LoadCursor(NULL, m_bVertical ? IDC_SIZENS : IDC_SIZEWE);
|
||||
_TinyAssert(hCur != NULL);
|
||||
SetCursor(hCur);
|
||||
|
||||
if (m_bDragging) {
|
||||
int xPos = _TINY_SIGNED_LOWORD(lParam);
|
||||
int yPos = _TINY_SIGNED_HIWORD(lParam);
|
||||
m_iSplitterPos = m_bVertical ? ReverseYAxis(yPos) : xPos;
|
||||
MoveSplitterToValidPos();
|
||||
Reshape();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnMouseLeave(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HCURSOR hCur = LoadCursor(NULL, IDC_ARROW);
|
||||
SetCursor(hCur);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnLButtonDown(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_bDragging = true;
|
||||
SetCapture();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnLButtonUp(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_bDragging = false;
|
||||
_TinyVerify(ReleaseCapture());
|
||||
|
||||
int xPos = LOWORD(lParam);
|
||||
int yPos = HIWORD(lParam);
|
||||
m_iSplitterPos = m_bVertical ? ReverseYAxis(yPos) : xPos;
|
||||
MoveSplitterToValidPos();
|
||||
Reshape();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnPaint(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyRect rc;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC;
|
||||
::BeginPaint(m_hWnd, &ps);
|
||||
hDC = ::GetDC(m_hWnd);
|
||||
|
||||
GetClientRect(&rc);
|
||||
::FillRect(hDC, &rc, GetSysColorBrush(COLOR_BTNFACE));
|
||||
|
||||
ObtainSplitterRect(rc);
|
||||
#ifdef DRAW_RAISED_SPLITTER
|
||||
DrawFrameControl(hDC, &rc, DFC_BUTTON, DFCS_BUTTONPUSH);
|
||||
#else
|
||||
DrawFrameControl(hDC, &rc, DFC_BUTTON, DFCS_BUTTONPUSH | DFCS_PUSHED);
|
||||
#endif
|
||||
EndPaint(m_hWnd,&ps);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MoveSplitterToValidPos()
|
||||
{
|
||||
return; // TODO
|
||||
_TinyRect rc;
|
||||
GetClientRect(&rc);
|
||||
m_iSplitterPos = __min(__max(m_iSplitterPos, SPLITTER_WIDTH), rc.bottom - SPLITTER_WIDTH);
|
||||
}
|
||||
|
||||
UINT ReverseYAxis(UINT iY) {
|
||||
_TinyRect rc;
|
||||
_TinyVerify(GetClientRect(&rc));
|
||||
return rc.bottom - iY;
|
||||
}
|
||||
|
||||
long m_iSplitterPos;
|
||||
_TinyWindow *m_pPan0;
|
||||
_TinyWindow *m_pPan1;
|
||||
bool m_bVertical;
|
||||
bool m_bDragging;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
38
CrySystem/LuaDebugger/_TinyStatusBar.h
Normal file
38
CrySystem/LuaDebugger/_TinyStatusBar.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef __TINY_STATUS_BAR__
|
||||
#define __TINY_STATUS_BAR__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _TINY_WINDOW_H_
|
||||
#error "_TinyStatusBar requires <_TinyWindow.h>"
|
||||
#endif
|
||||
|
||||
class _TinyStatusBar : public _TinyWindow {
|
||||
public:
|
||||
_TinyStatusBar() {};
|
||||
virtual ~_TinyStatusBar() {};
|
||||
|
||||
BOOL Create(ULONG nID=0, const _TinyRect *pRect=NULL, _TinyWindow *pParentWnd = NULL) {
|
||||
if(!_TinyWindow::Create(STATUSCLASSNAME, _T(""), WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, NULL, pRect, pParentWnd, nID)) {
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return FALSE;
|
||||
}
|
||||
if (pParentWnd) {
|
||||
_TinyRect rc;
|
||||
GetClientRect(&rc);
|
||||
Reshape(rc.right - rc.left, rc.bottom - rc.top);
|
||||
}
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
|
||||
void SetPanelText(const char *pszText)
|
||||
{
|
||||
SendMessage(SB_SETTEXT, SB_SIMPLEID, (LPARAM) pszText);
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
64
CrySystem/LuaDebugger/_TinyTreeList.h
Normal file
64
CrySystem/LuaDebugger/_TinyTreeList.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef _TINYTREELIST_H_
|
||||
#define _TINYTREELIST_H_
|
||||
|
||||
#ifndef _TINY_WINDOW_H_
|
||||
#error "_TinyTreeList requires <_TinyWindow.h>"
|
||||
#endif
|
||||
|
||||
#define ID_HEADER 1
|
||||
#define ID_TREE 2
|
||||
class _TinyTreeList : public _TinyWindow{
|
||||
protected:
|
||||
_BEGIN_MSG_MAP(_TinyTreeList)
|
||||
_MESSAGE_HANDLER(WM_SIZE,OnSize)
|
||||
_MESSAGE_HANDLER(WM_ERASEBKGND,OnEraseBkGnd)
|
||||
_END_MSG_MAP()
|
||||
|
||||
public:
|
||||
_TinyTreeList()
|
||||
{
|
||||
m_nNumOfColumns=0;
|
||||
}
|
||||
BOOL Create(ULONG nID=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL)
|
||||
{
|
||||
if(!_TinyWindow::Create(NULL,_T(""),WS_CHILD|WS_VISIBLE,NULL,pRect,pParentWnd,nID))
|
||||
return FALSE;
|
||||
m_ttvTreeView.Create(ID_TREE,WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|WS_VISIBLE,0,pRect,this);
|
||||
m_thHeader.Create(ID_HEADER,WS_VISIBLE|WS_CHILD | WS_BORDER | HDS_BUTTONS | HDS_HORZ,0,0,this);
|
||||
if(pParentWnd)
|
||||
{
|
||||
_TinyRect rect;
|
||||
GetClientRect(&rect);
|
||||
Reshape(rect.right-rect.left,rect.bottom-rect.top);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
BOOL AddCoulumn(LPSTR sName,int nWidth,BOOL bTree=FALSE)
|
||||
{
|
||||
m_thHeader.InsertItem(m_nNumOfColumns,nWidth,sName);
|
||||
m_nNumOfColumns++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private:
|
||||
LRESULT OnSize(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Reshape(LOWORD(lParam),HIWORD(lParam));
|
||||
return 0;
|
||||
}
|
||||
LRESULT OnEraseBkGnd(HWND hWnd,UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Reshape(int w,int h)
|
||||
{
|
||||
m_thHeader.SetWindowPos(0,0,w,20,0);
|
||||
m_ttvTreeView.SetWindowPos(0,20,w,h-20,0);
|
||||
}
|
||||
_TinyTreeView m_ttvTreeView;
|
||||
_TinyHeader m_thHeader;
|
||||
int m_nNumOfColumns;
|
||||
};
|
||||
|
||||
#endif
|
||||
772
CrySystem/LuaDebugger/_TinyWindow.h
Normal file
772
CrySystem/LuaDebugger/_TinyWindow.h
Normal file
@@ -0,0 +1,772 @@
|
||||
/******************************************************************************************2
|
||||
TINY WINDOWS LIBRARY
|
||||
copyright by Alberto Demichelis 2001
|
||||
email: albertodemichelis@hotmail.com
|
||||
right now this code is not GPL or LGPL in any way
|
||||
******************************************************************************************/
|
||||
#ifndef _TINY_WINDOW_H_
|
||||
#define _TINY_WINDOW_H_
|
||||
|
||||
#include <Richedit.h>
|
||||
|
||||
#ifndef __TINY_MAIN_H__
|
||||
#error "_TinyWindow require <_TinyMain.h>"
|
||||
#endif
|
||||
|
||||
#include <ISystem.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
LRESULT CALLBACK _TinyWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
static BOOL CALLBACK _TinyDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline ATOM __RegisterSmartClass(HINSTANCE hInstance,DWORD nIcon)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC) _TinyWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(nIcon));
|
||||
wc.hCursor = 0;
|
||||
// wc.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = 0;
|
||||
wc.lpszClassName = _T("_default_TinyWindowClass");
|
||||
|
||||
return RegisterClass(&wc);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define _BEGIN_MSG_MAP(__class) \
|
||||
virtual LRESULT __Tiny_WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) \
|
||||
{ int wmId = 0, wmEvent = 0;\
|
||||
switch(message){
|
||||
|
||||
#define _BEGIN_DLG_MSG_MAP(__class) \
|
||||
virtual LRESULT __Tiny_WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) \
|
||||
{ int wmId = 0, wmEvent = 0;\
|
||||
switch(message){
|
||||
|
||||
#define _MESSAGE_HANDLER(__message,__handler) \
|
||||
case __message: \
|
||||
return __handler(hWnd,message,wParam,lParam); \
|
||||
break;
|
||||
|
||||
#define _BEGIN_COMMAND_HANDLER() \
|
||||
case WM_COMMAND: \
|
||||
wmId = LOWORD(wParam); \
|
||||
wmEvent = HIWORD(wParam); \
|
||||
switch(wmId){ \
|
||||
|
||||
#define _COMMAND_HANDLER(__wmId,__command_handler) \
|
||||
case __wmId: \
|
||||
return __command_handler(hWnd,message, wParam, lParam); \
|
||||
break;
|
||||
#define _DEFAULT_DLG_COMMAND_HANDLERS() \
|
||||
case IDOK: \
|
||||
m_nModalRet=IDOK;\
|
||||
DestroyWindow(m_hWnd); \
|
||||
break; \
|
||||
case IDCANCEL: \
|
||||
m_nModalRet=IDCANCEL;\
|
||||
DestroyWindow(m_hWnd); \
|
||||
break;
|
||||
|
||||
#define _BEGIN_CMD_EVENT_FILTER(__wmId) \
|
||||
case __wmId: \
|
||||
switch(wmEvent){
|
||||
|
||||
#define _EVENT_FILTER(__wmEvent,__command_handler) \
|
||||
case __wmEvent: \
|
||||
return __command_handler(hWnd,message, wParam, lParam); \
|
||||
break;
|
||||
|
||||
#define _END_CMD_EVENT_FILTER() \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
break;
|
||||
|
||||
#define _END_COMMAND_HANDLER() \
|
||||
default: \
|
||||
return DefWindowProc(hWnd, message, wParam, lParam); \
|
||||
break; \
|
||||
} \
|
||||
break;
|
||||
|
||||
#define _END_MSG_MAP() \
|
||||
default: \
|
||||
return DefWindowProc(hWnd, message, wParam, lParam); \
|
||||
break; \
|
||||
} \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#define _END_DLG_MSG_MAP() \
|
||||
default: \
|
||||
return FALSE; \
|
||||
break; \
|
||||
} \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyWindow{
|
||||
|
||||
public:
|
||||
_TinyWindow(){
|
||||
m_hWnd=NULL;
|
||||
}
|
||||
_TinyWindow(HWND hWnd){
|
||||
m_hWnd=hWnd;
|
||||
}
|
||||
|
||||
virtual ~_TinyWindow(){
|
||||
Close();
|
||||
}
|
||||
virtual void Close(){
|
||||
if(m_hWnd){
|
||||
SetWindowLong(m_hWnd,GWLP_USERDATA,NULL);
|
||||
DestroyWindow(m_hWnd);
|
||||
m_hWnd=NULL;
|
||||
}
|
||||
}
|
||||
virtual void Quit(){
|
||||
PostQuitMessage(0);
|
||||
// g_bDone=true;
|
||||
//Close();
|
||||
|
||||
}
|
||||
|
||||
virtual LRESULT __Tiny_WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){return ::DefWindowProc(hWnd,message,wParam,lParam);}
|
||||
|
||||
virtual BOOL Create(LPCTSTR lpszClassName,LPCTSTR lpszWindowName,DWORD dwStyle=WS_VISIBLE,DWORD dwExStyle=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL,ULONG_PTR nID=0){
|
||||
HWND hParent=NULL;
|
||||
BOOL bSmart=FALSE;
|
||||
int x=CW_USEDEFAULT,y=CW_USEDEFAULT,width=CW_USEDEFAULT,height=CW_USEDEFAULT;
|
||||
//class name
|
||||
if(!lpszClassName){
|
||||
lpszClassName=_T("_default_TinyWindowClass");
|
||||
bSmart=TRUE;
|
||||
}
|
||||
//parent
|
||||
if(pParentWnd!=NULL)hParent=pParentWnd->m_hWnd;
|
||||
//rect
|
||||
if(pRect){
|
||||
x=pRect->left;
|
||||
y=pRect->top;
|
||||
width=(pRect->right-pRect->left);
|
||||
height=(pRect->bottom-pRect->top);
|
||||
}
|
||||
//create
|
||||
m_hWnd=::CreateWindowEx(dwExStyle,lpszClassName,
|
||||
lpszWindowName,
|
||||
dwStyle,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
hParent,
|
||||
(HMENU)nID,
|
||||
_Tiny_GetInstance(),
|
||||
NULL);
|
||||
if(!m_hWnd)
|
||||
{
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return FALSE;
|
||||
}
|
||||
__Tiny_WindowProc(m_hWnd,WM_CREATE,0,0);
|
||||
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR> (this));
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
virtual BOOL IsCreated() { return IsWindow(m_hWnd); };
|
||||
|
||||
virtual MakeChild()
|
||||
{
|
||||
_TinyAssert(IsCreated());
|
||||
DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE);
|
||||
dwStyle |= WS_CHILD;
|
||||
SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
|
||||
}
|
||||
|
||||
virtual bool Reshape(int w, int h)
|
||||
{
|
||||
SetWindowPos(0, 0, w, h, SWP_NOZORDER | SWP_NOMOVE);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void CenterOnScreen()
|
||||
{
|
||||
_TinyRect rc;
|
||||
UINT iX = GetSystemMetrics(SM_CXFULLSCREEN);
|
||||
UINT iY = GetSystemMetrics(SM_CYFULLSCREEN);
|
||||
GetClientRect(&rc);
|
||||
SetWindowPos(iX / 2 - rc.right / 2, iY / 2 - rc.bottom / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
public:
|
||||
HWND m_hWnd;
|
||||
public:
|
||||
//wrappers
|
||||
virtual LRESULT SetTimer(UINT nIDEvent,UINT uElapse){
|
||||
return (LRESULT)::SetTimer(m_hWnd,nIDEvent,uElapse,NULL);
|
||||
}
|
||||
virtual LRESULT KillTimer(UINT nIDEvent){
|
||||
return (LRESULT)::KillTimer(m_hWnd,nIDEvent);
|
||||
}
|
||||
virtual LRESULT ShowWindow(int nCmdShow=SW_SHOW){
|
||||
return (LRESULT)::ShowWindow(m_hWnd,nCmdShow);
|
||||
}
|
||||
virtual LRESULT SendMessage(UINT Msg,WPARAM wParam=0,LPARAM lParam=0){
|
||||
return (LRESULT)::SendMessage(m_hWnd,Msg,wParam,lParam);
|
||||
}
|
||||
virtual LRESULT PostMessage(UINT Msg,WPARAM wParam=0,LPARAM lParam=0){
|
||||
return (LRESULT)::PostMessage(m_hWnd,Msg,wParam,lParam);
|
||||
}
|
||||
virtual LRESULT SetWindowText(LPCTSTR lpString){
|
||||
return (LRESULT)::SetWindowText(m_hWnd,lpString);
|
||||
}
|
||||
virtual LRESULT GetWindowText(LPTSTR lpString,int nMaxCount){
|
||||
return (LRESULT)::GetWindowText(m_hWnd,lpString,nMaxCount);
|
||||
}
|
||||
virtual LRESULT GetClientRect(_TinyRect *pRect){
|
||||
return (LRESULT)::GetClientRect(m_hWnd,pRect);
|
||||
}
|
||||
virtual LRESULT SetWindowPos(int x,int y,int cx,int cy,UINT flags){
|
||||
return (LRESULT)::SetWindowPos(m_hWnd,0,x,y,cx,cy,flags);
|
||||
}
|
||||
virtual LRESULT InvalidateRect(_TinyRect *pRect=NULL,BOOL bErase=FALSE)
|
||||
{
|
||||
return ::InvalidateRect(m_hWnd,pRect,bErase);
|
||||
}
|
||||
virtual HWND SetParent(_TinyWindow *pParent)
|
||||
{
|
||||
if(pParent)
|
||||
return ::SetParent(m_hWnd,pParent->m_hWnd);
|
||||
else
|
||||
return ::SetParent(m_hWnd,NULL);
|
||||
}
|
||||
virtual BOOL SetCapture(){
|
||||
return ::SetCapture(m_hWnd)?TRUE:FALSE;
|
||||
}
|
||||
virtual void NotifyReflection(BOOL bEnable){
|
||||
m_bReflectNotify=bEnable?true:false;
|
||||
}
|
||||
virtual BOOL HasNotifyReflection(){
|
||||
return m_bReflectNotify;
|
||||
}
|
||||
private:
|
||||
BOOL m_bReflectNotify;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyDialog : public _TinyWindow{
|
||||
public:
|
||||
BOOL Create(LPCTSTR lpTemplate,_TinyWindow *pParent=NULL){
|
||||
m_nModalRet=0;
|
||||
HWND hParent=NULL;
|
||||
if(pParent)hParent=pParent->m_hWnd;
|
||||
m_hWnd=CreateDialog(_Tiny_GetResourceInstance(),lpTemplate,hParent,(DLGPROC) _TinyDlgProc);
|
||||
if(!m_hWnd) {
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return FALSE;
|
||||
}
|
||||
FakeCreate();
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
int DoModal(LPCTSTR lpTemplate, _TinyWindow *pParent = NULL)
|
||||
{
|
||||
INT_PTR nRet = DialogBoxParam(_Tiny_GetResourceInstance(), lpTemplate, (pParent != NULL) ?
|
||||
pParent->m_hWnd : NULL, (DLGPROC) _TinyDlgProc, (LPARAM) this);
|
||||
if (nRet == -1)
|
||||
{
|
||||
_TINY_CHECK_LAST_ERROR
|
||||
return 0;
|
||||
}
|
||||
return nRet;
|
||||
};
|
||||
|
||||
/*
|
||||
int DoModal(){
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return m_nModalRet;
|
||||
}
|
||||
*/
|
||||
|
||||
protected:
|
||||
void FakeCreate()
|
||||
{
|
||||
// Fake the WM_CREATE message
|
||||
__Tiny_WindowProc(m_hWnd, WM_CREATE,0,0);
|
||||
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||
};
|
||||
|
||||
public:
|
||||
int m_nModalRet;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyFrameWindow: public _TinyWindow{
|
||||
public:
|
||||
_TinyFrameWindow()
|
||||
{
|
||||
m_hMenu=NULL;
|
||||
}
|
||||
#ifdef WIN_CE
|
||||
BOOL AddBarMenu(WORD idMenu){
|
||||
m_hCommandBar = ::CommandBar_Create(_Tiny_GetResourceInstance(), m_hWnd, 1);
|
||||
::CommandBar_InsertMenubar(m_hCommandBar , _Tiny_GetResourceInstance(), idMenu, 0);
|
||||
return ::CommandBar_AddAdornments(m_hCommandBar , 0, 0);
|
||||
}
|
||||
HWND m_hCommandBar;
|
||||
#else
|
||||
bool AddMenu(WORD idMenu)
|
||||
{
|
||||
CryError("AddMenu");
|
||||
m_hMenu=LoadMenu(_Tiny_GetResourceInstance(),MAKEINTRESOURCE(idMenu));
|
||||
//<<FIXME>>
|
||||
}
|
||||
HMENU m_hMenu;
|
||||
#endif
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyEdit: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_VISIBLE,DWORD dwExStyle=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL){
|
||||
BOOL bRes=_TinyWindow::Create(_T("EDIT"),_T(""),dwStyle,dwExStyle,pRect,pParentWnd,nID);
|
||||
if(!bRes)return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
virtual void AppendText(const TCHAR *sText)
|
||||
{
|
||||
SendMessage(EM_SETSEL,-1,-1);
|
||||
SendMessage(EM_REPLACESEL,0,(LPARAM)sText);
|
||||
SendMessage(EM_SCROLLCARET,0,0);
|
||||
}
|
||||
virtual int GetFirstVisibleLine()
|
||||
{
|
||||
return SendMessage(EM_GETFIRSTVISIBLELINE,0,0);
|
||||
}
|
||||
virtual int GetScrollPos()
|
||||
{
|
||||
TEXTMETRIC tm;
|
||||
POINT pt;
|
||||
int iSel=GetSel();
|
||||
int iLine=LineFromChar(iSel);
|
||||
GetCaretPos(&pt);
|
||||
GetTextMetrics(&tm);
|
||||
int cyLine=tm.tmHeight;
|
||||
|
||||
// Calculate the first visible line.
|
||||
// While the vertical coordinate of the caret is greater than
|
||||
// tmHeight, subtract tmHeight from the vertical coordinate and
|
||||
// subtract 1 from the line number of the caret.
|
||||
// The value remaining in the line number variable is the line
|
||||
// number of the first visible line in the edit control.
|
||||
int iTopLine=iLine;
|
||||
while (pt.y > cyLine)
|
||||
{
|
||||
pt.y -=cyLine;
|
||||
iTopLine--;
|
||||
}
|
||||
return iTopLine;
|
||||
}
|
||||
|
||||
virtual int LineFromChar(int nSel)
|
||||
{
|
||||
return SendMessage(EM_LINEFROMCHAR, nSel, 0L);
|
||||
}
|
||||
virtual int GetSel()
|
||||
{
|
||||
return SendMessage(EM_GETSEL, NULL, 0L);
|
||||
}
|
||||
virtual void GetTextMetrics(TEXTMETRIC *tm)
|
||||
{
|
||||
HDC hDC;
|
||||
HFONT hFont;
|
||||
hDC=GetDC(m_hWnd);
|
||||
hFont=(HFONT)SendMessage(WM_GETFONT, 0, 0L);
|
||||
if (hFont != NULL)
|
||||
SelectObject(hDC, hFont);
|
||||
::GetTextMetrics(hDC,(TEXTMETRIC *)tm);
|
||||
ReleaseDC(m_hWnd, hDC);
|
||||
}
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyRichEdit: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_VISIBLE,DWORD dwExStyle=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL){
|
||||
BOOL bRes=_TinyWindow::Create(RICHEDIT_CLASS,_T(""),dwStyle,dwExStyle,pRect,pParentWnd,nID);
|
||||
int n=::GetLastError();
|
||||
if(!bRes)return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
virtual void AppendText(const TCHAR *sText)
|
||||
{
|
||||
SendMessage(EM_SETSEL,-1,-1);
|
||||
SendMessage(EM_REPLACESEL,0,(LPARAM)sText);
|
||||
SendMessage(EM_SCROLLCARET,0,0);
|
||||
}
|
||||
virtual int GetFirstVisibleLine()
|
||||
{
|
||||
return SendMessage(EM_GETFIRSTVISIBLELINE,0,0);
|
||||
}
|
||||
virtual int GetScrollPos(POINT *pt)
|
||||
{
|
||||
return SendMessage(EM_GETSCROLLPOS,0,(LPARAM)pt);
|
||||
}
|
||||
|
||||
virtual void ScrollToLine(UINT iLine)
|
||||
{
|
||||
UINT iChar = SendMessage(EM_LINEINDEX, iLine, 0);
|
||||
UINT iLineLength = SendMessage(EM_LINELENGTH, iChar - 1, 0);
|
||||
SendMessage(EM_SETSEL, iChar, iChar);
|
||||
SendMessage(EM_LINESCROLL, 0, -99999);
|
||||
SendMessage(EM_LINESCROLL, 0, iLine - 5);
|
||||
}
|
||||
|
||||
virtual int LineFromChar(int nSel)
|
||||
{
|
||||
return SendMessage(EM_LINEFROMCHAR, nSel, 0L) + 1;
|
||||
}
|
||||
virtual int GetSel()
|
||||
{
|
||||
DWORD dwStart, dwEnd;
|
||||
SendMessage(EM_GETSEL, (WPARAM) &dwStart, (LPARAM) &dwEnd);
|
||||
return dwStart;
|
||||
}
|
||||
virtual void GetTextMetrics(TEXTMETRIC *tm)
|
||||
{
|
||||
HDC hDC;
|
||||
HFONT hFont;
|
||||
hDC=GetDC(m_hWnd);
|
||||
hFont=(HFONT)SendMessage(WM_GETFONT, 0, 0L);
|
||||
if (hFont != NULL)
|
||||
SelectObject(hDC, hFont);
|
||||
::GetTextMetrics(hDC,(TEXTMETRIC *)tm);
|
||||
ReleaseDC(m_hWnd, hDC);
|
||||
}
|
||||
virtual void SetFont (HFONT hFont)
|
||||
{
|
||||
SendMessage(WM_SETFONT, (WPARAM) hFont, (LPARAM) 0);
|
||||
}
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyStatic: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_VISIBLE,DWORD dwStyleEx=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL){
|
||||
BOOL bRes=_TinyWindow::Create(_T("STATIC"),_T(""),dwStyle,dwStyleEx,pRect,pParentWnd,nID);
|
||||
if(!bRes)return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyToolbar: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nMenuID=0,DWORD dwStyle=WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS,DWORD dwStyleEx=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL)
|
||||
{
|
||||
BOOL bRes=_TinyWindow::Create(TOOLBARCLASSNAME,_T(""),dwStyle,dwStyleEx,pRect,pParentWnd,nMenuID);
|
||||
if(!bRes)
|
||||
return FALSE;
|
||||
SendMessage(TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
virtual BOOL AddButtons(DWORD nBitmapID,TBBUTTON *pButtons,DWORD nNumOfButtons)
|
||||
{
|
||||
TBADDBITMAP tb;
|
||||
tb.hInst = _Tiny_GetResourceInstance();
|
||||
tb.nID = nBitmapID;
|
||||
DWORD stdidx= SendMessage (TB_ADDBITMAP, nNumOfButtons, (LPARAM)&tb);
|
||||
for (DWORD index = 0; index < nNumOfButtons; index++)
|
||||
pButtons[index].iBitmap += stdidx;
|
||||
SendMessage (TB_ADDBUTTONS, nNumOfButtons, (LPARAM) pButtons);
|
||||
return TRUE;
|
||||
}
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyListBox: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_CHILD,DWORD dwStyleEx=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL)
|
||||
{
|
||||
BOOL bRes=_TinyWindow::Create(_T("LISTBOX"),_T(""),dwStyle,dwStyleEx,pRect,pParentWnd,nID);
|
||||
if(!bRes)return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
virtual int AddString(const TCHAR *sText)
|
||||
{
|
||||
return SendMessage(LB_ADDSTRING,0,(LPARAM)sText);
|
||||
}
|
||||
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyListView: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_CHILD,DWORD dwStyleEx=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL)
|
||||
{
|
||||
BOOL bRes=_TinyWindow::Create(WC_LISTVIEW,_T(""),dwStyle,dwStyleEx,pRect,pParentWnd,nID);
|
||||
if(!bRes)return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
virtual void SetViewStyle(DWORD dwView)
|
||||
{
|
||||
// Retrieve the current window style.
|
||||
DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE);
|
||||
|
||||
// Only set the window style if the view bits have changed.
|
||||
if ((dwStyle & LVS_TYPEMASK) != dwView)
|
||||
SetWindowLong(m_hWnd, GWL_STYLE,
|
||||
(dwStyle & ~LVS_TYPEMASK) | dwView);
|
||||
}
|
||||
virtual int InsertColumn(int nCol,LPCTSTR lpszColumnHeading,int nWidth,int nSubItem=0,int nFormat = LVCFMT_LEFT)
|
||||
{
|
||||
LVCOLUMN lvc;
|
||||
lvc.mask=LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
|
||||
lvc.cx=nWidth;
|
||||
lvc.pszText=(LPSTR)lpszColumnHeading;
|
||||
lvc.iSubItem=nSubItem;
|
||||
return ListView_InsertColumn(m_hWnd,nCol,&lvc);
|
||||
|
||||
}
|
||||
virtual int InsertItem(int nCol,LPCTSTR pszText,int iSubItem = 0, int nParam=NULL)
|
||||
{
|
||||
LVITEM lvi;
|
||||
lvi.mask=LVIF_PARAM | LVIF_TEXT;
|
||||
lvi.iItem=nCol;
|
||||
lvi.iSubItem=iSubItem;
|
||||
lvi.pszText=(LPTSTR)pszText;
|
||||
lvi.lParam=(LPARAM) nParam;
|
||||
return ListView_InsertItem(m_hWnd, &lvi);
|
||||
}
|
||||
|
||||
virtual int SetItemText(int nItem,int nSubItem,LPCTSTR pszText)
|
||||
{
|
||||
ListView_SetItemText(m_hWnd,nItem,nSubItem,(LPTSTR)pszText);
|
||||
return 0;
|
||||
}
|
||||
virtual int GetItemText(int iItem,int iSubItem,LPTSTR pszText,int cchTextMax)
|
||||
{
|
||||
ListView_GetItemText(m_hWnd,iItem,iSubItem,pszText,cchTextMax);
|
||||
return 0;
|
||||
}
|
||||
virtual int GetSelection()
|
||||
{
|
||||
return ListView_GetSelectionMark(m_hWnd); //-1 mean no selection
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void Clear() { ListView_DeleteAllItems(m_hWnd); };
|
||||
|
||||
};
|
||||
|
||||
class _TinyHeader: public _TinyWindow
|
||||
{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_VISIBLE|WS_CHILD | WS_BORDER | HDS_BUTTONS | HDS_HORZ,DWORD dwStyleEx=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL)
|
||||
{
|
||||
BOOL bRes=_TinyWindow::Create(WC_HEADER,_T(""),dwStyle,dwStyleEx,pRect,pParentWnd,nID);
|
||||
if(!bRes)
|
||||
return FALSE;
|
||||
/*if(pParentWnd)
|
||||
{
|
||||
_TinyRect rect;
|
||||
pParentWnd->GetClientRect(&rect);
|
||||
HDLAYOUT hdl;
|
||||
WINDOWPOS wp;
|
||||
hdl.prc = ▭
|
||||
hdl.pwpos = ℘
|
||||
if (!SendMessage(HDM_LAYOUT, 0, (LPARAM) &hdl))
|
||||
return FALSE;
|
||||
SetWindowPos(wp.x, wp.y,wp.cx, wp.cy, wp.flags | SWP_SHOWWINDOW);
|
||||
}*/
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
virtual int InsertItem(int iInsertAfter,int nWidth, LPSTR lpsz)
|
||||
{
|
||||
HDITEM hdi;
|
||||
int index;
|
||||
|
||||
hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
|
||||
hdi.pszText = lpsz;
|
||||
hdi.cxy = nWidth;
|
||||
hdi.cchTextMax = lstrlen(hdi.pszText);
|
||||
hdi.fmt = HDF_LEFT | HDF_STRING;
|
||||
|
||||
index = SendMessage(HDM_INSERTITEM,
|
||||
(WPARAM) iInsertAfter, (LPARAM) &hdi);
|
||||
|
||||
return index;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyTreeView: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|WS_VISIBLE,DWORD dwStyleEx=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL)
|
||||
{
|
||||
BOOL bRes=_TinyWindow::Create(WC_TREEVIEW,_T(""),dwStyle,dwStyleEx,pRect,pParentWnd,nID);
|
||||
NotifyReflection(TRUE);
|
||||
if(!bRes)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
virtual HTREEITEM AddItemToTree(LPTSTR lpszItem,LPARAM ud=NULL,HTREEITEM hParent=NULL, UINT iImage=0)
|
||||
{
|
||||
TVITEM tv;
|
||||
TVINSERTSTRUCT tvins;
|
||||
static HTREEITEM hPrev = (HTREEITEM) TVI_FIRST;
|
||||
memset(&tv,0,sizeof(TVITEM));
|
||||
tv.mask=TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
||||
tv.pszText=lpszItem;
|
||||
tv.lParam=ud;
|
||||
tv.iImage = iImage;
|
||||
tv.iSelectedImage = iImage;
|
||||
tvins.item = tv;
|
||||
|
||||
tvins.hInsertAfter = hPrev;
|
||||
if(hParent==NULL)
|
||||
tvins.hParent=TVI_ROOT;
|
||||
else
|
||||
tvins.hParent=hParent;
|
||||
hPrev = (HTREEITEM) SendMessage(TVM_INSERTITEM, 0,
|
||||
(LPARAM) (LPTVINSERTSTRUCT) &tvins);
|
||||
|
||||
TreeView_SortChildren(m_hWnd,hParent,0);
|
||||
return hPrev;
|
||||
};
|
||||
|
||||
virtual void SetImageList(HIMAGELIST hLst)
|
||||
{
|
||||
_TinyAssert(m_hWnd);
|
||||
TreeView_SetImageList(m_hWnd, hLst, TVSIL_NORMAL);
|
||||
};
|
||||
|
||||
HTREEITEM GetSelectedItem() { return TreeView_GetSelection(m_hWnd); };
|
||||
|
||||
LPARAM GetItemUserData(HTREEITEM hItem)
|
||||
{
|
||||
TVITEM tvItem;
|
||||
BOOL bRet;
|
||||
|
||||
tvItem.hItem = hItem;
|
||||
tvItem.mask = TVIF_HANDLE;
|
||||
|
||||
bRet = TreeView_GetItem(m_hWnd, &tvItem);
|
||||
_TinyAssert(bRet);
|
||||
|
||||
return tvItem.lParam;
|
||||
};
|
||||
|
||||
void Expand(HTREEITEM hItem)
|
||||
{
|
||||
TreeView_Expand(m_hWnd, hItem, TVE_EXPAND);
|
||||
};
|
||||
|
||||
void Clear() { TreeView_DeleteAllItems(m_hWnd); };
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class _TinyScrollBar: public _TinyWindow{
|
||||
public:
|
||||
virtual BOOL Create(ULONG nID=0,DWORD dwStyle=WS_VISIBLE,DWORD dwStyleEx=0,const RECT* pRect=NULL,_TinyWindow *pParentWnd=NULL){
|
||||
BOOL bRes=_TinyWindow::Create(_T("SCROLLBAR"),_T(""),dwStyle,dwStyleEx,pRect,pParentWnd,nID);
|
||||
int n=GetLastError();
|
||||
if(SBS_VERT&dwStyle)m_nBar=SB_VERT;
|
||||
if(SBS_HORZ&dwStyle)m_nBar=SB_HORZ;
|
||||
if(!bRes)return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
virtual BOOL SetScrollPos(int nPos,BOOL bRedraw=TRUE){
|
||||
return ::SetScrollPos(m_hWnd,SB_CTL,nPos,bRedraw);
|
||||
}
|
||||
virtual BOOL SetScrollInfo(LPSCROLLINFO lpsi,BOOL bRedraw=TRUE){
|
||||
return ::SetScrollInfo(m_hWnd,SB_CTL,lpsi,bRedraw);
|
||||
}
|
||||
virtual int GetScrollPos(){
|
||||
SCROLLINFO si;
|
||||
si.cbSize=sizeof(SCROLLINFO);
|
||||
si.fMask=SIF_POS;
|
||||
::GetScrollInfo(m_hWnd,SB_CTL,&si);
|
||||
return si.nPos;
|
||||
}
|
||||
private:
|
||||
int m_nBar;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static LRESULT CALLBACK _TinyWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyWindow *pWnd;
|
||||
pWnd=(_TinyWindow *)::GetWindowLongPtr(hWnd,GWLP_USERDATA);
|
||||
if(pWnd)
|
||||
{
|
||||
if(message==WM_NOTIFY && pWnd->HasNotifyReflection())
|
||||
{
|
||||
HWND hParentWnd=::GetParent(hWnd);
|
||||
if(hParentWnd)
|
||||
{
|
||||
_TinyWndProc(hParentWnd,WM_NOTIFY,wParam,lParam);
|
||||
}
|
||||
}
|
||||
return pWnd->__Tiny_WindowProc(hWnd,message,wParam,lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL CALLBACK _TinyDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_TinyWindow *pWnd = NULL;
|
||||
if (message == WM_INITDIALOG) {
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) lParam);
|
||||
pWnd = reinterpret_cast<_TinyWindow *> (lParam);
|
||||
_TinyAssert(!IsBadReadPtr(pWnd, sizeof(_TinyWindow)));
|
||||
pWnd->m_hWnd = hWnd;
|
||||
}
|
||||
pWnd = (_TinyWindow *) ::GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
if (pWnd)
|
||||
return (BOOL) pWnd->__Tiny_WindowProc(hWnd, message, wParam, lParam);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif //_TINY_WINDOW_H_
|
||||
BIN
CrySystem/LuaDebugger/res/TreeView.bmp
Normal file
BIN
CrySystem/LuaDebugger/res/TreeView.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
CrySystem/LuaDebugger/res/toolbar1.bmp
Normal file
BIN
CrySystem/LuaDebugger/res/toolbar1.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
CrySystem/LuaDebugger/small.ico
Normal file
BIN
CrySystem/LuaDebugger/small.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Reference in New Issue
Block a user