1
0
Fork 0
forked from len0rd/rockbox

plugins: clock: adjust defaults, don't restore color

- Default to round border in analog mode
- Default to segmented LCD style in digital and binary mode
- Default to date format most fitting for current language
  (instead of D-M-Y)
- Don't forcibly set a light background before menu is
  displayed or when quitting
- Update manual

Change-Id: Ifb6a41bb99701ae8f8cbf5fa0db2a3a332085f43
This commit is contained in:
Christian Soffke 2025-06-08 01:40:57 +02:00
parent 8d4efb6cf2
commit 91c724dc19
4 changed files with 63 additions and 92 deletions

View file

@ -65,7 +65,6 @@ const struct button_mapping* plugin_contexts[]={
*************************/ *************************/
static void cleanup(void) static void cleanup(void)
{ {
clock_draw_restore_colors();
if(clock_settings.general.save_settings == 1) if(clock_settings.general.save_settings == 1)
save_settings(); save_settings();
@ -181,7 +180,6 @@ enum plugin_status plugin_start(const void* parameter){
break; break;
#endif #endif
case ACTION_MENU: case ACTION_MENU:
clock_draw_restore_colors();
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
rb->viewportmanager_theme_enable(i, true, NULL); rb->viewportmanager_theme_enable(i, true, NULL);
exit_clock=main_menu(); exit_clock=main_menu();
@ -198,7 +196,8 @@ enum plugin_status plugin_start(const void* parameter){
break; break;
} }
if(redraw){ if (redraw && !exit_clock)
{
clock_draw_set_colors(); clock_draw_set_colors();
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
clock_draw(rb->screens[i], &time, &counter); clock_draw(rb->screens[i], &time, &counter);

View file

@ -64,11 +64,6 @@ static void skin_set_background(struct screen* display, int mode, int skin){
white_background(display); white_background(display);
} }
static void skin_restore_background(struct screen* display, int mode, int skin){
if(skin_require_black_background(mode, skin) )
white_background(display);
}
void clock_draw_set_colors(void){ void clock_draw_set_colors(void){
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
skin_set_background(rb->screens[i], skin_set_background(rb->screens[i],
@ -76,15 +71,6 @@ void clock_draw_set_colors(void){
clock_settings.skin[clock_settings.mode]); clock_settings.skin[clock_settings.mode]);
} }
void clock_draw_restore_colors(void){
FOR_NB_SCREENS(i){
skin_restore_background(rb->screens[i],
clock_settings.mode,
clock_settings.skin[clock_settings.mode]);
rb->screens[i]->update();
}
}
void clock_draw(struct screen* display, struct time* time, void clock_draw(struct screen* display, struct time* time,
struct counter* counter){ struct counter* counter){
if(!show_counter) if(!show_counter)

View file

@ -58,11 +58,25 @@ static bool settings_needs_saving(struct clock_settings* settings){
void clock_settings_reset(struct clock_settings* settings){ void clock_settings_reset(struct clock_settings* settings){
settings->mode = ANALOG; settings->mode = ANALOG;
int i;
for(i=0;i<NB_CLOCK_MODES;i++){
settings->skin[i]=0;
}
settings->general.date_format = EUROPEAN; settings->general.date_format = EUROPEAN;
settings->skin[ANALOG] = 1; /* round */
settings->skin[DIGITAL] = 1; /* LCD-style */
settings->skin[BINARY] = 2; /* LCD-style */
for (const char *ptr = rb->str(LANG_VOICED_DATE_FORMAT) ; *ptr; ptr++)
{
if (*ptr == 'd')
break;
else if (*ptr == 'Y')
{
settings->general.date_format = JAPANESE;
break;
}
else if (*ptr == 'A' || *ptr == 'm')
{
settings->general.date_format = ENGLISH;
break;
}
}
settings->general.save_settings = true; settings->general.save_settings = true;
settings->general.idle_poweroff=true; settings->general.idle_poweroff=true;
settings->general.backlight = ROCKBOX_SETTING; settings->general.backlight = ROCKBOX_SETTING;

View file

@ -1,7 +1,8 @@
\subsection{Clock} \subsection{Clock}
\screenshot{plugins/images/ss-clock}{Clock}{img:clock} \screenshot{plugins/images/ss-clock}{Clock}{img:clock}
This is a fully featured analogue and digital clock plugin. Clock with an analog, digital, and binary mode.
Includes a handy timer and can show the current date.
\subsubsection{Key configuration} \subsubsection{Key configuration}
@ -13,92 +14,63 @@ This is a fully featured analogue and digital clock plugin.
\nopt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginUp{} / \PluginDown} \nopt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginUp{} / \PluginDown}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginDown} \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginDown}
\opt{HAVEREMOTEKEYMAP}{& \PluginRCUp{} / \PluginRCDown} \opt{HAVEREMOTEKEYMAP}{& \PluginRCUp{} / \PluginRCDown}
& Cycle through skins \\ & Cycle through different skins in each mode \\
\PluginSelect
\opt{HAVEREMOTEKEYMAP}{& \PluginRCSelect}
& Start or stop timer (visible in analog or digital mode) \\
\PluginSelectRepeat
\opt{HAVEREMOTEKEYMAP}{& \PluginRCSelectRepeat}
& Reset and hide the timer \\
\nopt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginCancel} \nopt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginCancel}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonMenu} \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonMenu}
\opt{HAVEREMOTEKEYMAP}{& \PluginRCCancel} \opt{HAVEREMOTEKEYMAP}{& \PluginRCCancel}
& Main Menu \\ & Open Clock menu \\
\PluginSelect
\opt{HAVEREMOTEKEYMAP}{& \PluginRCSelect}
& Start / Stop Counter \\
\PluginSelectRepeat
\opt{HAVEREMOTEKEYMAP}{& \PluginRCSelectRepeat}
& Reset Counter \\
\end{btnmap} \end{btnmap}
\textbf{Clock Menu} \textbf{Clock Menu}
\begin{description} \begin{description}
\item[View Clock] Exits the menu and returns to the current clock mode display. \item[Mode] Select analog, digital, or binary mode.
\item[Mode Selector] Opens a menu from which you can select a clock mode to view. \item[Settings]
\item[Counter Settings] Opens a menu from which you can adjust settings
pertaining to the counter.
\item[Mode Settings] Opens a menu from which you can adjust settings pertaining to
the current clock mode (analog, digital, binary).
\item[General Settings]
\begin{description} \begin{description}
\item[Reset Settings] \item[Analog] Adjust settings pertaining to the analog mode.
Reset all settings to their default values. \item[Digital] Adjust settings pertaining to the digital mode.
\item[Date Format]
Switch between formatting used in the United States (M-D-Y), Europe (D-M-Y), and Japan (Y-M-D).
\item[Backlight]
Keep backlight turned off, on, or have it respect the system setting.
\item[Idle Poweroff]
Temporarily enable or disable Idle Poweroff while the plugin is running.
\item[Save On Exit]
Save settings to disk when the plugin is quit (enabled by default).
\item[Save Settings] \item[Save Settings]
Save all settings to disk. Save all settings to disk.
\item[Show Counter] \item[Reset Settings]
Toggle Counter display. Reset all settings to their default values.
\item[Save]
Choose whether to disable automatic saving, saving to disk on exit, or
saving to disk every settings change.
\item[Backlight]
Choose whether to disable the backlight, use the user's timeout setting,
or keep the backlight on.
\item[Idle Poweroff]
Toggle Idle Poweroff.
\note{This setting is not saved to disk.}
\end{description} \end{description}
\item[Help] Opens a brief help screen with key mappings and functionality. \item[Playback Control] Show the playback control menu.
\item[Credits] Displays a credits roll. \item[Quit] Quit the plugin.
\end{description} \end{description}
\subsubsection{Analog mode} \subsubsection{Analog}
Small, round, analog clock is displayed in the middle of the LCD. In analog mode, you can switch between two skins: One is round, the other square.
Time readout, if enabled, is displayed at the upper left. Both the second hand and the border can be hidden by going into Settings.
If Time readout is in 12-hour (``12h'') mode, AM or PM will be displayed at the You can also choose to display the current date in the lower left corner.
upper right. The Date readout, if enabled, is displayed at the lower left. Any running timer will appear in the lower right corner.
The Counter, if enabled, is displayed at the lower right.
The second hand, if enabled, is displayed along with the hour and minute hands.
Digit display, if enabled, places ``12'', ``3'', ``6'', and ``9'' around the
face of the clock in their respective positions.
\subsubsection{Digital mode}
An imitation of an LCD, this mode shows a Clock comprised of digital ``segments''.
The Date readout, if enabled, is displayed at the bottom, center.
The Second readout, if in ``Text'' mode, is displayed at the top, center; if in
``Bar'' mode, is displayed as a progress bar at the top of the LCD; if in
``Invert'' mode, will invert the LCD left-to-right as the seconds pass (a
fully-inverted LCD means the entire minute has passed).
The Counter, if displayed, is shown at the upper left.
The Blinking Colon, if enabled, blinks the colon once every second.
12-hour mode, if enabled, will display the time in a 12-hour format.
\subsubsection{LCD mode} \subsubsection{Digital}
Based on the Digital Mode, the LCD mode is another imitation of an LCD. Digital mode imitates a segmented LCD by default. A plain display style is
The settings available in this mode are exactly the same as Digital Mode, but also available, by switching to a different skin.
they are independent of Digital Mode. For example, you can have the Date The current date is displayed on the bottom, unless it is disabled.
Readout enabled in Digital Mode and disabled in LCD Mode. You can hide seconds, or make the colon blink once every second.
Any running timer will appear on the bottom.
\subsubsection{Fullscreen} \subsubsection{Binary}
A Fullscreen clock is displayed. Show Border, if enabled, will draw a small Binary mode can either display ones and zeros, or filled and empty circles, depending
box at every hour position (1 to 12 inclusive). on your chosen skin. The default binary skin imitates a segmented LCD.
Invert Seconds, if enabled, will invert the LCD as the seconds pass. The three rows show hours on top, followed by minutes, then seconds.
Second Hand, if enabled, will draw a second hand among the hour and minute hands.
\subsubsection{Binary mode}
This mode shows a Binary clock.
The hour is displayed on the top line, the minute is displayed on the middle
line, and the seconds are on the last line.
Circle mode, if enabled, draws empty and full circles, instead of zeros and ones.
For help on reading binary, please visit: For help on reading binary, please visit:
\url{http://en.wikipedia.org/wiki/Binary_numeral_system} \url{http://en.wikipedia.org/wiki/Binary_numeral_system}
\subsubsection{Plain mode}
This mode shows a ``plain'' clock in large text that takes up nearly the whole LCD.