| [ Return to Bugs & Features | Roadmap 1.3 | Post Text | Post File | Prev | Next ]
STR #3240
Application: | FLTK Library |
Status: | 5 - New |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | Fl_Html_View - more capable replacement for Fl_Help_View |
Version: | 1.3-feature |
Created By: | rokan2 |
Assigned To: | Unassigned |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]
Trouble Report Comments:
[ Post Text ]
|
#1 | rokan2 06:52 Jul 14, 2015 |
| Fl_Html_View is much more capable (see screenshots), less-buggy and extensible replacement for Fl_Help_View. The widget is fully source compatible with Fl_Help_View so Fl_Help_View can be just a typedef to it or Fl_Html_View can be renamed as Fl_Help_View in some future FLTK version. For now it is just an external widget which does not require modification of FLTK library.
It also adds "html" label drawing capabilities through FL_HTML_LABEL* labeltype so that html-formatted text can be rendered as "ritch text" label in any FLTK widget.
For list of features see Fl_Html_View.html
Roman | |
|
#2 | greg.ercolano 20:31 Jul 14, 2015 |
| Wow
Does all that and clean code too? Amazin'! ;)
Wanna see what others say, but initially this is looking great. | |
|
#3 | AlbrechtS 03:42 Jul 17, 2015 |
| Thanks for this powerful contribution. As said elsewhere, this could be added to the FLTK library or used to replace Fl_Help_View in FLTK 1.4. I didn't look at the code yet though, nor did I test anything.
The code size (as Roman said: less than 10,000 lines) would be more than 5% of the current code size of the entire FLTK library (w/o test and examples folders). Current size is 177,468 LOC, including all UTF-8 conversion tables, which are not all included in the lib, IIRC).
That said, it might be interesting to check if we can add this powerful widget as a separate library like Fl_Images. Especially if the announce extensions (print preview, more CSS capabilities) add even more to the code size. Just a thought...
Note: I uploaded the missing demo image files smiley.png and Discipline.png to complete the posted test file http://www.fltk.org/strfiles/3240/Fl_Html_View.html | |
|
#4 | superbem 19:56 Dec 18, 2015 |
| Nice. I like it the idea. But it hangs when it have some parse errors. When using the method value(const char*) | |
|
#5 | haavard.holm 11:24 Jul 15, 2017 |
| Hi,
Seems like there is a small bug in the code.
I use the following code : {Fl_Html_View *o = HTML_View = new Fl_Html_View(x+300, y+70, width-x-300, y+height-150); o->color(FL_WHITE); o->format_width(-1); o->load("Manual/Start.html", 0); } Running valgrind on my program do produce errors based on this code.
Else I find the widget very useful !
Best regards HÃ¥vard | |
|
#6 | greg.ercolano 13:37 Jul 15, 2017 |
| I'm following up with Haavard's valgrind output he posted on fltk.general, as it's likely useful to determine what he's reporting:
---- snip ==28623== Conditional jump or move depends on uninitialised value(s) ==28623== at 0x52B456: Fl_Html_Parser::create_word(char const*, unsigned int, int) (Fl_Html_Parser.cxx:1271) ==28623== by 0x52B0D5: Fl_Xml_Parser::parse(char const*, Fl_Xml_Object**) (Fl_Html_Parser.cxx:1203) ==28623== by 0x52B80C: Fl_Html_Parser::parse(char const*, Fl_Xml_Object**) (Fl_Html_Parser.cxx:1343) ==28623== by 0x52F19C: Fl_Html_View::value(char const*, bool, char const*) (Fl_Html_View.cxx:1136) ==28623== by 0x52F62A: Fl_Html_View::load(char const*, bool, bool) (Fl_Html_View.cxx:1198) ==28623== by 0x470EA8: Fl_Html_View::load(char const*) (Fl_Html_View.H:102)
Also if I run valgrind on the example-code-example I get error messages from valgrind. ---- snip | |
|
#7 | greg.ercolano 13:52 Jul 15, 2017 |
| I believe valgrind is objecting to the Fl_Xml_Parser class data element 'last_result_' is not initialized by the class constructor.
Looking at Fl_Xml_Parser's constructor:
Fl_Xml_Parser(int table_size = 32):Fl_Html_Tokenizer(0), parent_table_size_(table_size) { parent_table_ = new Fl_Xml_Object * [table_size]; parent_table_next_ = new Fl_Xml_Object ** [table_size]; scht_ = Fl_Html_Tokenizer::Special_Character_Table::default_table(); }
..it does seem like there's no initialization of last_result_.
This uninitialized value is apparently being used by Fl_Html_Parse::create_word() at line #1411 in src/Fl_Html_Parser.cxx:
if(last_result()==CDATA) | |
|
#8 | AlbrechtS 06:10 Feb 09, 2019 |
| Please see STR 3511 (closed, but maybe related). https://www.fltk.org/str.php?L3511 | |
|
| If you load a local file with Fl_Html_View, local images are not loaded. The problem seems to be in Fl_Html_Parser where the value of directory_ is set incorrectly to the same as filename_ if there are no slashes in the string. Making directory_ an empty string for that case solves the problem:
...... if(slash) *slash = 0; else *directory_ = 0; // no slash found: no directory name was included } | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |