Fixing unicode in georges edit dll

feature/3ds-max-2020
kaetemi 6 years ago
parent 01d5edd47b
commit 556806715e

@ -579,12 +579,12 @@ void CGeorgesImpl::LoadDocument( const std::string& _sxfullname )
AFX_MANAGE_STATE(AfxGetStaticModuleState());
try
{
theApp.OpenDocumentFile(_sxfullname.c_str());
theApp.OpenDocumentFile(utf8ToTStr(_sxfullname));
}
catch (const NLMISC::Exception &e)
{
std::string tmp = std::string(e.what()) + "(" + _sxfullname + ")";
theApp.m_pMainWnd->MessageBox(tmp.c_str(), "Georges_Lib", MB_ICONERROR | MB_OK);
theApp.m_pMainWnd->MessageBox(utf8ToTStr(tmp), _T("Georges_Lib"), MB_ICONERROR | MB_OK);
}
}
@ -666,7 +666,7 @@ IGeorges* IGeorges::getInterface (int version)
// Check version number
if (version != GEORGES_VERSION)
{
MessageBox (NULL, "Bad version of georges.dll.", "Georges", MB_ICONEXCLAMATION|MB_OK);
MessageBox(NULL, _T("Bad version of georges.dll."), _T("Georges"), MB_ICONEXCLAMATION | MB_OK);
return NULL;
}
else

