mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-22 03:22:48 -05:00
text viewer: for tv_action and tv_bookmark, the prototype of the initializer is the same arguments as other modules.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27243 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0fef85e9db
commit
2cdf332f01
5 changed files with 83 additions and 25 deletions
|
|
@ -35,13 +35,23 @@ enum plugin_status plugin_start(const void* file)
|
||||||
long old_tick;
|
long old_tick;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
bool display_update = true;
|
bool display_update = true;
|
||||||
|
size_t size;
|
||||||
|
unsigned char *plugin_buf;
|
||||||
|
|
||||||
old_tick = *rb->current_tick;
|
old_tick = *rb->current_tick;
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
|
|
||||||
if (!tv_init(file)) {
|
/* get the plugin buffer */
|
||||||
|
plugin_buf = rb->plugin_get_buffer(&size);
|
||||||
|
|
||||||
|
if (!tv_init_action(&plugin_buf, &size)) {
|
||||||
|
rb->splash(HZ, "Error initialize");
|
||||||
|
return PLUGIN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tv_load_file(file)) {
|
||||||
rb->splash(HZ, "Error opening file");
|
rb->splash(HZ, "Error opening file");
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,26 +28,23 @@
|
||||||
#include "tv_settings.h"
|
#include "tv_settings.h"
|
||||||
#include "tv_window.h"
|
#include "tv_window.h"
|
||||||
|
|
||||||
bool tv_init(const unsigned char *file)
|
bool tv_init_action(unsigned char **buf, size_t *size)
|
||||||
{
|
{
|
||||||
size_t size;
|
/* initialize bookmarks and window modules */
|
||||||
|
return tv_init_bookmark(buf, size) && tv_init_window(buf, size);
|
||||||
|
}
|
||||||
|
|
||||||
/* get the plugin buffer */
|
static void tv_finalize_action(void)
|
||||||
unsigned char *buf = rb->plugin_get_buffer(&size);
|
{
|
||||||
|
/* save preference and bookmarks */
|
||||||
|
if (!tv_save_settings())
|
||||||
|
rb->splash(HZ, "Can't save preferences and bookmarks");
|
||||||
|
|
||||||
tv_init_bookmark();
|
/* finalize bookmark modules */
|
||||||
|
tv_finalize_bookmark();
|
||||||
|
|
||||||
/* initialize modules */
|
/* finalize window modules */
|
||||||
if (!tv_init_window(&buf, &size))
|
tv_finalize_window();
|
||||||
return false;
|
|
||||||
|
|
||||||
/* load the preferences and bookmark */
|
|
||||||
if (!tv_load_settings(file))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* select to read the page */
|
|
||||||
tv_select_bookmark();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tv_exit(void *parameter)
|
void tv_exit(void *parameter)
|
||||||
|
|
@ -59,7 +56,19 @@ void tv_exit(void *parameter)
|
||||||
rb->splash(HZ, "Can't save preferences and bookmarks");
|
rb->splash(HZ, "Can't save preferences and bookmarks");
|
||||||
|
|
||||||
/* finalize modules */
|
/* finalize modules */
|
||||||
tv_finalize_window();
|
tv_finalize_action();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tv_load_file(const unsigned char *file)
|
||||||
|
{
|
||||||
|
/* load the preferences and bookmark */
|
||||||
|
if (!tv_load_settings(file))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* select to read the page */
|
||||||
|
tv_select_bookmark();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tv_draw(void)
|
void tv_draw(void)
|
||||||
|
|
|
||||||
|
|
@ -42,16 +42,19 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize modules
|
* initialize the action module
|
||||||
*
|
*
|
||||||
* [In] file
|
* [In/Out] buf
|
||||||
* read file name
|
* the start pointer of the buffer
|
||||||
|
*
|
||||||
|
* [In/Out] size
|
||||||
|
* buffer size
|
||||||
*
|
*
|
||||||
* return
|
* return
|
||||||
* true initialize success
|
* true initialize success
|
||||||
* false initialize failure
|
* false initialize failure
|
||||||
*/
|
*/
|
||||||
bool tv_init(const unsigned char *file);
|
bool tv_init_action(unsigned char **buf, size_t *bufsize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* finalize modules
|
* finalize modules
|
||||||
|
|
@ -61,6 +64,18 @@ bool tv_init(const unsigned char *file);
|
||||||
*/
|
*/
|
||||||
void tv_exit(void *parameter);
|
void tv_exit(void *parameter);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* load the file
|
||||||
|
*
|
||||||
|
* [In] file
|
||||||
|
* read file name
|
||||||
|
*
|
||||||
|
* return
|
||||||
|
* true load success
|
||||||
|
* false load failure
|
||||||
|
*/
|
||||||
|
bool tv_load_file(const unsigned char *file);
|
||||||
|
|
||||||
/* draw the current page */
|
/* draw the current page */
|
||||||
void tv_draw(void);
|
void tv_draw(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,18 @@ static int tv_change_preferences(const struct tv_preferences *oldp)
|
||||||
return TV_CALLBACK_OK;
|
return TV_CALLBACK_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tv_init_bookmark(void)
|
bool tv_init_bookmark(unsigned char **buf, size_t *size)
|
||||||
{
|
{
|
||||||
|
(void)buf;
|
||||||
|
(void)size;
|
||||||
|
|
||||||
tv_add_preferences_change_listner(tv_change_preferences);
|
tv_add_preferences_change_listner(tv_change_preferences);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tv_finalize_bookmark(void)
|
||||||
|
{
|
||||||
|
/* no-operation function */
|
||||||
}
|
}
|
||||||
|
|
||||||
int tv_get_bookmark_positions(struct tv_screen_pos *pos_array)
|
int tv_get_bookmark_positions(struct tv_screen_pos *pos_array)
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,23 @@
|
||||||
/* Maximum amount of register possible bookmarks */
|
/* Maximum amount of register possible bookmarks */
|
||||||
#define TV_MAX_BOOKMARKS 16
|
#define TV_MAX_BOOKMARKS 16
|
||||||
|
|
||||||
/* initialize the bookmark module */
|
/*
|
||||||
void tv_init_bookmark(void);
|
* initialize the bookmark module
|
||||||
|
*
|
||||||
|
* [In/Out] buf
|
||||||
|
* the start pointer of the buffer
|
||||||
|
*
|
||||||
|
* [In/Out] size
|
||||||
|
* buffer size
|
||||||
|
*
|
||||||
|
* return
|
||||||
|
* true initialize success
|
||||||
|
* false initialize failure
|
||||||
|
*/
|
||||||
|
bool tv_init_bookmark(unsigned char **buf, size_t *size);
|
||||||
|
|
||||||
|
/* finalize the bookmark module */
|
||||||
|
void tv_finalize_bookmark(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get the positions which registered bookmarks
|
* get the positions which registered bookmarks
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue