From 66b5fdecfb2e4d57b9d99611ba6373ceeae2364a Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 2 Sep 2025 11:12:48 +0200 Subject: [PATCH] give imgui code access to notes --- plugins/plugin_crdtnotes_imgui.cpp | 3 ++- src/solanaceae/crdtnotes/crdtnotes_sync.hpp | 5 +++++ src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.cpp | 2 +- src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.hpp | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/plugin_crdtnotes_imgui.cpp b/plugins/plugin_crdtnotes_imgui.cpp index 6ace04e..76dd5b8 100644 --- a/plugins/plugin_crdtnotes_imgui.cpp +++ b/plugins/plugin_crdtnotes_imgui.cpp @@ -35,6 +35,7 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api) } try { + auto* crdtn = PLUG_RESOLVE_INSTANCE(CRDTNotes); auto* crdtns = PLUG_RESOLVE_INSTANCE(CRDTNotesSync); auto* cs = PLUG_RESOLVE_INSTANCE(ContactStore4I); auto* imguic = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiContext, ImGui::GetVersion()); @@ -48,7 +49,7 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api) // static store, could be anywhere tho // construct with fetched dependencies - g_crdtn_imgui = std::make_unique(*crdtns, *cs); + g_crdtn_imgui = std::make_unique(*crdtn, *crdtns, *cs); // register types PLUG_PROVIDE_INSTANCE(CRDTNotesImGui, plugin_name, g_crdtn_imgui.get()); diff --git a/src/solanaceae/crdtnotes/crdtnotes_sync.hpp b/src/solanaceae/crdtnotes/crdtnotes_sync.hpp index e9ad822..168388e 100644 --- a/src/solanaceae/crdtnotes/crdtnotes_sync.hpp +++ b/src/solanaceae/crdtnotes/crdtnotes_sync.hpp @@ -62,6 +62,11 @@ namespace Events { std::vector ops; }; + // TODO: curser + // - DocID + // - AgentID + // - CRDTNotes::Doc::ListType::ListID parent_left + } // Events // this is different than other "i might not handle this" event interfaces diff --git a/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.cpp b/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.cpp index 5e727bc..aea12c6 100644 --- a/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.cpp +++ b/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.cpp @@ -48,7 +48,7 @@ namespace detail { } // detail -CRDTNotesImGui::CRDTNotesImGui(CRDTNotesSync& notes_sync, ContactStore4I& cs) : _notes_sync(notes_sync), _cs(cs) { +CRDTNotesImGui::CRDTNotesImGui(CRDTNotes& notes, CRDTNotesSync& notes_sync, ContactStore4I& cs) : _notes(notes), _notes_sync(notes_sync), _cs(cs) { } float CRDTNotesImGui::render(void) { diff --git a/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.hpp b/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.hpp index 9b6c4be..b0fb52a 100644 --- a/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.hpp +++ b/src/solanaceae/crdtnotes_imgui/crdtnotes_imgui.hpp @@ -6,6 +6,7 @@ #include class CRDTNotesImGui { + CRDTNotes& _notes; CRDTNotesSync& _notes_sync; ContactStore4I& _cs; @@ -14,7 +15,7 @@ class CRDTNotesImGui { std::set _open_docs; public: - CRDTNotesImGui(CRDTNotesSync& notes_sync, ContactStore4I& cs); + CRDTNotesImGui(CRDTNotes& notes, CRDTNotesSync& notes_sync, ContactStore4I& cs); float render(void);