give imgui code access to notes

This commit is contained in:
Green Sky
2025-09-02 11:12:48 +02:00
parent b6a68c830e
commit 66b5fdecfb
4 changed files with 10 additions and 3 deletions

View File

@@ -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<CRDTNotesImGui>(*crdtns, *cs);
g_crdtn_imgui = std::make_unique<CRDTNotesImGui>(*crdtn, *crdtns, *cs);
// register types
PLUG_PROVIDE_INSTANCE(CRDTNotesImGui, plugin_name, g_crdtn_imgui.get());

View File

@@ -62,6 +62,11 @@ namespace Events {
std::vector<CRDTNotes::Doc::Op> ops;
};
// TODO: curser
// - DocID
// - AgentID
// - CRDTNotes::Doc::ListType::ListID parent_left
} // Events
// this is different than other "i might not handle this" event interfaces

View File

@@ -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) {

View File

@@ -6,6 +6,7 @@
#include <set>
class CRDTNotesImGui {
CRDTNotes& _notes;
CRDTNotesSync& _notes_sync;
ContactStore4I& _cs;
@@ -14,7 +15,7 @@ class CRDTNotesImGui {
std::set<CRDTNotes::DocID> _open_docs;
public:
CRDTNotesImGui(CRDTNotesSync& notes_sync, ContactStore4I& cs);
CRDTNotesImGui(CRDTNotes& notes, CRDTNotesSync& notes_sync, ContactStore4I& cs);
float render(void);