TextEditor: Improve none color, fix data/state load
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
76e7de2399
commit
d37fc6dda9
4 changed files with 10 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -173,7 +173,8 @@ public:
|
|||
bool mCaseSensitive;
|
||||
|
||||
LanguageDefinition()
|
||||
: mPreprocChar('#')
|
||||
: mName("None")
|
||||
, mPreprocChar('#')
|
||||
, mAutoIndentation(true)
|
||||
, mColorize(nullptr)
|
||||
, mColorizeData(nullptr)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Syntax highlighting text editor (for ImGui in DPF)
|
||||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
|
||||
* 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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* DISTRHO Cardinal Plugin
|
||||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
|
||||
*
|
||||
* 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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue