diff --git a/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.cpp b/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.cpp index 0d8d8bd..4f17d25 100644 --- a/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.cpp +++ b/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.cpp @@ -2010,7 +2010,7 @@ void TextEditor::Redo(int aSteps) const TextEditor::Palette & TextEditor::GetDarkPalette() { const static Palette p = { { - 0xff7f7f7f, // Default + 0xffe0e0e0, // Default 0xffd69c56, // Keyword 0xff00ff00, // Number 0xff7070e0, // String diff --git a/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.h b/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.h index c629407..a5d72e5 100644 --- a/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.h +++ b/plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.h @@ -173,7 +173,8 @@ public: bool mCaseSensitive; LanguageDefinition() - : mPreprocChar('#') + : mName("None") + , mPreprocChar('#') , mAutoIndentation(true) , mColorize(nullptr) , mColorizeData(nullptr) diff --git a/plugins/Cardinal/src/ImGuiTextEditor.cpp b/plugins/Cardinal/src/ImGuiTextEditor.cpp index c709b74..58479a8 100644 --- a/plugins/Cardinal/src/ImGuiTextEditor.cpp +++ b/plugins/Cardinal/src/ImGuiTextEditor.cpp @@ -1,6 +1,6 @@ /* * Syntax highlighting text editor (for ImGui in DPF) - * Copyright (C) 2021 Filipe Coelho + * Copyright (C) 2021-2022 Filipe Coelho * Copyright (c) 2017 BalazsJako * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -75,6 +75,8 @@ std::string ImGuiTextEditor::getFile() const void ImGuiTextEditor::setLanguageDefinition(const std::string& lang) { + pData->editor.SetColorizerEnable(true); + if (lang == "AngelScript") return pData->editor.SetLanguageDefinition(TextEditor::LanguageDefinition::AngelScript()); if (lang == "C") @@ -90,6 +92,7 @@ void ImGuiTextEditor::setLanguageDefinition(const std::string& lang) if (lang == "SQL") return pData->editor.SetLanguageDefinition(TextEditor::LanguageDefinition::SQL()); + pData->editor.SetColorizerEnable(false); pData->editor.SetLanguageDefinition(TextEditor::LanguageDefinition()); } diff --git a/plugins/Cardinal/src/TextEditor.cpp b/plugins/Cardinal/src/TextEditor.cpp index 417918b..600b42a 100644 --- a/plugins/Cardinal/src/TextEditor.cpp +++ b/plugins/Cardinal/src/TextEditor.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021 Filipe Coelho + * Copyright (C) 2021-2022 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -134,7 +134,7 @@ struct TextEditorLangSelectItem : MenuItem { rightText = CHECKMARK_STRING; } - void onAction(const event::Action &e) override + void onAction(const event::Action&) override { module->lang = text; widget->setLanguageDefinition(text); @@ -311,6 +311,7 @@ struct TextEditorModuleWidget : ModuleWidget { textEditorWidget->box.pos = Vec(RACK_GRID_WIDTH, 0); textEditorWidget->box.size = Vec((module->width - 2) * RACK_GRID_WIDTH, box.size.y); addChild(textEditorWidget); + module->widgetPtr = textEditorWidget; } else {