diff --git a/plugins/Cardinal/src/ImGuiTextEditor.cpp b/plugins/Cardinal/src/ImGuiTextEditor.cpp index 58479a8..31f893a 100644 --- a/plugins/Cardinal/src/ImGuiTextEditor.cpp +++ b/plugins/Cardinal/src/ImGuiTextEditor.cpp @@ -145,11 +145,10 @@ void ImGuiTextEditor::drawImGui() const TextEditor::Coordinates cpos = editor.GetCursorPosition(); - ImGui::Text("%6d/%-6d %6d lines | %s | %s | %s | %s", + ImGui::Text("%6d/%-6d %6d lines | %s | %s | %s", cpos.mLine + 1, cpos.mColumn + 1, editor.GetTotalLines(), editor.IsOverwrite() ? "Ovr" : "Ins", - editor.CanUndo() ? "*" : " ", editor.GetLanguageDefinition().mName.c_str(), pData->file.c_str()); @@ -158,3 +157,26 @@ void ImGuiTextEditor::drawImGui() ImGui::End(); } + +/* +void ImGuiTextEditor::onSelectKey(const SelectKeyEvent& e) +{ + ImGuiWidget::onSelectKey(e); + + if (e.action == GLFW_PRESS && (e.mods & GLFW_MOD_CONTROL) != 0) + { + switch (e.key) + { + case GLFW_KEY_X: + pData->editor.Cut(); + break; + case GLFW_KEY_C: + pData->editor.Copy(); + break; + case GLFW_KEY_V: + pData->editor.Paste(); + break; + } + } +} +*/ diff --git a/plugins/Cardinal/src/ImGuiTextEditor.hpp b/plugins/Cardinal/src/ImGuiTextEditor.hpp index 08b45e2..2ccae17 100644 --- a/plugins/Cardinal/src/ImGuiTextEditor.hpp +++ b/plugins/Cardinal/src/ImGuiTextEditor.hpp @@ -59,4 +59,7 @@ struct ImGuiTextEditor : ImGuiWidget protected: /** @internal */ void drawImGui() override; + /* + void onSelectKey(const SelectKeyEvent& e) override; + */ }; diff --git a/plugins/Cardinal/src/TextEditor.cpp b/plugins/Cardinal/src/TextEditor.cpp index 600b42a..b99eebd 100644 --- a/plugins/Cardinal/src/TextEditor.cpp +++ b/plugins/Cardinal/src/TextEditor.cpp @@ -50,13 +50,29 @@ struct TextEditorModule : Module { json_t* rootJ = json_object(); json_object_set_new(rootJ, "filepath", json_string(file.c_str())); json_object_set_new(rootJ, "lang", json_string(lang.c_str())); - json_object_set_new(rootJ, "text", json_string(text.c_str())); + json_object_set_new(rootJ, "etext", json_string(text.c_str())); json_object_set_new(rootJ, "width", json_integer(width)); return rootJ; } void dataFromJson(json_t* const rootJ) override { + // Rack Core Notes compatiblity + if (json_t* const textJ = json_object_get(rootJ, "text")) + { + text = json_string_value(textJ); + file = ""; + lang = "None"; + width = 16; +#ifndef HEADLESS + if (ImGuiTextEditor* const widget = widgetPtr) + { + widget->setLanguageDefinition(lang); + widget->setText(text); + } +#endif + } + if (json_t* const widthJ = json_object_get(rootJ, "width")) width = json_integer_value(widthJ); @@ -90,7 +106,7 @@ struct TextEditorModule : Module { } } - if (json_t* const textJ = json_object_get(rootJ, "text")) + if (json_t* const textJ = json_object_get(rootJ, "etext")) { text = json_string_value(textJ); #ifndef HEADLESS diff --git a/plugins/Core.json b/plugins/Core.json index e3a4c94..bfb2651 100644 --- a/plugins/Core.json +++ b/plugins/Core.json @@ -71,16 +71,6 @@ "Blank" ], "hidden": true - }, - { - "slug": "Notes", - "name": "Notes", - "description": "Write text for patch notes or artist attribution", - "manualUrl": "https://vcvrack.com/manual/Core#Notes", - "tags": [ - "Blank" - ], - "hidden": true } ] } diff --git a/plugins/plugins.cpp b/plugins/plugins.cpp index 85baf93..dafce3f 100644 --- a/plugins/plugins.cpp +++ b/plugins/plugins.cpp @@ -607,7 +607,6 @@ extern Model* modelMIDIMap; extern Model* modelCV_MIDICC; extern Model* modelGate_MIDI; extern Model* modelBlank; -extern Model* modelNotes; } // regular plugins @@ -705,7 +704,6 @@ static void initStatic__Core() p->addModel(rack::core::modelCV_MIDICC); p->addModel(rack::core::modelGate_MIDI); p->addModel(rack::core::modelBlank); - p->addModel(rack::core::modelNotes); } } diff --git a/src/Makefile b/src/Makefile index 5934c60..9506336 100644 --- a/src/Makefile +++ b/src/Makefile @@ -130,6 +130,7 @@ IGNORED_FILES += Rack/src/app/TipWindow.cpp IGNORED_FILES += Rack/src/core/Audio.cpp IGNORED_FILES += Rack/src/core/CV_MIDI.cpp IGNORED_FILES += Rack/src/core/MIDI_CV.cpp +IGNORED_FILES += Rack/src/core/Notes.cpp IGNORED_FILES += Rack/src/engine/Engine.cpp IGNORED_FILES += Rack/src/plugin/Model.cpp IGNORED_FILES += Rack/src/window/Window.cpp diff --git a/src/override/plugin.cpp b/src/override/plugin.cpp index 1173b91..012a1d4 100644 --- a/src/override/plugin.cpp +++ b/src/override/plugin.cpp @@ -89,6 +89,7 @@ static const std::map moduleSlugFallbacks = {{"Core", "AudioInterface16"}, {"Cardinal", "HostAudio8"}}, {{"Core", "MIDIToCVInterface"}, {"Cardinal", "HostMIDI"}}, {{"Core", "CV-MIDI"}, {"Cardinal", "HostMIDI"}}, + {{"Core", "Notes"}, {"Cardinal", "TextEditor"}}, {{"MindMeld-ShapeMasterPro", "ShapeMasterPro"}, {"MindMeldModular", "ShapeMaster"}}, {{"MindMeldModular", "ShapeMaster"}, {"MindMeld-ShapeMasterPro", "ShapeMasterPro"}}, // {{"", ""}, {"", ""}},