From 6f4c59079f97289eafc29840e3873ce08c869e71 Mon Sep 17 00:00:00 2001 From: Ian MacArthur Date: Fri, 13 Apr 2012 14:45:18 +0000 Subject: This change to fluid's CodeEditor ought to make it honour textsize changes that are applied at text buffer creation. How effective this will be for etxtsize changes that occur later is another question, but this corrects a problem identified in the thread "Re: [fltk.general] FLUID fonts earlier git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9341 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/CodeEditor.cxx | 10 ++++++++++ fluid/CodeEditor.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fluid/CodeEditor.cxx b/fluid/CodeEditor.cxx index 864f5045f..bad97057c 100644 --- a/fluid/CodeEditor.cxx +++ b/fluid/CodeEditor.cxx @@ -114,6 +114,16 @@ const char * const CodeEditor:: "volatile" }; +// attempt to make the fluid code editor widget honour textsize setting +void CodeEditor::textsize(Fl_Fontsize s) { + Fl_Text_Editor::textsize(s); // call base class method + // now attempt to update our styletable to honour the new size... + int entries = sizeof(styletable) / sizeof(styletable[0]); + for(int iter = 0; iter < entries; iter++) { + styletable[iter].size = s; + } +} // textsize + // 'compare_keywords()' - Compare two keywords... int CodeEditor::compare_keywords(const void *a, const void *b) { diff --git a/fluid/CodeEditor.h b/fluid/CodeEditor.h index 1c7c037db..ce7120ef1 100644 --- a/fluid/CodeEditor.h +++ b/fluid/CodeEditor.h @@ -59,6 +59,10 @@ class CodeEditor : public Fl_Text_Editor { CodeEditor(int X, int Y, int W, int H, const char *L=0); ~CodeEditor(); int top_line() { return get_absolute_top_line_number(); } + + // attempt to make the fluid code editor widget honour textsize setting + void textsize(Fl_Fontsize s); + }; class CodeViewer : public CodeEditor { @@ -66,7 +70,7 @@ class CodeViewer : public CodeEditor { public: CodeViewer(int X, int Y, int W, int H, const char *L=0); - + protected: int handle(int ev) { return Fl_Text_Display::handle(ev); } -- cgit v1.2.3