1#ifndef YAZE_APP_EDITOR_ORACLE_PANELS_ANNOTATION_OVERLAY_PANEL_H
2#define YAZE_APP_EDITOR_ORACLE_PANELS_ANNOTATION_OVERLAY_PANEL_H
15#include "imgui/imgui.h"
16#include "nlohmann/json.hpp"
55 std::string
GetId()
const override {
return "oracle.annotations"; }
68 void Draw(
bool* )
override {
72 if (!project->code_folder.empty()) {
73 namespace fs = std::filesystem;
75 fs::path(project->GetAbsolutePath(project->code_folder)) /
76 "Docs" /
"Dev" /
"Planning" /
"annotations.json";
83 ImGui::Text(
"Room filter:");
90 const char* priorities[] = {
"All",
"Note",
"Bug",
"Blocker"};
96 ImGui::BeginChild(
"annotation_list", ImVec2(0, -120),
97 ImGuiChildFlags_Borders);
109 ImVec2 cursor = ImGui::GetCursorScreenPos();
110 ImGui::GetWindowDrawList()->AddCircleFilled(
111 ImVec2(cursor.x + 6, cursor.y + 10), 5.0f, dot_color);
112 ImGui::Dummy(ImVec2(16, 0));
116 snprintf(label,
sizeof(label),
"Room 0x%02X: %s##ann_%zu", ann.room_id,
117 ann.text.c_str(), i);
119 if (ImGui::Selectable(label,
selected_index_ ==
static_cast<int>(i))) {
126 ann.category.c_str());
135 ImGui::Text(
"Room:");
137 ImGui::SetNextItemWidth(80);
141 ImGui::Text(
"Priority:");
143 ImGui::SetNextItemWidth(80);
144 const char* pri_names[] = {
"Note",
"Bug",
"Blocker"};
150 if (ImGui::Button(
"Add")) {
163 if (ImGui::Button(
"Update")) {
172 if (ImGui::Button(
"Delete")) {
187 std::vector<const AnnotationEntry*> result;
189 if (ann.room_id == room_id) {
190 result.push_back(&ann);
203 if (ann.room_id == room_id) {
204 max_pri = std::max(max_pri,
static_cast<int>(ann.priority));
213 return IM_COL32(220, 50, 50, 255);
215 return IM_COL32(220, 150, 30, 255);
218 return IM_COL32(60, 120, 220, 255);
228 if (!file.is_open())
return;
234 if (root.contains(
"annotations") && root[
"annotations"].is_array()) {
235 for (
const auto& item : root[
"annotations"]) {
237 entry.
room_id = item.value(
"room_id", 0);
238 entry.
text = item.value(
"text",
"");
241 entry.
category = item.value(
"category",
"");
242 entry.
created_at = item.value(
"created_at",
"");
255 nlohmann::json arr = nlohmann::json::array();
259 item[
"room_id"] = ann.room_id;
260 item[
"text"] = ann.text;
261 item[
"priority"] =
static_cast<int>(ann.priority);
262 item[
"category"] = ann.category;
263 item[
"created_at"] = ann.created_at;
267 root[
"annotations"] = arr;
270 if (file.is_open()) {
271 file << root.dump(2) << std::endl;
Room-level annotation management for Oracle projects.
void SetAnnotationsPath(const std::string &path)
void Draw(bool *) override
Draw the panel content.
std::vector< AnnotationEntry > annotations_
std::vector< const AnnotationEntry * > GetAnnotationsForRoom(int room_id) const
Get annotations for a specific room.
int GetMaxPriorityForRoom(int room_id) const
Get the highest priority for a room (for dot color). Returns -1 if no annotations.
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::string annotations_path_
static ImU32 GetPriorityColor(AnnotationPriority priority)
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
std::string GetId() const override
Unique identifier for this panel.
PanelCategory GetPanelCategory() const override
Get the lifecycle category for this panel.
std::string GetIcon() const override
Material Design icon for this panel.
Base interface for all logical panel components.
::yaze::project::YazeProject * current_project()
Get the current project instance.
Editors are the view controllers for the application.
AnnotationPriority
Annotation priority levels.
PanelCategory
Defines lifecycle behavior for editor panels.
@ CrossEditor
User can pin to persist across editors.
A room-level annotation entry.
AnnotationPriority priority