Ember
Loading...
Searching...
No Matches
AppPreferences.h
Go to the documentation of this file.
1#pragma once
2
15
16#include "Types/Color.h"
17#include "Types/String.h"
18#include <string>
19#include <vector>
20
21// Forward declarations
22class wxColour;
23
24namespace EmberForge {
25
34 public:
38 enum class ThemeMode { Dark, Light };
39
43 enum class StartupMode { Normal, Maximized };
44
48 enum class SortBy { Name, Date, Size, Type };
49
53 enum class IconSize {
54 Small = 48, // 48x48
55 Medium = 80, // 80x80
56 Large = 128 // 128x128
57 };
58
62 enum class TreeItemSize {
63 Small = 16, // 16x16 icons, compact rows
64 Medium = 24, // 24x24 icons, standard rows
65 Large = 32 // 32x32 icons, spacious rows
66 };
67
71 enum class StartPathMode {
72 ExecutableDirectory, // Always start at executable directory
73 CustomPath // Use custom path
74 };
75
80
85
90 int windowX = -1; // Window X position (-1 = center)
91 int windowY = -1; // Window Y position (-1 = center)
92 int windowWidth = 1280; // Window width
93 int windowHeight = 720; // Window height
94 StartupMode startupMode = StartupMode::Normal; // Startup mode (normal/maximized)
95 EmberCore::String maximizeHotkey = "F11"; // Hotkey for maximize toggle
96
97 // File menu hotkeys
98 EmberCore::String newProjectHotkey = "Ctrl+Shift+N"; // Hotkey for new project
99 EmberCore::String openProjectHotkey = "Ctrl+Shift+O"; // Hotkey for open project
100 EmberCore::String openFileHotkey = "Ctrl+O"; // Hotkey for open XML file
101 EmberCore::String saveHotkey = "Ctrl+S"; // Hotkey for save
102 EmberCore::String saveAsHotkey = "Ctrl+Shift+S"; // Hotkey for save as
103
104 // View menu hotkeys
105 EmberCore::String resetUIHotkey = "Ctrl+Shift+R"; // Hotkey for reset UI
106
107 // Settings menu hotkeys
108 EmberCore::String preferencesHotkey = "Ctrl+,"; // Hotkey for preferences
109 EmberCore::String parserConfigHotkey = "Ctrl+Shift+P"; // Hotkey for parser config
110
112 EmberCore::Color accentColor = EmberCore::Color(100, 149, 237); // Cornflower blue
113
114 // Window appearance and behavior
115 bool showStatusBar = true; // Show status bar at bottom
116 bool showPanelCaptions = false; // Show caption headers on panels
117 bool alwaysOnTop = false; // Keep window above all others (wxSTAY_ON_TOP)
118
119 // Window constraints (percentage of screen)
120 int minWindowWidthPct = 42; // Minimum window width (% of screen)
121 int minWindowHeightPct = 56; // Minimum window height (% of screen)
122 int maxWindowWidthPct = -1; // Maximum window width (% of screen, -1=unlimited)
123 int maxWindowHeightPct = -1; // Maximum window height (% of screen, -1=unlimited)
124 bool enforceAspectRatio = false; // Enforce aspect ratio (16:9)
125 float aspectRatio = 16.0f / 9.0f; // Aspect ratio to enforce
126 };
127
132 float defaultZoomLevel = 1.0f; // Default zoom (0.1-2.0)
133 bool showGrid = true; // Show grid on canvas
134 int gridSize = 20; // Grid size in pixels (10-100)
135 EmberCore::Color gridBackgroundColor = EmberCore::Color(45, 45, 45); // Grid background color
136 EmberCore::Color gridLineColor = EmberCore::Color(54, 54, 54); // Grid line color
137 bool snapToGrid = false; // Snap nodes to grid
138 EmberCore::Color canvasBackgroundColor = EmberCore::Color(50, 50, 50); // Canvas background
139 EmberCore::Color connectionLineColor = EmberCore::Color(255, 255, 255); // Connection line color (white)
140 bool highlightPathToSelected = true; // Highlight path from root to selected node
141 EmberCore::Color pathHighlightColor = EmberCore::Color(144, 238, 144); // Path highlight color (light green)
142 EmberCore::Color idleNodeBgColor = EmberCore::Color(75, 75, 75); // Idle node background color
143 EmberCore::Color idleNodeBorderColor = EmberCore::Color(120, 120, 120); // Idle node border color (gray)
144 EmberCore::Color idleNodeTextColor = EmberCore::Color(180, 180, 180); // Idle node text color (light gray)
145 float selectedNodeBgTint = -0.33f; // Selected node background tint (-1.0 to 1.0, negative = darker)
146 float hoveredNodeBgTint = -0.13f; // Hovered node background tint (-1.0 to 1.0, negative = darker)
147 EmberCore::Color selectedNodeColor = EmberCore::Color(48, 92, 222); // Selected node border color (blue)
148 EmberCore::Color hoveredNodeColor = EmberCore::Color(144, 238, 144); // Hovered node border color (light green)
149 EmberCore::Color selectedNodeTextColor = EmberCore::Color(255, 255, 255); // Selected node text color (white)
150 EmberCore::Color hoveredNodeTextColor = EmberCore::Color(255, 255, 255); // Hovered node text color (white)
152 EmberCore::Color(200, 200, 200); // Selected node info text color (light gray)
154 EmberCore::Color(200, 200, 200); // Hovered node info text color (light gray)
155 int maxScenes = 10; // Maximum number of scenes/tabs (1-50, -1=unlimited)
157 EmberCore::String nextSceneHotkey = "Ctrl+Tab"; // Hotkey to switch to next scene
158 EmberCore::String previousSceneHotkey = "Ctrl+Shift+Tab"; // Hotkey to switch to previous scene
159 bool showMinimap = true;
161 };
162
166 enum class TextAnchor { TopLeft = 0, TopRight = 1, BottomLeft = 2, BottomRight = 3 };
167
172 // Zoom settings
173 float zoomStepSize = 0.1f; // Zoom step size (0.05-0.5, represents 5%-50%)
174 float mouseWheelSensitivity = 1.0f; // Mouse wheel zoom sensitivity multiplier (0.1-5.0)
175 bool zoomFollowsCursor = true; // Zoom towards cursor position vs center
176 EmberCore::String resetViewHotkey = "R"; // Hotkey to reset view (zoom + pan)
177
178 // Pan settings
179 float panSensitivity = 1.51f; // Pan sensitivity multiplier (0.1-2.0)
180 EmberCore::String panKey = "Middle Mouse Button"; // Key/button to hold while moving mouse to pan
181 bool enableSmoothPanning = false; // Enable smooth panning animation
182 float panSmoothness = 30.0f; // Pan smoothness (0-100, higher = smoother/slower)
183 float panStepSize = 40.0f; // Arrow key pan step size in pixels (10-500)
184
185 // Navigation hotkeys
186 EmberCore::String centerOnNodeHotkey = "C"; // Hotkey to center on selected node
187 EmberCore::String deleteNodeHotkey = "Delete"; // Hotkey to delete selected node
188 EmberCore::String panUpHotkey = "Up"; // Hotkey to pan view up
189 EmberCore::String panDownHotkey = "Down"; // Hotkey to pan view down
190 EmberCore::String panLeftHotkey = "Left"; // Hotkey to pan view left
191 EmberCore::String panRightHotkey = "Right"; // Hotkey to pan view right
192
193 // Debug text - Coordinate System Info (zoom and pan)
194 bool showCoordinateInfo = true; // Show coordinate system information
195 int coordinateInfoFontSize = 9; // Font size for coordinate info (6-20)
196 EmberCore::Color coordinateInfoColor = EmberCore::Color(200, 200, 200); // Coordinate info text color
198 int coordinateInfoX = 10; // X offset from anchor (0-9999)
199 int coordinateInfoY = 34; // Y offset from anchor (0-9999)
200
201 // Debug text - Selected Node Info
202 bool showSelectedNodeInfo = true; // Show selected node information
203 int selectedNodeInfoFontSize = 9; // Font size for selected node info (6-20)
204 EmberCore::Color selectedNodeInfoColor = EmberCore::Color(100, 150, 255); // Selected node info text color
206 int selectedNodeInfoX = 10; // X offset from anchor (0-9999)
207 int selectedNodeInfoY = 54; // Y offset from anchor (0-9999)
208
209 // Debug text - Tree Statistics Info
210 bool showTreeInfo = true; // Show tree statistics
211 int treeInfoFontSize = 9; // Font size for tree info (6-20)
212 EmberCore::Color treeInfoColor = EmberCore::Color(150, 200, 150); // Tree info text color
214 int treeInfoX = 10; // X offset from anchor (0-9999)
215 int treeInfoY = 74; // Y offset from anchor (0-9999)
216
217 // Debug text - FPS Display
218 bool showFPS = true; // Show frames per second
219 int fpsFontSize = 9; // Font size for FPS (6-20)
220 EmberCore::Color fpsColor = EmberCore::Color(255, 200, 100); // FPS text color (orange)
222 int fpsX = 10; // X offset from anchor (0-9999)
223 int fpsY = 94; // Y offset from anchor (0-9999)
224
225 // Debug text - Controls Help Text
226 bool showControlsHelp = true; // Show controls/hotkeys help text
227 int controlsHelpFontSize = 11; // Font size for controls help (6-20)
228 EmberCore::Color controlsHelpColor = EmberCore::Color(85, 87, 83); // Controls help text color
230 int controlsHelpX = 10; // X offset from anchor (0-9999)
231 int controlsHelpY = 25; // Y offset from anchor (0-9999)
232 };
233
237 enum class PanelStartupState {
238 Show, // Always show panel on startup
239 Hide, // Always hide panel on startup
240 RememberLast // Remember last state
241 };
242
247 bool showHiddenFiles = false; // Show hidden files/folders in tree
248 bool showFileExtensions = true; // Show file extensions in tree
249 SortBy sortFilesBy = SortBy::Name; // File sorting method for tree
250 TreeItemSize itemSize = TreeItemSize::Medium; // Tree item size (icons and row height)
251 };
252
256 enum class LogFontSize { Small = 8, Medium = 10, Large = 12 };
257
261 struct RGBColor {
262 int r = 200;
263 int g = 200;
264 int b = 200;
265
266 RGBColor() = default;
267 RGBColor(int red, int green, int blue) : r(red), g(green), b(blue) {}
268 };
269
274 int defaultLevelFilter = 2; // 0=All, 1=Trace, 2=Info, 3=Warning, 4=Error, 5=Critical
275 bool autoScrollEnabled = true; // Auto-scroll to newest logs
276 int maxLogEntries = 2000; // Maximum log entries to keep
277 LogFontSize fontSize = LogFontSize::Medium; // Font size for log list
278
279 // Color settings
280 bool enableGuiColors = true; // Enable colored text in LogTab GUI
281 bool enableConsoleColors = true; // Enable ANSI colors in console output (spdlog)
282
283 // Log level colors (RGB)
284 RGBColor traceColor{128, 128, 128}; // Gray
285 RGBColor infoColor{100, 200, 100}; // Green
286 RGBColor warningColor{230, 180, 50}; // Yellow/Orange
287 RGBColor errorColor{230, 80, 80}; // Red
288 RGBColor criticalColor{255, 50, 50}; // Bright Red
289 };
290
295 bool showHiddenFiles = false; // Show hidden files/folders in grid
296 bool showFileExtensions = true; // Show file extensions in grid
297 SortBy sortFilesBy = SortBy::Name; // File sorting method for grid
298 IconSize iconSize = IconSize::Medium; // Icon size (48, 80, or 128)
299 };
300
305 // Panel layout settings (percentage of window)
306 int defaultPanelHeightPct = 25; // Default panel height (% of window)
307 bool defaultPanelHeightEnabled = true; // Whether default height is enforced
308 int minimumPanelHeightPct = 15; // Minimum panel height (% of window)
309 bool minimumPanelHeightEnabled = true; // Whether minimum height is enforced
311 bool lastPanelVisible = true; // Last panel visibility state (for RememberLast feature)
312
313 // Tab bar settings
314 bool showTabCloseButtons = true; // Show close buttons on tabs
315
316 // Behavior settings
317 bool rememberLastTab = true; // Remember last active tab between sessions
318 bool allowPanelCollapse = true; // Allow panel collapse via splitter
319 EmberCore::String lastActiveTab = "FileExplorer"; // Last active tab (for rememberLastTab feature)
320 std::vector<EmberCore::String> lastOpenTabs; // List of tabs that were open (for rememberLastTab feature)
321
322 // File Explorer general settings
323 bool showBreadcrumb = true; // Show breadcrumb navigation bar
324 bool showHistory = true; // Show navigation history button
326 EmberCore::String customStartPath = ""; // Custom path when startPathMode is CustomPath
327
328 // View-specific settings
331
332 // Log tab settings
334 };
335
341 // Future global settings that affect all side panels (left, right, bottom) will go here
342 };
343
348 // Panel layout settings (percentage of window)
349 int defaultPanelWidthPct = 20; // Default panel width (% of window)
350 bool defaultPanelWidthEnabled = true; // Whether default width is enforced
351 int minimumPanelWidthPct = 10; // Minimum panel width (% of window)
352 bool minimumPanelWidthEnabled = true; // Whether minimum width is enforced
354 bool lastPanelVisible = true; // Last panel visibility state (for RememberLast feature)
355
356 // Tab bar settings
357 bool showTabCloseButtons = true; // Show close buttons on tabs
358
359 // Behavior settings
360 bool rememberLastTab = true; // Remember last active tab between sessions
361 bool allowPanelCollapse = true; // Allow panel collapse via splitter
362 EmberCore::String defaultActiveTab = "Navigator"; // Default active tab
363 EmberCore::String lastActiveTab = "Navigator"; // Last active tab (for rememberLastTab feature)
364 std::vector<EmberCore::String> lastOpenTabs; // List of tabs that were open (for rememberLastTab feature)
365 };
366
371 // Panel layout settings (percentage of window)
372 int defaultPanelWidthPct = 20; // Default panel width (% of window)
373 bool defaultPanelWidthEnabled = true; // Whether default width is enforced
374 int minimumPanelWidthPct = 10; // Minimum panel width (% of window)
375 bool minimumPanelWidthEnabled = true; // Whether minimum width is enforced
377 bool lastPanelVisible = true; // Last panel visibility state (for RememberLast feature)
378
379 // Tab bar settings
380 bool showTabCloseButtons = true; // Show close buttons on tabs
381
382 // Behavior settings
383 bool rememberLastTab = true; // Remember last active tab between sessions
384 bool allowPanelCollapse = true; // Allow panel collapse via splitter
385 EmberCore::String defaultActiveTab = "Properties"; // Default active tab
386 EmberCore::String lastActiveTab = "Properties"; // Last active tab (for rememberLastTab feature)
387 std::vector<EmberCore::String> lastOpenTabs; // List of tabs that were open (for rememberLastTab feature)
388 };
389
394 bool autoLoadLastFile = false; // Auto-load last file on startup
395 EmberCore::String lastOpenedFilePath = ""; // Last opened file path
396 EmberCore::String defaultFileEncoding = "UTF-8"; // Default encoding
397 bool showParseWarnings = true; // Show parsing warnings
398 };
399
404 // Rendering settings (wxWidgets-supported)
405 bool enableVSync = true; // Enable vertical sync (OpenGL contexts)
406 FPSLimit fpsLimit = FPSLimit::FPS_60; // Frame rate limit
407 bool hardwareAcceleration = true; // Enable GPU acceleration (OpenGL contexts)
408 bool enableDoubleBuffering = true; // Double buffering for flicker reduction
409 bool enableAntiAliasing = true; // Anti-aliasing for graphics (wxGraphicsContext)
410 bool enableTextAntiAliasing = true; // Text anti-aliasing (font flags)
411 bool enablePartialRedraws = true; // Only redraw changed areas (window style)
412 bool enableBackgroundErase = false; // Erase background before paint (disable for performance)
413
414 // Viewport culling settings (for large trees)
415 bool enableViewportCulling = true; // Enable viewport culling optimization
416 int viewportCullingMargin = 500; // Culling safety margin in screen pixels (100-1000)
417
418 // UI responsiveness settings
419 bool enableIdleProcessing = true; // Process idle events
420 };
421
422 public:
424 ~AppPreferences() = default;
425
426 // Settings access
429
432
435
438
441
444
447
450
453
454 // Configuration management
455 void ResetToDefaults();
456 bool LoadFromFile(const EmberCore::String &filename);
457 bool SaveToFile(const EmberCore::String &filename) const;
458
459 // Helper to get default config path
461
462 private:
472
473 // Helper methods for enum conversion
474 static ThemeMode StringToThemeMode(const std::string &str);
475 static std::string ThemeModeToString(ThemeMode mode);
476 static StartupMode StringToStartupMode(const std::string &str);
477 static std::string StartupModeToString(StartupMode mode);
478 static SortBy StringToSortBy(const std::string &str);
479 static std::string SortByToString(SortBy sort);
480 static IconSize StringToIconSize(const std::string &str);
481 static std::string IconSizeToString(IconSize size);
482 static TreeItemSize StringToTreeItemSize(const std::string &str);
483 static std::string TreeItemSizeToString(TreeItemSize size);
484 static LogFontSize StringToLogFontSize(const std::string &str);
485 static std::string LogFontSizeToString(LogFontSize size);
486 static StartPathMode StringToStartPathMode(const std::string &str);
487 static std::string StartPathModeToString(StartPathMode mode);
488 static FPSLimit StringToFPSLimit(const std::string &str);
489 static std::string FPSLimitToString(FPSLimit limit);
490 static CloseConfirmationMode StringToCloseConfirmationMode(const std::string &str);
492 static PanelStartupState StringToPanelStartupState(const std::string &str);
493 static std::string PanelStartupStateToString(PanelStartupState state);
494};
495
500 public:
502
504 const AppPreferences &GetPreferences() const { return preferences_; }
505
510 static wxColour GetAccentColor();
511
512 private:
515};
516
517} // namespace EmberForge
const AppPreferences & GetPreferences() const
static wxColour GetAccentColor()
Get the accent color as a wxColour for UI elements.
static AppPreferencesManager & GetInstance()
Application preferences configuration.
BehaviorTreeViewSettings behaviorTreeViewSettings_
PerformanceSettings & GetPerformanceSettings()
static std::string StartupModeToString(StartupMode mode)
BehaviorTreeViewSettings & GetBehaviorTreeViewSettings()
StartupMode
Startup mode enumeration.
FPSLimit
Frame rate limit options.
PanelStartupState
Panel startup state options.
static LogFontSize StringToLogFontSize(const std::string &str)
LeftPanelSettings & GetLeftPanelSettings()
SortBy
File sorting criteria.
bool SaveToFile(const EmberCore::String &filename) const
CloseConfirmationMode
Close confirmation behavior for scenes.
IconSize
Icon size for grid view.
static std::string ThemeModeToString(ThemeMode mode)
MainPanelSettings & GetMainPanelSettings()
const WindowSettings & GetWindowSettings() const
static std::string SortByToString(SortBy sort)
LeftPanelSettings leftPanelSettings_
const LeftPanelSettings & GetLeftPanelSettings() const
RightPanelSettings & GetRightPanelSettings()
const BottomPanelSettings & GetBottomPanelSettings() const
BottomPanelSettings bottomPanelSettings_
TreeItemSize
Tree item size (affects icon and row height)
const PerformanceSettings & GetPerformanceSettings() const
static StartPathMode StringToStartPathMode(const std::string &str)
TextAnchor
Text anchor position for debug info overlay.
static PanelStartupState StringToPanelStartupState(const std::string &str)
static std::string LogFontSizeToString(LogFontSize size)
BottomPanelSettings & GetBottomPanelSettings()
SidePanelSettings & GetSidePanelSettings()
RightPanelSettings rightPanelSettings_
PerformanceSettings performanceSettings_
const ParserSettings & GetParserSettings() const
static TreeItemSize StringToTreeItemSize(const std::string &str)
static std::string FPSLimitToString(FPSLimit limit)
static FPSLimit StringToFPSLimit(const std::string &str)
static std::string IconSizeToString(IconSize size)
ParserSettings & GetParserSettings()
MainPanelSettings mainPanelSettings_
const RightPanelSettings & GetRightPanelSettings() const
static IconSize StringToIconSize(const std::string &str)
ThemeMode
Theme mode enumeration.
bool LoadFromFile(const EmberCore::String &filename)
static CloseConfirmationMode StringToCloseConfirmationMode(const std::string &str)
SidePanelSettings sidePanelSettings_
StartPathMode
Default start path behavior.
LogFontSize
Log tab font size.
WindowSettings & GetWindowSettings()
const MainPanelSettings & GetMainPanelSettings() const
static StartupMode StringToStartupMode(const std::string &str)
static EmberCore::String GetDefaultConfigPath()
const BehaviorTreeViewSettings & GetBehaviorTreeViewSettings() const
static std::string CloseConfirmationModeToString(CloseConfirmationMode mode)
static SortBy StringToSortBy(const std::string &str)
static ThemeMode StringToThemeMode(const std::string &str)
static std::string TreeItemSizeToString(TreeItemSize size)
static std::string PanelStartupStateToString(PanelStartupState state)
const SidePanelSettings & GetSidePanelSettings() const
static std::string StartPathModeToString(StartPathMode mode)
std::string String
Framework-agnostic string type.
Definition String.h:14
RGBA color with 8-bit components.
Definition Color.h:10
Behavior Tree View specific settings.
std::vector< EmberCore::String > lastOpenTabs
std::vector< EmberCore::String > lastOpenTabs
Main panel (scene view) settings.
Simple RGB color struct for preferences storage.
RGBColor(int red, int green, int blue)
std::vector< EmberCore::String > lastOpenTabs
Global side panel settings (applies to all panels that inherit from SidePanel) Reserved for future us...