Add LoadRom to MasterEditor
This commit is contained in:
@@ -313,17 +313,7 @@ void MasterEditor::DrawFileMenu() {
|
|||||||
|
|
||||||
if (BeginMenu("File")) {
|
if (BeginMenu("File")) {
|
||||||
if (MenuItem("Open", "Ctrl+O")) {
|
if (MenuItem("Open", "Ctrl+O")) {
|
||||||
if (flags()->kNewFileDialogWrapper) {
|
LoadRom();
|
||||||
auto file_name = FileDialogWrapper::ShowOpenFileDialog();
|
|
||||||
PRINT_IF_ERROR(rom()->LoadFromFile(file_name));
|
|
||||||
static RecentFilesManager manager("recent_files.txt");
|
|
||||||
manager.Load();
|
|
||||||
manager.AddFile(file_name);
|
|
||||||
manager.Save();
|
|
||||||
} else {
|
|
||||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Open ROM",
|
|
||||||
".sfc,.smc", ".");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BeginMenu("Open Recent")) {
|
if (BeginMenu("Open Recent")) {
|
||||||
@@ -609,6 +599,20 @@ void MasterEditor::DrawHelpMenu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MasterEditor::LoadRom() {
|
||||||
|
if (flags()->kNewFileDialogWrapper) {
|
||||||
|
auto file_name = FileDialogWrapper::ShowOpenFileDialog();
|
||||||
|
PRINT_IF_ERROR(rom()->LoadFromFile(file_name));
|
||||||
|
static RecentFilesManager manager("recent_files.txt");
|
||||||
|
manager.Load();
|
||||||
|
manager.AddFile(file_name);
|
||||||
|
manager.Save();
|
||||||
|
} else {
|
||||||
|
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Open ROM",
|
||||||
|
".sfc,.smc", ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MasterEditor::SaveRom() {
|
void MasterEditor::SaveRom() {
|
||||||
if (flags()->kSaveDungeonMaps) {
|
if (flags()->kSaveDungeonMaps) {
|
||||||
status_ = screen_editor_.SaveDungeonMaps();
|
status_ = screen_editor_.SaveDungeonMaps();
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class MasterEditor : public SharedRom,
|
|||||||
void DrawViewMenu();
|
void DrawViewMenu();
|
||||||
void DrawHelpMenu();
|
void DrawHelpMenu();
|
||||||
|
|
||||||
|
void LoadRom();
|
||||||
void SaveRom();
|
void SaveRom();
|
||||||
|
|
||||||
bool about_ = false;
|
bool about_ = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user