add DrawProjectMenu

This commit is contained in:
scawful
2024-07-19 16:13:45 -04:00
parent 1c76fddff4
commit dea86b090c
2 changed files with 27 additions and 46 deletions

View File

@@ -360,16 +360,7 @@ void MasterEditor::DrawYazeMenu() {
DrawFileMenu();
DrawEditMenu();
DrawViewMenu();
if (current_project_.project_opened_) {
// Project Menu
if (BeginMenu("Project")) {
Text("Project: %s", current_project_.name.c_str());
Text("ROM: %s", current_project_.rom_filename_.c_str());
Text("Labels: %s", current_project_.labels_filename_.c_str());
Text("Code: %s", current_project_.code_folder_.c_str());
ImGui::EndMenu();
}
}
DrawProjectMenu();
DrawHelpMenu();
SameLine(ImGui::GetWindowWidth() - ImGui::GetStyle().ItemSpacing.x -
@@ -613,10 +604,8 @@ void MasterEditor::DrawViewMenu() {
static bool show_memory_editor = false;
static bool show_asm_editor = false;
static bool show_imgui_demo = false;
static bool show_memory_viewer = false;
static bool show_palette_editor = false;
static bool show_emulator = false;
static bool show_resource_label_manager = false;
if (show_emulator) {
ImGui::Begin("Emulator", &show_emulator, ImGuiWindowFlags_MenuBar);
@@ -683,41 +672,8 @@ void MasterEditor::DrawViewMenu() {
ImGui::End();
}
if (show_memory_viewer) {
ImGui::Begin("Memory Viewer (ImGui)", &show_memory_viewer);
const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
static ImGuiTableFlags flags =
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable |
ImGuiTableFlags_ContextMenuInBody | ImGuiTableFlags_RowBg |
ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoHostExtendX;
if (auto outer_size = ImVec2(0.0f, TEXT_BASE_HEIGHT * 5.5f);
ImGui::BeginTable("table1", 3, flags, outer_size)) {
for (int row = 0; row < 10; row++) {
ImGui::TableNextRow();
for (int column = 0; column < 3; column++) {
ImGui::TableNextColumn();
Text("Cell %d,%d", column, row);
}
}
ImGui::EndTable();
}
ImGui::End();
}
if (show_resource_label_manager) {
rom()->resource_label()->DisplayLabels(&show_resource_label_manager);
if (current_project_.project_opened_) {
current_project_.labels_filename_ = rom()->resource_label()->filename_;
}
}
if (BeginMenu("View")) {
MenuItem("Emulator", nullptr, &show_emulator);
MenuItem("Memory Viewer", nullptr, &show_memory_viewer);
Separator();
MenuItem("Resource Label Manager", nullptr, &show_resource_label_manager);
Separator();
MenuItem("Hex Editor", nullptr, &show_memory_editor);
MenuItem("Assembly Editor", nullptr, &show_asm_editor);
@@ -729,6 +685,30 @@ void MasterEditor::DrawViewMenu() {
}
}
void MasterEditor::DrawProjectMenu() {
static bool show_resource_label_manager = false;
if (current_project_.project_opened_) {
// Project Menu
if (BeginMenu("Project")) {
Text("Name: %s", current_project_.name.c_str());
Text("ROM: %s", current_project_.rom_filename_.c_str());
Text("Labels: %s", current_project_.labels_filename_.c_str());
Text("Code: %s", current_project_.code_folder_.c_str());
Separator();
MenuItem("Resource Labels", nullptr, &show_resource_label_manager);
ImGui::EndMenu();
}
}
if (show_resource_label_manager) {
rom()->resource_label()->DisplayLabels(&show_resource_label_manager);
if (current_project_.project_opened_ &&
!current_project_.labels_filename_.empty()) {
current_project_.labels_filename_ = rom()->resource_label()->filename_;
}
}
}
void MasterEditor::DrawHelpMenu() {
static bool open_rom_help = false;
static bool open_supported_features = false;

View File

@@ -1,7 +1,7 @@
#ifndef YAZE_APP_EDITOR_MASTER_EDITOR_H
#define YAZE_APP_EDITOR_MASTER_EDITOR_H
#define IMGUI_DEFINE_MATH_OPERATORS 1
#define IMGUI_DEFINE_MATH_OPERATORS
#include <ImGuiColorTextEdit/TextEditor.h>
#include <ImGuiFileDialog/ImGuiFileDialog.h>
@@ -85,6 +85,7 @@ class MasterEditor : public SharedRom,
void DrawFileMenu();
void DrawEditMenu();
void DrawViewMenu();
void DrawProjectMenu();
void DrawHelpMenu();
void LoadRom();