From cec029dbee435e7f608b9f6a4a3d8e98f2c5a398 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Wed, 16 Sep 2020 09:33:24 -0700 Subject: Rewrite CodeEditor syntax highlighting for issue #135 --- fluid/CodeEditor.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'fluid/CodeEditor.h') diff --git a/fluid/CodeEditor.h b/fluid/CodeEditor.h index e865ac63e..617f61413 100644 --- a/fluid/CodeEditor.h +++ b/fluid/CodeEditor.h @@ -15,29 +15,30 @@ // #ifndef CodeEditor_h -# define CodeEditor_h +#define CodeEditor_h // // Include necessary headers... // -# include -# include -# include -# include -# include -# include -# include - +#include +#include +#include +#include +#include +#include +#include +#include "StyleParse.h" class CodeEditor : public Fl_Text_Editor { static Fl_Text_Display::Style_Table_Entry styletable[]; static const char * const code_keywords[]; static const char * const code_types[]; - + static void* search_types(char *find); + static void* search_keywords(char *find); // 'style_parse()' - Parse text and produce style data. - static void style_parse(const char *text, char *style, int length); + static void style_parse(const char *tbuff, char *sbuff, int len, char style); // 'style_unfinished_cb()' - Update unfinished styles. static void style_unfinished_cb(int, void*); @@ -58,6 +59,7 @@ class CodeEditor : public Fl_Text_Editor { // attempt to make the fluid code editor widget honour textsize setting void textsize(Fl_Fontsize s); + friend class StyleParse; }; class CodeViewer : public CodeEditor { -- cgit v1.2.3 From 890533a863718ba10925a807b90e621d7a8cf24a Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Thu, 17 Sep 2020 23:57:14 -0700 Subject: Code cleanup: moved keyword/type arrays to StyleParse Needed to do this to prevent lower StyleParse class from #including upper CodeEditor. --- fluid/CodeEditor.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'fluid/CodeEditor.h') diff --git a/fluid/CodeEditor.h b/fluid/CodeEditor.h index 617f61413..7b7955991 100644 --- a/fluid/CodeEditor.h +++ b/fluid/CodeEditor.h @@ -32,10 +32,6 @@ class CodeEditor : public Fl_Text_Editor { static Fl_Text_Display::Style_Table_Entry styletable[]; - static const char * const code_keywords[]; - static const char * const code_types[]; - static void* search_types(char *find); - static void* search_keywords(char *find); // 'style_parse()' - Parse text and produce style data. static void style_parse(const char *tbuff, char *sbuff, int len, char style); -- cgit v1.2.3 From 4d503899a3dec9df8380b3981f1a7259e9d6cb8c Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Sat, 19 Sep 2020 10:43:27 -0700 Subject: Mods for Albrecht's 09/19/20 code review --- fluid/CodeEditor.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fluid/CodeEditor.h') diff --git a/fluid/CodeEditor.h b/fluid/CodeEditor.h index 7b7955991..bf4b7b499 100644 --- a/fluid/CodeEditor.h +++ b/fluid/CodeEditor.h @@ -1,7 +1,7 @@ // // Code editor widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -31,6 +31,8 @@ #include "StyleParse.h" class CodeEditor : public Fl_Text_Editor { + friend class StyleParse; + static Fl_Text_Display::Style_Table_Entry styletable[]; // 'style_parse()' - Parse text and produce style data. @@ -54,8 +56,6 @@ class CodeEditor : public Fl_Text_Editor { // attempt to make the fluid code editor widget honour textsize setting void textsize(Fl_Fontsize s); - - friend class StyleParse; }; class CodeViewer : public CodeEditor { -- cgit v1.2.3