#include "plugin.h" #include "lib/configfile.h" #include "mpeg_settings.h" extern struct plugin_api* rb; struct mpeg_settings settings; static struct mpeg_settings old_settings; #define SETTINGS_VERSION 1 #define SETTINGS_MIN_VERSION 1 #define SETTINGS_FILENAME "mpegplayer.cfg" static char* showfps_options[] = {"No", "Yes"}; static char* limitfps_options[] = {"No", "Yes"}; static char* skipframes_options[] = {"No", "Yes"}; static struct configdata config[] = { {TYPE_ENUM, 0, 2, &settings.showfps, "Show FPS", showfps_options, NULL}, {TYPE_ENUM, 0, 2, &settings.limitfps, "Limit FPS", limitfps_options, NULL}, {TYPE_ENUM, 0, 2, &settings.skipframes, "Skip frames", skipframes_options, NULL}, }; bool mpeg_menu(void) { int m; int result; int menu_quit=0; static const struct opt_items noyes[2] = { { "No", -1 }, { "Yes", -1 }, }; static const struct menu_item items[] = { { "Display FPS", NULL }, { "Limit FPS", NULL }, { "Skip frames", NULL }, { "Quit mpegplayer", NULL }, }; m = rb->menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); rb->button_clear_queue(); while (!menu_quit) { result=rb->menu_show(m); switch(result) { case 0: /* Show FPS */ rb->set_option("Display FPS",&settings.showfps,INT, noyes, 2, NULL); break; case 1: /* Limit FPS */ rb->set_option("Limit FPS",&settings.limitfps,INT, noyes, 2, NULL); break; case 2: /* Skip frames */ rb->set_option("Skip frames",&settings.skipframes,INT, noyes, 2, NULL); break; default: menu_quit=1; break; } } rb->menu_exit(m); rb->lcd_clear_display(); rb->lcd_update(); return (result==3); } void init_settings(void) { /* Set the default settings */ settings.showfps = 0; /* Do not show FPS */ settings.limitfps = 0; /* Do not limit FPS */ settings.skipframes = 0; /* Do not skip frames */ configfile_init(rb); if (configfile_load(SETTINGS_FILENAME, config, sizeof(config)/sizeof(*config), SETTINGS_MIN_VERSION ) < 0) { /* If the loading failed, save a new config file (as the disk is already spinning) */ configfile_save(SETTINGS_FILENAME, config, sizeof(config)/sizeof(*config), SETTINGS_VERSION); } /* Keep a copy of the saved version of the settings - so we can check if the settings have changed when we quit */ old_settings = settings; } void save_settings(void) { /* Save the user settings if they have changed */ if (rb->memcmp(&settings,&old_settings,sizeof(settings))!=0) { configfile_save(SETTINGS_FILENAME, config, sizeof(config)/sizeof(*config), SETTINGS_VERSION); /* Store the settings in old_settings - to check for future changes */ old_settings = settings; } } ='#n7'>7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2007 Michael Sevakis
*
* LCD scrolling driver and scheduler
*
* Much collected and combined from the various Rockbox LCD drivers.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __SCROLL_ENGINE_H__
#define __SCROLL_ENGINE_H__
#include "config.h"
#include <lcd.h>
#include "file.h"
void scroll_init(void) INIT_ATTR;
void lcd_scroll_stop(const struct viewport* vp);
void lcd_scroll_stop_line(const struct viewport* vp, int y);
void lcd_scroll_fn(void);
#ifdef HAVE_REMOTE_LCD
void lcd_remote_scroll_fn(void);
void lcd_remote_scroll_stop(const struct viewport* vp);
void lcd_remote_scroll_stop_line(const struct viewport* vp, int y);
#endif
/* internal usage, but in multiple drivers */
#define SCROLL_SPACING 3
#ifdef HAVE_LCD_BITMAP
#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
#else
#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2)
#endif
struct scrollinfo
{
struct viewport* vp;
char line[SCROLL_LINE_SIZE];
#ifdef HAVE_LCD_CHARCELLS