yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
right_panel_manager.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MENU_RIGHT_PANEL_MANAGER_H_
2#define YAZE_APP_EDITOR_MENU_RIGHT_PANEL_MANAGER_H_
3
4#include <functional>
5#include <string>
6#include <unordered_map>
7
8#include "app/editor/editor.h"
10#include "imgui/imgui.h"
11
12namespace yaze {
13
14class Rom;
15
16namespace project {
17struct YazeProject;
18}
19
20namespace core {
21class VersionManager;
22}
23
24namespace editor {
25
26// Forward declarations
27class ProposalDrawer;
28class ToastManager;
29class AgentChat;
30class SettingsPanel;
31class SelectionPropertiesPanel;
32class ProjectManagementPanel;
33class ShortcutManager;
34
55 public:
56 enum class PanelType {
57 kNone = 0,
61 kHelp,
62 kNotifications, // Full notification history panel
63 kProperties, // Full-editing properties panel
64 kProject // Project management panel
65 };
66
67 RightPanelManager() = default;
68 ~RightPanelManager() = default;
69
70 // Non-copyable
73
74 // ============================================================================
75 // Configuration
76 // ============================================================================
77
78 void SetAgentChat(AgentChat* chat) { agent_chat_ = chat; }
82 shortcut_manager_ = manager;
83 }
90 void SetToastManager(ToastManager* manager) { toast_manager_ = manager; }
91 void SetRom(Rom* rom) { rom_ = rom; }
92
98
99 // ============================================================================
100 // Panel Control
101 // ============================================================================
102
110 void TogglePanel(PanelType type);
111
116 void OpenPanel(PanelType type);
117
121 void ClosePanel();
122
127 void CyclePanel(int direction);
130
137 void OnHostVisibilityChanged(bool visible);
138
142 bool IsPanelExpanded() const;
143
148
152 bool IsPanelActive(PanelType type) const { return active_panel_ == type; }
153
154 // ============================================================================
155 // Dimensions
156 // ============================================================================
157
161 float GetPanelWidth() const;
162
166 static constexpr float GetCollapsedWidth() { return 0.0f; }
167
171 void SetPanelWidth(PanelType type, float width);
172
176 void ResetPanelWidths();
177
184 static float GetDefaultPanelWidth(PanelType type,
186
191
195 void SetPanelSizeLimits(PanelType type, const PanelSizeLimits& limits);
197
201 std::unordered_map<std::string, float> SerializePanelWidths() const;
202 void RestorePanelWidths(const std::unordered_map<std::string, float>& widths);
203
205 std::function<void(PanelType, float)> callback) {
206 on_panel_width_changed_ = std::move(callback);
207 }
208
209 // ============================================================================
210 // Rendering
211 // ============================================================================
212
219 void Draw();
220
227
228 // ============================================================================
229 // Panel-specific accessors
230 // ============================================================================
231
232 AgentChat* agent_chat() const { return agent_chat_; }
239
240 private:
241 void DrawPanelHeader(const char* title, const char* icon);
242 void DrawAgentChatPanel();
243 void DrawProposalsPanel();
244 void DrawSettingsPanel();
245 void DrawHelpPanel();
247 void DrawPropertiesPanel();
248 void DrawProjectPanel();
250
251 // Help panel helpers for context-aware content
253 void DrawGlobalShortcuts();
257 void DrawAboutSection();
258
259 // Styling helpers for consistent panel UI
260 bool BeginPanelSection(const char* label, const char* icon = nullptr,
261 bool default_open = true);
262 void EndPanelSection();
263 void DrawPanelDivider();
264 void DrawPanelLabel(const char* label);
265 void DrawPanelValue(const char* label, const char* value);
266 void DrawPanelDescription(const char* text);
267 std::string GetShortcutLabel(const std::string& action,
268 const std::string& fallback) const;
269 void DrawShortcutRow(const std::string& action, const char* description,
270 const std::string& fallback);
271 float GetConfiguredPanelWidth(PanelType type) const;
272 float GetClampedPanelWidth(PanelType type, float viewport_width) const;
273 void NotifyPanelWidthChanged(PanelType type, float width);
274 static std::string PanelTypeKey(PanelType type);
275
276 // Active panel
278
279 // Active editor for context-aware help
281
282 // Panel widths (customizable per panel type) - consistent sizing
290
291 // Component references (not owned)
299 Rom* rom_ = nullptr;
300
301 // Properties panel lock state
302 bool properties_locked_ = false;
303
304 // Animation state
305 float panel_animation_ = 0.0f; // 0.0 = fully closed, 1.0 = fully open
306 float animation_target_ = 0.0f; // Target value for lerp
307 bool animating_ = false;
308 bool closing_ = false; // True during close animation
309 PanelType closing_panel_ = PanelType::kNone; // Panel being animated closed
310 std::unordered_map<std::string, PanelSizeLimits> panel_size_limits_;
311 std::function<void(PanelType, float)> on_panel_width_changed_;
312};
313
318
323
324} // namespace editor
325} // namespace yaze
326
327#endif // YAZE_APP_EDITOR_MENU_RIGHT_PANEL_MANAGER_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
Unified Agent Chat Component.
Definition agent_chat.h:32
Panel for managing project settings, ROM versions, and snapshots.
ImGui drawer for displaying and managing agent proposals.
Manages right-side sliding panels for agent chat, proposals, settings.
std::string GetShortcutLabel(const std::string &action, const std::string &fallback) const
void SetSettingsPanel(SettingsPanel *panel)
void Draw()
Draw the panel and its contents.
void SetPropertiesPanel(SelectionPropertiesPanel *panel)
std::unordered_map< std::string, float > SerializePanelWidths() const
Persist/restore per-panel widths for user settings.
float GetClampedPanelWidth(PanelType type, float viewport_width) const
float GetPanelWidth() const
Get the width of the panel when expanded.
ProposalDrawer * proposal_drawer() const
void ClosePanel()
Close the currently active panel.
void CyclePanel(int direction)
Cycle to the next/previous right panel in header order.
void SetActiveEditor(EditorType type)
Set the active editor for context-aware help content.
void DrawPanelValue(const char *label, const char *value)
void NotifyPanelWidthChanged(PanelType type, float width)
void SetPanelWidth(PanelType type, float width)
Set panel width for a specific panel type.
SelectionPropertiesPanel * properties_panel() const
void SetShortcutManager(ShortcutManager *manager)
static constexpr float GetCollapsedWidth()
Get the width of the collapsed panel strip (toggle buttons)
void OnHostVisibilityChanged(bool visible)
Snap transient animations when host visibility changes.
void TogglePanel(PanelType type)
Toggle a specific panel on/off.
bool BeginPanelSection(const char *label, const char *icon=nullptr, bool default_open=true)
PanelType GetActivePanel() const
Get the currently active panel type.
static std::string PanelTypeKey(PanelType type)
std::unordered_map< std::string, PanelSizeLimits > panel_size_limits_
float GetConfiguredPanelWidth(PanelType type) const
SettingsPanel * settings_panel() const
static float GetDefaultPanelWidth(PanelType type, EditorType editor=EditorType::kUnknown)
Get the default width for a specific panel type.
void SetPanelSizeLimits(PanelType type, const PanelSizeLimits &limits)
Set sizing constraints for an individual right panel.
void SetProposalDrawer(ProposalDrawer *drawer)
bool IsPanelExpanded() const
Check if any panel is currently expanded (or animating closed)
bool DrawPanelToggleButtons()
Draw toggle buttons for the status cluster.
bool IsPanelActive(PanelType type) const
Check if a specific panel is active.
RightPanelManager & operator=(const RightPanelManager &)=delete
void ResetPanelWidths()
Reset all panel widths to their defaults.
void OpenPanel(PanelType type)
Open a specific panel.
void DrawPanelLabel(const char *label)
SelectionPropertiesPanel * properties_panel_
ProjectManagementPanel * project_panel() const
void SetProjectManagementPanel(ProjectManagementPanel *panel)
void DrawPanelDescription(const char *text)
PanelSizeLimits GetPanelSizeLimits(PanelType type) const
void DrawShortcutRow(const std::string &action, const char *description, const std::string &fallback)
RightPanelManager(const RightPanelManager &)=delete
std::function< void(PanelType, float)> on_panel_width_changed_
void DrawPanelHeader(const char *title, const char *icon)
ProjectManagementPanel * project_panel_
void SetPanelWidthChangedCallback(std::function< void(PanelType, float)> callback)
void RestorePanelWidths(const std::unordered_map< std::string, float > &widths)
void SetToastManager(ToastManager *manager)
Full-editing properties panel for selected entities.
Manages the settings UI displayed in the right sidebar.
const char * GetPanelTypeName(RightPanelManager::PanelType type)
Get the name of a panel type.
const char * GetPanelTypeIcon(RightPanelManager::PanelType type)
Get the icon for a panel type.
static constexpr float kPanelWidthSettings
Definition ui_config.h:31
static constexpr float kPanelWidthHelp
Definition ui_config.h:32
static constexpr float kPanelWidthNotifications
Definition ui_config.h:33
static constexpr float kMaxPanelWidthRatio
Definition ui_config.h:39
static constexpr float kPanelWidthProject
Definition ui_config.h:35
static constexpr float kPanelWidthProposals
Definition ui_config.h:30
static constexpr float kPanelWidthProperties
Definition ui_config.h:34
static constexpr float kPanelWidthAgentChat
Definition ui_config.h:29