diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-05-21 11:14:59 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-05-21 11:14:59 +0000 |
| commit | 23cfc372a0dab95c688190f49614c1b9090cc435 (patch) | |
| tree | a68cce3f557d44c3a09a497f3f102ed30ee10ce3 /src | |
| parent | 0104b4abc53eaf2d77c7407a01d09a886885d92e (diff) | |
Fix links inside PRE
Make style data const in Fl_Text_Display.
Use INT input only when step() is an integral value.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2246 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Help_View.cxx | 24 | ||||
| -rw-r--r-- | src/Fl_Text_Display.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_Value_Input.cxx | 18 |
3 files changed, 32 insertions, 18 deletions
diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index b2783539a..bda620360 100644 --- a/src/Fl_Help_View.cxx +++ b/src/Fl_Help_View.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Help_View.cxx,v 1.1.2.31 2002/05/16 12:47:43 easysw Exp $" +// "$Id: Fl_Help_View.cxx,v 1.1.2.32 2002/05/21 11:14:57 easysw Exp $" // // Fl_Help_View widget routines. // @@ -836,12 +836,13 @@ Fl_Help_View::format() { if ((*ptr == '<' || isspace(*ptr)) && s > buf) { + // Get width... + *s = '\0'; + ww = (int)fl_width(buf); + if (!head && !pre) { // Check width... - *s = '\0'; - ww = (int)fl_width(buf); - if (ww > hsize_) { hsize_ = ww; done = 0; @@ -874,6 +875,14 @@ Fl_Help_View::format() } else if (pre) { + // Add a link as needed... + if (link[0]) + add_link(link, xx, yy - hh, ww, hh); + + xx += ww; + if ((size + 2) > hh) + hh = size + 2; + // Handle preformatted text... while (isspace(*ptr)) { @@ -881,15 +890,14 @@ Fl_Help_View::format() { if (xx > hsize_) break; - if (link[0]) - add_link(link, xx, yy - hh, ww, hh); - line = do_align(block, line, xx, newalign, links); xx = block->x; yy += hh; block->h += hh; hh = size + 2; } + else + xx += (int)fl_width(' '); if ((size + 2) > hh) hh = size + 2; @@ -2615,5 +2623,5 @@ hscrollbar_callback(Fl_Widget *s, void *) // -// End of "$Id: Fl_Help_View.cxx,v 1.1.2.31 2002/05/16 12:47:43 easysw Exp $". +// End of "$Id: Fl_Help_View.cxx,v 1.1.2.32 2002/05/21 11:14:57 easysw Exp $". // diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 4be0e9aed..74303de78 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Display.cxx,v 1.12.2.13 2002/04/11 11:52:42 easysw Exp $" +// "$Id: Fl_Text_Display.cxx,v 1.12.2.14 2002/05/21 11:14:59 easysw Exp $" // // Copyright 2001-2002 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -167,7 +167,7 @@ void Fl_Text_Display::buffer( Fl_Text_Buffer *buf ) { */ void Fl_Text_Display::highlight_data(Fl_Text_Buffer *styleBuffer, - Style_Table_Entry *styleTable, + const Style_Table_Entry *styleTable, int nStyles, char unfinishedStyle, Unfinished_Style_Cb unfinishedHighlightCB, void *cbArg ) { @@ -1036,7 +1036,7 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip, */ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX, const char *string, int nChars ) { - Style_Table_Entry * styleRec; + const Style_Table_Entry * styleRec; /* Draw blank area rather than text, if that was the request */ if ( style & FILL_MASK ) { @@ -1958,5 +1958,5 @@ int Fl_Text_Display::handle(int event) { // -// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.13 2002/04/11 11:52:42 easysw Exp $". +// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.14 2002/05/21 11:14:59 easysw Exp $". // diff --git a/src/Fl_Value_Input.cxx b/src/Fl_Value_Input.cxx index 11241033c..0fefb7694 100644 --- a/src/Fl_Value_Input.cxx +++ b/src/Fl_Value_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.3 2002/02/18 13:25:26 easysw Exp $" +// "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.4 2002/05/21 11:14:59 easysw Exp $" // // Value input widget for the Fast Light Tool Kit (FLTK). // @@ -23,7 +23,7 @@ // Please report all bugs and problems to "fltk-bugs@fltk.org". // -// Fltk widget for drag-adjusting a floating point value. +// FLTK widget for drag-adjusting a floating point value. // Warning: this works by making a child Fl_Input object, even // though this object is *not* an Fl_Group. May be a kludge? @@ -31,12 +31,18 @@ #include <FL/Fl_Value_Input.H> #include <FL/Fl_Group.H> #include <stdlib.h> +#include <FL/math.h> + +// Some math headers don't seem to define this function... +extern "C" { + double trunc(double); +} void Fl_Value_Input::input_cb(Fl_Widget*, void* v) { Fl_Value_Input& t = *(Fl_Value_Input*)v; double nv; - if (t.step()>=1.0) nv = strtol(t.input.value(), 0, 0); - else nv = strtod(t.input.value(), 0); + if ((trunc(t.step()) - t.step())>0.0) nv = strtod(t.input.value(), 0); + else nv = strtol(t.input.value(), 0, 0); if (nv != t.value() || t.when() & FL_WHEN_NOT_CHANGED) { t.set_value(nv); if (t.when()) { @@ -108,7 +114,7 @@ int Fl_Value_Input::handle(int event) { return input.take_focus(); default: DEFAULT: - input.type(step()>=1.0 ? FL_INT_INPUT : FL_FLOAT_INPUT); + input.type((trunc(step()) - step())>0.0 ? FL_FLOAT_INPUT : FL_INT_INPUT); return input.handle(event); } } @@ -129,5 +135,5 @@ Fl_Value_Input::Fl_Value_Input(int x, int y, int w, int h, const char* l) } // -// End of "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.3 2002/02/18 13:25:26 easysw Exp $". +// End of "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.4 2002/05/21 11:14:59 easysw Exp $". // |
