yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dashboard_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SHELL_WINDOWS_DASHBOARD_PANEL_H_
2#define YAZE_APP_EDITOR_SHELL_WINDOWS_DASHBOARD_PANEL_H_
3
4#include <functional>
5#include <optional>
6#include <string>
7#include <vector>
8
9#include "app/editor/editor.h"
11#include "imgui/imgui.h"
12
13namespace yaze {
14namespace editor {
15
16class IEditorSwitcher;
17
19 public:
20 explicit DashboardPanel(IEditorSwitcher* editor_switcher);
21 ~DashboardPanel() = default;
22
23 void Draw();
24
25 void Show() { show_ = true; }
26 void Hide() { show_ = false; }
27 bool IsVisible() const { return show_; }
28 bool* visibility_flag() { return &show_; }
29
31 std::optional<EditorType> MostRecentEditor() const {
32 if (recent_editors_.empty()) {
33 return std::nullopt;
34 }
35 return recent_editors_.front();
36 }
37 // Parses the recent-editors file body. Pure and static so the validation
38 // rules are testable without touching the user's real config directory,
39 // which LoadFileFromConfigDir/SaveFile resolve through PlatformPaths.
40 static std::vector<EditorType> ParseRecentEditors(const std::string& data,
41 size_t max_entries);
42 void LoadRecentEditors();
43 void SaveRecentEditors();
44 void ClearRecentEditors();
45
46 private:
47 struct EditorInfo {
48 std::string name;
49 std::string icon;
50 std::string description;
51 std::string shortcut;
53 bool recently_used = false;
54 bool requires_rom = true;
55 };
56
57 void DrawWelcomeHeader();
58 void DrawRecentEditors();
59 void DrawEditorGrid();
60 void DrawEditorPanel(const EditorInfo& info, int index,
61 const ImVec2& card_size, bool enabled);
62
65 bool show_ = true;
66 bool has_rom_ = false;
67
68 std::vector<EditorInfo> editors_;
69 std::vector<EditorType> recent_editors_;
70 static constexpr size_t kMaxRecentEditors = 5;
71};
72
73} // namespace editor
74} // namespace yaze
75
76#endif // YAZE_APP_EDITOR_SHELL_WINDOWS_DASHBOARD_PANEL_H_
std::vector< EditorInfo > editors_
static std::vector< EditorType > ParseRecentEditors(const std::string &data, size_t max_entries)
static constexpr size_t kMaxRecentEditors
std::optional< EditorType > MostRecentEditor() const
std::vector< EditorType > recent_editors_
void MarkRecentlyUsed(EditorType type)
void DrawEditorPanel(const EditorInfo &info, int index, const ImVec2 &card_size, bool enabled)
DashboardPanel(IEditorSwitcher *editor_switcher)
IEditorSwitcher * editor_switcher_
Interface for editor selection and navigation.
Draggable, dockable panel for editor sub-windows.