yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
settings_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SHELL_WINDOWS_SETTINGS_PANEL_H_
2#define YAZE_APP_EDITOR_SHELL_WINDOWS_SETTINGS_PANEL_H_
3
4#include <array>
5#include <functional>
6#include <string>
7#include <utility>
8#include <vector>
9
10#include "absl/status/status.h"
11#include "app/editor/editor.h"
16#include "core/project.h"
17
18namespace yaze {
19
20class Rom;
21
22namespace editor {
23
24class WorkspaceWindowManager;
25class ShortcutManager;
26class SettingsPanelTestPeer;
27
41class SettingsPanel : public Editor {
42 public:
43 enum class Scope {
47 };
48
50 const char* id;
51 const char* label;
52 const char* icon;
54 const char* keywords;
55 };
56
57 using OpenMinecartTracksCallback = std::function<absl::Status()>;
58
60
61 void SetDependencies(const EditorDependencies& deps) override;
62
63 void Initialize() override {}
64 absl::Status Load() override { return absl::OkStatus(); }
65 absl::Status Save() override { return absl::OkStatus(); }
66 absl::Status Update() override {
67 Draw();
68 return absl::OkStatus();
69 }
70
71 absl::Status Undo() override { return absl::OkStatus(); }
72 absl::Status Redo() override { return absl::OkStatus(); }
73 absl::Status Cut() override { return absl::OkStatus(); }
74 absl::Status Copy() override { return absl::OkStatus(); }
75 absl::Status Paste() override { return absl::OkStatus(); }
76 absl::Status Find() override { return absl::OkStatus(); }
77 // Edit-menu actions are no-ops for the settings editor.
78 bool CanUndo() const override { return false; }
79 bool CanRedo() const override { return false; }
80 bool CanCut() const override { return false; }
81 bool CanCopy() const override { return false; }
82 bool CanPaste() const override { return false; }
83
84 void SetUserSettings(UserSettings* settings) { user_settings_ = settings; }
86 window_manager_ = registry;
87 }
89 shortcut_manager_ = manager;
90 }
91 void SetStatusBar(StatusBar* bar) { status_bar_ = bar; }
92 void SetRom(Rom* rom) { rom_ = rom; }
97
98 // Resolve the active project and its save-policy identity at draw time.
100 std::function<project::YazeProject*()> project_provider,
101 std::function<std::string()> hash_provider) {
102 project_provider_ = std::move(project_provider);
103 rom_hash_provider_ = std::move(hash_provider);
104 }
105
106 // Main draw entry point
107 void Draw();
108
109 static std::vector<CategoryDescriptor> FilterCategories(
110 Scope scope, const std::string& query);
111
112 private:
113 void DrawScopeTabs();
114 void DrawCategoryNavigation(const std::vector<CategoryDescriptor>& categories,
115 bool compact);
116 void DrawCategoryContent(const std::string& category_id);
117 void EnsureActiveCategory(const std::vector<CategoryDescriptor>& categories);
118
120
121 using DungeonOverlaySummary = std::array<std::pair<std::string, bool>, 5>;
122
123 void DrawGeneralSettings();
125 // Switches the active theme to `preset` density. Lives outside the combo
126 // callback so it can be tested: the combo is one line, but the behaviour
127 // that matters — routing through ReapplyTheme so Classic YAZE repaints via
128 // ColorsYaze() rather than its struct — is not reachable from a unit test
129 // while it is buried in an ImGui interaction.
132 // Loads `name` from UserSettings::named_layouts, validates the
133 // serialized DockTree, and applies it to the live main dockspace via
134 // LayoutManager. Surface for the Workspace section's combo + Re-apply
135 // button. On success, persists `last_applied_layout_name = name` so a
136 // subsequent startup reapplies the same layout (mirrors the
137 // theme-persistence pattern shipped in Phase 5.1). Status is reported
138 // via workspace_status_message_.
139 void ApplyNamedLayoutToDockspace(const std::string& name);
140 void DrawEditorBehavior();
142 void DrawAIAgentSettings();
145 void DrawGlobalShortcuts();
146 void DrawEditorShortcuts();
147 void DrawPanelShortcuts();
148 bool MatchesShortcutFilter(const std::string& text) const;
149 void DrawPatchSettings();
150 void DrawProjectSettings(); // New method
151 void DrawPatchList(const std::string& folder);
152 void DrawPatchDetails();
155 const project::DungeonOverlaySettings& overlay);
156 absl::Status RequestOpenMinecartTracks();
157
163 std::function<std::string()> rom_hash_provider_;
164 Rom* rom_ = nullptr;
165 project::YazeProject* project_ = nullptr; // Project reference
166
167 // Shortcut editing state
169 std::string editing_card_id_;
171 std::string shortcut_filter_;
172
173 // Patch system state
175 std::string selected_folder_;
177 bool patches_loaded_ = false;
178
179 // Workspace layout picker transient status — last apply attempt's
180 // outcome, drawn beneath the section. Persists across frames within a
181 // session; cleared on the next apply attempt.
184
187
189 std::string active_category_ = "appearance";
190 std::array<char, 128> settings_search_{};
191};
192
193} // namespace editor
194} // namespace yaze
195
196#endif // YAZE_APP_EDITOR_SHELL_WINDOWS_SETTINGS_PANEL_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:49
Represents a ZScream-compatible ASM patch file.
Definition asm_patch.h:74
Manages a collection of ZScream-compatible ASM patches.
Interface for editor classes.
Definition editor.h:249
project::YazeProject * project() const
Definition editor.h:358
Rom * rom() const
Definition editor.h:356
EditorType type_
Definition editor.h:369
Manages the settings UI displayed in the right sidebar.
void SetOpenMinecartTracksCallback(OpenMinecartTracksCallback callback)
void SetStatusBar(StatusBar *bar)
std::function< project::YazeProject *()> project_provider_
void DrawPatchList(const std::string &folder)
bool CanCut() const override
void SetWindowManager(WorkspaceWindowManager *registry)
std::array< char, 128 > settings_search_
absl::Status Paste() override
void DrawCategoryNavigation(const std::vector< CategoryDescriptor > &categories, bool compact)
bool CanPaste() const override
ShortcutManager * shortcut_manager_
void EnsureActiveCategory(const std::vector< CategoryDescriptor > &categories)
std::function< std::string()> rom_hash_provider_
void SetDependencies(const EditorDependencies &deps) override
bool CanUndo() const override
absl::Status Copy() override
void ApplyNamedLayoutToDockspace(const std::string &name)
bool MatchesShortcutFilter(const std::string &text) const
void DrawParameterWidget(core::PatchParameter *param)
absl::Status Redo() override
static DungeonOverlaySummary BuildDungeonOverlaySummary(const project::DungeonOverlaySettings &overlay)
absl::Status Undo() override
core::AsmPatch * selected_patch_
core::PatchManager patch_manager_
OpenMinecartTracksCallback open_minecart_tracks_callback_
project::YazeProject * project_
void SetShortcutManager(ShortcutManager *manager)
void SetProjectContextProvider(std::function< project::YazeProject *()> project_provider, std::function< std::string()> hash_provider)
void DrawCategoryContent(const std::string &category_id)
void SetUserSettings(UserSettings *settings)
std::array< std::pair< std::string, bool >, 5 > DungeonOverlaySummary
static std::vector< CategoryDescriptor > FilterCategories(Scope scope, const std::string &query)
absl::Status Find() override
bool CanRedo() const override
void SetProject(project::YazeProject *project)
bool CanCopy() const override
void ApplyDisplayDensity(gui::DensityPreset preset)
absl::Status RequestOpenMinecartTracks()
absl::Status Save() override
absl::Status Update() override
absl::Status Load() override
WorkspaceWindowManager * window_manager_
absl::Status Cut() override
std::function< absl::Status()> OpenMinecartTracksCallback
A session-aware status bar displayed at the bottom of the application.
Definition status_bar.h:57
Manages user preferences and settings persistence.
Central registry for all editor cards with session awareness and dependency injection.
DensityPreset
Typography and spacing density presets.
Represents a configurable parameter within an ASM patch.
Definition asm_patch.h:33
Unified dependency container for all editor types.
Definition editor.h:170
Dungeon overlay configuration (per-project).
Definition project.h:94
Modern project structure with comprehensive settings consolidation.
Definition project.h:287