57 if (!filename.empty()) {
68 context_.shortcut_manager.RegisterShortcut(
69 "Open", {ImGuiKey_O, ImGuiMod_Ctrl}, [
this]() {
status_ =
LoadRom(); });
70 context_.shortcut_manager.RegisterShortcut(
71 "Save", {ImGuiKey_S, ImGuiMod_Ctrl}, [
this]() {
status_ =
SaveRom(); });
72 context_.shortcut_manager.RegisterShortcut(
73 "Close", {ImGuiKey_W, ImGuiMod_Ctrl}, [
this]() {
76 context_.shortcut_manager.RegisterShortcut(
77 "Quit", {ImGuiKey_Q, ImGuiMod_Ctrl}, [
this]() {
quit_ =
true; });
79 context_.shortcut_manager.RegisterShortcut(
80 "Undo", {ImGuiKey_Z, ImGuiMod_Ctrl},
82 context_.shortcut_manager.RegisterShortcut(
83 "Redo", {ImGuiKey_Y, ImGuiMod_Ctrl},
85 context_.shortcut_manager.RegisterShortcut(
86 "Cut", {ImGuiKey_X, ImGuiMod_Ctrl},
88 context_.shortcut_manager.RegisterShortcut(
89 "Copy", {ImGuiKey_C, ImGuiMod_Ctrl},
91 context_.shortcut_manager.RegisterShortcut(
92 "Paste", {ImGuiKey_V, ImGuiMod_Ctrl},
94 context_.shortcut_manager.RegisterShortcut(
95 "Find", {ImGuiKey_F, ImGuiMod_Ctrl},
98 context_.shortcut_manager.RegisterShortcut(
99 "Load Last ROM", {ImGuiKey_R, ImGuiMod_Ctrl}, [
this]() {
108 context_.shortcut_manager.RegisterShortcut(
112 std::vector<gui::MenuItem> recent_files;
116 recent_files.emplace_back(
"No Recent Files",
"",
nullptr);
119 recent_files.emplace_back(filePath,
"", [filePath,
this]() {
125 std::vector<gui::MenuItem> options_subitems;
126 options_subitems.emplace_back(
129 options_subitems.emplace_back(
133 std::vector<gui::MenuItem> project_menu_subitems;
134 project_menu_subitems.emplace_back(
135 "New Project",
"", [
this]() {
popup_manager_->Show(
"New Project"); });
136 project_menu_subitems.emplace_back(
"Open Project",
"",
138 project_menu_subitems.emplace_back(
149 context_.shortcut_manager.GetKeys(
"Open"),
150 context_.shortcut_manager.GetCallback(
"Open")},
151 {
"Open Recent",
"", []() {},
152 []() {
return !manager.
GetRecentFiles().empty(); }, recent_files},
154 context_.shortcut_manager.GetKeys(
"Save"),
155 context_.shortcut_manager.GetCallback(
"Save")},
159 []() {
return true; }, project_menu_subitems},
166 []() {}, []() {
return true; }, options_subitems},
168 [
this]() {
quit_ =
true; }},
176 context_.shortcut_manager.GetKeys(
"Cut"),
177 context_.shortcut_manager.GetCallback(
"Cut")},
179 context_.shortcut_manager.GetKeys(
"Copy"),
180 context_.shortcut_manager.GetCallback(
"Copy")},
182 context_.shortcut_manager.GetKeys(
"Paste"),
183 context_.shortcut_manager.GetCallback(
"Paste")},
186 context_.shortcut_manager.GetKeys(
"Undo"),
187 context_.shortcut_manager.GetCallback(
"Undo")},
189 context_.shortcut_manager.GetKeys(
"Redo"),
190 context_.shortcut_manager.GetCallback(
"Redo")},
193 context_.shortcut_manager.GetKeys(
"Find"),
194 context_.shortcut_manager.GetCallback(
"Find")},
262 {absl::StrCat(
ICON_MD_HELP,
" How to manage a project"),
"",
394 static bool show_display_settings =
false;
395 static bool save_as_menu =
false;
397 if (BeginMenuBar()) {
402 SameLine(GetWindowWidth() - GetStyle().ItemSpacing.x -
404 PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
406 show_display_settings = !show_display_settings;
413 if (show_display_settings) {
414 Begin(
"Display Settings", &show_display_settings, ImGuiWindowFlags_None);
450 static std::string save_as_filename =
"";
451 Begin(
"Save As..", &save_as_menu, ImGuiWindowFlags_AlwaysAutoResize);
452 InputText(
"Filename", &save_as_filename);
455 save_as_menu =
false;
459 save_as_menu =
false;
466 static std::string save_as_filename =
"";
467 InputText(
"Project Name", &save_as_filename);