Fixing unicode in georges edit dll

This commit is contained in:
kaetemi 2019-04-30 12:53:26 +08:00
parent d2fc5d200e
commit bb792b8307
10 changed files with 79 additions and 78 deletions

View file

@ -44,7 +44,7 @@ IAction::IAction (TTypeAction type, uint selId, uint slot)
// *************************************************************************** // ***************************************************************************
void IAction::setLabel (const std::string &logLabel, CGeorgesEditDoc &doc) void IAction::setLabel (const char *logLabel, CGeorgesEditDoc &doc)
{ {
_LogLabel = logLabel; _LogLabel = logLabel;
@ -75,7 +75,7 @@ bool IAction::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool fi
// *************************************************************************** // ***************************************************************************
void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeorgesEditDoc &doc, const std::string &_FormName) void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeorgesEditDoc &doc, const char *_FormName)
{ {
// Right and left view // Right and left view
CGeorgesEditView *rightView = doc.getRightView (); CGeorgesEditView *rightView = doc.getRightView ();
@ -129,7 +129,7 @@ void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeor
// *************************************************************************** // ***************************************************************************
CActionString::CActionString (IAction::TTypeAction type, const std::string &newValue, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot) : IAction (type, selId, slot) CActionString::CActionString (IAction::TTypeAction type, const char *newValue, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot) : IAction (type, selId, slot)
{ {
// Set the new value // Set the new value
_NewValue = newValue; _NewValue = newValue;
@ -235,7 +235,7 @@ CActionString::CActionString (IAction::TTypeAction type, const std::string &newV
bool vdfnArray; bool vdfnArray;
CForm *form=doc.getFormPtr (); CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (slot); CFormElm *elm = doc.getRootNode (slot);
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) ); &nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) );
if (node) if (node)
{ {
@ -364,7 +364,7 @@ bool CActionString::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, b
bool parentVDnfArray; bool parentVDnfArray;
CForm *form=doc.getFormPtr (); CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (_Slot); CFormElm *elm = doc.getRootNode (_Slot);
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDnfArray, true, NLGEORGES_FIRST_ROUND) ); &nodeDfn, &nodeType, &node, type, array, parentVDnfArray, true, NLGEORGES_FIRST_ROUND) );
nlassert (node); nlassert (node);
CFormElmAtom *atom = safe_cast<CFormElmAtom*> (node); CFormElmAtom *atom = safe_cast<CFormElmAtom*> (node);
@ -437,14 +437,14 @@ bool CActionString::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, b
bool vdfnArray; bool vdfnArray;
CForm *form=doc.getFormPtr (); CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (_Slot); CFormElm *elm = doc.getRootNode (_Slot);
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) ); &nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) );
if (node) if (node)
{ {
CFormElmArray* array = safe_cast<CFormElmArray*> (node->getParent ()); CFormElmArray* array = safe_cast<CFormElmArray*> (node->getParent ());
array->Elements[idInParent].Name = _Value[index]; array->Elements[idInParent].Name = _Value[index];
modified = true; modified = true;
update (true, DoNothing, doc, _FormName); update (true, DoNothing, doc, _FormName.c_str ());
} }
} }
break; break;
@ -716,14 +716,14 @@ bool CActionStringVector::doAction (CGeorgesEditDoc &doc, bool redo, bool &modif
bool parentVDfnArray; bool parentVDfnArray;
CForm *form=doc.getFormPtr (); CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (slot); CFormElm *elm = doc.getRootNode (slot);
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true) ); nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true) );
// Is a type entry ? // Is a type entry ?
if ((type == UFormDfn::EntryType) && array) if ((type == UFormDfn::EntryType) && array)
{ {
// Create the array // Create the array
bool created; bool created;
nlverify ( elm->createNodeByName (_FormName, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, created) ); nlverify ( elm->createNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, created) );
nlassert (node); nlassert (node);
// Get the atom // Get the atom
@ -921,7 +921,7 @@ bool CActionStringVectorVector::doAction (CGeorgesEditDoc &doc, bool redo, bool
// *************************************************************************** // ***************************************************************************
CActionBuffer::CActionBuffer(IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot) : IAction(type, selId, slot) CActionBuffer::CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot) : IAction (type, selId, slot)
{ {
// New value // New value
_FormName = formName; _FormName = formName;

View file

@ -59,7 +59,7 @@ protected:
IAction (TTypeAction type, uint selId, uint slot); IAction (TTypeAction type, uint selId, uint slot);
// Init log label // Init log label
void setLabel (const std::string &logLabel, CGeorgesEditDoc &doc); void setLabel (const char *logLabel, CGeorgesEditDoc &doc);
public: public:
@ -96,7 +96,7 @@ protected:
UpdateValues, UpdateValues,
Redraw Redraw
}; };
void update (bool updateLeftView, TUpdateRightView rightView, CGeorgesEditDoc &doc, const std::string &_FormName); void update (bool updateLeftView, TUpdateRightView rightView, CGeorgesEditDoc &doc, const char *_FormName);
}; };
// String modification action // String modification action
@ -105,7 +105,7 @@ class CActionString : public IAction
public: public:
// Constructor // Constructor
CActionString(IAction::TTypeAction type, const std::string &newValue, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot); CActionString (IAction::TTypeAction type, const char *newValue, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot);
protected: protected:
@ -165,7 +165,7 @@ class CActionBuffer : public IAction
public: public:
// Constructor // Constructor
CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot); CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot);
protected: protected:
@ -182,4 +182,5 @@ protected:
virtual bool doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool firstTime); virtual bool doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool firstTime);
}; };
#endif #endif /* GEORGES_EDIT_ACTION_H */

