2 Commits

Author SHA1 Message Date
ff87b1ab12 change: Translate MouseController stuff 2025-06-17 14:56:30 +01:00
ae09ce7198 fix: Cursor destruction and Property line endings.
add: src/vcpkg_installed to .gitignore
2025-06-17 14:52:45 +01:00
5 changed files with 52 additions and 35 deletions

2
.gitignore vendored
View File

@ -378,3 +378,5 @@ FodyWeavers.xsd
# Build directories # Build directories
build/ build/
dist/ dist/
src/vcpkg_installed

12
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"configurations": [
{
"type": "cmake",
"request": "launch",
"name": "Debug portfile(s)",
"cmakeDebugType": "external",
"pipeName": "/tmp/vcpkg_ext_portfile_dbg",
"preLaunchTask": "Debug vcpkg commands"
}
]
}

View File

@ -16,7 +16,7 @@ import systemSetting
import localeInfo import localeInfo
## Mouse Controler ## Mouse Controler
## <EFBFBD><EFBFBD><EFBFBD>콺 Ŀ<><C4BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20><><EFBFBD>콺 Ŀ<><C4BF><EFBFBD><EFBFBD> Attach<63>Ǿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD> Object<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>. ## When the cursor is over the object, the Attach menu appears and allows attaching or editing the object.
class CursorImage(object): class CursorImage(object):
def __init__(self): def __init__(self):
@ -57,9 +57,7 @@ class CursorImage(object):
grpImage.Render(self.handle) grpImage.Render(self.handle)
class CMouseController(object): class CMouseController(object):
def __init__(self): def __init__(self):
self.x = 0 self.x = 0
self.y = 0 self.y = 0
@ -84,9 +82,12 @@ class CMouseController(object):
self.DeattachObject() self.DeattachObject()
self.callbackDict = {} self.callbackDict = {}
self.cursorDict = {}
def __del__(self): def __del__(self):
self.callbackDict = {} self.callbackDict = {}
for k, v in self.cursorDict.items():
v.DeleteImage()
def Create(self): def Create(self):
self.IsSoftwareCursor = systemSetting.IsSoftwareCursor() self.IsSoftwareCursor = systemSetting.IsSoftwareCursor()
@ -157,7 +158,7 @@ class CMouseController(object):
self.curCursorImage = self.cursorDict[app.NORMAL] self.curCursorImage = self.cursorDict[app.NORMAL]
except KeyError: except KeyError:
dbg.TraceError("mouseModule.MouseController.SetCursor - <20>߸<EFBFBD><DFB8><EFBFBD> Ŀ<><C4BF> <20><>ȣ [%d]" % cursorNum) dbg.TraceError("mouseModule.MouseController.SetCursor - <20>߸<EFBFBD><DFB8><EFBFBD> Ŀ<><C4BF> <20><>ȣ [%d]" % cursorNum)
self.curCursorName = app.NORMAL self.curCursorName = app.NORMAL
self.curCursorImage = self.cursorDict[app.NORMAL] self.curCursorImage = self.cursorDict[app.NORMAL]

View File

@ -57,6 +57,7 @@ def RunApp():
app.Loop() app.Loop()
mainStream.Destroy() mainStream.Destroy()
del mouseModule.mouseController
RunApp() RunApp()

View File

