44#include " BI_InputUINodes.hpp"
55#include " BI_ArithmeticUINodes.hpp"
66#include " BI_ViewerUINodes.hpp"
7+ #include " WXAS_wxFileIO.hpp"
78#include " WXAS_ParameterDialog.hpp"
89#include " WXAS_NodeEditorControl.hpp"
910
1516#include < wx/wx.h>
1617#include < wx/splitter.h>
1718
18- static std::string WideStringToNormalString (const std::wstring& str)
19- {
20- std::wstring_convert<std::codecvt_utf8<wchar_t >, wchar_t > converter;
21- return converter.to_bytes (str);
22- }
23-
2419class ApplicationState
2520{
2621public:
@@ -364,6 +359,7 @@ class MainFrame : public wxFrame
364359
365360 void OnCommand (wxCommandEvent& evt)
366361 {
362+ WXAS ::wxFileIO fileIO;
367363 MenuBar::CommandId commandId = (MenuBar::CommandId) evt.GetId ();
368364 switch (commandId) {
369365 case MenuBar::CommandId::File_New:
@@ -378,7 +374,7 @@ class MainFrame : public wxFrame
378374 std::wstring fileName = fileDialog.GetPath ().ToStdWstring ();
379375 drawingControl->ClearImage ();
380376 // TODO: handle when open fails
381- if (nodeEditorControl->Open (WideStringToNormalString ( fileName) , &headerIO)) {
377+ if (nodeEditorControl->Open (fileName, &fileIO , &headerIO)) {
382378 applicationState.SetCurrentFileName (fileName);
383379 } else {
384380 Reset ();
@@ -390,10 +386,10 @@ class MainFrame : public wxFrame
390386 {
391387 wxFileDialog fileDialog (this , L" Save" , L" " , L" " , L" Node Engine Files (*.ne)|*.ne" , wxFD_SAVE);
392388 if (applicationState.HasCurrentFileName ()) {
393- nodeEditorControl->Save (WideStringToNormalString ( applicationState.GetCurrentFileName ()) , &headerIO);
389+ nodeEditorControl->Save (applicationState.GetCurrentFileName (), &fileIO , &headerIO);
394390 } else if (fileDialog.ShowModal () == wxID_OK) {
395391 std::wstring fileName = fileDialog.GetPath ().ToStdWstring ();
396- nodeEditorControl->Save (WideStringToNormalString ( fileName) , &headerIO);
392+ nodeEditorControl->Save (fileName, &fileIO , &headerIO);
397393 applicationState.SetCurrentFileName (fileName);
398394 }
399395 }
@@ -403,7 +399,7 @@ class MainFrame : public wxFrame
403399 wxFileDialog fileDialog (this , L" Save As" , L" " , L" " , L" Node Engine Files (*.ne)|*.ne" , wxFD_SAVE);
404400 if (fileDialog.ShowModal () == wxID_OK) {
405401 std::wstring fileName = fileDialog.GetPath ().ToStdWstring ();
406- nodeEditorControl->Save (WideStringToNormalString ( fileName) , &headerIO);
402+ nodeEditorControl->Save (fileName, &fileIO , &headerIO);
407403 applicationState.SetCurrentFileName (fileName);
408404 }
409405 }
0 commit comments