View file

@ -230,7 +230,7 @@ BOOL CBaseDialog::PreTranslateMessage(MSG* pMsg)
return CDialog::PreTranslateMessage(pMsg); return CDialog::PreTranslateMessage(pMsg);
} }
void CBaseDialog::setEditTextMultiLine (CEdit &edit, const std::string &text) void CBaseDialog::setEditTextMultiLine (CEdit &edit, const char *text)
{ {
edit.SetWindowText (utf8ToTStr(NLMISC::addSlashR(text))); edit.SetWindowText (utf8ToTStr(NLMISC::addSlashR(text)));
} }

View file

@ -126,7 +126,7 @@ public:
void registerLastControl (); void registerLastControl ();
void unRegisterLastControl (); void unRegisterLastControl ();
static void setEditTextMultiLine(CEdit &edit, const std::string &text); static void setEditTextMultiLine (CEdit &edit, const char *text);
virtual void onOpenSelected (); virtual void onOpenSelected ();
virtual void setFocusLastWidget (); virtual void setFocusLastWidget ();

View file

@ -468,16 +468,16 @@ void CDfnDialog::onOpenSelected ()
int nItem = Parents.ListCtrl.GetNextSelectedItem(pos); int nItem = Parents.ListCtrl.GetNextSelectedItem(pos);
// Get the string // Get the string
std::string str = tStrToUtf8(Parents.ListCtrl.GetItemText (nItem, 0)); CString str = Parents.ListCtrl.GetItemText (nItem, 0);
if (!str.empty()) if (str != "")
{ {
// Look for the file // Look for the file
string name = CPath::lookup (str, false, false); CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
if (name.empty ()) if (name.IsEmpty())
name = str; name = str;
// Open the file // Open the file
theApp.OpenDocumentFile (utf8ToTStr(name)); theApp.OpenDocumentFile(name);
} }
} }
} }
@ -490,16 +490,16 @@ void CDfnDialog::onOpenSelected ()
int nItem = Struct.ListCtrl.GetNextSelectedItem(pos); int nItem = Struct.ListCtrl.GetNextSelectedItem(pos);
// Get the string // Get the string
std::string str = tStrToUtf8(Struct.ListCtrl.GetItemText (nItem, 2)); CString str = Struct.ListCtrl.GetItemText (nItem, 2);
if (!str.empty()) if (str != "")
{ {
// Look for the file // Look for the file
string name = CPath::lookup (str, false, false); CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
if (name.empty ()) if (name.IsEmpty())
name = str; name = str;
// Open the file // Open the file
theApp.OpenDocumentFile (utf8ToTStr(name)); theApp.OpenDocumentFile(name);
} }
} }
} }

View file

