69 auto blank_editor_set = std::make_unique<EditorSet>();
73 if (!filename.empty()) {
84 context_.shortcut_manager.RegisterShortcut(
85 "Open", {ImGuiKey_O, ImGuiMod_Ctrl}, [&]() {
status_ =
LoadRom(); });
86 context_.shortcut_manager.RegisterShortcut(
87 "Save", {ImGuiKey_S, ImGuiMod_Ctrl}, [&]() {
status_ =
SaveRom(); });
88 context_.shortcut_manager.RegisterShortcut(
89 "Close", {ImGuiKey_W, ImGuiMod_Ctrl}, [&]() {
92 context_.shortcut_manager.RegisterShortcut(
93 "Quit", {ImGuiKey_Q, ImGuiMod_Ctrl}, [&]() {
quit_ =
true; });
95 context_.shortcut_manager.RegisterShortcut(
96 "Undo", {ImGuiKey_Z, ImGuiMod_Ctrl},
98 context_.shortcut_manager.RegisterShortcut(
99 "Redo", {ImGuiKey_Y, ImGuiMod_Ctrl},
101 context_.shortcut_manager.RegisterShortcut(
102 "Cut", {ImGuiKey_X, ImGuiMod_Ctrl},
104 context_.shortcut_manager.RegisterShortcut(
105 "Copy", {ImGuiKey_C, ImGuiMod_Ctrl},
107 context_.shortcut_manager.RegisterShortcut(
108 "Paste", {ImGuiKey_V, ImGuiMod_Ctrl},
110 context_.shortcut_manager.RegisterShortcut(
111 "Find", {ImGuiKey_F, ImGuiMod_Ctrl},
114 context_.shortcut_manager.RegisterShortcut(
115 "Load Last ROM", {ImGuiKey_R, ImGuiMod_Ctrl}, [&]() {
124 context_.shortcut_manager.RegisterShortcut(
128 std::vector<gui::MenuItem> recent_files;
132 recent_files.emplace_back(
"No Recent Files",
"",
nullptr);
135 recent_files.emplace_back(filePath,
"", [filePath,
this]() {
141 std::vector<gui::MenuItem> options_subitems;
142 options_subitems.emplace_back(
145 options_subitems.emplace_back(
149 std::vector<gui::MenuItem> project_menu_subitems;
150 project_menu_subitems.emplace_back(
151 "New Project",
"", [&]() {
popup_manager_->Show(
"New Project"); });
152 project_menu_subitems.emplace_back(
"Open Project",
"",
154 project_menu_subitems.emplace_back(
165 context_.shortcut_manager.GetKeys(
"Open"),
166 context_.shortcut_manager.GetCallback(
"Open")},
167 {
"Open Recent",
"", [&]() {},
168 []() {
return !manager.
GetRecentFiles().empty(); }, recent_files},
170 context_.shortcut_manager.GetKeys(
"Save"),
171 context_.shortcut_manager.GetCallback(
"Save")},
175 []() {
return true; }, project_menu_subitems},
182 [&]() {}, []() {
return true; }, options_subitems},
184 [&]() {
quit_ =
true; }},
192 context_.shortcut_manager.GetKeys(
"Cut"),
193 context_.shortcut_manager.GetCallback(
"Cut")},
195 context_.shortcut_manager.GetKeys(
"Copy"),
196 context_.shortcut_manager.GetCallback(
"Copy")},
198 context_.shortcut_manager.GetKeys(
"Paste"),
199 context_.shortcut_manager.GetCallback(
"Paste")},
202 context_.shortcut_manager.GetKeys(
"Undo"),
203 context_.shortcut_manager.GetCallback(
"Undo")},
205 context_.shortcut_manager.GetKeys(
"Redo"),
206 context_.shortcut_manager.GetCallback(
"Redo")},
209 context_.shortcut_manager.GetKeys(
"Find"),
210 context_.shortcut_manager.GetCallback(
"Find")},
278 {absl::StrCat(
ICON_MD_HELP,
" How to manage a project"),
"",
408 static bool show_display_settings =
false;
409 static bool save_as_menu =
false;
411 if (BeginMenuBar()) {
416 SameLine(GetWindowWidth() - GetStyle().ItemSpacing.x -
418 PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
420 show_display_settings = !show_display_settings;
427 if (show_display_settings) {
428 Begin(
"Display Settings", &show_display_settings, ImGuiWindowFlags_None);
464 static std::string save_as_filename =
"";
465 Begin(
"Save As..", &save_as_menu, ImGuiWindowFlags_AlwaysAutoResize);
466 InputText(
"Filename", &save_as_filename);
469 save_as_menu =
false;
473 save_as_menu =
false;
480 static std::string save_as_filename =
"";
481 InputText(
"Project Name", &save_as_filename);