67 auto blank_editor_set = std::make_unique<EditorSet>();
71 if (!filename.empty()) {
82 context_.shortcut_manager.RegisterShortcut(
83 "Open", {ImGuiKey_O, ImGuiMod_Ctrl}, [&]() {
status_ =
LoadRom(); });
84 context_.shortcut_manager.RegisterShortcut(
85 "Save", {ImGuiKey_S, ImGuiMod_Ctrl}, [&]() {
status_ =
SaveRom(); });
86 context_.shortcut_manager.RegisterShortcut(
87 "Close", {ImGuiKey_W, ImGuiMod_Ctrl}, [&]() {
90 context_.shortcut_manager.RegisterShortcut(
91 "Quit", {ImGuiKey_Q, ImGuiMod_Ctrl}, [&]() {
quit_ =
true; });
93 context_.shortcut_manager.RegisterShortcut(
94 "Undo", {ImGuiKey_Z, ImGuiMod_Ctrl},
96 context_.shortcut_manager.RegisterShortcut(
97 "Redo", {ImGuiKey_Y, ImGuiMod_Ctrl},
99 context_.shortcut_manager.RegisterShortcut(
100 "Cut", {ImGuiKey_X, ImGuiMod_Ctrl},
102 context_.shortcut_manager.RegisterShortcut(
103 "Copy", {ImGuiKey_C, ImGuiMod_Ctrl},
105 context_.shortcut_manager.RegisterShortcut(
106 "Paste", {ImGuiKey_V, ImGuiMod_Ctrl},
108 context_.shortcut_manager.RegisterShortcut(
109 "Find", {ImGuiKey_F, ImGuiMod_Ctrl},
112 context_.shortcut_manager.RegisterShortcut(
113 "Load Last ROM", {ImGuiKey_R, ImGuiMod_Ctrl}, [&]() {
122 context_.shortcut_manager.RegisterShortcut(
126 std::vector<gui::MenuItem> recent_files;
130 recent_files.emplace_back(
"No Recent Files",
"",
nullptr);
133 recent_files.emplace_back(filePath,
"", [filePath,
this]() {
139 std::vector<gui::MenuItem> options_subitems;
140 options_subitems.emplace_back(
143 options_subitems.emplace_back(
147 std::vector<gui::MenuItem> project_menu_subitems;
148 project_menu_subitems.emplace_back(
149 "New Project",
"", [&]() {
popup_manager_->Show(
"New Project"); });
150 project_menu_subitems.emplace_back(
"Open Project",
"",
152 project_menu_subitems.emplace_back(
163 context_.shortcut_manager.GetKeys(
"Open"),
164 context_.shortcut_manager.GetCallback(
"Open")},
165 {
"Open Recent",
"", [&]() {},
166 []() {
return !manager.
GetRecentFiles().empty(); }, recent_files},
168 context_.shortcut_manager.GetKeys(
"Save"),
169 context_.shortcut_manager.GetCallback(
"Save")},
173 []() {
return true; }, project_menu_subitems},
180 [&]() {}, []() {
return true; }, options_subitems},
182 [&]() {
quit_ =
true; }},
190 context_.shortcut_manager.GetKeys(
"Cut"),
191 context_.shortcut_manager.GetCallback(
"Cut")},
193 context_.shortcut_manager.GetKeys(
"Copy"),
194 context_.shortcut_manager.GetCallback(
"Copy")},
196 context_.shortcut_manager.GetKeys(
"Paste"),
197 context_.shortcut_manager.GetCallback(
"Paste")},
200 context_.shortcut_manager.GetKeys(
"Undo"),
201 context_.shortcut_manager.GetCallback(
"Undo")},
203 context_.shortcut_manager.GetKeys(
"Redo"),
204 context_.shortcut_manager.GetCallback(
"Redo")},
207 context_.shortcut_manager.GetKeys(
"Find"),
208 context_.shortcut_manager.GetCallback(
"Find")},
276 {absl::StrCat(
ICON_MD_HELP,
" How to manage a project"),
"",
414 static bool show_display_settings =
false;
415 static bool save_as_menu =
false;
417 if (BeginMenuBar()) {
422 SameLine(GetWindowWidth() - GetStyle().ItemSpacing.x -
424 PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
426 show_display_settings = !show_display_settings;
433 if (show_display_settings) {
434 Begin(
"Display Settings", &show_display_settings, ImGuiWindowFlags_None);
470 static std::string save_as_filename =
"";
471 Begin(
"Save As..", &save_as_menu, ImGuiWindowFlags_AlwaysAutoResize);
472 InputText(
"Filename", &save_as_filename);
475 save_as_menu =
false;
479 save_as_menu =
false;
486 static std::string save_as_filename =
"";
487 InputText(
"Project Name", &save_as_filename);