yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
planning_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_PLANNING_PLANNING_EDITOR_H_
2#define YAZE_APP_EDITOR_PLANNING_PLANNING_EDITOR_H_
3
4#include <optional>
5#include <string>
6
7#include "absl/status/status.h"
8#include "app/editor/editor.h"
9#include "core/project_plan.h"
10
11namespace yaze::editor {
12
13// Project planning: goal, milestones, play route and open decisions, kept in
14// the yaze.plan/1 file named by the project's [planning] section. Works with
15// or without a ROM and never writes the ROM; Save() writes only the plan file.
16class PlanningEditor : public Editor {
17 public:
19
20 void Initialize() override;
21 absl::Status Load() override { return absl::OkStatus(); }
22 absl::Status Save() override;
23 absl::Status Update() override;
24
25 absl::Status Undo() override { return absl::OkStatus(); }
26 absl::Status Redo() override { return absl::OkStatus(); }
27 absl::Status Cut() override { return absl::OkStatus(); }
28 absl::Status Copy() override { return absl::OkStatus(); }
29 absl::Status Paste() override { return absl::OkStatus(); }
30 absl::Status Find() override { return absl::OkStatus(); }
31 bool CanUndo() const override { return false; }
32 bool CanRedo() const override { return false; }
33 bool CanCut() const override { return false; }
34 bool CanCopy() const override { return false; }
35 bool CanPaste() const override { return false; }
36
37 void DrawOverview();
38 void DrawRoute();
39
40 bool dirty() const { return dirty_; }
41 const std::optional<core::ProjectPlan>& plan() const { return plan_; }
42
43 private:
44 // Loads the plan when the project's [planning] path changes.
45 void SyncWithProject();
46 absl::Status Reload();
47 bool DrawPlanHeader();
48 void DrawNoPlan();
49 void DrawGoal();
50 void DrawMilestones();
51 void DrawRouteStrip();
52 void DrawDecisionQueue();
53 void DrawReferences();
54 void DrawStepList();
55 void DrawStepDetail();
56 void DrawItems();
57 void DrawTargets(const std::vector<std::string>& targets, const char* id);
58 void OpenTarget(const std::string& target);
59 void MarkDirty() { dirty_ = true; }
60
61 std::string plan_path_;
62 std::optional<core::ProjectPlan> plan_;
63 std::string load_error_;
64 std::string save_error_;
65 std::string new_plan_path_;
66 bool dirty_ = false;
67 bool panels_registered_ = false;
71};
72
73} // namespace yaze::editor
74
75#endif // YAZE_APP_EDITOR_PLANNING_PLANNING_EDITOR_H_
Interface for editor classes.
Definition editor.h:249
EditorType type_
Definition editor.h:369
absl::Status Redo() override
absl::Status Cut() override
bool CanUndo() const override
absl::Status Save() override
bool CanCopy() const override
absl::Status Undo() override
absl::Status Paste() override
absl::Status Load() override
bool CanCut() const override
const std::optional< core::ProjectPlan > & plan() const
bool CanRedo() const override
void DrawTargets(const std::vector< std::string > &targets, const char *id)
absl::Status Find() override
absl::Status Copy() override
bool CanPaste() const override
std::optional< core::ProjectPlan > plan_
absl::Status Update() override
void OpenTarget(const std::string &target)
Editors are the view controllers for the application.