Re: [fltk.bugs] [MOD] STR #2689: Handling of "@" symbols in fl_draw() and symbol expansion
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current Yes, it's a mix of outdated features and bad documentation. This is a typical case where one idea is abused by "adding just that one little feature". Originally, a label was text *or* a symbol. Then someone said, hey, how about a symbol, followed by text, and it was implemented. Then someone wanted the text first, then the symbol, and it was implemented, etc. etc. . In FLTK 2, symbols can be anywhere, they can even be images, and there are control codes for bold, italics, font size, baseline changes, and more. I have visited and fixed the label code 20 times or more, and there is always something that doesn't work. And every few months or so, someone files a bug report that EMail addresses can not be a label. Now this makes me wonder: wouldn't it be easier to just *reduce* the feature set back to either a symbol *or* text, and for everything else, the programmer should use HTML (Fl_Help_View)? Sorry, just rambling on and on ;-) Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2689: Handling of "@" symbols in fl_draw() and symbol expansion
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current I think the documentation of label symbols can need some more details: First regarding the fact, that there can be only two symbols at most in a string (one at the begin, one at the end) [Not really sure about that - just the source of fl_draw() seems to imply it], then that a found symbol that is not at the begin stops parsing the string. Also how are illegal symbols treated? Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2689: Handling of "@" symbols in fl_draw() and symbol expansion
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current The following change seems to fox the case when draw_symbols is off: Index: src/fl_draw.cxx === --- src/fl_draw.cxx (Revision 9116) +++ src/fl_draw.cxx (Arbeitskopie) @@ -304,8 +304,7 @@ if (underline_at && underline_at >= buf && underline_at < (buf + buflen)) callthis("_",1,xpos+int(fl_width(buf,underline_at-buf)),ypos-desc); - - if (!*e || (*e == '@' && e[1] != '@')) break; + if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break; p = e; } } Remark to the test program: What should the output of the test case 3 look like? @. is not valid sequence (this is for the browser escapes) so "@.first" will try to draw the symbol ".first". Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2689: Handling of "@" symbols in fl_draw() and symbol expansion
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2689: Handling of "@" symbols in fl_draw() and symbol expansion
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current Removed Duplicate Of dependency (hopefully) Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2689: Handling of "@" symbols in fl_draw() and symbol expansion
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
[fltk.bugs] [MOD] STR #2689: Handling of "@" symbols in fl_draw() and symbol expansion
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current There's somethng a bit weird going on with the expansion of symbols, in particualr the "@" symbol, when using fl_draw. This was initially flagged in the following thread: http://www.fltk.org/newsgroups.php?gfltk.general+v:33384 The attached patch I think illustrates the problem. Or maybe I just don't understand what it's meant to do? In any case, the behaviour seems wrong. NOTE: 1.3.x and 1.1.x behave in the same way, as of r8868. What I see: A string with a single @ symbol and "draw_symbols" disabled (i.e. not the default draw_symbols state) is *not* correctly drawn if the string has to wrap to fit the box, particularly if the wrap-point occurs within the word that starts with the "@" symbol. If the wrap does not "interact" with the "@" symbol, the string seems to draw more as I'd expect. In addition, turning off symbol-parsing by starting the string with "@." does not seem to be having quite the effect I'd anticiapted. I suspect there is something awry with measuring the string and symbol expansion... The example allows various combinations of escaped (i.e. "@@") and not-escaped strings to be drawn, with and without symbol expansion. The results are puzzling and not what I had expected. Is it a bug? I think it may well be. Link: http://www.fltk.org/str.php?L2689 Version: 1.3-current/***/ // compile as: // fltk-config --compile draw_test.cxx // #include #include #include #include #include #include #include #include #include static Fl_Double_Window *main_win; static Fl_Group *str_grp=(Fl_Group *)0; static Fl_Round_Button *bt1=(Fl_Round_Button *)0; static Fl_Round_Button *bt2=(Fl_Round_Button *)0; static Fl_Round_Button *bt3=(Fl_Round_Button *)0; static Fl_Check_Button *dr_symbs=(Fl_Check_Button *)0; static Fl_Check_Button *use_esc=(Fl_Check_Button *)0; static int draw_symbols = 0; static int use_escaped = 0; static int string_state = 2; static const char s1[] = "first @second third"; // plain string static const char s2[] = "first @@second third"; // escaped string static const char s3[] = "@.first @second third"; // no-expansion string // "escaped" versions of the above for display purposes... static const char s1e[] = "first @@second third"; static const char s2e[] = "first second third"; static const char s3e[] = "@@.first @@second third"; /***/ class tst_box : public Fl_Box { protected: void draw(void); const char *line; public: tst_box(int X, int Y, int W, int H) : Fl_Box(X,Y,W,H) {line = NULL;} void set_data(const char *newdat); }; /***/ void tst_box::set_data(const char *newdat) { line = newdat; } /***/ void tst_box::draw(void) { int wd = w(), ht = h(); int xo = x(), yo = y(); // first clear out the view fl_color(FL_WHITE); // background colour fl_rectf(xo, yo, wd, ht); if (!line) return; fl_color(FL_DARK_BLUE); // text colour fl_font(FL_COURIER, 14); // text face fl_draw(line, xo, yo, wd, ht, (Fl_Align)(FL_ALIGN_CLIP | FL_ALIGN_TOP_LEFT | FL_ALIGN_WRAP), 0, draw_symbols); } /***/ static tst_box *box_2; // image box /***/ void quit_cb(Fl_Button *, void *) { main_win->hide(); } /***/ static void cb_bt1(Fl_Round_Button*, void*) { string_state = 1; if(use_escaped) { box_2->set_data(s1e); } else box_2->set_data(s1); main_win->redraw(); } /***/ static void cb_bt2(Fl_Round_Button*, void*) { string_state = 2; if(use_escaped) { box_2->set_data(s2e); } else box_2->set_data(s2); main_win->redraw(); } /***/ static void cb_bt3(Fl_Round_Button*, void*) { string_state = 3; if(use_escaped) { box_2->set_data(s3e); } else box_2->set_data(s3); main_win->redraw(); } /***/ static void cb_dr_symbs(Fl_Check_Button*, void*) { draw_symbols = dr_symbs->value(); main_win->redraw(); } /***/ static void cb_use_esc(Fl_Check_Button*, void*) { use_escaped = use_esc->value(); switch(string_state){ case 1: cb_bt1(NULL, NULL); break; case 2: cb_bt2(NULL, NULL); break; case 3: cb_bt3(NULL, NULL); break; } main_win->redraw(); } /***/ int main(int argc, char **argv) { int WW = 60, HH = 60; main_win = new Fl_Double_Window(460, 210); main_win->begin(); box_2 = new