Commit FS#11799 by Alexander Meshcheryakov. Improves the text viewer plugin to write...
[kugel-rb.git] / apps / plugins / text_viewer / tv_preferences.h
blobbb448b0f4bd99f0f4a74488f88c46e060ec7aabf
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_PREFERENCES_H
24 #define PLUGIN_TEXT_VIEWER_PREFERENCES_H
26 enum {
27 TV_CALLBACK_OK,
28 TV_CALLBACK_STOP,
29 TV_CALLBACK_ERROR,
32 /* word_mode */
33 enum {
34 WM_WRAP = 0,
35 WM_CHOP,
38 /* line_mode */
39 enum {
40 LM_NORMAL = 0,
41 LM_JOIN,
42 LM_EXPAND,
43 LM_REFLOW,
46 /* alignment */
47 enum {
48 AL_LEFT = 0,
49 AL_RIGHT,
52 /* horizontal_scroll_mode */
53 enum {
54 HS_SCREEN = 0,
55 HS_COLUMN,
58 /* vertical_scroll_mode */
59 enum {
60 VS_PAGE = 0,
61 VS_LINE,
64 /* narrow_mode */
65 enum {
66 NM_PAGE = 0,
67 NM_TOP_BOTTOM,
70 struct tv_preferences {
71 unsigned word_mode;
72 unsigned line_mode;
73 unsigned alignment;
75 unsigned encoding;
77 bool horizontal_scrollbar;
78 bool vertical_scrollbar;
80 bool overlap_page_mode;
81 bool header_mode;
82 bool footer_mode;
83 unsigned horizontal_scroll_mode;
84 unsigned vertical_scroll_mode;
86 int autoscroll_speed;
88 int windows;
90 unsigned narrow_mode;
92 unsigned indent_spaces;
94 bool statusbar;
96 #ifdef HAVE_LCD_BITMAP
97 unsigned char font_name[MAX_PATH];
98 struct font *font;
99 #endif
100 unsigned char file_name[MAX_PATH];
104 * global pointer to the preferences (read-only)
106 extern const struct tv_preferences * const preferences;
107 extern bool preferences_changed;
110 * change the preferences
112 * [In] new_prefs
113 * new preferences
115 * return
116 * true success
117 * false error
119 bool tv_set_preferences(const struct tv_preferences *new_prefs);
122 * copy the preferences
124 * [Out] copy_prefs
125 * the preferences in copy destination
127 void tv_copy_preferences(struct tv_preferences *copy_prefs);
130 * compare the preferences structs (binary)
132 * return
133 * true differs
134 * false identical
136 bool tv_compare_preferences(struct tv_preferences *copy_prefs);
139 * set the default settings
141 * [Out] p
142 * the preferences which store the default settings
144 void tv_set_default_preferences(struct tv_preferences *p);
147 * register the function to be executed when the current preferences is changed
149 * [In] listner
150 * the function to be executed when the current preferences is changed
152 void tv_add_preferences_change_listner(int (*listner)(const struct tv_preferences *oldp));
154 #endif