Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/AtlasUI/CustomControls/MapDialog/MapDialog.cpp
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | void MapDialog::OnListBox(wxCommandEvent& evt) | ||||
else | else | ||||
m_FileName = evt.GetString(); | m_FileName = evt.GetString(); | ||||
if (m_Type == MAPDIALOG_SAVE) | if (m_Type == MAPDIALOG_SAVE) | ||||
wxDynamicCast(FindWindow(ID_MapDialogFilename), wxTextCtrl)->ChangeValue(m_FileName); | wxDynamicCast(FindWindow(ID_MapDialogFilename), wxTextCtrl)->ChangeValue(m_FileName); | ||||
else | else | ||||
{ | { | ||||
wxString filePath = GetSelectedFilePath(); | wxString filePath = GetSelectedFilePath(); | ||||
AtlasMessage::qVFSFileExists qry(filePath.wc_str()); | AtlasMessage::qVFSFileExists qry(filePath.ToStdWstring()); | ||||
qry.Post(); | qry.Post(); | ||||
if (!filePath.IsEmpty() && qry.exists) | if (!filePath.IsEmpty() && qry.exists) | ||||
{ | { | ||||
AtlasMessage::qVFSFileRealPath qry(filePath.wc_str()); | AtlasMessage::qVFSFileRealPath qry(filePath.ToStdWstring()); | ||||
qry.Post(); | qry.Post(); | ||||
wxDynamicCast(FindWindow(ID_MapDialogFilename), wxTextCtrl)->ChangeValue(*qry.realPath); | wxDynamicCast(FindWindow(ID_MapDialogFilename), wxTextCtrl)->ChangeValue(*qry.realPath); | ||||
} | } | ||||
} | } | ||||
if (evt.GetEventType() == wxEVT_COMMAND_LISTBOX_DOUBLECLICKED) | if (evt.GetEventType() == wxEVT_COMMAND_LISTBOX_DOUBLECLICKED) | ||||
{ | { | ||||
if (m_Type == MAPDIALOG_OPEN) | if (m_Type == MAPDIALOG_OPEN) | ||||
Show All 34 Lines | |||||
} | } | ||||
void MapDialog::OpenFile() | void MapDialog::OpenFile() | ||||
{ | { | ||||
wxString filePath = GetSelectedFilePath(); | wxString filePath = GetSelectedFilePath(); | ||||
if (filePath.empty()) | if (filePath.empty()) | ||||
return; | return; | ||||
AtlasMessage::qVFSFileExists qry(filePath.wc_str()); | AtlasMessage::qVFSFileExists qry(filePath.ToStdWstring()); | ||||
qry.Post(); | qry.Post(); | ||||
if (!qry.exists) | if (!qry.exists) | ||||
return; | return; | ||||
EndModal(wxID_OK); | EndModal(wxID_OK); | ||||
} | } | ||||
void MapDialog::SaveFile() | void MapDialog::SaveFile() | ||||
{ | { | ||||
wxString filePath = GetSelectedFilePath(); | wxString filePath = GetSelectedFilePath(); | ||||
if (filePath.empty()) | if (filePath.empty()) | ||||
return; | return; | ||||
// TODO: this test would work better outside the VFS | // TODO: this test would work better outside the VFS | ||||
AtlasMessage::qVFSFileExists qry(filePath.wc_str()); | AtlasMessage::qVFSFileExists qry(filePath.ToStdWstring()); | ||||
qry.Post(); | qry.Post(); | ||||
if (qry.exists) | if (qry.exists) | ||||
{ | { | ||||
if (wxMessageBox(_("WARNING: '") + filePath + _("' already exists, it may be overwritten. Continue?"), _("Overwrite map confirmation"), wxICON_EXCLAMATION | wxYES_NO) != wxYES) | if (wxMessageBox(_("WARNING: '") + filePath + _("' already exists, it may be overwritten. Continue?"), _("Overwrite map confirmation"), wxICON_EXCLAMATION | wxYES_NO) != wxYES) | ||||
return; | return; | ||||
} | } | ||||
EndModal(wxID_OK); | EndModal(wxID_OK); | ||||
Show All 11 Lines |
Wildfire Games · Phabricator