@ -86,20 +86,20 @@ BOOL CHeaderDialog::OnInitDialog()
// Create the version
setStaticSize (currentPos);
char versionText[512];
smprintf (versionText, 512, "Version %d.%d", 0, 0);
CString versionText;
versionText.Format(_T("Version %d.%d"), 0, 0);
LabelVersion.Create (versionText, WS_VISIBLE, currentPos, this);
initWidget (LabelVersion);
getNextPosLabel (currentPos);
setButtonSize (currentPos, SmallWidget);
IncrementVersion.Create ("Increment Version", WS_VISIBLE|WS_TABSTOP, currentPos, this, BtIncrement);
IncrementVersion.Create (_T("Increment Version"), WS_VISIBLE|WS_TABSTOP, currentPos, this, BtIncrement);
initWidget (IncrementVersion);
getNextPos (currentPos);
// Create the state combo
setStaticSize (currentPos);
LabelState.Create ("State:", WS_VISIBLE, currentPos, this);
LabelState.Create (_T("State:"), WS_VISIBLE, currentPos, this);
initWidget (LabelState);
getNextPosLabel (currentPos);
@ -109,30 +109,30 @@ BOOL CHeaderDialog::OnInitDialog()
ComboState.Create (WS_VISIBLE|CBS_DROPDOWNLIST|WS_TABSTOP, pos, this, CbState);
uint item;
for (item=0; item<CFileHeader::StateCount; item++)
ComboState.InsertString (-1, CFileHeader::getStateString ((CFileHeader::TState)item));
ComboState.InsertString (-1, utf8ToTStr(CFileHeader::getStateString ((CFileHeader::TState)item)));
ComboState.SetCurSel (0);
initWidget (ComboState);
getNextPos (currentPos);
// Default value
setStaticSize (currentPos);
LabelComments.Create ("Comments:", WS_VISIBLE, currentPos, this);
LabelComments.Create (_T("Comments:"), WS_VISIBLE, currentPos, this);
initWidget (LabelComments);
getNextPosLabel (currentPos);
setBigEditSize (currentPos, SmallWidget);
Comments.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), "", WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, this, EdComments);
Comments.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, this, EdComments);
initWidget (Comments);
getNextPos (currentPos);
// Min value
setStaticSize (currentPos);
LabelLog.Create ("Log:", WS_VISIBLE, currentPos, this);
LabelLog.Create (_T("Log:"), WS_VISIBLE, currentPos, this);
initWidget (LabelLog);
getNextPosLabel (currentPos);
setBigEditSize (currentPos, SmallWidget);
Log.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), "", WS_VSCROLL|ES_READONLY|ES_MULTILINE|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, this, EdLog);
Log.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_VSCROLL|ES_READONLY|ES_MULTILINE|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, this, EdLog);
initWidget (Log);
getNextPos (currentPos);
@ -244,8 +244,8 @@ void CHeaderDialog::getFromDocument (const NLGEORGES::CFileHeader &header)
{
// Nel standard version number
ComboState.SetCurSel (header.State);
char name[512];
smprintf (name, 512, "Version %d.%d", header.MajorVersion, header.MinorVersion);
CString name;
name.Format(_T("Version %d.%d"), header.MajorVersion, header.MinorVersion);
LabelVersion.SetWindowText (name);
// Set comments
@ -276,16 +276,16 @@ void CHeaderDialog::setVersionToDocument ()
uint v0, v1;
CString str;
LabelVersion.GetWindowText (str);
if (sscanf ((const char*)str, "Version %d.%d", &v0, &v1)==2)
if (sscanf (tStrToUtf8(str).c_str(), "Version %d.%d", &v0, &v1)==2)
{
v0++;
v1=0;
char name[512];
smprintf (name, 512, "Version %d.%d", v0, v1);
CString name;
name.Format(_T("Version %d.%d"), v0, v1);
LabelVersion.SetWindowText (name);
// Modify docuemnt
doc->modify (new CActionString (IAction::HeaderVersion, name, *doc, "", "",
doc->modify(new CActionString(IAction::HeaderVersion, tStrToUtf8(name).c_str(), *doc, "", "",
doc->getLeftView ()->getCurrentSelectionId (), 0));
}
}
@ -299,7 +299,7 @@ void CHeaderDialog::setCommentsToDocument ()
CGeorgesEditDocSub *current = doc->getSelectedObject ();
CString str;
Comments.GetWindowText (str);
doc->modify (new CActionString (IAction::HeaderComments, str, *doc, "", "",
doc->modify(new CActionString(IAction::HeaderComments, tStrToUtf8(str).c_str(), *doc, "", "",
doc->getLeftView ()->getCurrentSelectionId (), 0));
}
}

@ -85,7 +85,7 @@ void CIconWnd::create (DWORD wStyle, RECT &pos, CWnd *parent, uint dialogIndex)
LPCTSTR className = AfxRegisterWndClass(CS_OWNDC);
// Create this window
CWnd::Create(className, "empty", wStyle, pos, parent, dialogIndex);
CWnd::Create(className, _T("empty"), wStyle, pos, parent, dialogIndex);
}
bool CIconWnd::updateStr()
@ -283,14 +283,15 @@ void CIconWnd::addIconLayer(NLMISC::CBitmap &dst, const std::string iconStr, con
bool CIconWnd::updateWnd(CWnd *pWnd, std::string &str)
{
char buffer[512];
TCHAR buffer[512];
if (pWnd)
{
pWnd->GetWindowText(buffer, 512);
if (buffer != str)
std::string buf = tStrToUtf8(buffer);
if (buf != str)
{
str = buffer;
str = buf;
return true;
}
}

@ -27,7 +27,7 @@ using namespace NLMISC;
#pragma warning (disable : 4786)
BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCSTR lpszType, LPCSTR lpszName, WORD wIDLanguage,
BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage,
LONG_PTR lParam)
{
set<HRSRC> *iconNames = (set<HRSRC>*)lParam;
@ -96,7 +96,7 @@ void CImageListEx::addResourceIcon (const char *filename)
int height = imageInfo.rcImage.bottom - imageInfo.rcImage.top;
// Load the icon
HICON handle = (HICON) LoadImage (NULL, filename, IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE);
HICON handle = (HICON) LoadImage (NULL, utf8ToTStr(filename), IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE);
if (handle)
{
// Copy the icon

Loading…
Cancel
Save