diff options
author | Markus Braun <markus.braun@krawel.de> | 2002-08-07 10:35:26 +0000 |
---|---|---|
committer | Markus Braun <markus.braun@krawel.de> | 2002-08-07 10:35:26 +0000 |
commit | de8fbf00a8a4a2c85fc9ee4b2758881f4ec435d9 (patch) | |
tree | 5cc60884b43b291f3878527413c4d7f21f210624 /apps/recorder/widgets.c | |
parent | 999e2127af292ffac2d36dcb54b78a2f1abce6bf (diff) | |
download | rockbox-de8fbf00a8a4a2c85fc9ee4b2758881f4ec435d9.tar.gz rockbox-de8fbf00a8a4a2c85fc9ee4b2758881f4ec435d9.zip |
Added status bar to file browser and wps
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1582 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/widgets.c')
-rw-r--r-- | apps/recorder/widgets.c | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/apps/recorder/widgets.c b/apps/recorder/widgets.c new file mode 100644 index 0000000000..1c3f0b1a10 --- /dev/null +++ b/apps/recorder/widgets.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: not checked in | ||
9 | * | ||
10 | * Copyright (C) 2002 Markus Braun | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include <lcd.h> | ||
20 | |||
21 | #include "widgets.h" | ||
22 | |||
23 | #ifdef HAVE_LCD_BITMAP | ||
24 | /* | ||
25 | * Print a progress bar | ||
26 | */ | ||
27 | void progressbar(int x, int y, int width, int height, int percent, int direction) | ||
28 | { | ||
29 | int pos; | ||
30 | int i,j; | ||
31 | |||
32 | /* draw horizontal lines */ | ||
33 | for(i=x+1;i<=x+width-2;i++) { | ||
34 | DRAW_PIXEL(i,y); | ||
35 | DRAW_PIXEL(i,(y+height-1)); | ||
36 | } | ||
37 | |||
38 | /* draw vertical lines */ | ||
39 | for(i=1;i<height;i++) { | ||
40 | DRAW_PIXEL(x,(y+i)); | ||
41 | DRAW_PIXEL((x+width-1),(y+i)); | ||
42 | } | ||
43 | |||
44 | /* clear edge pixels */ | ||
45 | CLEAR_PIXEL(x,y); | ||
46 | CLEAR_PIXEL((x+width-1),y); | ||
47 | CLEAR_PIXEL(x,(y+height-1)); | ||
48 | CLEAR_PIXEL((x+width-1),(y+height-1)); | ||
49 | |||
50 | /* clear pixels in progress bar */ | ||
51 | for(i=1;i<=width-2;i++) { | ||
52 | for(j=1;j<=height-2;j++) { | ||
53 | CLEAR_PIXEL((x+i),(y+j)); | ||
54 | CLEAR_PIXEL((x+i),(y+j)); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | /* draw bar */ | ||
59 | pos=percent; | ||
60 | if(pos<0) | ||
61 | pos=0; | ||
62 | if(pos>100) | ||
63 | pos=100; | ||
64 | |||
65 | switch (direction) | ||
66 | { | ||
67 | case Grow_Right: | ||
68 | pos=(width-2)*pos/100; | ||
69 | for(i=1;i<=pos;i++) | ||
70 | for(j=1;j<height-1;j++) | ||
71 | DRAW_PIXEL((x+i),(y+j)); | ||
72 | break; | ||
73 | case Grow_Left: | ||
74 | pos=(width-2)*(100-pos)/100; | ||
75 | for(i=pos+1;i<=width-2;i++) | ||
76 | for(j=1;j<height-1;j++) | ||
77 | DRAW_PIXEL((x+i),(y+j)); | ||
78 | break; | ||
79 | case Grow_Down: | ||
80 | pos=(height-2)*pos/100; | ||
81 | for(i=1;i<=pos;i++) | ||
82 | for(j=1;j<width-1;j++) | ||
83 | DRAW_PIXEL((x+j),(y+i)); | ||
84 | break; | ||
85 | case Grow_Up: | ||
86 | pos=(height-2)*(100-pos)/100; | ||
87 | for(i=pos+1;i<=height-2;i++) | ||
88 | for(j=1;j<width-1;j++) | ||
89 | DRAW_PIXEL((x+j),(y+i)); | ||
90 | break; | ||
91 | } | ||
92 | |||
93 | } | ||
94 | |||
95 | |||
96 | /* | ||
97 | * Print a slidebar bar | ||
98 | */ | ||
99 | void slidebar(int x, int y, int width, int height, int percent, int direction) | ||
100 | { | ||
101 | int pos; | ||
102 | int i,j; | ||
103 | |||
104 | /* draw horizontal lines */ | ||
105 | for(i=x+1;i<=x+width-2;i++) { | ||
106 | DRAW_PIXEL(i,y); | ||
107 | DRAW_PIXEL(i,(y+height-1)); | ||
108 | } | ||
109 | |||
110 | /* draw vertical lines */ | ||
111 | for(i=1;i<height;i++) { | ||
112 | DRAW_PIXEL(x,(y+i)); | ||
113 | DRAW_PIXEL((x+width-1),(y+i)); | ||
114 | } | ||
115 | |||
116 | /* clear edge pixels */ | ||
117 | CLEAR_PIXEL(x,y); | ||
118 | CLEAR_PIXEL((x+width-1),y); | ||
119 | CLEAR_PIXEL(x,(y+height-1)); | ||
120 | CLEAR_PIXEL((x+width-1),(y+height-1)); | ||
121 | |||
122 | /* clear pixels in progress bar */ | ||
123 | for(i=1;i<=width-2;i++) | ||
124 | for(j=1;j<=height-2;j++) { | ||
125 | CLEAR_PIXEL((x+i),(y+j)); | ||
126 | CLEAR_PIXEL((x+i),(y+j)); | ||
127 | } | ||
128 | |||
129 | /* draw point */ | ||
130 | pos=percent; | ||
131 | if(pos<0) | ||
132 | pos=0; | ||
133 | if(pos>100) | ||
134 | pos=100; | ||
135 | |||
136 | switch (direction) | ||
137 | { | ||
138 | case Grow_Right: | ||
139 | pos=(width-height-1)*pos/100; | ||
140 | break; | ||
141 | case Grow_Left: | ||
142 | pos=(width-height-1)*(100-pos)/100; | ||
143 | break; | ||
144 | case Grow_Down: | ||
145 | pos=(height-width-1)*pos/100; | ||
146 | break; | ||
147 | case Grow_Up: | ||
148 | pos=(height-width-1)*(100-pos)/100; | ||
149 | break; | ||
150 | } | ||
151 | |||
152 | if(direction == Grow_Left || direction == Grow_Right) | ||
153 | for(i=1;i<height;i++) | ||
154 | for(j=1;j<height;j++) | ||
155 | DRAW_PIXEL((x+pos+i),(y+j)); | ||
156 | else | ||
157 | for(i=1;i<width;i++) | ||
158 | for(j=1;j<width;j++) | ||
159 | DRAW_PIXEL((x+i),(y+pos+j)); | ||
160 | } | ||
161 | #endif | ||