feat: Integrate ProjectFileEditor into EditorManager for enhanced project file handling
- Initialized ProjectFileEditor within EditorManager to facilitate project file editing. - Added menu options for editing project files, including loading and error handling with toast notifications. - Updated the DrawMenuBar method to render the ProjectFileEditor interface. - Included necessary header for ProjectFileEditor in editor_manager.h.
This commit is contained in:
@@ -670,7 +670,8 @@ void AgentChatWidget::Draw() {
|
||||
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
|
||||
ImGui::PopStyleVar(4); // Pop the 4 style vars we pushed
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ void ProjectFileEditor::Draw() {
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(900, 700), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin(absl::StrFormat("%s Project Editor###ProjectFileEditor",
|
||||
ICON_MD_EDIT_DOCUMENT).c_str(),
|
||||
ICON_MD_DESCRIPTION).c_str(),
|
||||
&active_)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
@@ -239,7 +239,7 @@ void ProjectFileEditor::ValidateContent() {
|
||||
|
||||
for (const auto& line : lines) {
|
||||
line_num++;
|
||||
std::string trimmed = absl::StripAsciiWhitespace(line);
|
||||
std::string trimmed = std::string(absl::StripAsciiWhitespace(line));
|
||||
|
||||
// Skip empty lines and comments
|
||||
if (trimmed.empty() || trimmed[0] == '#') continue;
|
||||
|
||||
@@ -20,6 +20,7 @@ set(
|
||||
app/editor/message/message_data.cc
|
||||
app/editor/message/message_preview.cc
|
||||
app/editor/code/assembly_editor.cc
|
||||
app/editor/code/project_file_editor.cc
|
||||
app/editor/graphics/screen_editor.cc
|
||||
app/editor/graphics/graphics_editor.cc
|
||||
app/editor/graphics/palette_editor.cc
|
||||
|
||||
@@ -232,6 +232,9 @@ void EditorManager::Initialize(const std::string& filename) {
|
||||
// Set the popup manager in the context
|
||||
context_.popup_manager = popup_manager_.get();
|
||||
|
||||
// Initialize project file editor
|
||||
project_file_editor_.SetToastManager(&toast_manager_);
|
||||
|
||||
#ifdef YAZE_WITH_GRPC
|
||||
// Initialize the agent editor
|
||||
agent_editor_.Initialize(&toast_manager_, &proposal_drawer_);
|
||||
@@ -482,6 +485,19 @@ void EditorManager::Initialize(const std::string& filename) {
|
||||
project_menu_subitems.emplace_back(
|
||||
"Save Project", "", [this]() { status_ = SaveProject(); },
|
||||
[this]() { return current_project_.project_opened(); });
|
||||
project_menu_subitems.emplace_back(gui::kSeparator, "", nullptr, []() { return true; });
|
||||
project_menu_subitems.emplace_back(
|
||||
absl::StrCat(ICON_MD_EDIT, " Edit Project File"), "",
|
||||
[this]() {
|
||||
project_file_editor_.set_active(true);
|
||||
if (current_project_.project_opened() && !current_project_.filepath.empty()) {
|
||||
auto status = project_file_editor_.LoadFile(current_project_.filepath);
|
||||
if (!status.ok()) {
|
||||
toast_manager_.Show(std::string(status.message()), editor::ToastType::kError);
|
||||
}
|
||||
}
|
||||
},
|
||||
[this]() { return current_project_.project_opened(); });
|
||||
project_menu_subitems.emplace_back("Save Workspace Layout", "", [this]() {
|
||||
ImGuiID dockspace_id = ImGui::GetID("MyDockSpace");
|
||||
ImGui::SaveIniSettingsToDisk("yaze_workspace.ini");
|
||||
@@ -1249,6 +1265,9 @@ void EditorManager::DrawMenuBar() {
|
||||
if (show_asm_editor_ && current_editor_set_) {
|
||||
current_editor_set_->assembly_editor_.Update(show_asm_editor_);
|
||||
}
|
||||
|
||||
// Project file editor
|
||||
project_file_editor_.Draw();
|
||||
if (show_performance_dashboard_) {
|
||||
gfx::PerformanceDashboard::Get().SetVisible(true);
|
||||
gfx::PerformanceDashboard::Get().Update();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "app/core/project.h"
|
||||
#include "app/editor/code/assembly_editor.h"
|
||||
#include "app/editor/code/memory_editor.h"
|
||||
#include "app/editor/code/project_file_editor.h"
|
||||
#include "app/editor/dungeon/dungeon_editor_v2.h"
|
||||
#include "app/editor/graphics/graphics_editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
@@ -184,6 +185,9 @@ class EditorManager {
|
||||
ProposalDrawer proposal_drawer_;
|
||||
bool show_proposal_drawer_ = false;
|
||||
|
||||
// Project file editor
|
||||
ProjectFileEditor project_file_editor_;
|
||||
|
||||
#ifdef YAZE_WITH_GRPC
|
||||
// Agent editor - manages chat, collaboration, and network coordination
|
||||
AgentEditor agent_editor_;
|
||||
|
||||
Reference in New Issue
Block a user