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
120 int minWindowWidth = 800; // Minimum window width
121 int minWindowHeight = 600; // Minimum window height
122 int maxWindowWidth = -1; // Maximum window width (-1=unlimited)
123 int maxWindowHeight = -1; // Maximum window height (-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 };
160
164 enum class TextAnchor { TopLeft = 0, TopRight = 1, BottomLeft = 2, BottomRight = 3 };
165
170 // Zoom settings
171 float zoomStepSize = 0.1f; // Zoom step size (0.05-0.5, represents 5%-50%)
172 float mouseWheelSensitivity = 1.0f; // Mouse wheel zoom sensitivity multiplier (0.1-5.0)
173 bool zoomFollowsCursor = true; // Zoom towards cursor position vs center
174 EmberCore::String resetViewHotkey = "R"; // Hotkey to reset view (zoom + pan)
175
176 // Pan settings
177 float panSensitivity = 1.51f; // Pan sensitivity multiplier (0.1-2.0)
178 EmberCore::String panKey = "Middle Mouse Button"; // Key/button to hold while moving mouse to pan
179 bool enableSmoothPanning = false; // Enable smooth panning animation
180 float panSmoothness = 30.0f; // Pan smoothness (0-100, higher = smoother/slower)
181 float panStepSize = 40.0f; // Arrow key pan step size in pixels (10-500)
182
183 // Navigation hotkeys
184 EmberCore::String centerOnNodeHotkey = "C"; // Hotkey to center on selected node
185 EmberCore::String deleteNodeHotkey = "Delete"; // Hotkey to delete selected node
186 EmberCore::String panUpHotkey = "Up"; // Hotkey to pan view up
187 EmberCore::String panDownHotkey = "Down"; // Hotkey to pan view down
188 EmberCore::String panLeftHotkey = "Left"; // Hotkey to pan view left
189 EmberCore::String panRightHotkey = "Right"; // Hotkey to pan view right
190
191 // Debug text - Coordinate System Info (zoom and pan)
192 bool showCoordinateInfo = true; // Show coordinate system information
193 int coordinateInfoFontSize = 9; // Font size for coordinate info (6-20)
194 EmberCore::Color coordinateInfoColor = EmberCore::Color(200, 200, 200); // Coordinate info text color
196 int coordinateInfoX = 10; // X offset from anchor (0-9999)
197 int coordinateInfoY = 10; // Y offset from anchor (0-9999)
198
199 // Debug text - Selected Node Info
200 bool showSelectedNodeInfo = true; // Show selected node information
201 int selectedNodeInfoFontSize = 9; // Font size for selected node info (6-20)
202 EmberCore::Color selectedNodeInfoColor = EmberCore::Color(100, 150, 255); // Selected node info text color
204 int selectedNodeInfoX = 10; // X offset from anchor (0-9999)
205 int selectedNodeInfoY = 30; // Y offset from anchor (0-9999)
206
207 // Debug text - Tree Statistics Info
208 bool showTreeInfo = true; // Show tree statistics
209 int treeInfoFontSize = 9; // Font size for tree info (6-20)
210 EmberCore::Color treeInfoColor = EmberCore::Color(150, 200, 150); // Tree info text color
212 int treeInfoX = 10; // X offset from anchor (0-9999)
213 int treeInfoY = 50; // Y offset from anchor (0-9999)
214
215 // Debug text - FPS Display
216 bool showFPS = true; // Show frames per second
217 int fpsFontSize = 9; // Font size for FPS (6-20)
218 EmberCore::Color fpsColor = EmberCore::Color(255, 200, 100); // FPS text color (orange)
220 int fpsX = 10; // X offset from anchor (0-9999)
221 int fpsY = 70; // Y offset from anchor (0-9999)
222
223 // Debug text - Controls Help Text
224 bool showControlsHelp = true; // Show controls/hotkeys help text
225 int controlsHelpFontSize = 11; // Font size for controls help (6-20)
226 EmberCore::Color controlsHelpColor = EmberCore::Color(85, 87, 83); // Controls help text color
228 int controlsHelpX = 10; // X offset from anchor (0-9999)
229 int controlsHelpY = 25; // Y offset from anchor (0-9999)
230 };
231
235 enum class PanelStartupState {
236 Show, // Always show panel on startup
237 Hide, // Always hide panel on startup
238 RememberLast // Remember last state
239 };
240
245 bool showHiddenFiles = false; // Show hidden files/folders in tree
246 bool showFileExtensions = true; // Show file extensions in tree
247 SortBy sortFilesBy = SortBy::Name; // File sorting method for tree
248 TreeItemSize itemSize = TreeItemSize::Medium; // Tree item size (icons and row height)
249 };
250
254 enum class LogFontSize { Small = 8, Medium = 10, Large = 12 };
255
259 struct RGBColor {
260 int r = 200;
261 int g = 200;
262 int b = 200;
263
264 RGBColor() = default;
265 RGBColor(int red, int green, int blue) : r(red), g(green), b(blue) {}
266 };
267
272 int defaultLevelFilter = 2; // 0=All, 1=Trace, 2=Info, 3=Warning, 4=Error, 5=Critical
273 bool autoScrollEnabled = true; // Auto-scroll to newest logs
274 int maxLogEntries = 2000; // Maximum log entries to keep
275 LogFontSize fontSize = LogFontSize::Medium; // Font size for log list
276
277 // Color settings
278 bool enableGuiColors = true; // Enable colored text in LogTab GUI
279 bool enableConsoleColors = true; // Enable ANSI colors in console output (spdlog)
280
281 // Log level colors (RGB)
282 RGBColor traceColor{128, 128, 128}; // Gray
283 RGBColor infoColor{100, 200, 100}; // Green
284 RGBColor warningColor{230, 180, 50}; // Yellow/Orange
285 RGBColor errorColor{230, 80, 80}; // Red
286 RGBColor criticalColor{255, 50, 50}; // Bright Red
287 };
288
293 bool showHiddenFiles = false; // Show hidden files/folders in grid
294 bool showFileExtensions = true; // Show file extensions in grid
295 SortBy sortFilesBy = SortBy::Name; // File sorting method for grid
296 IconSize iconSize = IconSize::Medium; // Icon size (48, 80, or 128)
297 };
298
303 // Panel layout settings
304 int defaultPanelHeight = 600; // Default panel height in pixels
305 bool defaultPanelHeightEnabled = true; // Whether default height is enforced
306 int minimumPanelHeight = 500; // Minimum panel height in pixels
307 bool minimumPanelHeightEnabled = true; // Whether minimum height is enforced
309 bool lastPanelVisible = true; // Last panel visibility state (for RememberLast feature)
310
311 // Tab bar settings
312 bool showTabCloseButtons = true; // Show close buttons on tabs
313
314 // Behavior settings
315 bool rememberLastTab = true; // Remember last active tab between sessions
316 bool allowPanelCollapse = true; // Allow panel collapse via splitter
317 EmberCore::String lastActiveTab = "FileExplorer"; // Last active tab (for rememberLastTab feature)
318 std::vector<EmberCore::String> lastOpenTabs; // List of tabs that were open (for rememberLastTab feature)
319
320 // File Explorer general settings
321 bool showBreadcrumb = true; // Show breadcrumb navigation bar
322 bool showHistory = true; // Show navigation history button
324 EmberCore::String customStartPath = ""; // Custom path when startPathMode is CustomPath
325
326 // View-specific settings
329
330 // Log tab settings
332 };
333
338 // Display settings
339 bool showSearchBar = true; // Show/hide search bar at top
340 bool showNodeIcons = true; // Show icons in tree view
341 bool showTreeLines = false; // Show connecting lines between nodes
342 int treeIndentationSize = 16; // Tree indentation in pixels (10-30)
343 int iconSize = 16; // Icon size in pixels (12, 16, 20, 24)
344 int fontSize = 9; // Node text font size (8-14)
345
346 // Color settings
347 int backgroundColorR = 50; // Tree background color - Red (0-255)
348 int backgroundColorG = 50; // Tree background color - Green (0-255)
349 int backgroundColorB = 50; // Tree background color - Blue (0-255)
350 int textColorR = 255; // Tree text color - Red (0-255)
351 int textColorG = 255; // Tree text color - Green (0-255)
352 int textColorB = 255; // Tree text color - Blue (0-255)
353 int selectionColorR = 70; // Selection highlight color - Red (0-255)
354 int selectionColorG = 130; // Selection highlight color - Green (0-255)
355 int selectionColorB = 180; // Selection highlight color - Blue (0-255)
356
357 // Behavior settings
358 bool autoExpandOnLoad = true; // Auto-expand tree when loading
359 bool syncSelectionWithCanvas = true; // Sync selection with main canvas (also auto-scrolls)
360 bool liveSearch = true; // Search as you type (false = search on enter)
361
362 // Click action options (shared by double-click and ctrl+click)
363 enum class ClickAction {
364 ExpandCollapse, // Toggle expand/collapse
365 Rename, // Rename node
366 CenterInCanvas // Center node in main canvas
367 };
370
371 // Legacy alias for backwards compatibility
373
374 // Context menu settings
375 bool showAddChildOption = true; // Show "Add Child" in context menu
376 bool showDeleteOption = true; // Show "Delete" in context menu
377 bool showRenameOption = true; // Show "Rename" in context menu
378 bool showDuplicateOption = true; // Show "Duplicate" in context menu
379
380 // Performance settings
381 bool rememberExpandedNodes = true; // Remember which nodes were expanded
382 };
383
389 // Future global settings that affect all side panels (left, right, bottom) will go here
390 };
391
396 // Panel layout settings
397 int defaultPanelWidth = 450; // Default panel width in pixels
398 bool defaultPanelWidthEnabled = true; // Whether default width is enforced
399 int minimumPanelWidth = 350; // Minimum panel width in pixels
400 bool minimumPanelWidthEnabled = true; // Whether minimum width is enforced
402 bool lastPanelVisible = true; // Last panel visibility state (for RememberLast feature)
403
404 // Tab bar settings
405 bool showTabCloseButtons = true; // Show close buttons on tabs
406
407 // Behavior settings
408 bool rememberLastTab = true; // Remember last active tab between sessions
409 bool allowPanelCollapse = true; // Allow panel collapse via splitter
410 EmberCore::String defaultActiveTab = "Hierarchy"; // Default active tab
411 EmberCore::String lastActiveTab = "Hierarchy"; // Last active tab (for rememberLastTab feature)
412 std::vector<EmberCore::String> lastOpenTabs; // List of tabs that were open (for rememberLastTab feature)
413
414 // Tab-specific settings
416 };
417
422 // Panel layout settings
423 int defaultPanelWidth = 450; // Default panel width in pixels
424 bool defaultPanelWidthEnabled = true; // Whether default width is enforced
425 int minimumPanelWidth = 350; // Minimum panel width in pixels
426 bool minimumPanelWidthEnabled = true; // Whether minimum width is enforced
428 bool lastPanelVisible = true; // Last panel visibility state (for RememberLast feature)
429
430 // Tab bar settings
431 bool showTabCloseButtons = true; // Show close buttons on tabs
432
433 // Behavior settings
434 bool rememberLastTab = true; // Remember last active tab between sessions
435 bool allowPanelCollapse = true; // Allow panel collapse via splitter
436 EmberCore::String defaultActiveTab = "Tool"; // Default active tab
437 EmberCore::String lastActiveTab = "Tool"; // Last active tab (for rememberLastTab feature)
438 std::vector<EmberCore::String> lastOpenTabs; // List of tabs that were open (for rememberLastTab feature)
439 };
440
445 bool autoLoadLastFile = false; // Auto-load last file on startup
446 EmberCore::String lastOpenedFilePath = ""; // Last opened file path
447 EmberCore::String defaultFileEncoding = "UTF-8"; // Default encoding
448 bool showParseWarnings = true; // Show parsing warnings
449 };
450
455 // Rendering settings (wxWidgets-supported)
456 bool enableVSync = true; // Enable vertical sync (OpenGL contexts)
457 FPSLimit fpsLimit = FPSLimit::FPS_60; // Frame rate limit
458 bool hardwareAcceleration = true; // Enable GPU acceleration (OpenGL contexts)
459 bool enableDoubleBuffering = true; // Double buffering for flicker reduction
460 bool enableAntiAliasing = true; // Anti-aliasing for graphics (wxGraphicsContext)
461 bool enableTextAntiAliasing = true; // Text anti-aliasing (font flags)
462 bool enablePartialRedraws = true; // Only redraw changed areas (window style)
463 bool enableBackgroundErase = false; // Erase background before paint (disable for performance)
464
465 // Viewport culling settings (for large trees)
466 bool enableViewportCulling = true; // Enable viewport culling optimization
467 int viewportCullingMargin = 500; // Culling safety margin in screen pixels (100-1000)
468
469 // UI responsiveness settings
470 bool enableIdleProcessing = true; // Process idle events
471 };
472
473 public:
475 ~AppPreferences() = default;
476
477 // Settings access
480
483
486
489
492
495
498
501
504
505 // Configuration management
506 void ResetToDefaults();
507 bool LoadFromFile(const EmberCore::String &filename);
508 bool SaveToFile(const EmberCore::String &filename) const;
509
510 // Helper to get default config path
512
513 private:
523
524 // Helper methods for enum conversion
525 static ThemeMode StringToThemeMode(const std::string &str);
526 static std::string ThemeModeToString(ThemeMode mode);
527 static StartupMode StringToStartupMode(const std::string &str);
528 static std::string StartupModeToString(StartupMode mode);
529 static SortBy StringToSortBy(const std::string &str);
530 static std::string SortByToString(SortBy sort);
531 static IconSize StringToIconSize(const std::string &str);
532 static std::string IconSizeToString(IconSize size);
533 static TreeItemSize StringToTreeItemSize(const std::string &str);
534 static std::string TreeItemSizeToString(TreeItemSize size);
535 static LogFontSize StringToLogFontSize(const std::string &str);
536 static std::string LogFontSizeToString(LogFontSize size);
537 static StartPathMode StringToStartPathMode(const std::string &str);
538 static std::string StartPathModeToString(StartPathMode mode);
539 static FPSLimit StringToFPSLimit(const std::string &str);
540 static std::string FPSLimitToString(FPSLimit limit);
541 static CloseConfirmationMode StringToCloseConfirmationMode(const std::string &str);
543 static PanelStartupState StringToPanelStartupState(const std::string &str);
544 static std::string PanelStartupStateToString(PanelStartupState state);
545};
546
551 public:
553
555 const AppPreferences &GetPreferences() const { return preferences_; }
556
561 static wxColour GetAccentColor();
562
563 private:
566};
567
568} // 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...