@ -5,13 +5,13 @@
#include "PropertyManager.h" #include "PropertyManager.h"
#include "Property.h" #include "Property.h"
/* /*
* CProperty 파일 포맷 * CProperty file format
* *
* 0 ~ 4 bytes: fourcc * 0 ~ 4 bytes: fourcc
* 5 ~ 6 bytes: \r\n * 5 ~ 6 bytes: \r\n
* *
* 그 이후의 바이트들은 텍스트 파일 로더와 같은 구조 * The bytes after that are structured like a text file loader
*/ */
CProperty::CProperty(const char * c_pszFileName) : mc_pFileName(NULL), m_dwCRC(0) CProperty::CProperty(const char * c_pszFileName) : mc_pFileName(NULL), m_dwCRC(0)
{ {
m_stFileName = c_pszFileName; m_stFileName = c_pszFileName;
@ -68,25 +68,25 @@ bool CProperty::GetVector(const char * c_pszKey, CTokenVector & rTokenVector)
if (m_stTokenMap.end() == it) if (m_stTokenMap.end() == it)
return false; return false;
// NOTE : 튕김 현상 발견 // NOTE: Crash issue discovered
// std::copy(rTokenVector.begin(), it->second.begin(), it->second.end()); // std::copy(rTokenVector.begin(), it->second.begin(), it->second.end());
// NOTE : 레퍼런스에는 이런 식으로 하게끔 되어 있음 // NOTE: According to the reference, it's supposed to be done like this
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// template <class InputIterator, class OutputIterator> // template <class InputIterator, class OutputIterator>
// OutputIterator copy(InputIterator first, InputIterator last, // OutputIterator copy(InputIterator first, InputIterator last,
// OutputIterator result); // OutputIterator result);
// //
// vector<int> V(5); // vector<int> V(5);
// iota(V.begin(), V.end(), 1); // iota(V.begin(), V.end(), 1);
// list<int> L(V.size()); // list<int> L(V.size());
// copy(V.begin(), V.end(), L.begin()); // copy(V.begin(), V.end(), L.begin());
// assert(equal(V.begin(), V.end(), L.begin())); // assert(equal(V.begin(), V.end(), L.begin()));
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// 헌데 그래도 튕김. - [levites] // But it still crashes. - [levites]
// std::copy(it->second.begin(), it->second.end(), rTokenVector.begin()); // std::copy(it->second.begin(), it->second.end(), rTokenVector.begin());
// 결국 이렇게.. - [levites] // Ended up doing it this way.. - [levites]
// 현재 사용하는 곳 : WorldEditor/Dialog/MapObjectPropertyPageBuilding.cpp // Current usage location: WorldEditor/Dialog/MapObjectPropertyPageBuilding.cpp
CTokenVector & rSourceTokenVector = it->second; CTokenVector & rSourceTokenVector = it->second;
CTokenVector::iterator itor = rSourceTokenVector.begin(); CTokenVector::iterator itor = rSourceTokenVector.begin();
for (; itor != rSourceTokenVector.end(); ++itor) for (; itor != rSourceTokenVector.end(); ++itor)
@ -102,7 +102,7 @@ void CProperty::PutString(const char * c_pszKey, const char * c_pszString)
std::string stTempKey = c_pszKey; std::string stTempKey = c_pszKey;
stl_lowers(stTempKey); stl_lowers(stTempKey);
// 이미 있는걸 지움 // Deleting/removing what already exists
CTokenVectorMap::iterator itor = m_stTokenMap.find(stTempKey); CTokenVectorMap::iterator itor = m_stTokenMap.find(stTempKey);
if (itor != m_stTokenMap.end()) if (itor != m_stTokenMap.end())
@ -145,16 +145,17 @@ bool CProperty::ReadFromMemory(const void * c_pvData, int iLen, const char * c_p
pcData += sizeof(DWORD); pcData += sizeof(DWORD);
if (*pcData != '\r' || *(pcData + 1) != '\n') if ((*pcData == '\r' && *(pcData + 1) == '\n'))
{ pcData += 2;
else if (*pcData == '\n')
pcData += 1;
else {
TraceError("CProperty::ReadFromMemory: File format error after FourCC: %s\n", c_pszFileName); TraceError("CProperty::ReadFromMemory: File format error after FourCC: %s\n", c_pszFileName);
return false; return false;
} }
pcData += 2;
CTokenVector stTokenVector; CTokenVector stTokenVector;
/* /*
char szTimeStamp[64]; char szTimeStamp[64];
memcpy(szTimeStamp, pcData, 14); memcpy(szTimeStamp, pcData, 14);
szTimeStamp[14] = '\0'; szTimeStamp[14] = '\0';