diff --git a/CHANGES b/CHANGES index d90f084c8..de95d7972 100644 --- a/CHANGES +++ b/CHANGES @@ -3,9 +3,13 @@ CHANGES IN FLTK 1.1.8 - Documentation fixes (STR #1454, STR #1455, STR #1456, STR #1457, STR #1458, STR #1460, STR #1481, STR #1578, STR #1639, STR #1645, STR #1644) + - Added static icon, text selection, and HTML formatting to + fl_message etc. (STR #1626) + - Fixed selection of first word in Fl_Help_View - Fixed endless loop in Fl_Text_Display (STR #1655) - Allowing shortcuts in Tabs (STR #1652) - - Fixed Makefile "make clean" (STR #1642, STR #1643, STR #1641) + - Fixed Makefile "make clean" (STR #1642, + STR #1643, STR #1641) - The sample RPM spec file now enables large file support and threading support (STR #1603) - Changed minimum contrast between background and text to diff --git a/documentation/functions.html b/documentation/functions.html index 21c6cd1b7..7464e1d21 100644 --- a/documentation/functions.html +++ b/documentation/functions.html @@ -1270,6 +1270,13 @@ The message will wrap to fit the window, or may be many lines by putting \n characters into it. The enter key is a shortcut for the OK button. +
A message text can be further formatted with html tags by +adding <html> at the beginning of the message. +See Fl_Help_View for +details. + +
The message text is limited to 1024 characters. +
+ default: ++n; break;
+ }
+ }
+ char *dst = (char*)malloc(n), *d = dst;
+ s = src;
+ for (;;) {
+ char c = *s++;
+ if (!c) break;
+ switch (c) {
+ case '<': *d++='&'; *d++='l'; *d++='t'; *d++=';'; break;
+ case '&': *d++='&'; *d++='a'; *d++='m'; *d++='p'; *d++=';'; break;
+ case '\n':
+ if (*s=='\n') {
+ *d++='<'; *d++='p'; *d++='>'; ++s;
+ } else {
+ *d++='<'; *d++='b'; *d++='r'; *d++='>';
+ }
+ break;
+ default: *d++ = c; break;
+ }
+ }
+ *d = 0;
+ return dst;
+}
+
static int innards(const char* fmt, va_list ap,
const char *b0,
const char *b1,
const char *b2)
{
makeform();
- char buffer[1024];
+ const char *txt, *html;
+ char buffer[1024];
+
if (!strcmp(fmt,"%s")) {
- message->label(va_arg(ap, const char*));
+ txt = va_arg(ap, const char*);
} else {
//: matt: MacOS provides two equally named vsnprintf's...
::vsnprintf(buffer, 1024, fmt, ap);
- message->label(buffer);
+ txt = buffer;
}
+ html = check_html(txt);
+ message->value(html);
+ if (html!=txt) free((char*)html);
- message->labelfont(fl_message_font_);
- message->labelsize(fl_message_size_);
+ message->textfont(fl_message_font_);
+ message->textsize(fl_message_size_);
if (b0) {button[0]->show(); button[0]->label(b0); button[1]->position(210,70);}
else {button[0]->hide(); button[1]->position(310,70);}
if (b1) {button[1]->show(); button[1]->label(b1);}
diff --git a/test/message.cxx b/test/message.cxx
index a1ed47d0c..ba864831f 100644
--- a/test/message.cxx
+++ b/test/message.cxx
@@ -38,8 +38,11 @@ int main(int argc, char **argv) {
fl_message("Spelling check sucessful, %d errors found with %g%% confidence",
1002, 100*(15/77.0));
- fl_alert("Quantum fluctuations in the space-time continuum detected, "
- "you have %g seconds to comply.", 10.0);
+ fl_alert("Quantum fluctuations in the space-time continuum detected, "
+ "you have %g seconds to comply."
+ " For more information on time travel "
+ "please visit http://www.fltk.org/"
+ , 10.0);
printf("fl_choice returned %d\n",
fl_choice("Do you really want to %s?", "No", "Yes", 0L, "continue"));
diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx
index 07c05035f..8ea568e76 100644
--- a/src/Fl_Help_View.cxx
+++ b/src/Fl_Help_View.cxx
@@ -196,10 +196,6 @@ struct fl_margins {
* in a single set of variables.
*
* Still to do:
- * - The viewer flickers like crazy when redrawing. The window should be
- * Fl_Double_Window, but is that binary compatible?
- * - We should not draw anything when counting (draw_mode>0). That would
- * improve performance a lot
* - &word; style characters mess up our count inside a word boundary
* - we can only select words, no individual characters
* - no dragging of the selection into another widget
@@ -508,6 +504,7 @@ Fl_Help_View::draw()
hv_selection_color = FL_SELECTION_COLOR;
hv_selection_text_color = fl_contrast(textcolor_, FL_SELECTION_COLOR);
}
+ current_pos = 0;
// Clip the drawing to the inside of the box...
fl_push_clip(x() + Fl::box_dx(b), y() + Fl::box_dy(b),
diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx
index 6ab7e53d5..92da3c3f1 100644
--- a/src/fl_ask.cxx
+++ b/src/fl_ask.cxx
@@ -32,6 +32,7 @@
#include