Skip to content

Commit 2237ef3

Browse files
committed
FLTK: line numbers colours #93
1 parent 45a5dff commit 2237ef3

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2020-06-14 (0.12.19)
2+
FLTK: line numbers colours #93
3+
14
2020-06-06 (0.12.19)
25
COMMON: minor performance tweak
36

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function buildSDL() {
213213
esac
214214

215215
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} `sdl2-config --cflags` `pkg-config freetype2 --cflags` -fno-exceptions"
216-
CXXFLAGS="${CXXFLAGS} -fno-rtti -std=c++11"
216+
CXXFLAGS="${CXXFLAGS} -fno-rtti -std=c++14"
217217

218218
dnl preconfigured values for SDL build
219219
AC_DEFINE(_SDL, 1, [Defined when building SDL version])
@@ -345,7 +345,7 @@ function buildFLTK() {
345345
esac
346346

347347
FLTK_CXXFLAGS="${PACKAGE_CFLAGS} `fltk-config --cxxflags`"
348-
FLTK_CXXFLAGS="${FLTK_CXXFLAGS} -fno-exceptions -fno-rtti -std=c++11 -Wno-unknown-pragmas"
348+
FLTK_CXXFLAGS="${FLTK_CXXFLAGS} -fno-exceptions -fno-rtti -std=c++14 -Wno-unknown-pragmas"
349349
PACKAGE_LIBS="${PACKAGE_LIBS} `fltk-config --ldstaticflags --use-images`"
350350

351351
dnl do not depend on cygwin.dll under cygwin build

src/platform/fltk/EditorWidget.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ enum StyleField {
5656
st_numbers,
5757
st_operators,
5858
st_selection,
59-
st_background
59+
st_background,
60+
st_lineNumbers
6061
};
6162

6263
enum CommandOpt {

src/platform/fltk/MainWindow.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,8 @@ MainWindow::MainWindow(int w, int h) :
973973
m->add("&View/Text Color/_Subs", 0, EditorWidget::set_color_cb, (void *)st_subs);
974974
m->add("&View/Text Color/Numbers", 0, EditorWidget::set_color_cb, (void *)st_numbers);
975975
m->add("&View/Text Color/Operators", 0, EditorWidget::set_color_cb, (void *)st_operators);
976-
m->add("&View/Text Color/Find Matches", 0, EditorWidget::set_color_cb, (void *)st_findMatches);
976+
m->add("&View/Text Color/_Find Matches", 0, EditorWidget::set_color_cb, (void *)st_findMatches);
977+
m->add("&View/Text Color/Line Numbers", 0, EditorWidget::set_color_cb, (void *)st_lineNumbers);
977978
m->add("&View/Text Size/&Increase", FL_CTRL + ']', font_size_incr_cb);
978979
m->add("&View/Text Size/&Decrease", FL_CTRL + '[', font_size_decr_cb);
979980

src/platform/fltk/Profile.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const char *helpThemeIdKey = "helpThemeId";
2929
// in BasicEditor.cxx
3030
extern Fl_Text_Display::Style_Table_Entry styletable[];
3131

32+
static StyleField lastStyle = st_lineNumbers;
33+
3234
//
3335
// Profile constructor
3436
//
@@ -74,6 +76,7 @@ void Profile::loadEditTheme(int themeId) {
7476
styletable[9].color = get_color(_theme._syntax_command); // J - operators
7577
styletable[10].color = get_color(_theme._selection_background); // K Selection Background
7678
styletable[11].color = get_color(_theme._background); // L Background
79+
styletable[12].color = get_color(_theme._number_color); // M Line numbers
7780
}
7881

7982
//
@@ -186,6 +189,7 @@ void Profile::updateTheme() {
186189
_theme._syntax_command = styletable[9].color >> 8;
187190
_theme._selection_background = styletable[10].color >> 8;
188191
_theme._background = styletable[11].color >> 8;
192+
_theme._number_color = styletable[12].color >> 8;
189193
}
190194

191195
//
@@ -236,20 +240,18 @@ void Profile::restoreStyles(Properties<String *> *profile) {
236240
_font = get_font(fontName->c_str());
237241
}
238242

239-
for (int i = 0; i <= st_background; i++) {
243+
for (int i = 0; i <= lastStyle; i++) {
240244
char buffer[4];
241245
sprintf(buffer, "%02d", i);
242246
String *color = profile->get(buffer);
243247
if (color) {
244248
Fl_Color c = get_color(color->c_str(), NO_COLOR);
245249
if (c != (Fl_Color)NO_COLOR) {
246250
styletable[i].color = c;
247-
if (i == st_background) {
248-
_theme._background = c >> 8;
249-
}
250251
}
251252
}
252253
}
254+
updateTheme();
253255
}
254256

255257
//
@@ -347,7 +349,7 @@ void Profile::saveStyles(FILE *fp) {
347349
saveValue(fp, fontSizeKey, (int)styletable[0].size);
348350
saveValue(fp, fontNameKey, styletable[0].font);
349351

350-
for (int i = 0; i <= st_background; i++) {
352+
for (int i = 0; i <= lastStyle; i++) {
351353
Fl::get_color(styletable[i].color, r, g, b);
352354
fprintf(fp, "%02d=#%02x%02x%02x\n", i, r, g, b);
353355
}

0 commit comments

Comments
 (0)