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());
|
Edit.SetFont (ListCtrl.GetFont());
|
||||||
Combo.Create (WS_BORDER|CBS_DROPDOWNLIST, rect, &ListCtrl, IdCombo);
|
Combo.Create (WS_BORDER|CBS_DROPDOWNLIST, rect, &ListCtrl, IdCombo);
|
||||||
Combo.SetFont (ListCtrl.GetFont());
|
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());
|
MemCombo.SetFont (ListCtrl.GetFont());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ void CEditListCtrl::editItem (uint item, uint subitem)
|
||||||
string retString;
|
string retString;
|
||||||
bool browse;
|
bool browse;
|
||||||
getMemComboBoxProp (Item, SubItem, retString, browse);
|
getMemComboBoxProp (Item, SubItem, retString, browse);
|
||||||
MemCombo.setRegisterAdress (retString.c_str ());
|
MemCombo.setRegisterAdress (utf8ToTStr(retString));
|
||||||
MemCombo.clearCommand ();
|
MemCombo.clearCommand ();
|
||||||
if (browse)
|
if (browse)
|
||||||
MemCombo.addCommand (GEORGES_EDIT_BROWSE_LABEL, CmdBrowse);
|
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
|
// Create a reg key
|
||||||
string tfn = typeFilename;
|
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
|
// 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);
|
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
|
// Create the widget
|
||||||
memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, "Dfn:",
|
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
|
// Get from document
|
||||||
memCombo->getFromDocument (*doc->getFormPtr ());
|
memCombo->getFromDocument (*doc->getFormPtr ());
|
||||||
|
@ -462,7 +462,7 @@ void CFormDialog::getArrayFromDocument (const char *structName, uint structId, u
|
||||||
|
|
||||||
// Create the widget
|
// Create the widget
|
||||||
memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, "Array size:",
|
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
|
// Get from document
|
||||||
memCombo->getFromDocument (*doc->getFormPtr ());
|
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
|
// Get the doc
|
||||||
CGeorgesEditDoc *doc = Dialog->View->GetDocument ();
|
CGeorgesEditDoc *doc = Dialog->View->GetDocument ();
|
||||||
|
|
|
@ -207,7 +207,7 @@ public:
|
||||||
bool FileBrowser;
|
bool FileBrowser;
|
||||||
|
|
||||||
// Create the widget
|
// 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
|
// From IFormWidget
|
||||||
void onOk ();
|
void onOk ();
|
||||||
|
|
|
@ -109,11 +109,11 @@ void CLeftView::getSubObject (CGeorgesEditDocSub *subObject, HTREEITEM parent, H
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
int itemImage = subObject->getItemImage (GetDocument());
|
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
|
// Set name
|
||||||
TreeCtrl.SetItemText (item, subObject->getName ().c_str());
|
TreeCtrl.SetItemText (item, utf8ToTStr(subObject->getName()));
|
||||||
|
|
||||||
// Set item data
|
// Set item data
|
||||||
TreeCtrl.SetItemData (item, (DWORD)subObject);
|
TreeCtrl.SetItemData (item, (DWORD)subObject);
|
||||||
|
@ -351,8 +351,8 @@ BOOL CLeftView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
|
||||||
{
|
{
|
||||||
// Change the node name
|
// Change the node name
|
||||||
TreeCtrl.SetItemText (ptvdi->item.hItem, ptvdi->item.pszText);
|
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(),
|
subObject->getFormName().c_str(), toString (subObject->getIdInParent()).c_str(),
|
||||||
doc->getLeftView ()->getCurrentSelectionId (), subObject->getSlot ()));
|
doc->getLeftView ()->getCurrentSelectionId (), subObject->getSlot ()));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -878,7 +878,7 @@ void CLeftView::OnDelete()
|
||||||
CEdit *edit = TreeCtrl.GetEditControl();
|
CEdit *edit = TreeCtrl.GetEditControl();
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
edit->SetWindowText ("");
|
edit->SetWindowText (_T(""));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -163,7 +163,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||||
AssertLog->addDisplayer (&Displayer);
|
AssertLog->addDisplayer (&Displayer);
|
||||||
|
|
||||||
// JC: added LoadBarState
|
// JC: added LoadBarState
|
||||||
LoadBarState("Georges");
|
LoadBarState(_T("Georges"));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ void CMainFrame::OnClose()
|
||||||
if (theApp.SaveAllModified())
|
if (theApp.SaveAllModified())
|
||||||
{
|
{
|
||||||
// JC: added save bar state
|
// JC: added save bar state
|
||||||
SaveBarState("Georges");
|
SaveBarState(_T("Georges"));
|
||||||
// Save state
|
// Save state
|
||||||
theApp.saveState ();
|
theApp.saveState ();
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ void CMainFrame::OnUpdateModules0(CCmdUI* pCmdUI)
|
||||||
pCmdUI->Enable ();
|
pCmdUI->Enable ();
|
||||||
string name;
|
string name;
|
||||||
theApp.PluginArray[0].PluginInterface->getPluginName (name);
|
theApp.PluginArray[0].PluginInterface->getPluginName (name);
|
||||||
pCmdUI->SetText (name.c_str ());
|
pCmdUI->SetText (utf8ToTStr(name));
|
||||||
pCmdUI->SetCheck (theApp.PluginArray[0].Activated);
|
pCmdUI->SetCheck (theApp.PluginArray[0].Activated);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -464,7 +464,7 @@ void CMainFrame::OnUpdateModules1(CCmdUI* pCmdUI)
|
||||||
pCmdUI->Enable ();
|
pCmdUI->Enable ();
|
||||||
string name;
|
string name;
|
||||||
theApp.PluginArray[1].PluginInterface->getPluginName (name);
|
theApp.PluginArray[1].PluginInterface->getPluginName (name);
|
||||||
pCmdUI->SetText (name.c_str ());
|
pCmdUI->SetText (utf8ToTStr(name));
|
||||||
pCmdUI->SetCheck (theApp.PluginArray[1].Activated);
|
pCmdUI->SetCheck (theApp.PluginArray[1].Activated);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -492,7 +492,7 @@ void CMainFrame::OnUpdateModules2(CCmdUI* pCmdUI)
|
||||||
pCmdUI->Enable ();
|
pCmdUI->Enable ();
|
||||||
string name;
|
string name;
|
||||||
theApp.PluginArray[2].PluginInterface->getPluginName (name);
|
theApp.PluginArray[2].PluginInterface->getPluginName (name);
|
||||||
pCmdUI->SetText (name.c_str ());
|
pCmdUI->SetText (utf8ToTStr(name));
|
||||||
pCmdUI->SetCheck (theApp.PluginArray[2].Activated);
|
pCmdUI->SetCheck (theApp.PluginArray[2].Activated);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -520,7 +520,7 @@ void CMainFrame::OnUpdateModules3(CCmdUI* pCmdUI)
|
||||||
pCmdUI->Enable ();
|
pCmdUI->Enable ();
|
||||||
string name;
|
string name;
|
||||||
theApp.PluginArray[3].PluginInterface->getPluginName (name);
|
theApp.PluginArray[3].PluginInterface->getPluginName (name);
|
||||||
pCmdUI->SetText (name.c_str ());
|
pCmdUI->SetText (utf8ToTStr(name));
|
||||||
pCmdUI->SetCheck (theApp.PluginArray[3].Activated);
|
pCmdUI->SetCheck (theApp.PluginArray[3].Activated);
|
||||||
}
|
}
|
||||||
else
|
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
|
// Register a window
|
||||||
Id = nId;
|
Id = nId;
|
||||||
|
@ -52,7 +52,7 @@ void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT
|
||||||
LPCTSTR clas = AfxRegisterWndClass (0);
|
LPCTSTR clas = AfxRegisterWndClass (0);
|
||||||
if (clas)
|
if (clas)
|
||||||
{
|
{
|
||||||
if (Create (clas, "MemoryComboBox", style, rect, parent, nId))
|
if (Create (clas, _T("MemoryComboBox"), style, rect, parent, nId))
|
||||||
{
|
{
|
||||||
// Create the combo box
|
// Create the combo box
|
||||||
RECT comboRect;
|
RECT comboRect;
|
||||||
|
@ -95,16 +95,16 @@ bool CMemoryComboBox::getMemory (int slot, std::string &ret)
|
||||||
{
|
{
|
||||||
// Open the key
|
// Open the key
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
if (RegOpenKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS)
|
if (RegOpenKey(HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// Get the value
|
// Get the value
|
||||||
char strSrc[512];
|
char strSrc[512];
|
||||||
smprintf (strSrc, 512, "%d", slot);
|
smprintf (strSrc, 512, "%d", slot);
|
||||||
char str[512];
|
TCHAR str[512];
|
||||||
long size = 512;
|
LONG size = 512 * sizeof(TCHAR);
|
||||||
if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS)
|
if (RegQueryValue(hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ret = str;
|
ret = tStrToUtf8(str);
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
RegCloseKey (hKey);
|
RegCloseKey (hKey);
|
||||||
|
@ -132,14 +132,14 @@ void CMemoryComboBox::scrollDown (int start, int end)
|
||||||
// Get the old value
|
// Get the old value
|
||||||
char strSrc[512];
|
char strSrc[512];
|
||||||
smprintf (strSrc, 512, "%d", i-1);
|
smprintf (strSrc, 512, "%d", i-1);
|
||||||
char str[512];
|
TCHAR str[512];
|
||||||
long size = 512;
|
LONG size = 512 * sizeof(TCHAR);
|
||||||
if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS)
|
if (RegQueryValue (hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// Set the value
|
// Set the value
|
||||||
char strDst[512];
|
char strDst[512];
|
||||||
smprintf (strDst, 512, "%d", i);
|
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)
|
if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// Set the value
|
// 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
|
// Close
|
||||||
RegCloseKey (hKey);
|
RegCloseKey (hKey);
|
||||||
|
@ -460,7 +461,7 @@ void CMemoryComboBox::refreshStrings ()
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
void CMemoryComboBox::setRegisterAdress (const char *registerAdress)
|
void CMemoryComboBox::setRegisterAdress (const TCHAR *registerAdress)
|
||||||
{
|
{
|
||||||
RegisterAdress = registerAdress;
|
RegisterAdress = registerAdress;
|
||||||
refreshStrings ();
|
refreshStrings ();
|
||||||
|
|
|
@ -46,9 +46,9 @@ public:
|
||||||
|
|
||||||
void onOK ();
|
void onOK ();
|
||||||
void onCancel ();
|
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 create (DWORD style, const RECT &rect, CWnd *parent, UINT nId);
|
||||||
void setRegisterAdress (const char *registerAdress);
|
void setRegisterAdress (const TCHAR *registerAdress);
|
||||||
void clearCommand ();
|
void clearCommand ();
|
||||||
void addCommand (const char* commandLabel, uint commandId);
|
void addCommand (const char* commandLabel, uint commandId);
|
||||||
void clearStaticStrings ();
|
void clearStaticStrings ();
|
||||||
|
@ -59,7 +59,7 @@ public:
|
||||||
bool isWnd (const CWnd *wnd) const;
|
bool isWnd (const CWnd *wnd) const;
|
||||||
void enableAutoCompleteExtension (bool enable, const char * ext);
|
void enableAutoCompleteExtension (bool enable, const char * ext);
|
||||||
|
|
||||||
std::string RegisterAdress;
|
std::tstring RegisterAdress;
|
||||||
int MemoryCount;
|
int MemoryCount;
|
||||||
UINT Id;
|
UINT Id;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ void COutputConsoleDlg::outputString (const char *message)
|
||||||
{
|
{
|
||||||
int index = edit->LineIndex(edit->GetLineCount( )-1) + edit->LineLength(edit->GetLineCount( )-1);
|
int index = edit->LineIndex(edit->GetLineCount( )-1) + edit->LineLength(edit->GetLineCount( )-1);
|
||||||
edit->SetSel (index, index);
|
edit->SetSel (index, index);
|
||||||
edit->ReplaceSel (message);
|
edit->ReplaceSel (utf8ToTStr(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
void deleteKey (HKEY hKey, const char *name)
|
void deleteKey (HKEY hKey, const TCHAR *name)
|
||||||
{
|
{
|
||||||
HKEY subKey;
|
HKEY subKey;
|
||||||
if (RegOpenKey (hKey, name, &subKey) == ERROR_SUCCESS)
|
if (RegOpenKey (hKey, name, &subKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
char subName[512];
|
TCHAR subName[512];
|
||||||
while (RegEnumKey (subKey, 0, subName, 512) == ERROR_SUCCESS)
|
while (RegEnumKey (subKey, 0, subName, 512) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
deleteKey (subKey, subName);
|
deleteKey (subKey, subName);
|
||||||
|
|
Loading…
Reference in a new issue