@ -548,7 +548,7 @@ void CFormDialog::setToDocument (uint widget)
bool parentVDfnArray; bool parentVDfnArray;
CForm *form=doc->getFormPtr (); CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (Widgets[widget]->getSlot ()); CFormElm *elm = doc->getRootNode (Widgets[widget]->getSlot ());
nlverify ( elm->getNodeByName (Widgets[widget]->getFormName (), &parentDfn, indexDfn, nlverify ( elm->getNodeByName (Widgets[widget]->getFormName ().c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) ); &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Must create array or virtual dfn ? // Must create array or virtual dfn ?
@ -811,7 +811,7 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam)
bool parentVDfnArray; bool parentVDfnArray;
CForm *form=doc->getFormPtr (); CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (Widgets[widgetId]->getSlot ()); CFormElm *elm = doc->getRootNode (Widgets[widgetId]->getSlot ());
nlverify ( elm->getNodeByName (Widgets[widgetId]->getFormName (), &parentDfn, indexDfn, nlverify ( elm->getNodeByName (Widgets[widgetId]->getFormName ().c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) ); &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
nlassert (parentDfn); nlassert (parentDfn);
@ -832,11 +832,11 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam)
smprintf (filter, 512, "%s Files (%s)|%s|All Files(*.*)|*.*|", typeName+i, ext.c_str(), ext.c_str()); smprintf (filter, 512, "%s Files (%s)|%s|All Files(*.*)|*.*|", typeName+i, ext.c_str(), ext.c_str());
// Open the dialog // Open the dialog
CFileDialog dlgFile (TRUE, ext.c_str (), ext.c_str (), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, theApp.m_pMainWnd); CFileDialog dlgFile(TRUE, utf8ToTStr(ext), utf8ToTStr(ext), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, utf8ToTStr(filter), theApp.m_pMainWnd);
if (dlgFile.DoModal () == IDOK) if (dlgFile.DoModal () == IDOK)
{ {
combo->Combo.UpdateData (); combo->Combo.UpdateData ();
combo->Combo.SetWindowText (dlgFile.GetFileName ()); combo->Combo.SetWindowText(dlgFile.GetFileName());
combo->Combo.UpdateData (FALSE); combo->Combo.UpdateData (FALSE);
setToDocument (widgetId); setToDocument (widgetId);
PostMessage (CBN_CHANGED, 0, 0); PostMessage (CBN_CHANGED, 0, 0);
@ -850,7 +850,7 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam)
if (colorEdit && IsWindow (colorEdit->Color)) if (colorEdit && IsWindow (colorEdit->Color))
{ {
colorEdit->Empty = true; colorEdit->Empty = true;
colorEdit->Edit.SetWindowText(""); colorEdit->Edit.SetWindowText(_T(""));
setToDocument (getWidget (wParam)); setToDocument (getWidget (wParam));
updateValues (); updateValues ();
} }
@ -926,7 +926,7 @@ BOOL CFormDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
CString str; CString str;
combo->Combo.UpdateData (); combo->Combo.UpdateData ();
combo->Combo.GetWindowText (str); combo->Combo.GetWindowText (str);
if (sscanf (str, "%f", &value) == 1) if (_stscanf (str, _T("%f"), &value) == 1)
{ {
CGeorgesEditDoc *doc = View->GetDocument(); CGeorgesEditDoc *doc = View->GetDocument();
if (doc) if (doc)
@ -1166,14 +1166,14 @@ void CFormDialog::getFromDocument ()
// *************************************************************************** // ***************************************************************************
void CFormDialog::getDfnName (string &result) const void CFormDialog::getDfnName(string &result) const
{ {
CGeorgesEditDoc *doc = View->GetDocument (); CGeorgesEditDoc *doc = View->GetDocument ();
if (doc) if (doc)
{ {
// Get the DFN filename // Get the DFN filename
CString str = doc->GetPathName (); CString str = doc->GetPathName();
result NLMISC::CFile::getExtension(tStrToUtf8(str)); result = NLMISC::CFile::getExtension(tStrToUtf8(str));
} }
else else
result.clear(); result.clear();
@ -1316,16 +1316,16 @@ void IFormWidget::updateLabel ()
switch (where) switch (where)
{ {
case UFormElm::ValueForm: case UFormElm::ValueForm:
Label.SetWindowText ((SavedLabel+comp).c_str()); Label.SetWindowText(utf8ToTStr(SavedLabel + comp));
break; break;
case UFormElm::ValueParentForm: case UFormElm::ValueParentForm:
Label.SetWindowText ((SavedLabel+" (in parent form)"+comp).c_str()); Label.SetWindowText(utf8ToTStr(SavedLabel + " (in parent form)" + comp));
break; break;
case UFormElm::ValueDefaultDfn: case UFormElm::ValueDefaultDfn:
Label.SetWindowText ((SavedLabel+" (default DFN value)"+comp).c_str()); Label.SetWindowText(utf8ToTStr(SavedLabel + " (default DFN value)" + comp));
break; break;
case UFormElm::ValueDefaultType: case UFormElm::ValueDefaultType:
Label.SetWindowText ((SavedLabel+" (default TYPE value)"+comp).c_str()); Label.SetWindowText(utf8ToTStr(SavedLabel + " (default TYPE value)" + comp));
break; break;
} }
} }
@ -1569,7 +1569,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent,
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (label, WS_VISIBLE, currentPos, parent); Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -1603,7 +1603,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent,
RECT spinPos = currentPos; RECT spinPos = currentPos;
parent->getNextBrowsePos (spinPos); parent->getNextBrowsePos (spinPos);
parent->setBrowseSize (spinPos); parent->setBrowseSize (spinPos);
Browse.Create ("...", WS_CHILD|WS_VISIBLE|WS_TABSTOP, spinPos, parent, dialog_index+1); Browse.Create (_T("..."), WS_CHILD|WS_VISIBLE|WS_TABSTOP, spinPos, parent, dialog_index+1);
parent->initWidget (Browse); parent->initWidget (Browse);
parent->getNextPos (currentPos); parent->getNextPos (currentPos);
@ -1675,7 +1675,7 @@ void CFormMemCombo::getValue (std::string &result)
Combo.UpdateData (FALSE); Combo.UpdateData (FALSE);
// Set the atom value // Set the atom value
result = (const char*)str; result = tStrToUtf8(str);
} }
// *************************************************************************** // ***************************************************************************
@ -1720,7 +1720,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
CFormElmArray *arrayNode = safe_cast<CFormElmArray*> (node); CFormElmArray *arrayNode = safe_cast<CFormElmArray*> (node);
char label[512]; char label[512];
smprintf (label, 512, "%d", arrayNode->Elements.size ()); smprintf (label, 512, "%d", arrayNode->Elements.size ());
Combo.SetWindowText (label); Combo.SetWindowText (utf8ToTStr(label));
if (arrayNode->getForm () == &form) if (arrayNode->getForm () == &form)
Label.SetWindowText (_T("Array size:")); Label.SetWindowText (_T("Array size:"));
@ -1903,7 +1903,7 @@ void CFormCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (label, WS_VISIBLE, currentPos, parent); Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -1918,10 +1918,10 @@ void CFormCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
// Get predefs // Get predefs
if (nodeType) if (nodeType)
{ {
Combo.InsertString (0, ""); Combo.InsertString (0, _T(""));
for (uint predef=0; predef<nodeType->Definitions.size(); predef++) for (uint predef=0; predef<nodeType->Definitions.size(); predef++)
{ {
Combo.InsertString (predef+1, nodeType->Definitions[predef].Label.c_str()); Combo.InsertString (predef+1, utf8ToTStr(nodeType->Definitions[predef].Label));
} }
} }
@ -1973,7 +1973,7 @@ void CFormCombo::getValue (std::string &result)
Combo.UpdateData (FALSE); Combo.UpdateData (FALSE);
// Set the atom value // Set the atom value
result = (const char*)str; result = tStrToUtf8(str);
} }
// *************************************************************************** // ***************************************************************************
@ -2088,13 +2088,13 @@ void CFormBigEdit::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent,
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (label, WS_VISIBLE, currentPos, parent); Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
// Create the mem combobox // Create the mem combobox
parent->setBigEditSize (currentPos, parent->SmallWidget); parent->setBigEditSize (currentPos, parent->SmallWidget);
Edit.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, parent, dialog_index); Edit.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, parent, dialog_index);
parent->initWidget (Edit); parent->initWidget (Edit);
parent->getNextPos (currentPos); parent->getNextPos (currentPos);
@ -2146,7 +2146,7 @@ void CFormBigEdit::getValue (std::string &result)
Edit.UpdateData (FALSE); Edit.UpdateData (FALSE);
// Set the atom value // Set the atom value
result = (const char*)str; result = tStrToUtf8(str);
} }
// *************************************************************************** // ***************************************************************************
@ -2262,7 +2262,7 @@ void CColorEdit::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (label, WS_VISIBLE, currentPos, parent); Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -2275,13 +2275,13 @@ void CColorEdit::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
RECT resetPos = currentPos; RECT resetPos = currentPos;
parent->getNextColorPos (resetPos); parent->getNextColorPos (resetPos);
parent->setResetColorSize (resetPos); parent->setResetColorSize (resetPos);
Reset.Create ("Reset", WS_CHILD|WS_VISIBLE|WS_TABSTOP, resetPos, parent, dialog_index+1); Reset.Create (_T("Reset"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, resetPos, parent, dialog_index+1);
parent->initWidget (Reset); parent->initWidget (Reset);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
// Create the Edit // Create the Edit
parent->setBigEditSize (currentPos, parent->SmallWidget); parent->setBigEditSize (currentPos, parent->SmallWidget);
Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), "", ES_OEMCONVERT|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL, currentPos, parent, dialog_index+2); Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), ES_OEMCONVERT|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL, currentPos, parent, dialog_index+2);
parent->initWidget (Edit); parent->initWidget (Edit);
parent->getNextPos (currentPos); parent->getNextPos (currentPos);
@ -2492,7 +2492,7 @@ void CListWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (label, WS_VISIBLE, currentPos, parent); Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -2504,7 +2504,7 @@ void CListWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
// Create the assign parent // Create the assign parent
parent->setButtonSize (currentPos, parent->SmallWidget); parent->setButtonSize (currentPos, parent->SmallWidget);
Button.Create ("Assign parents", WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index+1); Button.Create (_T("Assign parents"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index+1);
parent->initWidget (Button); parent->initWidget (Button);
parent->getNextPos (currentPos); parent->getNextPos (currentPos);
@ -2515,7 +2515,7 @@ void CListWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
void CListWidget::addColumn (const char *name) void CListWidget::addColumn (const char *name)
{ {
ListCtrl.insertColumn (0, name); ListCtrl.insertColumn (0, utf8ToTStr(name));
ListCtrl.recalcColumn (); ListCtrl.recalcColumn ();
} }
@ -2566,7 +2566,7 @@ void CListWidget::getFromDocument (NLGEORGES::CForm &form)
string filename = form.getParentFilename (parent); string filename = form.getParentFilename (parent);
// Insert in the list // Insert in the list
ListCtrl.ListCtrl.InsertItem (parent, filename.c_str ()); ListCtrl.ListCtrl.InsertItem (parent, utf8ToTStr(filename));
ListCtrl.ListCtrl.UpdateData (FALSE); ListCtrl.ListCtrl.UpdateData (FALSE);
updateLabel (); updateLabel ();
@ -2585,7 +2585,7 @@ uint CListWidget::getNumValue ()
void CListWidget::getValue (std::string &result, uint value) void CListWidget::getValue (std::string &result, uint value)
{ {
CString str = ListCtrl.ListCtrl.GetItemText (value, 0); CString str = ListCtrl.ListCtrl.GetItemText (value, 0);
result = str; result = tStrToUtf8(str);
} }
// *************************************************************************** // ***************************************************************************
@ -2709,12 +2709,12 @@ void CListWidget::onOpenSelected ()
if (str != "") if (str != "")
{ {
// Look for the file // Look for the file
string name = CPath::lookup ((const char*)str, false, false); CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
if (name.empty ()) if (name.IsEmpty())
name = str; name = str;
// Open the file // Open the file
theApp.OpenDocumentFile (name.c_str ()); theApp.OpenDocumentFile(name);
} }
} }
} }
@ -2750,7 +2750,7 @@ void CIconWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (label, WS_VISIBLE, currentPos, parent); Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);

