make sure plugin reset backlight setting before exit. do code polish.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24076 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3e2aba0c3e
commit
dc010201a5
9 changed files with 73 additions and 71 deletions
70
apps/misc.c
70
apps/misc.c
|
@ -124,7 +124,7 @@ char *output_dyn_value(char *buf, int buf_size, int value,
|
||||||
snprintf(tbuf, sizeof(tbuf), "%01d", fraction / 100);
|
snprintf(tbuf, sizeof(tbuf), "%01d", fraction / 100);
|
||||||
else
|
else
|
||||||
snprintf(tbuf, sizeof(tbuf), "%02d", fraction / 10);
|
snprintf(tbuf, sizeof(tbuf), "%02d", fraction / 10);
|
||||||
|
|
||||||
if (buf)
|
if (buf)
|
||||||
{
|
{
|
||||||
if (strlen(tbuf))
|
if (strlen(tbuf))
|
||||||
|
@ -168,7 +168,7 @@ int read_line(int fd, char* buffer, int buffer_size)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int num_read = 0;
|
int num_read = 0;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
while (count < buffer_size)
|
while (count < buffer_size)
|
||||||
|
@ -177,9 +177,9 @@ int read_line(int fd, char* buffer, int buffer_size)
|
||||||
|
|
||||||
if (1 != read(fd, &c, 1))
|
if (1 != read(fd, &c, 1))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
num_read++;
|
num_read++;
|
||||||
|
|
||||||
if ( c == '\n' )
|
if ( c == '\n' )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -201,15 +201,15 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
|
||||||
char *p, *next;
|
char *p, *next;
|
||||||
int rc, pos = 0;
|
int rc, pos = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
next = NULL;
|
next = NULL;
|
||||||
|
|
||||||
rc = read(fd, &buf[pos], buf_size - pos - 1);
|
rc = read(fd, &buf[pos], buf_size - pos - 1);
|
||||||
if (rc >= 0)
|
if (rc >= 0)
|
||||||
buf[pos+rc] = '\0';
|
buf[pos+rc] = '\0';
|
||||||
|
|
||||||
if ( (p = strchr(buf, '\r')) != NULL)
|
if ( (p = strchr(buf, '\r')) != NULL)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -217,17 +217,17 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p = buf;
|
p = buf;
|
||||||
|
|
||||||
if ( (p = strchr(p, '\n')) != NULL)
|
if ( (p = strchr(p, '\n')) != NULL)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
next = ++p;
|
next = ++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = callback(count, buf, parameters);
|
rc = callback(count, buf, parameters);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
if (next)
|
if (next)
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
|
||||||
else
|
else
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
|
||||||
splashf(0, "%s %s", str(LANG_WARNING_BATTERY_EMPTY),
|
splashf(0, "%s %s", str(LANG_WARNING_BATTERY_EMPTY),
|
||||||
str(LANG_SHUTTINGDOWN));
|
str(LANG_SHUTTINGDOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global_settings.fade_on_stop
|
if (global_settings.fade_on_stop
|
||||||
&& (audio_stat & AUDIO_STATUS_PLAY))
|
&& (audio_stat & AUDIO_STATUS_PLAY))
|
||||||
{
|
{
|
||||||
|
@ -371,7 +371,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
|
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
|
||||||
audio_close_recording();
|
audio_close_recording();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(global_settings.talk_menu)
|
if(global_settings.talk_menu)
|
||||||
|
@ -461,11 +461,11 @@ static bool waiting_to_resume_play = false;
|
||||||
static long play_resume_tick;
|
static long play_resume_tick;
|
||||||
|
|
||||||
static void car_adapter_mode_processing(bool inserted)
|
static void car_adapter_mode_processing(bool inserted)
|
||||||
{
|
{
|
||||||
if (global_settings.car_adapter_mode)
|
if (global_settings.car_adapter_mode)
|
||||||
{
|
{
|
||||||
if(inserted)
|
if(inserted)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Just got plugged in, delay & resume if we were playing
|
* Just got plugged in, delay & resume if we were playing
|
||||||
*/
|
*/
|
||||||
|
@ -598,7 +598,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
||||||
case SYS_CHARGER_CONNECTED:
|
case SYS_CHARGER_CONNECTED:
|
||||||
car_adapter_mode_processing(true);
|
car_adapter_mode_processing(true);
|
||||||
return SYS_CHARGER_CONNECTED;
|
return SYS_CHARGER_CONNECTED;
|
||||||
|
|
||||||
case SYS_CHARGER_DISCONNECTED:
|
case SYS_CHARGER_DISCONNECTED:
|
||||||
car_adapter_mode_processing(false);
|
car_adapter_mode_processing(false);
|
||||||
return SYS_CHARGER_DISCONNECTED;
|
return SYS_CHARGER_DISCONNECTED;
|
||||||
|
@ -634,12 +634,12 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
||||||
return SYS_PHONE_UNPLUGGED;
|
return SYS_PHONE_UNPLUGGED;
|
||||||
#endif
|
#endif
|
||||||
#ifdef IPOD_ACCESSORY_PROTOCOL
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
||||||
case SYS_IAP_PERIODIC:
|
case SYS_IAP_PERIODIC:
|
||||||
iap_periodic();
|
iap_periodic();
|
||||||
return SYS_IAP_PERIODIC;
|
return SYS_IAP_PERIODIC;
|
||||||
case SYS_IAP_HANDLEPKT:
|
case SYS_IAP_HANDLEPKT:
|
||||||
iap_handlepkt();
|
iap_handlepkt();
|
||||||
return SYS_IAP_HANDLEPKT;
|
return SYS_IAP_HANDLEPKT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -772,7 +772,7 @@ char* strrsplt(char* str, int c)
|
||||||
{
|
{
|
||||||
s = str;
|
s = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,14 +857,14 @@ void format_time(char* buf, int buf_size, long t)
|
||||||
{
|
{
|
||||||
if ( t < 3600000 )
|
if ( t < 3600000 )
|
||||||
{
|
{
|
||||||
snprintf(buf, buf_size, "%d:%02d",
|
snprintf(buf, buf_size, "%d:%02d",
|
||||||
(int) (t / 60000), (int) (t % 60000 / 1000));
|
(int) (t / 60000), (int) (t % 60000 / 1000));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(buf, buf_size, "%d:%02d:%02d",
|
snprintf(buf, buf_size, "%d:%02d:%02d",
|
||||||
(int) (t / 3600000), (int) (t % 3600000 / 60000),
|
(int) (t / 3600000), (int) (t % 3600000 / 60000),
|
||||||
(int) (t % 60000 / 1000));
|
(int) (t % 60000 / 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ int open_utf8(const char* pathname, int flags)
|
||||||
read(fd, bom, BOM_SIZE);
|
read(fd, bom, BOM_SIZE);
|
||||||
/* check for BOM */
|
/* check for BOM */
|
||||||
if(memcmp(bom, BOM, BOM_SIZE))
|
if(memcmp(bom, BOM, BOM_SIZE))
|
||||||
lseek(fd, 0, SEEK_SET);
|
lseek(fd, 0, SEEK_SET);
|
||||||
}
|
}
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
@ -908,8 +908,8 @@ int open_utf8(const char* pathname, int flags)
|
||||||
|
|
||||||
static int hex2dec(int c)
|
static int hex2dec(int c)
|
||||||
{
|
{
|
||||||
return (((c) >= '0' && ((c) <= '9')) ? (c) - '0' :
|
return (((c) >= '0' && ((c) <= '9')) ? (c) - '0' :
|
||||||
(toupper(c)) - 'A' + 10);
|
(toupper(c)) - 'A' + 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hex_to_rgb(const char* hex, int* color)
|
int hex_to_rgb(const char* hex, int* color)
|
||||||
|
@ -986,7 +986,7 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
|
||||||
|
|
||||||
*s = p;
|
*s = p;
|
||||||
while (*p && *p != sep)
|
while (*p && *p != sep)
|
||||||
p++;
|
p++;
|
||||||
set = (s[0][0]!='-') && (s[0][1]!=sep) ;
|
set = (s[0][0]!='-') && (s[0][1]!=sep) ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1007,9 +1007,9 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*d = *p++ - '0';
|
*d = *p++ - '0';
|
||||||
while (isdigit(*p))
|
while (isdigit(*p))
|
||||||
*d = (*d * 10) + (*p++ - '0');
|
*d = (*d * 10) + (*p++ - '0');
|
||||||
set = true;
|
set = true;
|
||||||
if (is_negative)
|
if (is_negative)
|
||||||
*d *= -1;
|
*d *= -1;
|
||||||
|
|
|
@ -64,7 +64,7 @@ rockblox1d.c
|
||||||
brickmania.c
|
brickmania.c
|
||||||
calendar.c
|
calendar.c
|
||||||
maze.c
|
maze.c
|
||||||
mazezam.c
|
mazezam.c
|
||||||
text_editor.c
|
text_editor.c
|
||||||
wavview.c
|
wavview.c
|
||||||
robotfindskitten.c
|
robotfindskitten.c
|
||||||
|
|
|
@ -136,7 +136,7 @@ enum {
|
||||||
#define BJACK_LEFT BUTTON_LEFT
|
#define BJACK_LEFT BUTTON_LEFT
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
||||||
#define BJACK_SELECT_NAME "PLAY"
|
#define BJACK_SELECT_NAME "SELECT"
|
||||||
#define BJACK_STAY_NAME "REC"
|
#define BJACK_STAY_NAME "REC"
|
||||||
#define BJACK_RESUME_NAME "DOWN"
|
#define BJACK_RESUME_NAME "DOWN"
|
||||||
#define BJACK_QUIT_NAME "POWER"
|
#define BJACK_QUIT_NAME "POWER"
|
||||||
|
|
|
@ -208,20 +208,20 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
x = 2*GFX_WIDTH-x;
|
x = 2*GFX_WIDTH-x;
|
||||||
sx=-sx;
|
sx=-sx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x<0)
|
if (x<0)
|
||||||
{
|
{
|
||||||
x = -x;
|
x = -x;
|
||||||
sx = -sx;
|
sx = -sx;
|
||||||
}
|
}
|
||||||
|
|
||||||
y+=sy;
|
y+=sy;
|
||||||
if (y>GFX_HEIGHT)
|
if (y>GFX_HEIGHT)
|
||||||
{
|
{
|
||||||
y = 2*GFX_HEIGHT-y;
|
y = 2*GFX_HEIGHT-y;
|
||||||
sy=-sy;
|
sy=-sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y<0)
|
if (y<0)
|
||||||
{
|
{
|
||||||
y = -y;
|
y = -y;
|
||||||
|
@ -235,7 +235,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
MYLCD(update)();
|
MYLCD(update)();
|
||||||
|
|
||||||
rb->sleep(HZ/timer);
|
rb->sleep(HZ/timer);
|
||||||
|
|
||||||
button = rb->button_get(false);
|
button = rb->button_get(false);
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
|
@ -254,7 +254,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
if (timer>20)
|
if (timer>20)
|
||||||
timer=5;
|
timer=5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MOSAIQUE_RESTART:
|
case MOSAIQUE_RESTART:
|
||||||
|
|
||||||
sx = rb->rand() % (GFX_HEIGHT/2) + 1;
|
sx = rb->rand() % (GFX_HEIGHT/2) + 1;
|
||||||
|
@ -278,5 +278,3 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -676,7 +676,7 @@ static void play_game()
|
||||||
{
|
{
|
||||||
int old_x = robot.x;
|
int old_x = robot.x;
|
||||||
int old_y = robot.y;
|
int old_y = robot.y;
|
||||||
int input = 0; /* Not sure what a reasonable initial value is */
|
int input = BUTTON_NONE;
|
||||||
#ifdef __PLUGINLIB_ACTIONS_H__
|
#ifdef __PLUGINLIB_ACTIONS_H__
|
||||||
const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions};
|
const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -131,7 +131,7 @@ static bool load_cellfile(const char *file, char *pgrid){
|
||||||
fd = rb->open(file, O_RDONLY);
|
fd = rb->open(file, O_RDONLY);
|
||||||
if (fd<0)
|
if (fd<0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
init_grid(pgrid);
|
init_grid(pgrid);
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
|
@ -143,7 +143,7 @@ static bool load_cellfile(const char *file, char *pgrid){
|
||||||
ymid = (GRID_H>>1) - 2;
|
ymid = (GRID_H>>1) - 2;
|
||||||
comment = false;
|
comment = false;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
nc = rb->read(fd, &c, 1);
|
nc = rb->read(fd, &c, 1);
|
||||||
if (nc <= 0)
|
if (nc <= 0)
|
||||||
break;
|
break;
|
||||||
|
@ -343,7 +343,7 @@ static inline bool check_cell(unsigned char *n)
|
||||||
|
|
||||||
/* now we build the number of non-zero neighbours :-P */
|
/* now we build the number of non-zero neighbours :-P */
|
||||||
alive_cells = 8 - empty_cells;
|
alive_cells = 8 - empty_cells;
|
||||||
|
|
||||||
if (n[4]) {
|
if (n[4]) {
|
||||||
/* If the cell is alive, it stays alive iff it has 2 or 3 alive neighbours */
|
/* If the cell is alive, it stays alive iff it has 2 or 3 alive neighbours */
|
||||||
result = (alive_cells==2 || alive_cells==3);
|
result = (alive_cells==2 || alive_cells==3);
|
||||||
|
@ -468,6 +468,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
int button = 0;
|
int button = 0;
|
||||||
int quit = 0;
|
int quit = 0;
|
||||||
int stop = 0;
|
int stop = 0;
|
||||||
|
int usb = 0;
|
||||||
int pattern = 0;
|
int pattern = 0;
|
||||||
char *pgrid;
|
char *pgrid;
|
||||||
char *pnext_grid;
|
char *pnext_grid;
|
||||||
|
@ -488,8 +489,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
pgrid = (char *)grid_a;
|
pgrid = (char *)grid_a;
|
||||||
pnext_grid = (char *)grid_b;
|
pnext_grid = (char *)grid_b;
|
||||||
|
|
||||||
init_grid(pgrid);
|
init_grid(pgrid);
|
||||||
|
|
||||||
|
|
||||||
if( parameter == NULL )
|
if( parameter == NULL )
|
||||||
{
|
{
|
||||||
|
@ -544,6 +544,11 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
stop = 1;
|
stop = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
||||||
|
stop = 1;
|
||||||
|
quit = 1;
|
||||||
|
usb = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb->yield();
|
rb->yield();
|
||||||
|
@ -562,12 +567,12 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
break;
|
break;
|
||||||
case ROCKLIFE_QUIT:
|
case ROCKLIFE_QUIT:
|
||||||
/* quit plugin */
|
/* quit plugin */
|
||||||
quit=true;
|
quit = 1;
|
||||||
return PLUGIN_OK;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
||||||
return PLUGIN_USB_CONNECTED;
|
quit = 1;
|
||||||
|
usb = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -575,5 +580,5 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
}
|
}
|
||||||
|
|
||||||
backlight_use_settings(); /* backlight control in lib/helper.c */
|
backlight_use_settings(); /* backlight control in lib/helper.c */
|
||||||
return PLUGIN_OK;
|
return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,8 +482,6 @@ int plugin_main(void)
|
||||||
#endif
|
#endif
|
||||||
case(STARFIELD_QUIT):
|
case(STARFIELD_QUIT):
|
||||||
case(SYS_USB_CONNECTED):
|
case(SYS_USB_CONNECTED):
|
||||||
/* Turn on backlight timeout (revert to settings) */
|
|
||||||
backlight_use_settings(); /* backlight control in lib/helper.c*/
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -502,6 +500,9 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
|
|
||||||
ret = plugin_main();
|
ret = plugin_main();
|
||||||
|
|
||||||
|
/* Turn on backlight timeout (revert to settings) */
|
||||||
|
backlight_use_settings(); /* backlight control in lib/helper.c*/
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ char* _do_action(int action, char* str, int line)
|
||||||
break;
|
break;
|
||||||
case ACTION_REMOVE:
|
case ACTION_REMOVE:
|
||||||
if (line > line_count)
|
if (line > line_count)
|
||||||
return 0;
|
return NULL;
|
||||||
len = rb->strlen(&buffer[c])+1;
|
len = rb->strlen(&buffer[c])+1;
|
||||||
rb->memmove(&buffer[c],&buffer[c+len],char_count-c-len);
|
rb->memmove(&buffer[c],&buffer[c+len],char_count-c-len);
|
||||||
char_count -= len;
|
char_count -= len;
|
||||||
|
@ -225,7 +225,7 @@ enum {
|
||||||
};
|
};
|
||||||
int do_item_menu(int cur_sel, char* copy_buffer)
|
int do_item_menu(int cur_sel, char* copy_buffer)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = MENU_RET_NO_UPDATE;
|
||||||
MENUITEM_STRINGLIST(menu, "Line Options", NULL,
|
MENUITEM_STRINGLIST(menu, "Line Options", NULL,
|
||||||
"Cut/Delete", "Copy",
|
"Cut/Delete", "Copy",
|
||||||
"Insert Above", "Insert Below",
|
"Insert Above", "Insert Below",
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
*
|
|
||||||
* __________ __ ___.
|
* __________ __ ___.
|
||||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
*
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner
|
* Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner
|
||||||
*
|
*
|
||||||
|
@ -432,7 +431,6 @@ struct preferences {
|
||||||
} scroll_mode;
|
} scroll_mode;
|
||||||
|
|
||||||
int autoscroll_speed;
|
int autoscroll_speed;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct preferences prefs;
|
struct preferences prefs;
|
||||||
|
@ -1226,7 +1224,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same
|
||||||
int settings_fd, i;
|
int settings_fd, i;
|
||||||
struct bookmark_file_data *data;
|
struct bookmark_file_data *data;
|
||||||
struct bookmarked_file_info this_bookmark;
|
struct bookmarked_file_info this_bookmark;
|
||||||
|
|
||||||
/* read settings file */
|
/* read settings file */
|
||||||
settings_fd=rb->open(SETTINGS_FILE, O_RDONLY);
|
settings_fd=rb->open(SETTINGS_FILE, O_RDONLY);
|
||||||
if ((settings_fd >= 0) && (rb->filesize(settings_fd) == sizeof(struct preferences)))
|
if ((settings_fd >= 0) && (rb->filesize(settings_fd) == sizeof(struct preferences)))
|
||||||
|
@ -1271,7 +1269,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same
|
||||||
file_pos = screen_pos - screen_top;
|
file_pos = screen_pos - screen_top;
|
||||||
screen_top_ptr = buffer + screen_top;
|
screen_top_ptr = buffer + screen_top;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this_bookmark.file_position = file_pos;
|
this_bookmark.file_position = file_pos;
|
||||||
|
@ -1284,16 +1282,16 @@ static void viewer_load_settings(void) /* same name as global, but not the same
|
||||||
if (i >= data->bookmarked_files_count)
|
if (i >= data->bookmarked_files_count)
|
||||||
{
|
{
|
||||||
if (i < MAX_BOOKMARKED_FILES)
|
if (i < MAX_BOOKMARKED_FILES)
|
||||||
data->bookmarked_files_count++;
|
data->bookmarked_files_count++;
|
||||||
else
|
else
|
||||||
i = MAX_BOOKMARKED_FILES-1;
|
i = MAX_BOOKMARKED_FILES-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write bookmark file with spare slot in first position
|
/* write bookmark file with spare slot in first position
|
||||||
to be filled in by viewer_save_settings */
|
to be filled in by viewer_save_settings */
|
||||||
settings_fd = rb->open(BOOKMARKS_FILE, O_WRONLY|O_CREAT);
|
settings_fd = rb->open(BOOKMARKS_FILE, O_WRONLY|O_CREAT);
|
||||||
if (settings_fd >=0 )
|
if (settings_fd >=0 )
|
||||||
{
|
{
|
||||||
/* write count */
|
/* write count */
|
||||||
rb->write (settings_fd, &data->bookmarked_files_count, sizeof(signed int));
|
rb->write (settings_fd, &data->bookmarked_files_count, sizeof(signed int));
|
||||||
|
|
||||||
|
@ -1336,7 +1334,7 @@ static void viewer_save_settings(void)/* same name as global, but not the same f
|
||||||
rb->close(settings_fd);
|
rb->close(settings_fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the bookmark if the position has changed */
|
/* save the bookmark if the position has changed */
|
||||||
if (file_pos + screen_top_ptr - buffer != start_position)
|
if (file_pos + screen_top_ptr - buffer != start_position)
|
||||||
{
|
{
|
||||||
|
@ -1559,11 +1557,11 @@ enum plugin_status plugin_start(const void* file)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer_load_settings(); /* load the preferences and bookmark */
|
viewer_load_settings(); /* load the preferences and bookmark */
|
||||||
|
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
rb->lcd_set_backdrop(NULL);
|
rb->lcd_set_backdrop(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
viewer_draw(col);
|
viewer_draw(col);
|
||||||
|
|
||||||
while (!done) {
|
while (!done) {
|
||||||
|
@ -1577,7 +1575,7 @@ enum plugin_status plugin_start(const void* file)
|
||||||
old_tick = *rb->current_tick;
|
old_tick = *rb->current_tick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button = rb->button_get_w_tmo(HZ/10);
|
button = rb->button_get_w_tmo(HZ/10);
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case VIEWER_MENU:
|
case VIEWER_MENU:
|
||||||
|
|
Loading…
Reference in a new issue