57 if (!filename.empty()) {
61 std::vector<gui::MenuItem> recent_files;
65 recent_files.emplace_back(
"No Recent Files",
"",
nullptr);
68 recent_files.emplace_back(filePath,
"",
73 std::vector<gui::MenuItem> options_subitems;
74 options_subitems.emplace_back(
77 options_subitems.emplace_back(
81 std::vector<gui::MenuItem> project_menu_subitems;
82 project_menu_subitems.emplace_back(
"New Project",
"",
84 project_menu_subitems.emplace_back(
"Open Project",
"",
86 project_menu_subitems.emplace_back(
90 context_.shortcut_manager.RegisterShortcut(
91 "Open", {ImGuiKey_O, ImGuiMod_Ctrl}, [&]() {
LoadRom(); });
92 context_.shortcut_manager.RegisterShortcut(
93 "Save", {ImGuiKey_S, ImGuiMod_Ctrl}, [&]() {
SaveRom(); });
94 context_.shortcut_manager.RegisterShortcut(
95 "Close", {ImGuiKey_W, ImGuiMod_Ctrl}, [&]() {
rom()->Close(); });
96 context_.shortcut_manager.RegisterShortcut(
97 "Quit", {ImGuiKey_Q, ImGuiMod_Ctrl}, [&]() {
quit_ =
true; });
99 context_.shortcut_manager.RegisterShortcut(
100 "Undo", {ImGuiKey_Z, ImGuiMod_Ctrl},
102 context_.shortcut_manager.RegisterShortcut(
103 "Redo", {ImGuiKey_Y, ImGuiMod_Ctrl},
105 context_.shortcut_manager.RegisterShortcut(
106 "Cut", {ImGuiKey_X, ImGuiMod_Ctrl},
108 context_.shortcut_manager.RegisterShortcut(
109 "Copy", {ImGuiKey_C, ImGuiMod_Ctrl},
111 context_.shortcut_manager.RegisterShortcut(
112 "Paste", {ImGuiKey_V, ImGuiMod_Ctrl},
114 context_.shortcut_manager.RegisterShortcut(
115 "Find", {ImGuiKey_F, ImGuiMod_Ctrl},
118 context_.shortcut_manager.RegisterShortcut(
119 "Load Last ROM", {ImGuiKey_R, ImGuiMod_Ctrl}, [&]() {
127 context_.shortcut_manager.RegisterShortcut(
"F1", ImGuiKey_F1,
128 [&]() {
about_ =
true; });
137 context_.shortcut_manager.GetKeys(
"Open"),
138 context_.shortcut_manager.GetCallback(
"Open")},
139 {
"Open Recent",
"", [&]() {},
140 []() {
return !manager.
GetRecentFiles().empty(); }, recent_files},
142 context_.shortcut_manager.GetKeys(
"Save"),
143 context_.shortcut_manager.GetCallback(
"Save")},
147 []() {
return true; }, project_menu_subitems},
149 [&]() {
rom()->Close(); }},
152 [&]() {}, []() {
return true; }, options_subitems},
154 [&]() {
quit_ =
true; }},
162 context_.shortcut_manager.GetKeys(
"Cut"),
163 context_.shortcut_manager.GetCallback(
"Cut")},
165 context_.shortcut_manager.GetKeys(
"Copy"),
166 context_.shortcut_manager.GetCallback(
"Copy")},
168 context_.shortcut_manager.GetKeys(
"Paste"),
169 context_.shortcut_manager.GetCallback(
"Paste")},
172 context_.shortcut_manager.GetKeys(
"Undo"),
173 context_.shortcut_manager.GetCallback(
"Undo")},
175 context_.shortcut_manager.GetKeys(
"Redo"),
176 context_.shortcut_manager.GetCallback(
"Redo")},
179 context_.shortcut_manager.GetKeys(
"Find"),
180 context_.shortcut_manager.GetCallback(
"Find")},
247 {absl::StrCat(
ICON_MD_HELP,
" How to manage a project"),
"",
250 [&]() {
about_ =
true; }},
460 static bool show_status_ =
false;
461 static absl::Status prev_status;
467 if (show_status_ && (BeginCentered(
"StatusWindow"))) {
469 Text(
"%s", prev_status.ToString().c_str());
477 show_status_ =
false;
482 SetClipboardText(prev_status.ToString().c_str());
487 if (
about_) OpenPopup(
"About");
488 if (BeginPopupModal(
"About",
nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
489 Text(
"Yet Another Zelda3 Editor - v%s",
version_.c_str());
490 Text(
"Written by: scawful");
492 Text(
"Special Thanks: Zarby89, JaredBrian");
502 if (
rom_info_) OpenPopup(
"ROM Information");
503 if (BeginPopupModal(
"ROM Information",
nullptr,
504 ImGuiWindowFlags_AlwaysAutoResize)) {
505 Text(
"Title: %s",
rom()->title().c_str());
509 IsKeyPressed(ImGuiKey_Escape)) {
518 static bool show_display_settings =
false;
519 static bool save_as_menu =
false;
521 if (BeginMenuBar()) {
524 SameLine(GetWindowWidth() - GetStyle().ItemSpacing.x -
526 PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
528 show_display_settings = !show_display_settings;
535 if (show_display_settings) {
536 Begin(
"Display Settings", &show_display_settings, ImGuiWindowFlags_None);
559 if (BeginPopupModal(
"Supported Features",
nullptr,
560 ImGuiWindowFlags_AlwaysAutoResize)) {
562 BulletText(
"LW/DW/SW Tilemap Editing");
563 BulletText(
"LW/DW/SW Map Properties");
564 BulletText(
"Create/Delete/Update Entrances");
565 BulletText(
"Create/Delete/Update Exits");
566 BulletText(
"Create/Delete/Update Sprites");
567 BulletText(
"Create/Delete/Update Items");
570 BulletText(
"View Room Header Properties");
571 BulletText(
"View Entrance Properties");
574 BulletText(
"View Decompressed Graphics Sheets");
575 BulletText(
"View/Update Graphics Groups");
578 BulletText(
"View Palette Groups");
581 BulletText(
"All Listed Overworld Features");
582 BulletText(
"Hex Editor Changes");
592 if (BeginPopupModal(
"Open a ROM",
nullptr,
593 ImGuiWindowFlags_AlwaysAutoResize)) {
594 Text(
"File -> Open");
595 Text(
"Select a ROM file to open");
596 Text(
"Supported ROMs (headered or unheadered):");
597 Text(
"The Legend of Zelda: A Link to the Past");
598 Text(
"US Version 1.0");
599 Text(
"JP Version 1.0");
609 if (BeginPopupModal(
"Manage Project",
nullptr,
610 ImGuiWindowFlags_AlwaysAutoResize)) {
611 Text(
"Project Menu");
612 Text(
"Create a new project or open an existing one.");
613 Text(
"Save the project to save the current state of the project.");
615 "To save a project, you need to first open a ROM and initialize your "
616 "code path and labels file. Label resource manager can be found in "
617 "the View menu. Code path is set in the Code editor after opening a "
636 static std::string save_as_filename =
"";
637 Begin(
"Save As..", &save_as_menu, ImGuiWindowFlags_AlwaysAutoResize);
638 InputText(
"Filename", &save_as_filename);
641 save_as_menu =
false;
645 save_as_menu =
false;
652 static std::string save_as_filename =
"";
653 InputText(
"Project Name", &save_as_filename);