Rockbox mail archiveSubject: brain dump/plan re simplifying viewport/theme support in screens
brain dump/plan re simplifying viewport/theme support in screens
From: Jonathan Gordon <jdgordy_at_gmail.com>
Date: Mon, 23 Nov 2009 17:35:53 -0800
this is a bit of a braindump to get this down before I pass out and
forget it... and a partial notice on what I think should be done...
the current situation is a bit of a mess between statusbar, skinned
statusbar (sbs), user setting viewport (uivp), full screen, partial
There is the viewport_set_defaults() and viewport_set_fullscreen()
functions, and viewportmanager_set_statusbars(), and nothing to change
the uivp (there was, but it was removed becasue it shouldnt have ever
So this is what I'm planning...
Basically, a screen has exactly 2 choices for their display, either
the "theme" (which means sbs if loaded, and uivp), or fullscreen.
Screens should always try to fit in the themes ui area, so they should
all just assume that viewport_configure(struct *viewport) [or
whatever its called] will give them what they want. Now, if it turns
out its too small the screen would then call
viewportmanager_theme_enable(bool) and then call viewport_configure()
again which will then use the full display. These 2 steps could be
Now, when that screen exits it would simply call
viewportmanager_theme_undo(void) which would put it back to however it
was (it would work with a stack so screens could enable and disable as
they please without annoying other screens).
so a screen could end up looking like this:
void my_screen(enum screen_type screen)
struct viewport vp;
/* oops, dimensions are too small */
bool needsundo = true;
........ do your screens magic ........
/* exiting the screen... put it back the way you found it */
if (needsundo) viewportmanager_theme_undo();
The caveat here is that its all or nothing... i.e you get the sbs and
uivp (if both are loaded) and any extra elements which might be added
later, or nothing.. I tihnk this is how it should work.
Except, sometimes (actually only during usb connection really) you
want to force the bar on (if no sbs is loaded the inbuilt one will be
shown). that would be done with statusbar_force(bool) which needs to
be worked out how it should work... need to think about this a bit.
I'm struggling to think of a screen other than early USB which
requires a bar of any sort being displayed.. and early USB is only
because the users theme isnt loaded yet and they might want it
displayed. So, if that is inded the only one we can get rid of this
statusbar_force() nonesense and just hardcode the silly animations in
for early usb only and call it quits...
actually... back onto viewport_configure() thing.. it could be done
even simpler... viewport_configure(struct *viewport, int min_width,
int min_height) would fix up the viewport so it guarentees to fit (it
min is smaller than lcd of course), and then we can use
viewport_undo(*viewport) again to undo anything if it was changed by
storing the pointer :) as long as the viweport isnt static that should
Received on 2009-11-24