feat(canvas): implement popup registry for enhanced menu management
- Introduced a new `PopupRegistry` class to manage persistent popups, improving the organization and lifecycle handling of popups within the canvas. - Added `canvas_menu.cc` and `canvas_menu.h` to define menu item and section structures, along with rendering functions for a more declarative menu system. - Updated `canvas.cc` to utilize the new popup registry, ensuring backward compatibility with legacy popup handling during the migration phase. Benefits: - Streamlines popup management, enhancing usability and maintainability of the canvas UI. - Facilitates the addition of complex menu structures and interactions, improving overall user experience.
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
#include "app/gui/canvas/canvas_usage_tracker.h"
|
||||
#include "app/gui/canvas/canvas_performance_integration.h"
|
||||
#include "app/gui/canvas/canvas_interaction_handler.h"
|
||||
#include "app/gui/canvas/canvas_menu.h"
|
||||
#include "app/gui/canvas/canvas_popup.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
@@ -205,6 +207,10 @@ class Canvas {
|
||||
void ClosePersistentPopup(const std::string& popup_id);
|
||||
void RenderPersistentPopups();
|
||||
|
||||
// Popup registry access (Phase 3: for advanced users and testing)
|
||||
PopupRegistry& GetPopupRegistry() { return popup_registry_; }
|
||||
const PopupRegistry& GetPopupRegistry() const { return popup_registry_; }
|
||||
|
||||
// Enhanced view and edit operations
|
||||
void ShowAdvancedCanvasProperties();
|
||||
void ShowScalingControls();
|
||||
@@ -432,6 +438,11 @@ class Canvas {
|
||||
bool context_menu_enabled_ = true;
|
||||
|
||||
// Persistent popup state for context menu actions
|
||||
// Phase 3: New popup registry (preferred for new code)
|
||||
PopupRegistry popup_registry_;
|
||||
|
||||
// Legacy popup state (deprecated - kept for backward compatibility during migration)
|
||||
// TODO(Phase 4): Remove once all editors use popup_registry_ directly
|
||||
struct PopupState {
|
||||
std::string popup_id;
|
||||
bool is_open = false;
|
||||
|
||||
Reference in New Issue
Block a user