|
|
|
|
@@ -77,6 +77,12 @@ String Intern(InternTable *table, String string) {
|
|
|
|
|
// optimize worst offenders (like event text)
|
|
|
|
|
InternTable GlobalInternTable;
|
|
|
|
|
|
|
|
|
|
bool SkipRemainingCommands;
|
|
|
|
|
Array<CommandData> CommandFunctions;
|
|
|
|
|
Array<LuaFunctionData> LuaFunctions;
|
|
|
|
|
Array<FunctionData> TestFunctions;
|
|
|
|
|
Array<Variable> Variables;
|
|
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
|
// CONFIG
|
|
|
|
|
Color GruvboxDark0Hard = {0x1d, 0x20, 0x21, 0xff};
|
|
|
|
|
@@ -116,109 +122,34 @@ Color GruvboxFadedBlue = {0x07, 0x66, 0x78, 0xff};
|
|
|
|
|
Color GruvboxFadedPurple = {0x8f, 0x3f, 0x71, 0xff};
|
|
|
|
|
Color GruvboxFadedAqua = {0x42, 0x7b, 0x58, 0xff};
|
|
|
|
|
Color GruvboxFadedOrange = {0xaf, 0x3a, 0x03, 0xff};
|
|
|
|
|
Color ColorText = GruvboxDark0Hard;
|
|
|
|
|
Color ColorLoadTextHighlight = {0x00, 0x00, 0x00, 0x0F};
|
|
|
|
|
Color ColorBackground = GruvboxLight0Hard;
|
|
|
|
|
Color ColorInactiveWindow = {0x00, 0x00, 0x00, 0x0F};
|
|
|
|
|
Color ColorTextLineNumbers = GruvboxDark4;
|
|
|
|
|
Color ColorLineHighlight = GruvboxLight0Soft;
|
|
|
|
|
Color ColorMainCaret = GruvboxDark0Hard;
|
|
|
|
|
Color ColorSubCaret = GruvboxGray245;
|
|
|
|
|
Color ColorSelection = GruvboxLight1;
|
|
|
|
|
Color ColorWhitespaceDuringSelection = GruvboxLight4;
|
|
|
|
|
Color ColorMouseUnderline = GruvboxDark0Hard;
|
|
|
|
|
Color ColorCaretUnderline = GruvboxGray245;
|
|
|
|
|
Color ColorFuzzySearchLineHighlight = GruvboxDark0;
|
|
|
|
|
Color ColorScrollbarBackground = GruvboxLight2;
|
|
|
|
|
Color ColorScrollbarScroller = GruvboxLight1;
|
|
|
|
|
Color ColorScrollbarScrollerSelected = GruvboxLight0Hard;
|
|
|
|
|
Color ColorTitleBarText = GruvboxDark2;
|
|
|
|
|
Color ColorTitleBarBackground = GruvboxLight1;
|
|
|
|
|
Color ColorTitleBarActiveBackground = {0xfe, 0xfe, 0xfe, 0xfe};
|
|
|
|
|
Color ColorTitleBarSelection = GruvboxLight3;
|
|
|
|
|
Color ColorResizerBackground = GruvboxLight0Hard;
|
|
|
|
|
Color ColorResizerOutline = GruvboxLight3;
|
|
|
|
|
Int StyleWaitForEvents = 1;
|
|
|
|
|
Int StyleDrawLineNumbers = 1;
|
|
|
|
|
Int StyleDrawScrollbar = 1;
|
|
|
|
|
Int StyleIndentSize = 4;
|
|
|
|
|
Int StyleFontSize = 15;
|
|
|
|
|
Int StyleFontFilter = 0;
|
|
|
|
|
String StyleFont = "/home/krz/text_editor/package/CascadiaMono.ttf";
|
|
|
|
|
String StyleVCVarsall = "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat";
|
|
|
|
|
double StyleUndoMergeTimeout = 0.3;
|
|
|
|
|
|
|
|
|
|
void ReloadStyle() {
|
|
|
|
|
ColorText = GetColor("Text", ColorText);
|
|
|
|
|
ColorLoadTextHighlight = GetColor("LoadTextHighlight", ColorLoadTextHighlight);
|
|
|
|
|
ColorBackground = GetColor("Background", ColorBackground);
|
|
|
|
|
ColorInactiveWindow = GetColor("InactiveWindow", ColorInactiveWindow);
|
|
|
|
|
ColorTextLineNumbers = GetColor("TextLineNumbers", ColorTextLineNumbers);
|
|
|
|
|
ColorLineHighlight = GetColor("LineHighlight", ColorLineHighlight);
|
|
|
|
|
ColorMainCaret = GetColor("MainCaret", ColorMainCaret);
|
|
|
|
|
ColorSubCaret = GetColor("SubCaret", ColorSubCaret);
|
|
|
|
|
ColorSelection = GetColor("Selection", ColorSelection);
|
|
|
|
|
ColorWhitespaceDuringSelection = GetColor("WhitespaceDuringSelection", ColorWhitespaceDuringSelection);
|
|
|
|
|
ColorMouseUnderline = GetColor("MouseUnderline", ColorMouseUnderline);
|
|
|
|
|
ColorCaretUnderline = GetColor("CaretUnderline", ColorCaretUnderline);
|
|
|
|
|
ColorFuzzySearchLineHighlight = GetColor("FuzzySearchLineHighlight", ColorFuzzySearchLineHighlight);
|
|
|
|
|
ColorScrollbarBackground = GetColor("ScrollbarBackground", ColorScrollbarBackground);
|
|
|
|
|
ColorScrollbarScroller = GetColor("ScrollbarScroller", ColorScrollbarScroller);
|
|
|
|
|
ColorScrollbarScrollerSelected = GetColor("ScrollbarScrollerSelected", ColorScrollbarScrollerSelected);
|
|
|
|
|
ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText);
|
|
|
|
|
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
|
|
|
|
ColorTitleBarActiveBackground = GetColor("TitleBarActiveBackground", ColorTitleBarActiveBackground);
|
|
|
|
|
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
|
|
|
|
ColorResizerBackground = GetColor("ResizerBackground", ColorResizerBackground);
|
|
|
|
|
ColorResizerOutline = GetColor("ResizerOutline", ColorResizerOutline);
|
|
|
|
|
StyleWaitForEvents = GetStyleInt("WaitForEvents", StyleWaitForEvents);
|
|
|
|
|
StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers);
|
|
|
|
|
StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar);
|
|
|
|
|
StyleIndentSize = GetStyleInt("IndentSize", StyleIndentSize);
|
|
|
|
|
StyleFontSize = GetStyleInt("FontSize", StyleFontSize);
|
|
|
|
|
StyleFontFilter = GetStyleInt("FontFilter", StyleFontFilter);
|
|
|
|
|
StyleFont = GetStyleString("Font", StyleFont);
|
|
|
|
|
StyleVCVarsall = GetStyleString("VCVarsall", StyleVCVarsall);
|
|
|
|
|
StyleUndoMergeTimeout = GetStyleFloat("UndoMergeTimeout", StyleUndoMergeTimeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef void Function();
|
|
|
|
|
typedef void PFunction(void *param);
|
|
|
|
|
typedef int LuaFunction(lua_State *state);
|
|
|
|
|
struct FunctionData { String name; Function *function; };
|
|
|
|
|
struct LuaFunctionData { String name; LuaFunction *function; };
|
|
|
|
|
struct CommandData { String name; String binding; Function *function; struct Trigger *trigger; };
|
|
|
|
|
struct PFunctionData { String name; PFunction *function; };
|
|
|
|
|
|
|
|
|
|
bool SkipRemainingCommands;
|
|
|
|
|
Array<CommandData> CommandFunctions;
|
|
|
|
|
Array<LuaFunctionData> LuaFunctions;
|
|
|
|
|
Array<FunctionData> TestFunctions;
|
|
|
|
|
|
|
|
|
|
struct Register_Function {
|
|
|
|
|
Register_Function(Array<FunctionData> *functions, String name, Function *f) {
|
|
|
|
|
int64_t pos = 0;
|
|
|
|
|
if (Seek(name, "_", &pos, 0)) {
|
|
|
|
|
name = Skip(name, pos + 1);
|
|
|
|
|
}
|
|
|
|
|
Add(functions, {name, f});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
#define RegisterFunction(functions, name) Register_Function RF__##name(functions, #name, name)
|
|
|
|
|
|
|
|
|
|
struct Register_Lua { Register_Lua(LuaFunction *function, String name) { if (StartsWith(name, "Lua_")) name = Skip(name, 4); Add(&LuaFunctions, {name, function}); } };
|
|
|
|
|
#define RegisterLua(NAME) Register_Lua RL_##NAME(NAME, #NAME)
|
|
|
|
|
|
|
|
|
|
struct Register_Command { Register_Command(Function *function, String name, String binding) { if (StartsWith(name, "Command_")) name = Skip(name, 8); Add(&CommandFunctions, {name, binding, function}); } };
|
|
|
|
|
#define RegisterCommand(name, binding) Register_Command RC__##name(name, #name, binding)
|
|
|
|
|
|
|
|
|
|
struct Register_Hook { Register_Hook(Array<PFunctionData> *functions, PFunction *function, String name) { if (StartsWith(name, "Hook_")) name = Skip(name, 5); Add(functions, {name, function}); } };
|
|
|
|
|
#define RegisterHook(functions, name) Register_Hook RC__##name(functions, (PFunction *)name, #name)
|
|
|
|
|
|
|
|
|
|
const int DIR_RIGHT = 0;
|
|
|
|
|
const int DIR_LEFT = 1;
|
|
|
|
|
const int DIR_DOWN = 2;
|
|
|
|
|
const int DIR_UP = 3;
|
|
|
|
|
const int DIR_COUNT = 4;
|
|
|
|
|
const bool CTRL_PRESSED = true;
|
|
|
|
|
const bool SHIFT_PRESS = true;
|
|
|
|
|
RegisterVariable(Color, ColorText, GruvboxDark0Hard);
|
|
|
|
|
RegisterVariable(Color, ColorLoadTextHighlight, {0x00, 0x00, 0x00, 0x0F});
|
|
|
|
|
RegisterVariable(Color, ColorBackground, GruvboxLight0Hard);
|
|
|
|
|
RegisterVariable(Color, ColorInactiveWindow, {0x00, 0x00, 0x00, 0x0F});
|
|
|
|
|
RegisterVariable(Color, ColorTextLineNumbers, GruvboxDark4);
|
|
|
|
|
RegisterVariable(Color, ColorLineHighlight, GruvboxLight0Soft);
|
|
|
|
|
RegisterVariable(Color, ColorMainCaret, GruvboxDark0Hard);
|
|
|
|
|
RegisterVariable(Color, ColorSubCaret, GruvboxGray245);
|
|
|
|
|
RegisterVariable(Color, ColorSelection, GruvboxLight1);
|
|
|
|
|
RegisterVariable(Color, ColorWhitespaceDuringSelection, GruvboxLight4);
|
|
|
|
|
RegisterVariable(Color, ColorMouseUnderline, GruvboxDark0Hard);
|
|
|
|
|
RegisterVariable(Color, ColorCaretUnderline, GruvboxGray245);
|
|
|
|
|
RegisterVariable(Color, ColorFuzzySearchLineHighlight, GruvboxDark0);
|
|
|
|
|
RegisterVariable(Color, ColorScrollbarBackground, GruvboxLight2);
|
|
|
|
|
RegisterVariable(Color, ColorScrollbarScroller, GruvboxLight1);
|
|
|
|
|
RegisterVariable(Color, ColorScrollbarScrollerSelected, GruvboxLight0Hard);
|
|
|
|
|
RegisterVariable(Color, ColorTitleBarText, GruvboxDark2);
|
|
|
|
|
RegisterVariable(Color, ColorTitleBarBackground, GruvboxLight1);
|
|
|
|
|
RegisterVariable(Color, ColorTitleBarActiveBackground, {0xfe, 0xfe, 0xfe, 0xfe});
|
|
|
|
|
RegisterVariable(Color, ColorTitleBarSelection, GruvboxLight3);
|
|
|
|
|
RegisterVariable(Color, ColorResizerBackground, GruvboxLight0Hard);
|
|
|
|
|
RegisterVariable(Color, ColorResizerOutline, GruvboxLight3);
|
|
|
|
|
RegisterVariable(Int, StyleWaitForEvents, 1);
|
|
|
|
|
RegisterVariable(Int, StyleDrawLineNumbers, 1);
|
|
|
|
|
RegisterVariable(Int, StyleDrawScrollbar, 1);
|
|
|
|
|
RegisterVariable(Int, StyleIndentSize, 4);
|
|
|
|
|
RegisterVariable(Int, StyleFontSize, 15);
|
|
|
|
|
RegisterVariable(Int, StyleFontFilter, 0);
|
|
|
|
|
RegisterVariable(String, StyleFont, "/home/krz/text_editor/package/CascadiaMono.ttf");
|
|
|
|
|
RegisterVariable(String, StyleVCVarsall, "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat");
|
|
|
|
|
RegisterVariable(Float, StyleUndoMergeTimeout, 0.3);
|
|
|
|
|
|