> > I upgraded the showcase dialog (now in CVS) to have an option to do
> > channel previews.
>
>       How exactly are you doing this? Are you rendering an
> actually-gathered PDB file on the desktop? Or are you simply gathering the
> raw website into a 160x160 pane?

I wanted to avoid transcoding issues, (and to keep current without having to
have someone maintain it) the preview is rendered live from the web. I was
actually considering calling the checkbox option "Show live preview". I
actually had a 160x160 pane, but rewrote to use windowsplitters so could
resize bigger if so desired (the h1 font renders quite big, etc).

When select a channel, an address for the preview page is loaded into an
wxHtmlWindow class window.

wxHtmlWindow is generally too worthless to use for anything other than
showing help files (what is was created for, really), since only a bare
minimum of tags are supported [to keep things light]. However, these bare
tags are the ones pretty much used in handheld sites anyways, so I thought
this would work well.

There was some things to smooth out though:
-wxHtmlWindow will only load files ending in .html or .htm [others will just
display the source} unless add specific filters (which though documented,
didn't seem to be all that well laid out as to what to do there). Problem
since some channels are .shtml, .asp, .cfm, etc.
-Virtual filesystems are supposed to be implemented for the web and zip
files. However, seemed to stick on not knowing how to parse out an absolute
url within a rendered page (but would know to get a src-"http://.."; or a
src="file_in_the_same_directory" ).
-Internet filestreams are difficult to manage since don't know where they
end, and other stuff.

Implementation was to:
-Open a filestream and download the data to a temp file (using wxGetTempFile
or something to automatically know where to download the file in the OS's
location for temp files).
-Load and run through the file, replacing the href="" and src="" tags with
their absolute url equivalent. Keep the reformatted text as a string.
-Set that string to the htmlwindow, and the images will appear correctly
with the text.

There is no doubt better ways to do this, and probably best would be to
patch the wxWindows InternetFileSystem, and send back the patch. Another is
rewriting the href/src tag in the wxWindows parser. Another is doing
replacements on the textstream as it is downloaded and sending the output to
the htmlwindow without using a downloaded file at all.

Current limitations are:
-wxURL is not HTML1.1 compliant, so redirects rarely work, and usually need
to specify the full name of the actual file on the net.
-Only the first page renders with src="", and href="" replacements. If click
down, nope.
-Unknown reason why certain site's images report as "no image handler
found", even though the jpg, gif, and png handlers are loaded and ready.
Perhaps due to some comments or something in the image file when saved.
-In general for wxWindows, image pallettes not always rendered very well if
a desktop is set to  256-colors.

Was considering recycling the function to download a url to a local file to
use for updating the plucker_showcase.htm from the web to a local file, when
user clicks the appropriate button.

Best wishes,
Robert


Reply via email to