refactor(editor): reorganize includes and enhance EditorManager initialization

- Moved the declaration of `AgentControlServer` to a forward declaration in the header file for better clarity and organization.
- Updated the `EditorManager` constructor to initialize the version string and popup manager context.
- Added conditional compilation for gRPC-related includes and commented out the agent control server initialization for future reference.
- Ensured consistent definition of `IMGUI_DEFINE_MATH_OPERATORS` across multiple files to prevent potential issues with ImGui usage.

Benefits:
- Improved code organization and readability.
- Enhanced maintainability by clarifying the initialization process and managing includes effectively.
This commit is contained in:
scawful
2025-10-11 14:37:34 -04:00
parent 5ba66b7898
commit ab73a09f47
12 changed files with 80 additions and 18 deletions

View File

@@ -1,9 +1,10 @@
#ifndef YAZE_APP_EDITOR_EDITOR_MANAGER_H
#define YAZE_APP_EDITOR_EDITOR_MANAGER_H
#define IMGUI_DEFINE_MATH_OPERATORS
#include "app/editor/system/user_settings.h"
#include "app/editor/ui/workspace_manager.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui/imgui.h"
@@ -42,6 +43,10 @@
#include "yaze_config.h"
#ifdef YAZE_WITH_GRPC
// Forward declarations for gRPC-dependent types
namespace yaze::agent {
class AgentControlServer;
}
#endif
namespace yaze {
@@ -103,13 +108,9 @@ class EditorSet {
*/
class EditorManager {
public:
EditorManager() : blank_editor_set_(nullptr, &user_settings_) {
std::stringstream ss;
ss << YAZE_VERSION_MAJOR << "." << YAZE_VERSION_MINOR << "."
<< YAZE_VERSION_PATCH;
ss >> version_;
context_.popup_manager = popup_manager_.get();
}
// Constructor and destructor must be defined in .cc file for std::unique_ptr with forward-declared types
EditorManager();
~EditorManager();
void Initialize(gfx::IRenderer* renderer, const std::string& filename = "");
@@ -278,7 +279,7 @@ class EditorManager {
#ifdef YAZE_WITH_GRPC
// Agent editor - manages chat, collaboration, and network coordination
AgentEditor agent_editor_;
std::unique_ptr<agent::AgentControlServer> agent_control_server_;
std::unique_ptr<yaze::agent::AgentControlServer> agent_control_server_;
#endif
std::string version_ = "";