View file

@ -1025,7 +1025,7 @@ void CGeorgesEditApp::OnUpdateFileSaveAll(CCmdUI* pCmdUI)
pCmdUI->Enable (getActiveDocument () != NULL); pCmdUI->Enable (getActiveDocument () != NULL);
} }
bool CGeorgesEditApp::SerialIntoMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard) bool CGeorgesEditApp::SerialIntoMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard)
{ {
// Ok, get the node // Ok, get the node
const CFormDfn *parentDfn; const CFormDfn *parentDfn;
@ -1228,7 +1228,7 @@ bool CGeorgesEditApp::FillMemStreamWithClipboard (const char *formName, CGeorges
return false; return false;
} }
bool CGeorgesEditApp::SerialFromMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot) bool CGeorgesEditApp::SerialFromMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot)
{ {
// The form pointer // The form pointer
CForm *form = doc->getFormPtr (); CForm *form = doc->getFormPtr ();

View file

@ -119,11 +119,11 @@ public:
public: public:
// Memory stream // Memory stream
NLMISC::CMemStream MemStream; NLMISC::CMemStream MemStream;
bool FillMemStreamWithClipboard (const std::string &formName, CGeorgesEditDoc *doc, uint slot); bool FillMemStreamWithClipboard (const char *formName, CGeorgesEditDoc *doc, uint slot);
void FillMemStreamWithBuffer (const uint8 *buffer, uint size); void FillMemStreamWithBuffer (const uint8 *buffer, uint size);
bool SerialIntoMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard); bool SerialIntoMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard);
bool SerialFromMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot); bool SerialFromMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot);
// Init // Init
BOOL initInstance (int nCmdShow, bool exeStandalone, int x, int y, int cx, int cy); BOOL initInstance (int nCmdShow, bool exeStandalone, int x, int y, int cx, int cy);
@ -136,7 +136,7 @@ public:
// From IEdit // From IEdit
NLGEORGES::IEditDocument *getActiveDocument (); NLGEORGES::IEditDocument *getActiveDocument ();
NLGEORGES::IEditDocument *createDocument (const std::string &dfnName, const std::string &pathName); NLGEORGES::IEditDocument *createDocument (const char *dfnName, const char *pathName);
virtual void getSearchPath (std::string &searchPath); virtual void getSearchPath (std::string &searchPath);
virtual NLMISC::CConfigFile &getConfigFile() { return ConfigFile; } virtual NLMISC::CConfigFile &getConfigFile() { return ConfigFile; }
@ -153,10 +153,10 @@ public:
CImageListEx ImageList; CImageListEx ImageList;
// Get a template form // Get a template form
CMultiDocTemplate *getFormDocTemplate (const std::string &dfnName); CMultiDocTemplate *getFormDocTemplate (const char *dfnName);
void saveWindowState (const CWnd *wnd, const std::string &name, bool controlBar); void saveWindowState (const CWnd *wnd, const char *name, bool controlBar);
void loadWindowState (CWnd *wnd, const std::string &name, bool changeShowWindow, bool controlBar); void loadWindowState (CWnd *wnd, const char *name, bool changeShowWindow, bool controlBar);
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
@ -176,8 +176,8 @@ public:
void releasePlugins (); void releasePlugins ();
// Dialog function // Dialog function
void outputError (const std::string &message); void outputError (const char* message);
bool yesNo (const std::string &message); bool yesNo (const char* message);
bool getColor (NLMISC::CRGBA &color); bool getColor (NLMISC::CRGBA &color);
// Browse an URL // Browse an URL

