yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
unified_layout.h
Go to the documentation of this file.
1#ifndef YAZE_CLI_TUI_UNIFIED_LAYOUT_H
2#define YAZE_CLI_TUI_UNIFIED_LAYOUT_H
3
4#include <ftxui/component/component.hpp>
5#include <ftxui/dom/elements.hpp>
6#include <ftxui/screen/screen.hpp>
7#include <functional>
8#include <memory>
9#include <string>
10#include <vector>
11
12#include "rom/rom.h"
13#include "cli/tui/chat_tui.h"
14#include "cli/tui/hex_viewer.h"
15
16namespace yaze {
17namespace cli {
18namespace tui {
19class ChatTUI;
20} // namespace tui
21} // namespace cli
22} // namespace yaze
23
24namespace yaze {
25namespace cli {
26
27// Panel types for the unified layout
41
42// Layout configuration
44 int left_panel_width = 30; // Menu/Tools panel
45 int right_panel_width = 40; // Status/Info panel
46 int bottom_panel_height = 15; // Chat panel
47 bool show_chat = true;
48 bool show_status = true;
49 bool show_tools = true;
50};
51
52// Panel state management
65
67 public:
68 explicit UnifiedLayout(Rom* rom_context = nullptr);
69
70 // Main interface
71 void Run();
72 void SetRomContext(Rom* rom_context);
73
74 // Panel management
75 void SwitchMainPanel(PanelType panel);
76 void SwitchToolPanel(PanelType panel);
77 void ToggleChat();
78 void ToggleStatus();
79 void ToggleTodoOverlay();
80
81 // Configuration
82 void SetLayoutConfig(const LayoutConfig& config);
84 void SetStatusProvider(std::function<ftxui::Element()> provider);
86 std::function<std::vector<std::string>()> provider);
87 void SetTodoProvider(std::function<std::vector<std::string>()> provider);
88
89 private:
90 void InitializeTheme();
91 // Component creation
92 ftxui::Component CreateMainMenuPanel();
93 ftxui::Component CreateChatPanel();
94 ftxui::Component CreateStatusPanel();
95 ftxui::Component CreateToolsPanel();
96 ftxui::Component CreateHexViewerPanel();
97 ftxui::Component CreatePaletteEditorPanel();
98 ftxui::Component CreateTodoManagerPanel();
99 ftxui::Component CreateRomToolsPanel();
100 ftxui::Component CreateGraphicsToolsPanel();
101 ftxui::Component CreateSettingsPanel();
102 ftxui::Component CreateHelpPanel();
103
104 // Layout assembly
105 ftxui::Component CreateUnifiedLayout();
106
107 // Event handling
108 bool HandleGlobalEvents(const ftxui::Event& event);
109 bool HandlePanelEvents(const ftxui::Event& event);
110
111 // Rendering
112 ftxui::Element RenderPanelHeader(PanelType panel);
113 ftxui::Element RenderStatusBar();
114 ftxui::Element RenderAnimatedBanner();
115 ftxui::Element RenderWorkflowLane();
116 ftxui::Element RenderCommandHints();
117 ftxui::Element RenderTodoStack();
118 ftxui::Element RenderResponsiveGrid(const std::vector<ftxui::Element>& tiles);
119
120 // State
121 ftxui::ScreenInteractive screen_;
125
126 // Components
127 std::unique_ptr<tui::ChatTUI> chat_tui_;
128 std::unique_ptr<HexViewerComponent> hex_viewer_component_;
129
130 // Panel components (cached for performance)
131 ftxui::Component main_menu_panel_;
132 ftxui::Component chat_panel_;
133 ftxui::Component status_panel_;
134 ftxui::Component tools_panel_;
135 ftxui::Component hex_viewer_panel_;
136 ftxui::Component palette_editor_panel_;
137 ftxui::Component todo_manager_panel_;
138 ftxui::Component rom_tools_panel_;
139 ftxui::Component graphics_tools_panel_;
140 ftxui::Component settings_panel_;
141 ftxui::Component help_panel_;
142
143 // Layout components
144 ftxui::Component unified_layout_;
145
146 // Event handlers
147 std::function<bool(const ftxui::Event&)> global_event_handler_;
148 std::function<bool(const ftxui::Event&)> panel_event_handler_;
149
150 // External providers
151 std::function<ftxui::Element()> status_provider_;
152 std::function<std::vector<std::string>()> command_summary_provider_;
153 std::function<std::vector<std::string>()> todo_provider_;
154
156 ftxui::Component todo_overlay_component_;
157};
158
159} // namespace cli
160} // namespace yaze
161
162#endif // YAZE_CLI_TUI_UNIFIED_LAYOUT_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:24
ftxui::Component unified_layout_
ftxui::Element RenderTodoStack()
ftxui::Component CreateToolsPanel()
ftxui::Component CreatePaletteEditorPanel()
ftxui::Component graphics_tools_panel_
void SwitchToolPanel(PanelType panel)
ftxui::Component CreateHelpPanel()
void SetStatusProvider(std::function< ftxui::Element()> provider)
ftxui::Component settings_panel_
void SetLayoutConfig(const LayoutConfig &config)
std::function< bool(const ftxui::Event &) panel_event_handler_)
ftxui::Element RenderCommandHints()
std::unique_ptr< HexViewerComponent > hex_viewer_component_
UnifiedLayout(Rom *rom_context=nullptr)
std::function< ftxui::Element()> status_provider_
ftxui::Component rom_tools_panel_
ftxui::Component CreateRomToolsPanel()
ftxui::Element RenderStatusBar()
ftxui::Component hex_viewer_panel_
ftxui::Component CreateChatPanel()
ftxui::ScreenInteractive screen_
bool HandleGlobalEvents(const ftxui::Event &event)
std::unique_ptr< tui::ChatTUI > chat_tui_
ftxui::Element RenderPanelHeader(PanelType panel)
ftxui::Element RenderResponsiveGrid(const std::vector< ftxui::Element > &tiles)
void SwitchMainPanel(PanelType panel)
ftxui::Component status_panel_
ftxui::Component palette_editor_panel_
ftxui::Component chat_panel_
ftxui::Component help_panel_
ftxui::Component main_menu_panel_
void SetTodoProvider(std::function< std::vector< std::string >()> provider)
void SetRomContext(Rom *rom_context)
ftxui::Component CreateHexViewerPanel()
std::function< std::vector< std::string >()> todo_provider_
LayoutConfig GetLayoutConfig() const
ftxui::Component CreateSettingsPanel()
ftxui::Component todo_manager_panel_
ftxui::Component todo_overlay_component_
ftxui::Element RenderWorkflowLane()
ftxui::Component CreateStatusPanel()
ftxui::Component tools_panel_
void SetCommandSummaryProvider(std::function< std::vector< std::string >()> provider)
bool HandlePanelEvents(const ftxui::Event &event)
ftxui::Component CreateUnifiedLayout()
ftxui::Component CreateGraphicsToolsPanel()
ftxui::Component CreateTodoManagerPanel()
ftxui::Component CreateMainMenuPanel()
ftxui::Element RenderAnimatedBanner()
std::function< std::vector< std::string >()> command_summary_provider_
std::function< bool(const ftxui::Event &) global_event_handler_)
std::vector< std::string > active_workflows
std::string current_rom_file
std::string command_palette_hint