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 {
18
19 public:
21
22 void Initialize() override;
23 absl::Status Load() override { return absl::OkStatus(); }
24 absl::Status Save() override;
25 absl::Status Update() override;
26
27 absl::Status Undo() override { return absl::OkStatus(); }
28 absl::Status Redo() override { return absl::OkStatus(); }
29 absl::Status Cut() override { return absl::OkStatus(); }
30 absl::Status Copy() override { return absl::OkStatus(); }
31 absl::Status Paste() override { return absl::OkStatus(); }
32 absl::Status Find() override { return absl::OkStatus(); }
33 bool CanUndo() const override { return false; }
34 bool CanRedo() const override { return false; }
35 bool CanCut() const override { return false; }
36 bool CanCopy() const override { return false; }
37 bool CanPaste() const override { return false; }
38
39 void DrawOverview();
40 void DrawRoute();
41
42 bool dirty() const { return dirty_; }
43 bool HasPendingProjectDraftChanges() const { return dirty_; }
44 // Called only after an authorized project replacement succeeds, or an
45 // explicit discard. A failed or canceled open must preserve the draft.
47 const std::optional<core::ProjectPlan>& plan() const { return plan_; }
48
49 private:
50 // Loads the plan when the project's [planning] path changes.
51 absl::Status SyncWithProject();
52 absl::Status Reload(bool discard_changes = false);
53 bool DrawPlanHeader();
54 void DrawNoPlan();
55 void DrawGoal();
56 void DrawMilestones();
57 void DrawRouteStrip();
58 void DrawDecisionQueue();
59 void DrawReferences();
60 void DrawAgentStatus();
61 // Read-only agent observation for "<kind>:<id>", drawn under the user's
62 // editable fields for that entry.
63 void DrawAgentObservation(const std::string& key);
64 void DrawStepList();
65 void DrawStepDetail();
66 void DrawItems();
67 void DrawTargets(const std::vector<std::string>& targets, const char* id);
68 void OpenTarget(const std::string& target);
69 void MarkDirty() { dirty_ = true; }
70
71 std::string plan_path_;
72 std::string project_path_;
73 std::string loaded_source_;
74 std::optional<core::ProjectPlan> plan_;
75 std::string load_error_;
76 std::string save_error_;
77 std::string new_plan_path_;
78 bool dirty_ = false;
79 bool panels_registered_ = false;
83};
84
85} // namespace yaze::editor
86
87#endif // YAZE_APP_EDITOR_PLANNING_PLANNING_EDITOR_H_
Interface for editor classes.
Definition editor.h:252
EditorType type_
Definition editor.h:381
absl::Status Redo() override
absl::Status Cut() override
bool CanUndo() const override
absl::Status Reload(bool discard_changes=false)
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 DrawAgentObservation(const std::string &key)
void DrawTargets(const std::vector< std::string > &targets, const char *id)
bool HasPendingProjectDraftChanges() const
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.