add help section for project management

This commit is contained in:
scawful
2024-07-13 19:03:36 -04:00
parent f70a0d6b44
commit 7e951e2e19
2 changed files with 34 additions and 1 deletions

View File

@@ -105,7 +105,9 @@ struct Project {
absl::Status CheckForEmptyFields() { absl::Status CheckForEmptyFields() {
if (name.empty() || filepath.empty() || rom_filename_.empty() || if (name.empty() || filepath.empty() || rom_filename_.empty() ||
code_folder_.empty() || labels_filename_.empty()) { code_folder_.empty() || labels_filename_.empty()) {
return absl::InvalidArgumentError("Project fields cannot be empty."); return absl::InvalidArgumentError(
"Project fields cannot be empty. Please load a rom file, set your "
"code folder, and set your labels file. See HELP for more details.");
} }
return absl::OkStatus(); return absl::OkStatus();

View File

@@ -405,6 +405,13 @@ void MasterEditor::DrawYazeMenu() {
DrawFileMenu(); DrawFileMenu();
DrawEditMenu(); DrawEditMenu();
DrawViewMenu(); DrawViewMenu();
if (current_project_.project_opened_) {
// Project Menu
if (BeginMenu("Project")) {
ImGui::Text("Project: %s", current_project_.name.c_str());
}
ImGui::EndMenu();
}
DrawHelpMenu(); DrawHelpMenu();
ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetStyle().ItemSpacing.x - ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetStyle().ItemSpacing.x -
@@ -582,6 +589,9 @@ void MasterEditor::DrawFileMenu() {
if (ImGui::Button("Create", gui::kDefaultModalSize)) { if (ImGui::Button("Create", gui::kDefaultModalSize)) {
new_project_menu = false; new_project_menu = false;
status_ = current_project_.Create(save_as_filename); status_ = current_project_.Create(save_as_filename);
if (status_.ok()) {
status_ = current_project_.Save();
}
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Cancel", gui::kDefaultModalSize)) { if (ImGui::Button("Cancel", gui::kDefaultModalSize)) {
@@ -728,9 +738,11 @@ void MasterEditor::DrawViewMenu() {
void MasterEditor::DrawHelpMenu() { void MasterEditor::DrawHelpMenu() {
static bool open_rom_help = false; static bool open_rom_help = false;
static bool open_supported_features = false; static bool open_supported_features = 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")) open_rom_help = true;
if (MenuItem("Supported Features")) open_supported_features = true; if (MenuItem("Supported Features")) open_supported_features = true;
if (MenuItem("How to manage a project")) open_manage_project = true;
if (MenuItem("About")) about_ = true; if (MenuItem("About")) about_ = true;
ImGui::EndMenu(); ImGui::EndMenu();
@@ -785,6 +797,25 @@ void MasterEditor::DrawHelpMenu() {
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }
if (open_manage_project) ImGui::OpenPopup("Manage Project");
if (ImGui::BeginPopupModal("Manage Project", nullptr,
ImGuiWindowFlags_AlwaysAutoResize)) {
Text("Project Menu");
Text("Create a new project or open an existing one.");
Text("Save the project to save the current state of the project.");
Text(
"To save a project, you need to first open a ROM and initialize your "
"code path and labels file. Label resource manager can be found in the "
"View menu. Code path is set in the Code editor after opening a "
"folder.");
if (ImGui::Button("Close", gui::kDefaultModalSize)) {
open_manage_project = false;
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
} }
void MasterEditor::LoadRom() { void MasterEditor::LoadRom() {