text_viewer: cleanup & bugfix
[kugel-rb.git] / apps / plugins / text_viewer / tv_pager.h
blobec1de24b5a87b79e87ba61e00160275bcdb2879b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Gilles Roux
11 * 2003 Garrett Derner
12 * 2010 Yoshihisa Uchida
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
23 #ifndef PLUGIN_TEXT_VIEWER_PAGER_H
24 #define PLUGIN_TEXT_VIEWER_PAGER_H
26 #include "tv_screen_pos.h"
28 /* stuff for the paging */
31 * initialize the pager module
33 * return
34 * true initialize success
35 * false initialize failure
37 bool tv_init_pager(void);
39 /* finalize the pager module */
40 void tv_finalize_pager(void);
42 /* reset the stored line positions */
43 void tv_reset_line_positions(void);
46 * move to the next line
48 * [In] size
49 * the current line size
51 void tv_move_next_line(int size);
54 * return the distance from the top of the current page
56 * [In] offset
57 * the difference between the current line
59 * return
60 * difference between the current line + offset from the top of the current page
62 int tv_get_line_positions(int offset);
64 /* change the new page */
65 void tv_new_page(void);
68 * convert the given file position to the nearest the position (page, line)
70 * [In] fpos
71 * the file position which want to convert
73 * [Out] pos
74 * result
76 void tv_convert_fpos(off_t fpos, struct tv_screen_pos *pos);
79 * move to the given page and line
81 * [In] page_offset
82 * page offset
84 * [In] line_offset
85 * line offset
87 * [In] whence
88 * SEEK_CUR seek to the current page + offset page, the current line + offset line.
89 * SEEK_SET seek to the offset page, offset line.
90 * SEEK_END seek to the reading last page + offset page,
91 * the last line of the reading last page + offset line.
93 void tv_move_screen(int page_offset, int line_offset, int whence);
95 #endif