This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#10099 - lib, which display formatted text on every target
Attached to Project:
Rockbox
Opened by Johannes Schwarz (Ubuntuxer) - Sunday, 05 April 2009, 17:14 GMT+2
Last edited by Teruaki Kawashima (teru) - Tuesday, 14 July 2009, 15:36 GMT+2
Opened by Johannes Schwarz (Ubuntuxer) - Sunday, 05 April 2009, 17:14 GMT+2
Last edited by Teruaki Kawashima (teru) - Tuesday, 14 July 2009, 15:36 GMT+2
|
DetailsThe text is displayed on the full screen size and can also be formatted. The lib should work on every target.
The code is based on the function do_help() from Will Robertson. Please help me to improve the lib. |
This task depends upon
Closed by Teruaki Kawashima (teru)
Tuesday, 14 July 2009, 15:36 GMT+2
Reason for closing: Accepted
Additional comments about closing: Committed in r21861.
Tuesday, 14 July 2009, 15:36 GMT+2
Reason for closing: Accepted
Additional comments about closing: Committed in r21861.
Some other plugins(e.g. star) uses a function called display_text(), which displays the text in a right way on the screen, but the function doesn't support styles, so the text is hard to read and looks a little bit boring.
The lib give you the ability to display formatted text in a nice way.
The main disadvantage of the lib is that it uses a lot of memory, but I can't think of an other solution to combine style and adaptation to the screen size.
The remaining text will be displayed, if you press any button.
like bold, italics or actual different fonts?
we can get the actual screen size of the player and convert it to the specific screen size using a simple % calculation.
I have included the lib in brickmania, but I have to work on the viewport integration. The problem is, that I need the x, y, width and height from the viewport struct, but I don't know how to get it from the current viewport.
Please test the lib and if necessary rename it.
> unsigned short xmargin = 5, ymargin = 5;
maybe this margin is too large for the lcd with charcells.
When I tested on the simulator for player before, nothing was displayed.
> xmargin = xmargin + (*vp_text).x;
> ymargin = ymargin + (*vp_text).y;
This will cause problem especially when someone wants to set vp_text->x bigger than vp_text->width/2,
because the xmargin is subtracted from text_width(==vp_text->width) at line 70.
It would be better to use "rb->screens[SCREEN_MAIN]->set_viewport(vp_text);",
and no need to set foreground/background and branch when setting drawmode.
Declaration of standard_fcolor also shoud be surrounded by "#if LCD_DEPTH > 1".
"standard_fcolor=(*vp_text).fg_pattern;" at line 53 is duplicated.
> x=(LCD_WIDTH/2)-(width/2);
maybe should use text_width instead of LCD_WIDTH?
In my opinion, it is not necessary to restore drawmode.
Is there any reason not waiting key input aftrer displaying last word?
It would be nice if you implement scrolling up/down the text.
sorry for my bad english and description.
I fixed the bugs you have detected and avoid unused parameter warnings on targets without color or bitmaps.
>In my opinion, it is not necessary to restore drawmode.
I don't think so, it's very important, because the plugin writer, who use the lib can't know, that the drawmode is changed. So I add a reset for the foreground color, too.
>Is there any reason not waiting key input aftrer displaying last word?
The lib should be so flexible as possible, so I wouldn't change it.
>It would be nice if you implement scrolling up/down the text.
At the moment the text which fits on the screen is displayed and after you select a button the rest is displayed. It's a little bit like a book. In my view the main disadvantage is, that you can't go back.
A scolling text would be completely different concept, but we should discuss about it.
*rename text.* to display_text.* to fit name of function.
*modify some plugins to use display_text.
The patch, which modify the plugins to use display_text needs a review. I will do this within the next few days.
repeating entering and quiting help in brickmania crash the player.
*make "formation" static.
*try to reduce size of "formation".
But it could be a nerve limiatation, that the last text item musn't be a formatted word. Of course you could use just "" but it isn't elegant and can lead to problems!
I fix some minor typos and remove the limitation that the last item must be a unformatted word.