Fixing unicode in georges edit dll
This commit is contained in:
parent
556806715e
commit
883ee21a17
9 changed files with 38 additions and 37 deletions
|
@ -69,7 +69,7 @@ bool CEditListCtrl::create (DWORD wStyle, RECT &rect, CWnd *parent, uint dialog_
|
|||
Edit.SetFont (ListCtrl.GetFont());
|
||||
Combo.Create (WS_BORDER|CBS_DROPDOWNLIST, rect, &ListCtrl, IdCombo);
|
||||
Combo.SetFont (ListCtrl.GetFont());
|
||||
MemCombo.create (WS_CHILD, rect, &ListCtrl, IdMemCombo, "", theApp.RememberListSize);
|
||||
MemCombo.create (WS_CHILD, rect, &ListCtrl, IdMemCombo, _T(""), theApp.RememberListSize);
|
||||
MemCombo.SetFont (ListCtrl.GetFont());
|
||||
return true;
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ void CEditListCtrl::editItem (uint item, uint subitem)
|
|||
string retString;
|
||||
bool browse;
|
||||
getMemComboBoxProp (Item, SubItem, retString, browse);
|
||||
MemCombo.setRegisterAdress (retString.c_str ());
|
||||
MemCombo.setRegisterAdress (utf8ToTStr(retString));
|
||||
MemCombo.clearCommand ();
|
||||
if (browse)
|
||||
MemCombo.addCommand (GEORGES_EDIT_BROWSE_LABEL, CmdBrowse);
|
||||
|
|
|
@ -165,7 +165,7 @@ CWnd* CFormDialog::addTypeWidget (const NLGEORGES::CType &type, uint elmIndex, c
|
|||
|
||||
// Create a reg key
|
||||
string tfn = typeFilename;
|
||||
string key = GEORGES_EDIT_BASE_REG_KEY"\\"+strlwr (typeFilename)+" MemCombo";
|
||||
tstring key = utf8ToTStr(GEORGES_EDIT_BASE_REG_KEY"\\"+strlwr (typeFilename)+" MemCombo");
|
||||
|
||||
// Create the widget
|
||||
memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, title, key.c_str(), type.UIType==CType::EditSpin, type.UIType==CType::FileBrowser, filenameExt);
|
||||
|
@ -251,7 +251,7 @@ void CFormDialog::getVirtualDfnFromDocument (const NLGEORGES::CFormDfn *_dfn, co
|
|||
|
||||
// Create the widget
|
||||
memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, "Dfn:",
|
||||
GEORGES_EDIT_BASE_REG_KEY"\\Virtual Dfn MemCombo", false, true, "*.dfn");
|
||||
_T(GEORGES_EDIT_BASE_REG_KEY) _T("\\Virtual Dfn MemCombo"), false, true, "*.dfn");
|
||||
|
||||
// Get from document
|
||||
memCombo->getFromDocument (*doc->getFormPtr ());
|
||||
|
@ -462,7 +462,7 @@ void CFormDialog::getArrayFromDocument (const char *structName, uint structId, u
|
|||
|
||||
// Create the widget
|
||||
memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, "Array size:",
|
||||
GEORGES_EDIT_BASE_REG_KEY"\\Array Size MemCombo", true, false, NULL);
|
||||
_T(GEORGES_EDIT_BASE_REG_KEY) _T("\\Array Size MemCombo"), true, false, NULL);
|
||||
|
||||
// Get from document
|
||||
memCombo->getFromDocument (*doc->getFormPtr ());
|
||||
|
@ -1541,7 +1541,7 @@ CFormMemCombo::~CFormMemCombo ()
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const char *reg, bool useSpinner, bool fileBrowser, const char *filenameExt)
|
||||
void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const TCHAR *reg, bool useSpinner, bool fileBrowser, const char *filenameExt)
|
||||
{
|
||||
// Get the doc
|
||||
CGeorgesEditDoc *doc = Dialog->View->GetDocument ();
|
||||
|
|
|
@ -207,7 +207,7 @@ public:
|
|||
bool FileBrowser;
|
||||
|
||||
// Create the widget
|
||||
void create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const char *reg, bool spinner, bool fileBrowser, const char *filenameExt);
|
||||
void create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const TCHAR *reg, bool spinner, bool fileBrowser, const char *filenameExt);
|
||||
|
||||
// From IFormWidget
|
||||
void onOk ();
|
||||
|
|
|
@ -109,11 +109,11 @@ void CLeftView::getSubObject (CGeorgesEditDocSub *subObject, HTREEITEM parent, H
|
|||
if (!item)
|
||||
{
|
||||
int itemImage = subObject->getItemImage (GetDocument());
|
||||
item = TreeCtrl.InsertItem (subObject->getName ().c_str(), itemImage, itemImage, parent);
|
||||
item = TreeCtrl.InsertItem (utf8ToTStr(subObject->getName()), itemImage, itemImage, parent);
|
||||
}
|
||||
|
||||
// Set name
|
||||
TreeCtrl.SetItemText (item, subObject->getName ().c_str());
|
||||
TreeCtrl.SetItemText (item, utf8ToTStr(subObject->getName()));
|
||||
|
||||
// Set item data
|
||||
TreeCtrl.SetItemData (item, (DWORD)subObject);
|
||||
|
@ -351,7 +351,7 @@ BOOL CLeftView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
|
|||
{
|
||||
// Change the node name
|
||||
TreeCtrl.SetItemText (ptvdi->item.hItem, ptvdi->item.pszText);
|
||||
doc->modify (new CActionString (IAction::FormArrayRename, ptvdi->item.pszText, *doc,
|
||||
doc->modify (new CActionString(IAction::FormArrayRename, tStrToUtf8(ptvdi->item.pszText).c_str(), *doc,
|
||||
subObject->getFormName().c_str(), toString (subObject->getIdInParent()).c_str(),
|
||||
doc->getLeftView ()->getCurrentSelectionId (), subObject->getSlot ()));
|
||||
return TRUE;
|
||||
|
@ -878,7 +878,7 @@ void CLeftView::OnDelete()
|
|||
CEdit *edit = TreeCtrl.GetEditControl();
|
||||
if (edit)
|
||||
{
|
||||
edit->SetWindowText ("");
|
||||
edit->SetWindowText (_T(""));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -163,7 +163,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|||
AssertLog->addDisplayer (&Displayer);
|
||||
|
||||
// JC: added LoadBarState
|
||||
LoadBarState("Georges");
|
||||
LoadBarState(_T("Georges"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ void CMainFrame::OnClose()
|
|||
if (theApp.SaveAllModified())
|
||||
{
|
||||
// JC: added save bar state
|
||||
SaveBarState("Georges");
|
||||
SaveBarState(_T("Georges"));
|
||||
// Save state
|
||||
theApp.saveState ();
|
||||
|
||||
|
@ -436,7 +436,7 @@ void CMainFrame::OnUpdateModules0(CCmdUI* pCmdUI)
|
|||
pCmdUI->Enable ();
|
||||
string name;
|
||||
theApp.PluginArray[0].PluginInterface->getPluginName (name);
|
||||
pCmdUI->SetText (name.c_str ());
|
||||
pCmdUI->SetText (utf8ToTStr(name));
|
||||
pCmdUI->SetCheck (theApp.PluginArray[0].Activated);
|
||||
}
|
||||
else
|
||||
|
@ -464,7 +464,7 @@ void CMainFrame::OnUpdateModules1(CCmdUI* pCmdUI)
|
|||
pCmdUI->Enable ();
|
||||
string name;
|
||||
theApp.PluginArray[1].PluginInterface->getPluginName (name);
|
||||
pCmdUI->SetText (name.c_str ());
|
||||
pCmdUI->SetText (utf8ToTStr(name));
|
||||
pCmdUI->SetCheck (theApp.PluginArray[1].Activated);
|
||||
}
|
||||
else
|
||||
|
@ -492,7 +492,7 @@ void CMainFrame::OnUpdateModules2(CCmdUI* pCmdUI)
|
|||
pCmdUI->Enable ();
|
||||
string name;
|
||||
theApp.PluginArray[2].PluginInterface->getPluginName (name);
|
||||
pCmdUI->SetText (name.c_str ());
|
||||
pCmdUI->SetText (utf8ToTStr(name));
|
||||
pCmdUI->SetCheck (theApp.PluginArray[2].Activated);
|
||||
}
|
||||
else
|
||||
|
@ -520,7 +520,7 @@ void CMainFrame::OnUpdateModules3(CCmdUI* pCmdUI)
|
|||
pCmdUI->Enable ();
|
||||
string name;
|
||||
theApp.PluginArray[3].PluginInterface->getPluginName (name);
|
||||
pCmdUI->SetText (name.c_str ());
|
||||
pCmdUI->SetText (utf8ToTStr(name));
|
||||
pCmdUI->SetCheck (theApp.PluginArray[3].Activated);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -43,7 +43,7 @@ CMemoryComboBox::~CMemoryComboBox()
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const char *registerAdress, int memoryCount)
|
||||
void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const TCHAR *registerAdress, int memoryCount)
|
||||
{
|
||||
// Register a window
|
||||
Id = nId;
|
||||
|
@ -52,7 +52,7 @@ void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT
|
|||
LPCTSTR clas = AfxRegisterWndClass (0);
|
||||
if (clas)
|
||||
{
|
||||
if (Create (clas, "MemoryComboBox", style, rect, parent, nId))
|
||||
if (Create (clas, _T("MemoryComboBox"), style, rect, parent, nId))
|
||||
{
|
||||
// Create the combo box
|
||||
RECT comboRect;
|
||||
|
@ -100,11 +100,11 @@ bool CMemoryComboBox::getMemory (int slot, std::string &ret)
|
|||
// Get the value
|
||||
char strSrc[512];
|
||||
smprintf (strSrc, 512, "%d", slot);
|
||||
char str[512];
|
||||
long size = 512;
|
||||
if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS)
|
||||
TCHAR str[512];
|
||||
LONG size = 512 * sizeof(TCHAR);
|
||||
if (RegQueryValue(hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS)
|
||||
{
|
||||
ret = str;
|
||||
ret = tStrToUtf8(str);
|
||||
|
||||
// Close
|
||||
RegCloseKey (hKey);
|
||||
|
@ -132,14 +132,14 @@ void CMemoryComboBox::scrollDown (int start, int end)
|
|||
// Get the old value
|
||||
char strSrc[512];
|
||||
smprintf (strSrc, 512, "%d", i-1);
|
||||
char str[512];
|
||||
long size = 512;
|
||||
if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS)
|
||||
TCHAR str[512];
|
||||
LONG size = 512 * sizeof(TCHAR);
|
||||
if (RegQueryValue (hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS)
|
||||
{
|
||||
// Set the value
|
||||
char strDst[512];
|
||||
smprintf (strDst, 512, "%d", i);
|
||||
RegSetValue (hKey, strDst, REG_SZ, str, size);
|
||||
RegSetValue (hKey, utf8ToTStr(strSrc), REG_SZ, str, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,8 @@ void CMemoryComboBox::pushString (const std::string &str)
|
|||
if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
// Set the value
|
||||
RegSetValue (hKey, _T("0"), REG_SZ, str.c_str (), str.size ());
|
||||
tstring tstr = utf8ToTStr(str);
|
||||
RegSetValue (hKey, _T("0"), REG_SZ, tstr.c_str (), tstr.size ());
|
||||
|
||||
// Close
|
||||
RegCloseKey (hKey);
|
||||
|
@ -460,7 +461,7 @@ void CMemoryComboBox::refreshStrings ()
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CMemoryComboBox::setRegisterAdress (const char *registerAdress)
|
||||
void CMemoryComboBox::setRegisterAdress (const TCHAR *registerAdress)
|
||||
{
|
||||
RegisterAdress = registerAdress;
|
||||
refreshStrings ();
|
||||
|
|
|
@ -46,9 +46,9 @@ public:
|
|||
|
||||
void onOK ();
|
||||
void onCancel ();
|
||||
void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const char *registerAdress, int memoryCount);
|
||||
void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const TCHAR *registerAdress, int memoryCount);
|
||||
void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId);
|
||||
void setRegisterAdress (const char *registerAdress);
|
||||
void setRegisterAdress (const TCHAR *registerAdress);
|
||||
void clearCommand ();
|
||||
void addCommand (const char* commandLabel, uint commandId);
|
||||
void clearStaticStrings ();
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
bool isWnd (const CWnd *wnd) const;
|
||||
void enableAutoCompleteExtension (bool enable, const char * ext);
|
||||
|
||||
std::string RegisterAdress;
|
||||
std::tstring RegisterAdress;
|
||||
int MemoryCount;
|
||||
UINT Id;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void COutputConsoleDlg::outputString (const char *message)
|
|||
{
|
||||
int index = edit->LineIndex(edit->GetLineCount( )-1) + edit->LineLength(edit->GetLineCount( )-1);
|
||||
edit->SetSel (index, index);
|
||||
edit->ReplaceSel (message);
|
||||
edit->ReplaceSel (utf8ToTStr(message));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
void deleteKey (HKEY hKey, const char *name)
|
||||
void deleteKey (HKEY hKey, const TCHAR *name)
|
||||
{
|
||||
HKEY subKey;
|
||||
if (RegOpenKey (hKey, name, &subKey) == ERROR_SUCCESS)
|
||||
{
|
||||
char subName[512];
|
||||
TCHAR subName[512];
|
||||
while (RegEnumKey (subKey, 0, subName, 512) == ERROR_SUCCESS)
|
||||
{
|
||||
deleteKey (subKey, subName);
|
||||
|
|
Loading…
Reference in a new issue