FS#9232 - Genericized help viewer for plugins

Attached to Project: Rockbox
Opened by William Poetra Yoga Hadisoeseno (wpyh) - Saturday, 02 August 2008, 02:25 GMT
Last edited by Teruaki Kawashima (teru) - Tuesday, 06 July 2010, 15:17 GMT
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This is a generic help viewer for plugins, with basic scrolling and word wrapping features.

With this help viewer, I hope to make all plugins (or at least games) to get a main menu and move all the help messages into a submenu. This will make Rockbox plugins look much more professional rather than just some random code thrown together.

Attached is a very early draft; it lacks:
1. scrollbar support
2. continuous scrolling
3. background display
4. etc

Please try the patch with the test plugin (also attached) and comment. In particular, I need some suggestions on how to best implement the word wrapping feature -- currently it's very simplistic.
This task depends upon

Closed by  Teruaki Kawashima (teru)
Tuesday, 06 July 2010, 15:17 GMT
Reason for closing:  Out of Date
Additional comments about closing:  Similar codes, display_text and simple_viewer are in svn.
Comment by Thomas Martitz (kugel.) - Saturday, 02 August 2008, 02:32 GMT
Why not just use existing code of the text viewer plugin? I mean, you baiscally only need to wipe out unneeded parts, but you gain scrolling, wordwrapping and scrollbar rather easily.

Anyway, I like the idea.
Comment by William Poetra Yoga Hadisoeseno (wpyh) - Saturday, 02 August 2008, 07:44 GMT
Hey, thanks :)

I've briefly looked at the text viewer plugin, but I think that's too complicated -- I think we just need a simple text viewer. Since you mentioned it, I'll take another look and see whether I can strip it down easily.

I've got a few (design) questions here:
1. For the quit button (the button used to exit from the help display), should it be hard-coded in the help viewer, or should it be configurable by plugins? The current implementation is configurable by plugins, but I find that it doesn't elegantly allow for multiple buttons or button combinations.
2. Should we display the status bar, or not? Or should it be configurable like the scroll bar?
Comment by William Poetra Yoga Hadisoeseno (wpyh) - Sunday, 03 August 2008, 19:16 GMT
OK, here's an update. Now we support a scrollbar and continuous scrolling.

This is the status:
1. The word-wrapping feature looks for space characters and uses them to break lines.
2. Scrollbar is supported and the width must be set by the calling plugin.
3. Scroll keys and the quit action must be set by the calling plugin.
4. Continuous scrolling is supported.
5. Background image shows up on the simulator, but I have to confirm it on my iPod first.
6. The status bar is not drawn.

Please try and comment (suggestions, etc).

P.S. I looked at the text viewer code again, and I see that it needs a buffer to implement more flexible word wrapping. I think this is overkill for a help viewer :)
P.P.S. While implementing the scrollbar, I found that a potentially useful function (lcd_puts_offset) is not exported in the API. Shouldn't it be exported so that plugins can use it too?
Comment by Nils Wallménius (nls) - Monday, 18 August 2008, 09:30 GMT
Hi, i like the idea of this but haven't tried it yet, some minor code nits though.
You have a couple of _very_ long lines, especially in your function definitions,
please keep them <= 80 chars.
c++ style comments // in help.h
also might i suggest changing help.[ch] to something a little more descriptive like help_viewer.[ch] ?
Comment by William Poetra Yoga Hadisoeseno (wpyh) - Monday, 01 September 2008, 23:46 GMT
OK, I've made the requested / suggested changes.
Comment by William Poetra Yoga Hadisoeseno (wpyh) - Thursday, 04 September 2008, 08:11 GMT
The previous version doesn't work. Please use this one instead.