View file

@ -460,7 +460,7 @@ void CMemoryComboBox::refreshStrings ()
// *************************************************************************** // ***************************************************************************
void CMemoryComboBox::setRegisterAdress(const std::string &registerAdress) void CMemoryComboBox::setRegisterAdress (const char *registerAdress)
{ {
RegisterAdress = registerAdress; RegisterAdress = registerAdress;
refreshStrings (); refreshStrings ();
@ -468,7 +468,7 @@ void CMemoryComboBox::setRegisterAdress(const std::string &registerAdress)
// *************************************************************************** // ***************************************************************************
void CMemoryComboBox::addCommand (const std::string &commandLabel, uint commandId) void CMemoryComboBox::addCommand (const char* commandLabel, uint commandId)
{ {
Commands.push_back (CCommand ()); Commands.push_back (CCommand ());
Commands[Commands.size()-1].Label = commandLabel; Commands[Commands.size()-1].Label = commandLabel;

View file

@ -48,9 +48,9 @@ public:
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 char *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 std::string &registerAdress); void setRegisterAdress (const char *registerAdress);
void clearCommand (); void clearCommand ();
void addCommand(const std::string &commandLabel, uint commandId); void addCommand (const char* commandLabel, uint commandId);
void clearStaticStrings (); void clearStaticStrings ();
void addStaticStrings (const char* strings); void addStaticStrings (const char* strings);
uint getCommandCount () const; uint getCommandCount () const;