diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-11 00:05:12 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-11 00:05:12 +0000 |
commit | a27f2b8683204e337b142124979592ee1cd0d6f9 (patch) | |
tree | 2ba4041e90f3ae6fbbaf378a9c8f8718fc5f10e6 | |
parent | 30d664bbbc1a6a160f9fed03e619c0a6e8440970 (diff) | |
download | rockbox-a27f2b8683204e337b142124979592ee1cd0d6f9.tar.gz rockbox-a27f2b8683204e337b142124979592ee1cd0d6f9.zip |
A bit of const correctness and 80-char limit correction.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23083 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/viewport.c | 19 | ||||
-rw-r--r-- | apps/gui/viewport.h | 15 |
2 files changed, 21 insertions, 13 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index d8e5d721e9..6f9abb74a0 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c | |||
@@ -102,7 +102,8 @@ static bool showing_bars(enum screen_type screen) | |||
102 | return false; | 102 | return false; |
103 | } | 103 | } |
104 | 104 | ||
105 | void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen) | 105 | void viewport_set_fullscreen(struct viewport *vp, |
106 | const enum screen_type screen) | ||
106 | { | 107 | { |
107 | vp->x = 0; | 108 | vp->x = 0; |
108 | vp->width = screens[screen].lcdwidth; | 109 | vp->width = screens[screen].lcdwidth; |
@@ -113,14 +114,16 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen) | |||
113 | vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ | 114 | vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ |
114 | 115 | ||
115 | vp->height = screens[screen].lcdheight; | 116 | vp->height = screens[screen].lcdheight; |
116 | if (statusbar_position(screen) != STATUSBAR_BOTTOM && showing_bars(screen)) | 117 | if (statusbar_position(screen) != STATUSBAR_BOTTOM |
118 | && showing_bars(screen)) | ||
117 | vp->y = STATUSBAR_HEIGHT; | 119 | vp->y = STATUSBAR_HEIGHT; |
118 | else | 120 | else |
119 | vp->y = 0; | 121 | vp->y = 0; |
120 | #else | 122 | #else |
121 | vp->y = 0; | 123 | vp->y = 0; |
122 | #endif | 124 | #endif |
123 | vp->height = screens[screen].lcdheight - (showing_bars(screen)?STATUSBAR_HEIGHT:0); | 125 | vp->height = screens[screen].lcdheight |
126 | - (showing_bars(screen)?STATUSBAR_HEIGHT:0); | ||
124 | 127 | ||
125 | #if LCD_DEPTH > 1 | 128 | #if LCD_DEPTH > 1 |
126 | #ifdef HAVE_REMOTE_LCD | 129 | #ifdef HAVE_REMOTE_LCD |
@@ -144,7 +147,8 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen) | |||
144 | 147 | ||
145 | } | 148 | } |
146 | 149 | ||
147 | void viewport_set_defaults(struct viewport *vp, enum screen_type screen) | 150 | void viewport_set_defaults(struct viewport *vp, |
151 | const enum screen_type screen) | ||
148 | { | 152 | { |
149 | #ifdef HAVE_LCD_BITMAP | 153 | #ifdef HAVE_LCD_BITMAP |
150 | if (ui_vp_info.active[screen]) | 154 | if (ui_vp_info.active[screen]) |
@@ -173,7 +177,7 @@ int viewportmanager_get_statusbar(void) | |||
173 | return statusbar_enabled; | 177 | return statusbar_enabled; |
174 | } | 178 | } |
175 | 179 | ||
176 | int viewportmanager_set_statusbar(int enabled) | 180 | int viewportmanager_set_statusbar(const int enabled) |
177 | { | 181 | { |
178 | int old = statusbar_enabled; | 182 | int old = statusbar_enabled; |
179 | statusbar_enabled = enabled; | 183 | statusbar_enabled = enabled; |
@@ -214,7 +218,7 @@ static void statusbar_toggled(void* param) | |||
214 | viewportmanager_theme_changed(THEME_STATUSBAR); | 218 | viewportmanager_theme_changed(THEME_STATUSBAR); |
215 | } | 219 | } |
216 | 220 | ||
217 | void viewportmanager_theme_changed(int which) | 221 | void viewportmanager_theme_changed(const int which) |
218 | { | 222 | { |
219 | int i; | 223 | int i; |
220 | #ifdef HAVE_BUTTONBAR | 224 | #ifdef HAVE_BUTTONBAR |
@@ -341,7 +345,8 @@ static unsigned viewport_init_ui_vp(void) | |||
341 | 345 | ||
342 | #ifdef HAVE_TOUCHSCREEN | 346 | #ifdef HAVE_TOUCHSCREEN |
343 | /* check if a point (x and y coordinates) are within a viewport */ | 347 | /* check if a point (x and y coordinates) are within a viewport */ |
344 | bool viewport_point_within_vp(const struct viewport *vp, int x, int y) | 348 | bool viewport_point_within_vp(const struct viewport *vp, |
349 | const int x, const int y) | ||
345 | { | 350 | { |
346 | bool is_x = (x >= vp->x && x < (vp->x + vp->width)); | 351 | bool is_x = (x >= vp->x && x < (vp->x + vp->width)); |
347 | bool is_y = (y >= vp->y && y < (vp->y + vp->height)); | 352 | bool is_y = (y >= vp->y && y < (vp->y + vp->height)); |
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h index cedb27e01c..cffc7fbaef 100644 --- a/apps/gui/viewport.h +++ b/apps/gui/viewport.h | |||
@@ -31,7 +31,8 @@ | |||
31 | /* return the number of text lines in the vp viewport */ | 31 | /* return the number of text lines in the vp viewport */ |
32 | int viewport_get_nb_lines(const struct viewport *vp); | 32 | int viewport_get_nb_lines(const struct viewport *vp); |
33 | 33 | ||
34 | void viewport_set_defaults(struct viewport *vp, enum screen_type screen); | 34 | void viewport_set_defaults(struct viewport *vp, |
35 | const enum screen_type screen); | ||
35 | 36 | ||
36 | /* Used to specify which screens the statusbar (SB) should be displayed on. | 37 | /* Used to specify which screens the statusbar (SB) should be displayed on. |
37 | * | 38 | * |
@@ -73,19 +74,20 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen); | |||
73 | */ | 74 | */ |
74 | void viewportmanager_init(void); | 75 | void viewportmanager_init(void); |
75 | int viewportmanager_get_statusbar(void); | 76 | int viewportmanager_get_statusbar(void); |
76 | int viewportmanager_set_statusbar(int enabled); | 77 | int viewportmanager_set_statusbar(const int enabled); |
77 | 78 | ||
78 | 79 | ||
79 | /* | 80 | /* |
80 | * Initializes the given viewport with maximum dimensions minus status- and | 81 | * Initializes the given viewport with maximum dimensions minus status- and |
81 | * buttonbar | 82 | * buttonbar |
82 | */ | 83 | */ |
83 | void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen); | 84 | void viewport_set_fullscreen(struct viewport *vp, |
85 | const enum screen_type screen); | ||
84 | 86 | ||
85 | #ifdef HAVE_LCD_BITMAP | 87 | #ifdef HAVE_LCD_BITMAP |
86 | 88 | ||
87 | /* call this when a theme changed */ | 89 | /* call this when a theme changed */ |
88 | void viewportmanager_theme_changed(int); | 90 | void viewportmanager_theme_changed(const int); |
89 | 91 | ||
90 | /* | 92 | /* |
91 | * Returns a pointer to the current viewport | 93 | * Returns a pointer to the current viewport |
@@ -103,9 +105,10 @@ void viewport_set_current_vp(struct viewport* vp); | |||
103 | /* | 105 | /* |
104 | * returns true if the ui viewport is active on the screen | 106 | * returns true if the ui viewport is active on the screen |
105 | */ | 107 | */ |
106 | bool viewport_ui_vp_get_state(enum screen_type screen); | 108 | bool viewport_ui_vp_get_state(const enum screen_type screen); |
107 | #ifdef HAVE_TOUCHSCREEN | 109 | #ifdef HAVE_TOUCHSCREEN |
108 | bool viewport_point_within_vp(const struct viewport *vp, int x, int y); | 110 | bool viewport_point_within_vp(const struct viewport *vp, |
111 | const int x, const int y); | ||
109 | #endif | 112 | #endif |
110 | 113 | ||
111 | #else /* HAVE_LCD_CHARCELL */ | 114 | #else /* HAVE_LCD_CHARCELL */ |