diff options
author | jcid <devnull@localhost> | 2007-11-20 20:18:20 +0100 |
---|---|---|
committer | jcid <devnull@localhost> | 2007-11-20 20:18:20 +0100 |
commit | e3dc26c04e15024ffb1b130c626bb4d5e8c7bdff (patch) | |
tree | 86340aa887d55a13acee072c0b0056695a2b07bf | |
parent | 4cd23d44a0d38c61dd3bfb8cbbcc4a098f43f4d2 (diff) |
Added line numbers and enabled wrapping in the "View Source" window.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/dialog.cc | 10 |
2 files changed, 11 insertions, 0 deletions
@@ -59,6 +59,7 @@ dillo-fltk2 - Added the "static" qualifier where missing. - Bound "Copy link location". - Bound preliminar find text support. + - Added line numbers and enabled wrapping in the "View Source" window. Patches: place +- Fixed a problem with locally-installed dpis. - Added code for optional image loading (nice interface) very advanced! diff --git a/src/dialog.cc b/src/dialog.cc index 934af086..5b8d3a13 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -101,6 +101,7 @@ char *a_Dialog_open_file(const char *msg, void a_Dialog_text_window(const char *txt, const char *title) { int wh = 500, ww = 480, bh = 30; + int lines, line_num_width; TextBuffer *text_buf = new TextBuffer(); text_buf->text(txt); @@ -109,6 +110,15 @@ void a_Dialog_text_window(const char *txt, const char *title) TextDisplay *td = new TextDisplay(0,0,ww, wh-bh); td->buffer(text_buf); + /* enable wrapping lines; text uses entire width of window */ + td->wrap_mode(true, 0); + + lines = td->total_lines(); + line_num_width = 2; + while (lines /= 10) + ++line_num_width; + line_num_width = (int)(line_num_width * fltk::getwidth("0")); + td->linenumber_width(line_num_width); ReturnButton *b = new ReturnButton (0, wh-bh, ww, bh, "Close"); b->callback(window_close_cb, window); |