FS#11399 by me: fix r26998 for text_viewer
[kugel-rb.git] / apps / plugins / text_viewer / tv_pager.h
blob27795a1637146342f86481c5fefdcb998bc784a4
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 * [In/Out] buf
34 * the start pointer of the buffer
36 * [In/Out] size
37 * buffer size
39 * return
40 * true initialize success
41 * false initialize failure
43 bool tv_init_pager(unsigned char **buf, size_t *bufsize);
45 /* finalize the pager module */
46 void tv_finalize_pager(void);
48 /* reset the stored line positions */
49 void tv_reset_line_positions(void);
52 * move to the next line
54 * [In] size
55 * the current line size
57 void tv_move_next_line(int size);
60 * return the distance from the top of the current page
62 * [In] offset
63 * the difference between the current line
65 * return
66 * difference between the current line + offset from the top of the current page
68 int tv_get_line_positions(int offset);
70 /* change the new page */
71 void tv_new_page(void);
74 * convert the given file position to the nearest the position (page, line)
76 * [In] fpos
77 * the file position which want to convert
79 * [Out] pos
80 * result
82 void tv_convert_fpos(off_t fpos, struct tv_screen_pos *pos);
85 * move to the given page and line
87 * [In] page_offset
88 * page offset
90 * [In] line_offset
91 * line offset
93 * [In] whence
94 * SEEK_CUR seek to the current page + offset page, the current line + offset line.
95 * SEEK_SET seek to the offset page, offset line.
96 * SEEK_END seek to the reading last page + offset page,
97 * the last line of the reading last page + offset line.
99 void tv_move_screen(int page_offset, int line_offset, int whence);
101 #endif