Author: ianmacarthur
Date: 2012-04-13 07:45:18 -0700 (Fri, 13 Apr 2012)
New Revision: 9341
Log:
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



Modified:
   branches/branch-1.3/fluid/CodeEditor.cxx
   branches/branch-1.3/fluid/CodeEditor.h

Modified: branches/branch-1.3/fluid/CodeEditor.cxx
===================================================================
--- branches/branch-1.3/fluid/CodeEditor.cxx    2012-04-13 02:51:15 UTC (rev 
9340)
+++ branches/branch-1.3/fluid/CodeEditor.cxx    2012-04-13 14:45:18 UTC (rev 
9341)
@@ -114,7 +114,17 @@
                  "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) {
   return (strcmp(*((const char **)a), *((const char **)b)));

Modified: branches/branch-1.3/fluid/CodeEditor.h
===================================================================
--- branches/branch-1.3/fluid/CodeEditor.h      2012-04-13 02:51:15 UTC (rev 
9340)
+++ branches/branch-1.3/fluid/CodeEditor.h      2012-04-13 14:45:18 UTC (rev 
9341)
@@ -59,6 +59,10 @@
   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 @@
   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); }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to