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 "app/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);
85 void SetCommandSummaryProvider(std::function<std::vector<std::string>()> provider);
86 void SetTodoProvider(std::function<std::vector<std::string>()> provider);
87
88 private:
89 void InitializeTheme();
90 // Component creation
91 ftxui::Component CreateMainMenuPanel();
92 ftxui::Component CreateChatPanel();
93 ftxui::Component CreateStatusPanel();
94 ftxui::Component CreateToolsPanel();
95 ftxui::Component CreateHexViewerPanel();
96 ftxui::Component CreatePaletteEditorPanel();
97 ftxui::Component CreateTodoManagerPanel();
98 ftxui::Component CreateRomToolsPanel();
99 ftxui::Component CreateGraphicsToolsPanel();
100 ftxui::Component CreateSettingsPanel();
101 ftxui::Component CreateHelpPanel();
102
103 // Layout assembly
104 ftxui::Component CreateUnifiedLayout();
105
106 // Event handling
107 bool HandleGlobalEvents(const ftxui::Event& event);
108 bool HandlePanelEvents(const ftxui::Event& event);
109
110 // Rendering
111 ftxui::Element RenderPanelHeader(PanelType panel);
112 ftxui::Element RenderStatusBar();
113 ftxui::Element RenderAnimatedBanner();
114 ftxui::Element RenderWorkflowLane();
115 ftxui::Element RenderCommandHints();
116 ftxui::Element RenderTodoStack();
117 ftxui::Element RenderResponsiveGrid(const std::vector<ftxui::Element>& tiles);
118
119 // State
120 ftxui::ScreenInteractive screen_;
124
125 // Components
126 std::unique_ptr<tui::ChatTUI> chat_tui_;
127 std::unique_ptr<HexViewerComponent> hex_viewer_component_;
128
129 // Panel components (cached for performance)
130 ftxui::Component main_menu_panel_;
131 ftxui::Component chat_panel_;
132 ftxui::Component status_panel_;
133 ftxui::Component tools_panel_;
134 ftxui::Component hex_viewer_panel_;
135 ftxui::Component palette_editor_panel_;
136 ftxui::Component todo_manager_panel_;
137 ftxui::Component rom_tools_panel_;
138 ftxui::Component graphics_tools_panel_;
139 ftxui::Component settings_panel_;
140 ftxui::Component help_panel_;
141
142 // Layout components
143 ftxui::Component unified_layout_;
144
145 // Event handlers
146 std::function<bool(const ftxui::Event&)> global_event_handler_;
147 std::function<bool(const ftxui::Event&)> panel_event_handler_;
148
149 // External providers
150 std::function<ftxui::Element()> status_provider_;
151 std::function<std::vector<std::string>()> command_summary_provider_;
152 std::function<std::vector<std::string>()> todo_provider_;
153
155 ftxui::Component todo_overlay_component_;
156};
157
158} // namespace cli
159} // namespace yaze
160
161#endif // YAZE_CLI_TUI_UNIFIED_LAYOUT_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
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)
ftxui::Element RenderCommandHints()
std::unique_ptr< HexViewerComponent > hex_viewer_component_
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)
std::function< bool(const ftxui::Event &)> global_event_handler_
ftxui::Element RenderResponsiveGrid(const std::vector< ftxui::Element > &tiles)
void SwitchMainPanel(PanelType panel)
ftxui::Component status_panel_
ftxui::Component palette_editor_panel_
std::function< bool(const ftxui::Event &)> panel_event_handler_
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_
Main namespace for the application.
std::vector< std::string > active_workflows
std::string current_rom_file
std::string command_palette_hint