Remove dynamic layout code
This commit is contained in:
@@ -1,51 +1,7 @@
|
|||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
|
|
||||||
#include "app/core/constants.h"
|
|
||||||
#include "imgui/imgui.h"
|
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
absl::Status DrawEditor(EditorLayoutParams *params) {
|
|
||||||
if (params->editor == nullptr) {
|
|
||||||
return absl::InternalError("Editor is not initialized");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the editors based on h_split and v_split in a recursive manner
|
|
||||||
if (params->v_split) {
|
|
||||||
ImGui::BeginTable("##VerticalSplitTable", 2);
|
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if (params->left)
|
|
||||||
RETURN_IF_ERROR(DrawEditor(params->left));
|
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if (params->right)
|
|
||||||
RETURN_IF_ERROR(DrawEditor(params->right));
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
|
||||||
} else if (params->h_split) {
|
|
||||||
ImGui::BeginTable("##HorizontalSplitTable", 1);
|
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if (params->top)
|
|
||||||
RETURN_IF_ERROR(DrawEditor(params->top));
|
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if (params->bottom)
|
|
||||||
RETURN_IF_ERROR(DrawEditor(params->bottom));
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
|
||||||
} else {
|
|
||||||
// No split, just draw the single editor
|
|
||||||
ImGui::Text("%s Editor",
|
|
||||||
kEditorNames[static_cast<int>(params->editor->type())]);
|
|
||||||
RETURN_IF_ERROR(params->editor->Update());
|
|
||||||
}
|
|
||||||
|
|
||||||
return absl::OkStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
|
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -73,30 +73,6 @@ class Editor {
|
|||||||
EditorContext context_;
|
EditorContext context_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Dynamic Editor Layout Parameters
|
|
||||||
*/
|
|
||||||
typedef struct EditorLayoutParams {
|
|
||||||
bool v_split;
|
|
||||||
bool h_split;
|
|
||||||
int v_split_pos;
|
|
||||||
int h_split_pos;
|
|
||||||
Editor *editor = nullptr;
|
|
||||||
EditorLayoutParams *left = nullptr;
|
|
||||||
EditorLayoutParams *right = nullptr;
|
|
||||||
EditorLayoutParams *top = nullptr;
|
|
||||||
EditorLayoutParams *bottom = nullptr;
|
|
||||||
|
|
||||||
EditorLayoutParams() {
|
|
||||||
v_split = false;
|
|
||||||
h_split = false;
|
|
||||||
v_split_pos = 0;
|
|
||||||
h_split_pos = 0;
|
|
||||||
}
|
|
||||||
} EditorLayoutParams;
|
|
||||||
|
|
||||||
absl::Status DrawEditor(EditorLayoutParams *params);
|
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ using core::FileDialogWrapper;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool BeginCentered(const char* name) {
|
bool BeginCentered(const char *name) {
|
||||||
ImGuiIO const& io = GetIO();
|
ImGuiIO const &io = GetIO();
|
||||||
ImVec2 pos(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f);
|
ImVec2 pos(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f);
|
||||||
SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||||
ImGuiWindowFlags flags =
|
ImGuiWindowFlags flags =
|
||||||
@@ -41,12 +41,12 @@ bool BeginCentered(const char* name) {
|
|||||||
return Begin(name, nullptr, flags);
|
return Begin(name, nullptr, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsEditorActive(Editor* editor, std::vector<Editor*>& active_editors) {
|
bool IsEditorActive(Editor *editor, std::vector<Editor *> &active_editors) {
|
||||||
return std::find(active_editors.begin(), active_editors.end(), editor) !=
|
return std::find(active_editors.begin(), active_editors.end(), editor) !=
|
||||||
active_editors.end();
|
active_editors.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void EditorManager::SetupScreen(std::string filename) {
|
void EditorManager::SetupScreen(std::string filename) {
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
@@ -65,17 +65,12 @@ absl::Status EditorManager::Update() {
|
|||||||
DrawInfoPopup();
|
DrawInfoPopup();
|
||||||
|
|
||||||
if (rom()->is_loaded() && !rom_assets_loaded_) {
|
if (rom()->is_loaded() && !rom_assets_loaded_) {
|
||||||
// Load all of the graphics data from the game.
|
|
||||||
RETURN_IF_ERROR(rom()->LoadAllGraphicsData())
|
RETURN_IF_ERROR(rom()->LoadAllGraphicsData())
|
||||||
// Initialize overworld graphics, maps, and palettes
|
|
||||||
RETURN_IF_ERROR(overworld_editor_.LoadGraphics());
|
RETURN_IF_ERROR(overworld_editor_.LoadGraphics());
|
||||||
rom_assets_loaded_ = true;
|
rom_assets_loaded_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynamic_layout_)
|
ManageActiveEditors();
|
||||||
RETURN_IF_ERROR(DrawDynamicLayout())
|
|
||||||
else
|
|
||||||
ManageActiveEditors();
|
|
||||||
|
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
@@ -83,7 +78,8 @@ absl::Status EditorManager::Update() {
|
|||||||
void EditorManager::ManageActiveEditors() {
|
void EditorManager::ManageActiveEditors() {
|
||||||
// Show popup pane to select an editor to add
|
// Show popup pane to select an editor to add
|
||||||
static bool show_add_editor = false;
|
static bool show_add_editor = false;
|
||||||
if (show_add_editor) OpenPopup("AddEditor");
|
if (show_add_editor)
|
||||||
|
OpenPopup("AddEditor");
|
||||||
|
|
||||||
if (BeginPopup("AddEditor", ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (BeginPopup("AddEditor", ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
if (MenuItem("Overworld", nullptr, false,
|
if (MenuItem("Overworld", nullptr, false,
|
||||||
@@ -148,85 +144,85 @@ void EditorManager::ManageActiveEditors() {
|
|||||||
for (auto editor : active_editors_) {
|
for (auto editor : active_editors_) {
|
||||||
bool open = true;
|
bool open = true;
|
||||||
switch (editor->type()) {
|
switch (editor->type()) {
|
||||||
case EditorType::kOverworld:
|
case EditorType::kOverworld:
|
||||||
if (overworld_editor_.jump_to_tab() == -1) {
|
if (overworld_editor_.jump_to_tab() == -1) {
|
||||||
if (BeginTabItem("Overworld", &open)) {
|
if (BeginTabItem("Overworld", &open)) {
|
||||||
current_editor_ = &overworld_editor_;
|
current_editor_ = &overworld_editor_;
|
||||||
status_ = overworld_editor_.Update();
|
status_ = overworld_editor_.Update();
|
||||||
EndTabItem();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EditorType::kDungeon:
|
|
||||||
if (BeginTabItem("Dungeon", &open)) {
|
|
||||||
current_editor_ = &dungeon_editor_;
|
|
||||||
status_ = dungeon_editor_.Update();
|
|
||||||
if (overworld_editor_.jump_to_tab() != -1) {
|
|
||||||
dungeon_editor_.add_room(overworld_editor_.jump_to_tab());
|
|
||||||
overworld_editor_.jump_to_tab_ = -1;
|
|
||||||
}
|
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case EditorType::kGraphics:
|
break;
|
||||||
if (BeginTabItem("Graphics", &open)) {
|
case EditorType::kDungeon:
|
||||||
current_editor_ = &graphics_editor_;
|
if (BeginTabItem("Dungeon", &open)) {
|
||||||
status_ = graphics_editor_.Update();
|
current_editor_ = &dungeon_editor_;
|
||||||
EndTabItem();
|
status_ = dungeon_editor_.Update();
|
||||||
|
if (overworld_editor_.jump_to_tab() != -1) {
|
||||||
|
dungeon_editor_.add_room(overworld_editor_.jump_to_tab());
|
||||||
|
overworld_editor_.jump_to_tab_ = -1;
|
||||||
}
|
}
|
||||||
break;
|
EndTabItem();
|
||||||
case EditorType::kMusic:
|
}
|
||||||
if (BeginTabItem("Music", &open)) {
|
break;
|
||||||
current_editor_ = &music_editor_;
|
case EditorType::kGraphics:
|
||||||
|
if (BeginTabItem("Graphics", &open)) {
|
||||||
|
current_editor_ = &graphics_editor_;
|
||||||
|
status_ = graphics_editor_.Update();
|
||||||
|
EndTabItem();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EditorType::kMusic:
|
||||||
|
if (BeginTabItem("Music", &open)) {
|
||||||
|
current_editor_ = &music_editor_;
|
||||||
|
|
||||||
status_ = music_editor_.Update();
|
status_ = music_editor_.Update();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EditorType::kPalette:
|
case EditorType::kPalette:
|
||||||
if (BeginTabItem("Palette", &open)) {
|
if (BeginTabItem("Palette", &open)) {
|
||||||
current_editor_ = &palette_editor_;
|
current_editor_ = &palette_editor_;
|
||||||
status_ = palette_editor_.Update();
|
status_ = palette_editor_.Update();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EditorType::kScreen:
|
case EditorType::kScreen:
|
||||||
if (BeginTabItem("Screen", &open)) {
|
if (BeginTabItem("Screen", &open)) {
|
||||||
current_editor_ = &screen_editor_;
|
current_editor_ = &screen_editor_;
|
||||||
status_ = screen_editor_.Update();
|
status_ = screen_editor_.Update();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EditorType::kSprite:
|
case EditorType::kSprite:
|
||||||
if (BeginTabItem("Sprite", &open)) {
|
if (BeginTabItem("Sprite", &open)) {
|
||||||
current_editor_ = &sprite_editor_;
|
current_editor_ = &sprite_editor_;
|
||||||
status_ = sprite_editor_.Update();
|
status_ = sprite_editor_.Update();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EditorType::kAssembly:
|
case EditorType::kAssembly:
|
||||||
if (BeginTabItem("Code", &open)) {
|
if (BeginTabItem("Code", &open)) {
|
||||||
current_editor_ = &assembly_editor_;
|
current_editor_ = &assembly_editor_;
|
||||||
assembly_editor_.UpdateCodeView();
|
assembly_editor_.UpdateCodeView();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EditorType::kSettings:
|
case EditorType::kSettings:
|
||||||
if (BeginTabItem("Settings", &open)) {
|
if (BeginTabItem("Settings", &open)) {
|
||||||
current_editor_ = &settings_editor_;
|
current_editor_ = &settings_editor_;
|
||||||
status_ = settings_editor_.Update();
|
status_ = settings_editor_.Update();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EditorType::kMessage:
|
case EditorType::kMessage:
|
||||||
if (BeginTabItem("Message", &open)) {
|
if (BeginTabItem("Message", &open)) {
|
||||||
current_editor_ = &message_editor_;
|
current_editor_ = &message_editor_;
|
||||||
status_ = message_editor_.Update();
|
status_ = message_editor_.Update();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!open) {
|
if (!open) {
|
||||||
active_editors_.erase(
|
active_editors_.erase(
|
||||||
@@ -243,12 +239,6 @@ void EditorManager::ManageActiveEditors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::Status EditorManager::DrawDynamicLayout() {
|
|
||||||
// Dynamic layout for multiple editors to be open at once
|
|
||||||
// Allows for tiling and resizing of editors using ImGui
|
|
||||||
return DrawEditor(&root_layout_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorManager::ManageKeyboardShortcuts() {
|
void EditorManager::ManageKeyboardShortcuts() {
|
||||||
bool ctrl_or_super = (GetIO().KeyCtrl || GetIO().KeySuper);
|
bool ctrl_or_super = (GetIO().KeyCtrl || GetIO().KeySuper);
|
||||||
|
|
||||||
@@ -309,78 +299,8 @@ void EditorManager::ManageKeyboardShortcuts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::InitializeCommands() {
|
void EditorManager::InitializeCommands() {
|
||||||
if (root_layout_.editor == nullptr) {
|
|
||||||
root_layout_.editor = &overworld_editor_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// New editor popup for window management commands
|
|
||||||
static EditorLayoutParams new_layout;
|
|
||||||
if (ImGui::BeginPopup("NewEditor")) {
|
|
||||||
ImGui::Text("New Editor");
|
|
||||||
ImGui::Separator();
|
|
||||||
if (ImGui::Button("Overworld")) {
|
|
||||||
new_layout.editor = &overworld_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Dungeon")) {
|
|
||||||
new_layout.editor = &dungeon_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Graphics")) {
|
|
||||||
new_layout.editor = &graphics_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Music")) {
|
|
||||||
new_layout.editor = &music_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Palette")) {
|
|
||||||
new_layout.editor = &palette_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Screen")) {
|
|
||||||
new_layout.editor = &screen_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Sprite")) {
|
|
||||||
new_layout.editor = &sprite_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Code")) {
|
|
||||||
new_layout.editor = &assembly_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Settings")) {
|
|
||||||
new_layout.editor = &settings_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
if (ImGui::Button("Message")) {
|
|
||||||
new_layout.editor = &message_editor_;
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
editor_context_.command_manager.RegisterPrefix("window", 'w',
|
editor_context_.command_manager.RegisterPrefix("window", 'w',
|
||||||
"window management", "");
|
"window management", "");
|
||||||
editor_context_.command_manager.RegisterSubcommand(
|
|
||||||
"window", "vsplit", '/', "vertical split",
|
|
||||||
"split windows vertically and place editor in new window", [this]() {
|
|
||||||
ImGui::OpenPopup("NewEditor");
|
|
||||||
root_layout_.v_split = true;
|
|
||||||
});
|
|
||||||
editor_context_.command_manager.RegisterSubcommand(
|
|
||||||
"window", "hsplit", '-', "horizontal split",
|
|
||||||
"split windows horizontally and place editor in new window", [this]() {
|
|
||||||
ImGui::OpenPopup("NewEditor");
|
|
||||||
root_layout_.h_split = true;
|
|
||||||
});
|
|
||||||
editor_context_.command_manager.RegisterSubcommand(
|
|
||||||
"window", "close", 'd', "close", "close the current editor", [this]() {
|
|
||||||
if (root_layout_.editor != nullptr) {
|
|
||||||
root_layout_.editor = nullptr;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::DrawStatusPopup() {
|
void EditorManager::DrawStatusPopup() {
|
||||||
@@ -412,7 +332,8 @@ void EditorManager::DrawStatusPopup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::DrawAboutPopup() {
|
void EditorManager::DrawAboutPopup() {
|
||||||
if (about_) OpenPopup("About");
|
if (about_)
|
||||||
|
OpenPopup("About");
|
||||||
if (BeginPopupModal("About", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (BeginPopupModal("About", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
Text("Yet Another Zelda3 Editor - v%s", core::kYazeVersion.data());
|
Text("Yet Another Zelda3 Editor - v%s", core::kYazeVersion.data());
|
||||||
Text("Written by: scawful");
|
Text("Written by: scawful");
|
||||||
@@ -429,7 +350,8 @@ void EditorManager::DrawAboutPopup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::DrawInfoPopup() {
|
void EditorManager::DrawInfoPopup() {
|
||||||
if (rom_info_) OpenPopup("ROM Information");
|
if (rom_info_)
|
||||||
|
OpenPopup("ROM Information");
|
||||||
if (BeginPopupModal("ROM Information", nullptr,
|
if (BeginPopupModal("ROM Information", nullptr,
|
||||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
Text("Title: %s", rom()->title().c_str());
|
Text("Title: %s", rom()->title().c_str());
|
||||||
@@ -482,7 +404,7 @@ void EditorManager::DrawYazeMenuBar() {
|
|||||||
if (manager.GetRecentFiles().empty()) {
|
if (manager.GetRecentFiles().empty()) {
|
||||||
MenuItem("No Recent Files", nullptr, false, false);
|
MenuItem("No Recent Files", nullptr, false, false);
|
||||||
} else {
|
} else {
|
||||||
for (const auto& filePath : manager.GetRecentFiles()) {
|
for (const auto &filePath : manager.GetRecentFiles()) {
|
||||||
if (MenuItem(filePath.c_str())) {
|
if (MenuItem(filePath.c_str())) {
|
||||||
OpenRomOrProject(filePath);
|
OpenRomOrProject(filePath);
|
||||||
}
|
}
|
||||||
@@ -624,10 +546,14 @@ void EditorManager::DrawYazeMenuBar() {
|
|||||||
static bool show_palette_editor = false;
|
static bool show_palette_editor = false;
|
||||||
static bool show_emulator = false;
|
static bool show_emulator = false;
|
||||||
|
|
||||||
if (show_imgui_demo) ShowDemoWindow();
|
if (show_imgui_demo)
|
||||||
if (show_imgui_metrics) ShowMetricsWindow(&show_imgui_metrics);
|
ShowDemoWindow();
|
||||||
if (show_memory_editor) memory_editor_.Update(show_memory_editor);
|
if (show_imgui_metrics)
|
||||||
if (show_asm_editor) assembly_editor_.Update(show_asm_editor);
|
ShowMetricsWindow(&show_imgui_metrics);
|
||||||
|
if (show_memory_editor)
|
||||||
|
memory_editor_.Update(show_memory_editor);
|
||||||
|
if (show_asm_editor)
|
||||||
|
assembly_editor_.Update(show_asm_editor);
|
||||||
|
|
||||||
if (show_emulator) {
|
if (show_emulator) {
|
||||||
Begin("Emulator", &show_emulator, ImGuiWindowFlags_MenuBar);
|
Begin("Emulator", &show_emulator, ImGuiWindowFlags_MenuBar);
|
||||||
@@ -642,7 +568,6 @@ void EditorManager::DrawYazeMenuBar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (BeginMenu("View")) {
|
if (BeginMenu("View")) {
|
||||||
MenuItem("Dynamic Layout", nullptr, &dynamic_layout_);
|
|
||||||
MenuItem("Emulator", nullptr, &show_emulator);
|
MenuItem("Emulator", nullptr, &show_emulator);
|
||||||
Separator();
|
Separator();
|
||||||
MenuItem("Memory Editor", nullptr, &show_memory_editor);
|
MenuItem("Memory Editor", nullptr, &show_memory_editor);
|
||||||
@@ -673,15 +598,20 @@ void EditorManager::DrawYazeMenuBar() {
|
|||||||
static bool open_supported_features = false;
|
static bool open_supported_features = false;
|
||||||
static bool open_manage_project = false;
|
static bool open_manage_project = false;
|
||||||
if (BeginMenu("Help")) {
|
if (BeginMenu("Help")) {
|
||||||
if (MenuItem("How to open a ROM")) open_rom_help = true;
|
if (MenuItem("How to open a ROM"))
|
||||||
if (MenuItem("Supported Features")) open_supported_features = true;
|
open_rom_help = true;
|
||||||
if (MenuItem("How to manage a project")) open_manage_project = true;
|
if (MenuItem("Supported Features"))
|
||||||
|
open_supported_features = true;
|
||||||
|
if (MenuItem("How to manage a project"))
|
||||||
|
open_manage_project = true;
|
||||||
|
|
||||||
if (MenuItem("About", "F1")) about_ = true;
|
if (MenuItem("About", "F1"))
|
||||||
|
about_ = true;
|
||||||
EndMenu();
|
EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_supported_features) OpenPopup("Supported Features");
|
if (open_supported_features)
|
||||||
|
OpenPopup("Supported Features");
|
||||||
if (BeginPopupModal("Supported Features", nullptr,
|
if (BeginPopupModal("Supported Features", nullptr,
|
||||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
Text("Overworld");
|
Text("Overworld");
|
||||||
@@ -714,7 +644,8 @@ void EditorManager::DrawYazeMenuBar() {
|
|||||||
EndPopup();
|
EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_rom_help) OpenPopup("Open a ROM");
|
if (open_rom_help)
|
||||||
|
OpenPopup("Open a ROM");
|
||||||
if (BeginPopupModal("Open a ROM", nullptr,
|
if (BeginPopupModal("Open a ROM", nullptr,
|
||||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
Text("File -> Open");
|
Text("File -> Open");
|
||||||
@@ -731,7 +662,8 @@ void EditorManager::DrawYazeMenuBar() {
|
|||||||
EndPopup();
|
EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_manage_project) OpenPopup("Manage Project");
|
if (open_manage_project)
|
||||||
|
OpenPopup("Manage Project");
|
||||||
if (BeginPopupModal("Manage Project", nullptr,
|
if (BeginPopupModal("Manage Project", nullptr,
|
||||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
Text("Project Menu");
|
Text("Project Menu");
|
||||||
@@ -782,7 +714,7 @@ void EditorManager::SaveRom() {
|
|||||||
status_ = rom()->SaveToFile(backup_rom_, save_new_auto_);
|
status_ = rom()->SaveToFile(backup_rom_, save_new_auto_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::OpenRomOrProject(const std::string& filename) {
|
void EditorManager::OpenRomOrProject(const std::string &filename) {
|
||||||
if (absl::StrContains(filename, ".yaze")) {
|
if (absl::StrContains(filename, ".yaze")) {
|
||||||
status_ = current_project_.Open(filename);
|
status_ = current_project_.Open(filename);
|
||||||
if (status_.ok()) {
|
if (status_.ok()) {
|
||||||
@@ -814,5 +746,5 @@ absl::Status EditorManager::OpenProject() {
|
|||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ class EditorManager : public SharedRom, public core::ExperimentFlags {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void ManageActiveEditors();
|
void ManageActiveEditors();
|
||||||
absl::Status DrawDynamicLayout();
|
|
||||||
|
|
||||||
void ManageKeyboardShortcuts();
|
void ManageKeyboardShortcuts();
|
||||||
void InitializeCommands();
|
void InitializeCommands();
|
||||||
|
|
||||||
@@ -80,16 +78,10 @@ class EditorManager : public SharedRom, public core::ExperimentFlags {
|
|||||||
bool save_new_auto_ = true;
|
bool save_new_auto_ = true;
|
||||||
bool show_status_ = false;
|
bool show_status_ = false;
|
||||||
bool rom_assets_loaded_ = false;
|
bool rom_assets_loaded_ = false;
|
||||||
bool dynamic_layout_ = false;
|
|
||||||
|
|
||||||
absl::Status status_;
|
absl::Status status_;
|
||||||
|
|
||||||
emu::Emulator emulator_;
|
emu::Emulator emulator_;
|
||||||
|
|
||||||
std::vector<Editor *> active_editors_;
|
std::vector<Editor *> active_editors_;
|
||||||
std::vector<EditorLayoutParams> active_layouts_;
|
|
||||||
|
|
||||||
EditorLayoutParams root_layout_;
|
|
||||||
|
|
||||||
Project current_project_;
|
Project current_project_;
|
||||||
EditorContext editor_context_;
|
EditorContext editor_context_;
|
||||||
|
|||||||
Reference in New Issue
Block a user