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