diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-15 19:40:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch) | |
tree | 98ec96946eeb2ae709cb0528cc6998e21bb9b290 /apps/gui/buttonbar.c | |
parent | 17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff) | |
download | rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip |
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets
Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'apps/gui/buttonbar.c')
-rw-r--r-- | apps/gui/buttonbar.c | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/apps/gui/buttonbar.c b/apps/gui/buttonbar.c deleted file mode 100644 index 48ef6d0994..0000000000 --- a/apps/gui/buttonbar.c +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) Linus Nielsen Feltzing (2002) | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | /* | ||
22 | 2005 Kevin Ferrare : | ||
23 | - Multi screen support | ||
24 | - Rewrote a lot of code to avoid global vars and make it accept eventually | ||
25 | more that 3 buttons on the bar (just the prototype of gui_buttonbar_set | ||
26 | and the constant BUTTONBAR_MAX_BUTTONS to modify) | ||
27 | 2008 Jonathan Gordon | ||
28 | - redone to use viewports, items will NOT scroll in their vp. | ||
29 | Bar is always drawn at the bottom of the screen. This may be changed later. | ||
30 | Callers need to remember to adjust their viewports to not be overwitten | ||
31 | */ | ||
32 | #include "config.h" | ||
33 | #include "buttonbar.h" | ||
34 | #include "viewport.h" | ||
35 | #include "lcd.h" | ||
36 | #include "font.h" | ||
37 | #include "string-extra.h" | ||
38 | #include "settings.h" | ||
39 | |||
40 | static struct viewport bb_vp[NB_SCREENS]; | ||
41 | void gui_buttonbar_init(struct gui_buttonbar * buttonbar) | ||
42 | { | ||
43 | gui_buttonbar_unset(buttonbar); | ||
44 | FOR_NB_SCREENS(i) | ||
45 | { | ||
46 | viewport_set_defaults(&bb_vp[i], i); | ||
47 | bb_vp[i].font = FONT_SYSFIXED; | ||
48 | bb_vp[i].y = screens[i].lcdheight - BUTTONBAR_HEIGHT; | ||
49 | bb_vp[i].height = BUTTONBAR_HEIGHT; | ||
50 | bb_vp[i].drawmode = DRMODE_COMPLEMENT; | ||
51 | } | ||
52 | } | ||
53 | |||
54 | void gui_buttonbar_set_display(struct gui_buttonbar * buttonbar, | ||
55 | struct screen * display) | ||
56 | { | ||
57 | buttonbar->display = display; | ||
58 | } | ||
59 | |||
60 | static void gui_buttonbar_draw_button(struct gui_buttonbar * buttonbar, int num) | ||
61 | { | ||
62 | int button_width; | ||
63 | int fh, fw; | ||
64 | struct screen * display = buttonbar->display; | ||
65 | struct viewport vp = bb_vp[display->screen_type]; | ||
66 | |||
67 | button_width = display->lcdwidth/BUTTONBAR_MAX_BUTTONS; | ||
68 | vp.width = button_width-1; | ||
69 | vp.x = button_width * num; | ||
70 | display->set_viewport(&vp); | ||
71 | display->fill_viewport(); | ||
72 | if(buttonbar->caption[num][0] != 0) | ||
73 | { | ||
74 | display->getstringsize(buttonbar->caption[num], &fw, &fh); | ||
75 | display->putsxy((button_width - fw)/2, | ||
76 | (vp.height-fh)/2, buttonbar->caption[num]); | ||
77 | } | ||
78 | display->set_viewport(NULL); | ||
79 | } | ||
80 | |||
81 | void gui_buttonbar_set(struct gui_buttonbar * buttonbar, | ||
82 | const char *caption1, | ||
83 | const char *caption2, | ||
84 | const char *caption3) | ||
85 | { | ||
86 | gui_buttonbar_unset(buttonbar); | ||
87 | if(caption1) | ||
88 | { | ||
89 | strlcpy(buttonbar->caption[0], caption1, BUTTONBAR_CAPTION_LENGTH); | ||
90 | } | ||
91 | if(caption2) | ||
92 | { | ||
93 | strlcpy(buttonbar->caption[1], caption2, BUTTONBAR_CAPTION_LENGTH); | ||
94 | } | ||
95 | if(caption3) | ||
96 | { | ||
97 | strlcpy(buttonbar->caption[2], caption3, BUTTONBAR_CAPTION_LENGTH); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | void gui_buttonbar_unset(struct gui_buttonbar * buttonbar) | ||
102 | { | ||
103 | int i; | ||
104 | for(i = 0;i < BUTTONBAR_MAX_BUTTONS;i++) | ||
105 | buttonbar->caption[i][0] = 0; | ||
106 | } | ||
107 | |||
108 | void gui_buttonbar_draw(struct gui_buttonbar * buttonbar) | ||
109 | { | ||
110 | struct screen * display = buttonbar->display; | ||
111 | if(!global_settings.buttonbar || !gui_buttonbar_isset(buttonbar)) | ||
112 | return; | ||
113 | int i; | ||
114 | display->set_viewport(&bb_vp[display->screen_type]); | ||
115 | display->clear_viewport(); | ||
116 | for(i = 0;i < BUTTONBAR_MAX_BUTTONS;i++) | ||
117 | gui_buttonbar_draw_button(buttonbar, i); | ||
118 | display->set_viewport(&bb_vp[display->screen_type]); | ||
119 | display->update_viewport(); | ||
120 | display->set_viewport(NULL); | ||
121 | } | ||
122 | |||
123 | bool gui_buttonbar_isset(struct gui_buttonbar * buttonbar) | ||
124 | { | ||
125 | /* If all buttons are unset, the button bar is considered disabled */ | ||
126 | int i; | ||
127 | for(i = 0;i < BUTTONBAR_MAX_BUTTONS;i++) | ||
128 | if(buttonbar->caption[i][0] != 0) | ||
129 | return true; | ||
130 | return false; | ||
131 | } | ||