Refactor EditorManager to improve project menu handling and streamline Home window rendering
This commit is contained in:
@@ -82,7 +82,7 @@ void EditorManager::Initialize(const std::string &filename) {
|
|||||||
project_menu_subitems.emplace_back("New Project", "",
|
project_menu_subitems.emplace_back("New Project", "",
|
||||||
[&]() { new_project_menu = true; });
|
[&]() { new_project_menu = true; });
|
||||||
project_menu_subitems.emplace_back("Open Project", "",
|
project_menu_subitems.emplace_back("Open Project", "",
|
||||||
[&]() { OpenProject(); });
|
[&]() { status_ = OpenProject(); });
|
||||||
project_menu_subitems.emplace_back(
|
project_menu_subitems.emplace_back(
|
||||||
"Save Project", "", [&]() { SaveProject(); },
|
"Save Project", "", [&]() { SaveProject(); },
|
||||||
[&]() { return current_project_.project_opened_; });
|
[&]() { return current_project_.project_opened_; });
|
||||||
@@ -185,7 +185,8 @@ void EditorManager::Initialize(const std::string &filename) {
|
|||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
{absl::StrCat(ICON_MD_CODE, " Assembly Editor"), "",
|
{absl::StrCat(ICON_MD_CODE, " Assembly Editor"), "",
|
||||||
[&]() { show_asm_editor_ = true; }},
|
[&]() { show_asm_editor_ = true; },
|
||||||
|
[&]() { return show_asm_editor_; }},
|
||||||
{absl::StrCat(ICON_MD_CASTLE, " Dungeon Editor"), "",
|
{absl::StrCat(ICON_MD_CASTLE, " Dungeon Editor"), "",
|
||||||
[&]() { dungeon_editor_.set_active(true); },
|
[&]() { dungeon_editor_.set_active(true); },
|
||||||
[&]() { return *dungeon_editor_.active(); }},
|
[&]() { return *dungeon_editor_.active(); }},
|
||||||
@@ -253,10 +254,8 @@ void EditorManager::Initialize(const std::string &filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
absl::Status EditorManager::Update() {
|
absl::Status EditorManager::Update() {
|
||||||
// DrawMenuBar();
|
|
||||||
DrawPopups();
|
DrawPopups();
|
||||||
ExecuteShortcuts(context_.shortcut_manager);
|
ExecuteShortcuts(context_.shortcut_manager);
|
||||||
context_.command_manager.ShowWhichKey();
|
|
||||||
|
|
||||||
for (auto editor : active_editors_) {
|
for (auto editor : active_editors_) {
|
||||||
if (*editor->active()) {
|
if (*editor->active()) {
|
||||||
@@ -270,15 +269,13 @@ absl::Status EditorManager::Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool show_home = true;
|
static bool show_home = true;
|
||||||
|
ImGui::Begin("Home", &show_home);
|
||||||
if (ImGui::Begin("Home", &show_home)) {
|
if (!current_rom_) {
|
||||||
if (!current_rom_) {
|
DrawHomepage();
|
||||||
DrawHomepage();
|
} else {
|
||||||
} else {
|
ManageActiveEditors();
|
||||||
ManageActiveEditors();
|
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
}
|
}
|
||||||
|
ImGui::End();
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user