yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
command_palette_providers.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SYSTEM_COMMAND_PALETTE_PROVIDERS_H_
2#define YAZE_APP_EDITOR_SYSTEM_COMMAND_PALETTE_PROVIDERS_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
9
10namespace yaze {
11namespace editor {
12
13class WorkspaceWindowManager;
14class RecentProjectsModel;
15class UserSettings;
16class ShortcutManager;
17
28std::string LookupShortcutHint(const ShortcutManager* shortcut_manager,
29 const std::string& name);
30
36std::string PaletteNameForShortcut(const std::string& name);
37
49 public:
51 size_t session_id);
52 std::string ProviderId() const override { return "panels"; }
53 void Provide(CommandPalette* palette) override;
54
55 private:
58};
59
62 public:
64 std::function<void(const std::string&)> switch_callback);
65 std::string ProviderId() const override { return "editors"; }
66 void Provide(CommandPalette* palette) override;
67
68 private:
69 std::function<void(const std::string&)> switch_callback_;
70};
71
74 public:
76 std::function<void(const std::string&)> open_callback);
77 std::string ProviderId() const override { return "recent-files"; }
78 void Provide(CommandPalette* palette) override;
79
80 private:
81 std::function<void(const std::string&)> open_callback_;
82};
83
86 public:
87 explicit DungeonRoomCommandsProvider(size_t session_id);
88 std::string ProviderId() const override { return "dungeon-rooms"; }
89 void Provide(CommandPalette* palette) override;
90
91 private:
93};
94
97 public:
98 explicit OverworldMapCommandsProvider(size_t session_id);
99 std::string ProviderId() const override { return "overworld-maps"; }
100 void Provide(CommandPalette* palette) override;
101
102 private:
104};
105
112 public:
113 explicit ShortcutCommandsProvider(const ShortcutManager* shortcut_manager);
114 std::string ProviderId() const override { return "shortcuts"; }
115 void Provide(CommandPalette* palette) override;
116
117 private:
119};
120
123 public:
124 DrawerCommandsProvider(std::function<void(int drawer_type)> toggle_callback,
125 std::function<void()> cycle_next = {},
126 std::function<void()> cycle_prev = {});
127 std::string ProviderId() const override { return "drawers"; }
128 void Provide(CommandPalette* palette) override;
129
130 private:
131 std::function<void(int)> toggle_callback_;
132 std::function<void()> cycle_next_;
133 std::function<void()> cycle_prev_;
134};
135
138 public:
139 explicit LayoutCommandsProvider(
140 std::function<void(const std::string&)> apply_callback);
141 std::string ProviderId() const override { return "layouts"; }
142 void Provide(CommandPalette* palette) override;
143
144 private:
145 std::function<void(const std::string&)> apply_callback_;
146};
147
150 public:
152 size_t session_id);
153 std::string ProviderId() const override { return "workflow"; }
154 void Provide(CommandPalette* palette) override;
155
156 private:
159};
160
166 public:
168 UserSettings* user_settings, size_t session_id);
169 std::string ProviderId() const override { return "sidebar"; }
170 void Provide(CommandPalette* palette) override;
171
172 private:
176};
177
182 public:
183 struct Callbacks {
184 const RecentProjectsModel* model = nullptr;
185 std::vector<std::string> template_names;
186 std::function<void(const std::string&)> remove;
187 std::function<void(const std::string&)> toggle_pin;
188 std::function<void()> undo_remove;
189 std::function<void()> clear_recents;
190 std::function<void(const std::string&)> create_from_template;
191 std::function<void()> dismiss_welcome;
192 std::function<void()> show_welcome;
193 };
194 explicit WelcomeCommandsProvider(Callbacks callbacks);
195 std::string ProviderId() const override { return "welcome"; }
196 void Provide(CommandPalette* palette) override;
197
198 private:
200};
201
202} // namespace editor
203} // namespace yaze
204
205#endif // YAZE_APP_EDITOR_SYSTEM_COMMAND_PALETTE_PROVIDERS_H_
Plug-in command source for the palette.
ID: "drawers". Right-drawer toggles with "drawer: " prefix for discovery.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
DrawerCommandsProvider(std::function< void(int drawer_type)> toggle_callback, std::function< void()> cycle_next={}, std::function< void()> cycle_prev={})
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "dungeon-rooms". One-shot; only depends on the session id.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
ID: "editors". Rebuilds on editor-registry changes (rare).
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
EditorCommandsProvider(std::function< void(const std::string &)> switch_callback)
std::function< void(const std::string &) switch_callback_)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "layouts". layout: / Apply Layout / profile commands.
LayoutCommandsProvider(std::function< void(const std::string &)> apply_callback)
std::function< void(const std::string &) apply_callback_)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
ID: "overworld-maps". One command per map 0x00-0x9F (JumpToMapRequest).
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
ID: "panels". Rebuilds when the set of open windows/panels changes.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
PanelCommandsProvider(WorkspaceWindowManager *window_manager, size_t session_id)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "recent-files". Refresh after RecentFilesManager mutates.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
std::function< void(const std::string &) open_callback_)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
RecentFilesCommandsProvider(std::function< void(const std::string &)> open_callback)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ShortcutCommandsProvider(const ShortcutManager *shortcut_manager)
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
SidebarCommandsProvider(WorkspaceWindowManager *window_manager, UserSettings *user_settings, size_t session_id)
Manages user preferences and settings persistence.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "workflow". Refresh when workflow actions change.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
WorkflowCommandsProvider(WorkspaceWindowManager *window_manager, size_t session_id)
Central registry for all editor cards with session awareness and dependency injection.
std::string PaletteNameForShortcut(const std::string &name)
std::string LookupShortcutHint(const ShortcutManager *shortcut_manager, const std::string &name)
std::function< void(const std::string &) toggle_pin)
std::function< void(const std::string &) remove)
std::function< void(const std::string &) create_from_template)