From 46521bf437f712234904a4295cb75ba15d168b5f Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Wed, 21 May 2014 06:56:59 +0000 Subject: Implements STR #2621: Add line numbers to Fl_Text_Display. Applied LZA's patch and included some mods to address TODO items and ABI issues. Also update CREDITS with LZA and a few other notably absent names. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10152 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/editor.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/editor.cxx b/test/editor.cxx index 1c9db095f..54245ab42 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -515,6 +515,19 @@ void delete_cb(Fl_Widget*, void*) { textbuf->remove_selection(); } +void linenumbers_cb(Fl_Widget *w, void* v) { + EditorWindow* e = (EditorWindow*)v; + Fl_Menu_Bar* m = (Fl_Menu_Bar*)w; + const Fl_Menu_Item* i = m->mvalue(); + if ( i->value() ) { + e->editor->linenumber_width(50); // enable + e->editor->linenumber_size(e->editor->textsize()); + } else { + e->editor->linenumber_width(0); // disable + } + e->redraw(); +} + void find_cb(Fl_Widget* w, void* v) { EditorWindow* e = (EditorWindow*)v; const char *val; @@ -751,6 +764,9 @@ Fl_Menu_Item menuitems[] = { { "&Copy", FL_COMMAND + 'c', (Fl_Callback *)copy_cb }, { "&Paste", FL_COMMAND + 'v', (Fl_Callback *)paste_cb }, { "&Delete", 0, (Fl_Callback *)delete_cb }, + { "Preferences", 0, 0, 0, FL_SUBMENU }, + { "Line Numbers", FL_COMMAND + 'l', (Fl_Callback *)linenumbers_cb, 0, FL_MENU_TOGGLE }, + { 0 }, { 0 }, { "&Search", 0, 0, 0, FL_SUBMENU }, -- cgit v1.2.3