Rev 7995 | Rev 9434 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7995 | Rev 8389 | ||
---|---|---|---|
1 | #define MEMSIZE 4096 * 50 |
1 | #define MEMSIZE 4096 * 50 |
2 | 2 | ||
3 | //===================================================// |
3 | //===================================================// |
4 | // // |
4 | // // |
5 | // LIB // |
5 | // LIB // |
6 | // // |
6 | // // |
7 | //===================================================// |
7 | //===================================================// |
8 | 8 | ||
9 | #include "../lib/fs.h" |
9 | #include "../lib/fs.h" |
10 | #include "../lib/list_box.h" |
10 | #include "../lib/list_box.h" |
11 | #include "../lib/gui.h" |
11 | #include "../lib/gui.h" |
12 | #include "../lib/random.h" |
12 | #include "../lib/random.h" |
13 | #include "../lib/kfont.h" |
13 | #include "../lib/kfont.h" |
14 | - | ||
15 | #include "../lib/obj/libio.h" |
14 | |
16 | #include "../lib/obj/libimg.h" |
15 | #include "../lib/obj/libimg.h" |
17 | #include "../lib/obj/libini.h" |
16 | #include "../lib/obj/libini.h" |
18 | #include "../lib/obj/proc_lib.h" |
17 | #include "../lib/obj/proc_lib.h" |
19 | #include "../lib/obj/box_lib.h" |
18 | #include "../lib/obj/box_lib.h" |
20 | 19 | ||
21 | #include "../lib/patterns/simple_open_dialog.h" |
20 | #include "../lib/patterns/simple_open_dialog.h" |
22 | 21 | ||
23 | //===================================================// |
22 | //===================================================// |
24 | // // |
23 | // // |
25 | // DATA // |
24 | // DATA // |
26 | // // |
25 | // // |
27 | //===================================================// |
26 | //===================================================// |
28 | 27 | ||
29 | //simple open dialog data |
28 | //simple open dialog data |
30 | char default_dir[] = "/rd/1"; |
29 | char default_dir[] = "/rd/1"; |
31 | od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" }; |
30 | od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" }; |
32 | 31 | ||
33 | #define ABOUT_MESSAGE " v2.94 Final |
32 | #define ABOUT_MESSAGE " v2.94 Final |
34 | 33 | ||
35 | A tiny music folder player. |
34 | A tiny music folder player. |
36 | Supports MP3, WAV, XM audio file formats. |
35 | Supports MP3, WAV, XM audio file formats. |
37 | 36 | ||
38 | Hot keys: |
37 | Hot keys: |
39 | Open file: O key |
38 | Open file: O key |
40 | Play/Stop: Space or P key |
39 | Play/Stop: Space or P key |
41 | Start playing selected file: Enter |
40 | Start playing selected file: Enter |
42 | Goto next/previous track: Ctrl + Left/Right |
41 | Goto next/previous track: Ctrl + Left/Right |
43 | Change sound volume: Left/Right key |
42 | Change sound volume: Left/Right key |
44 | Remove from the list: Delete |
43 | Remove from the list: Delete |
45 | Permanently delete file: Shift + Delete |
44 | Permanently delete file: Shift + Delete |
46 | Show file info: I |
45 | Show file info: I |
47 | Repeat: R |
46 | Repeat: R |
48 | Shuffle: S |
47 | Shuffle: S |
49 | Mute: M |
48 | Mute: M |
50 | 49 | ||
51 | kolibri-n.org & aspero.pro" |
50 | kolibri-n.org & aspero.pro" |
52 | 51 | ||
53 | scroll_bar scroll1 = { 5,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee, |
52 | scroll_bar scroll1 = { 5,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee, |
54 | 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
53 | 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
55 | 54 | ||
56 | proc_info Form; |
55 | proc_info Form; |
57 | llist list; |
56 | llist list; |
58 | 57 | ||
59 | char pixie_ini_path[4096]; |
58 | char pixie_ini_path[4096]; |
60 | char work_folder[4096]; |
59 | char work_folder[4096]; |
61 | char current_filename[256]; |
60 | char current_filename[256]; |
62 | 61 | ||
63 | enum { |
62 | enum { |
64 | BUTTON_WINDOW_CLOSE = 1, |
63 | BUTTON_WINDOW_CLOSE = 1, |
65 | BUTTON_WINDOW_MINIMIZE, |
64 | BUTTON_WINDOW_MINIMIZE, |
66 | BUTTON_WINDOW_REDUCE, |
65 | BUTTON_WINDOW_REDUCE, |
67 | BUTTON_PLAYBACK_PLAY_PAUSE = 10, |
66 | BUTTON_PLAYBACK_PLAY_PAUSE = 10, |
68 | BUTTON_PLAYBACK_PREV, |
67 | BUTTON_PLAYBACK_PREV, |
69 | BUTTON_PLAYBACK_NEXT, |
68 | BUTTON_PLAYBACK_NEXT, |
70 | BUTTON_REPEAT, |
69 | BUTTON_REPEAT, |
71 | BUTTON_SHUFFLE, |
70 | BUTTON_SHUFFLE, |
72 | BUTTON_OPEN_DIALOG, |
71 | BUTTON_OPEN_DIALOG, |
73 | BUTTON_SHOW_VOLUME |
72 | BUTTON_SHOW_VOLUME |
74 | }; |
73 | }; |
75 | 74 | ||
76 | int player_run_id; |
75 | int player_run_id; |
77 | int notify_run_id; |
76 | int notify_run_id; |
78 | 77 | ||
79 | bool repeat=false; |
78 | bool repeat=false; |
80 | bool shuffle=false; |
79 | bool shuffle=false; |
81 | 80 | ||
82 | int current_playing_file_n=0; |
81 | int current_playing_file_n=0; |
83 | 82 | ||
84 | word win_x_normal, win_y_normal; |
83 | word win_x_normal, win_y_normal; |
85 | word win_x_small, win_y_small; |
84 | word win_x_small, win_y_small; |
86 | 85 | ||
87 | byte window_mode; |
86 | byte window_mode; |
88 | enum { |
87 | enum { |
89 | WINDOW_MODE_NORMAL, |
88 | WINDOW_MODE_NORMAL, |
90 | WINDOW_MODE_SMALL |
89 | WINDOW_MODE_SMALL |
91 | }; |
90 | }; |
92 | 91 | ||
93 | byte playback_mode; |
92 | byte playback_mode; |
94 | enum { |
93 | enum { |
95 | PLAYBACK_MODE_STOPED, |
94 | PLAYBACK_MODE_STOPED, |
96 | PLAYBACK_MODE_PLAYING |
95 | PLAYBACK_MODE_PLAYING |
97 | }; |
96 | }; |
98 | 97 | ||
99 | libimg_image skin; |
98 | libimg_image skin; |
100 | 99 | ||
101 | #define LAST_FOLDER_EXISTS 1 |
100 | #define LAST_FOLDER_EXISTS 1 |
102 | 101 | ||
103 | //===================================================// |
102 | //===================================================// |
104 | // // |
103 | // // |
105 | // CODE // |
104 | // CODE // |
106 | // // |
105 | // // |
107 | //===================================================// |
106 | //===================================================// |
108 | 107 | ||
109 | #include "get_files_list.h" |
108 | #include "get_files_list.h" |
110 | #include "settings.h" |
109 | #include "settings.h" |
111 | 110 | ||
112 | void LoadLibraries() |
111 | void LoadLibraries() |
113 | { |
112 | { |
114 | load_dll(boxlib, #box_lib_init,0); |
113 | load_dll(boxlib, #box_lib_init,0); |
115 | load_dll(libio, #libio_init,1); |
- | |
116 | load_dll(libimg, #libimg_init,1); |
114 | load_dll(libimg, #libimg_init,1); |
117 | load_dll(libini, #lib_init,1); |
115 | load_dll(libini, #lib_init,1); |
118 | load_dll(Proc_lib, #OpenDialog_init,0); |
116 | load_dll(Proc_lib, #OpenDialog_init,0); |
119 | OpenDialog_init stdcall (#o_dialog); |
117 | OpenDialog_init stdcall (#o_dialog); |
120 | } |
118 | } |
121 | 119 | ||
122 | void main() |
120 | void main() |
123 | { |
121 | { |
124 | list.SetFont(8, 16, 13); |
122 | list.SetFont(8, 16, 13); |
125 | LoadLibraries(); |
123 | LoadLibraries(); |
126 | LoadIniConfig(); |
124 | LoadIniConfig(); |
127 | if (!param) { |
125 | if (!param) { |
128 | notify("'Pixie Player\nPress O key to open MP3/WAV/XM file' -St"); |
126 | notify("'Pixie Player\nPress O key to open MP3/WAV/XM file' -St"); |
129 | if (work_folder) param=LAST_FOLDER_EXISTS; |
127 | if (work_folder) param=LAST_FOLDER_EXISTS; |
130 | } |
128 | } |
131 | kfont.init(DEFAULT_FONT); |
129 | kfont.init(DEFAULT_FONT); |
132 | @SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
130 | @SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
133 | loop() switch(@WaitEventTimeout(10)) |
131 | loop() switch(@WaitEventTimeout(10)) |
134 | { |
132 | { |
135 | case evMouse: |
133 | case evMouse: |
136 | mouse.get(); |
134 | mouse.get(); |
137 | scrollbar_v_mouse (#scroll1); |
135 | scrollbar_v_mouse (#scroll1); |
138 | if (list.first != scroll1.position) |
136 | if (list.first != scroll1.position) |
139 | { |
137 | { |
140 | list.first = scroll1.position; |
138 | list.first = scroll1.position; |
141 | DrawPlayList(); |
139 | DrawPlayList(); |
142 | break; |
140 | break; |
143 | } |
141 | } |
144 | if (list.MouseOver(mouse.x, mouse.y)) |
142 | if (list.MouseOver(mouse.x, mouse.y)) |
145 | { |
143 | { |
146 | if (mouse.vert) && (list.MouseScroll(mouse.vert)) DrawPlayList(); |
144 | if (mouse.vert) && (list.MouseScroll(mouse.vert)) DrawPlayList(); |
147 | if (mouse.dblclick) EventStartPlayingSelectedItem(); |
145 | if (mouse.dblclick) EventStartPlayingSelectedItem(); |
148 | if (mouse.down) && (mouse.key&MOUSE_LEFT) |
146 | if (mouse.down) && (mouse.key&MOUSE_LEFT) |
149 | && (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList(); |
147 | && (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList(); |
150 | } |
148 | } |
151 | if(mouse.key&MOUSE_LEFT) && (mouse.x<14) |
149 | if(mouse.key&MOUSE_LEFT) && (mouse.x<14) |
152 | && (window_mode == WINDOW_MODE_SMALL) EventDragWindow(); |
150 | && (window_mode == WINDOW_MODE_SMALL) EventDragWindow(); |
153 | if (mouse.down) && (mouse.y>skin_height) && (mouse.key&MOUSE_RIGHT) EventShowAbout(); |
151 | if (mouse.down) && (mouse.y>skin_height) && (mouse.key&MOUSE_RIGHT) EventShowAbout(); |
154 | break; |
152 | break; |
155 | case evButton: |
153 | case evButton: |
156 | switch(@GetButtonID()) { |
154 | switch(@GetButtonID()) { |
157 | case BUTTON_WINDOW_CLOSE: EventExitApp(); break; |
155 | case BUTTON_WINDOW_CLOSE: EventExitApp(); break; |
158 | case BUTTON_WINDOW_MINIMIZE: MinimizeWindow(); break; |
156 | case BUTTON_WINDOW_MINIMIZE: MinimizeWindow(); break; |
159 | case BUTTON_WINDOW_REDUCE: EventChangeWindowMode(); break; |
157 | case BUTTON_WINDOW_REDUCE: EventChangeWindowMode(); break; |
160 | case BUTTON_PLAYBACK_PREV: EventPlaybackPrevious(); break; |
158 | case BUTTON_PLAYBACK_PREV: EventPlaybackPrevious(); break; |
161 | case BUTTON_PLAYBACK_NEXT: EventPlaybackNext(); break; |
159 | case BUTTON_PLAYBACK_NEXT: EventPlaybackNext(); break; |
162 | case BUTTON_PLAYBACK_PLAY_PAUSE: EventPlayAndPause(); break; |
160 | case BUTTON_PLAYBACK_PLAY_PAUSE: EventPlayAndPause(); break; |
163 | case BUTTON_REPEAT: EventRepeatClick(); break; |
161 | case BUTTON_REPEAT: EventRepeatClick(); break; |
164 | case BUTTON_SHUFFLE: EventShuffleClick(); break; |
162 | case BUTTON_SHUFFLE: EventShuffleClick(); break; |
165 | case BUTTON_OPEN_DIALOG: EventFileDialogOpen(); break; |
163 | case BUTTON_OPEN_DIALOG: EventFileDialogOpen(); break; |
166 | case BUTTON_SHOW_VOLUME: RunProgram("/sys/@VOLUME", NULL); break; |
164 | case BUTTON_SHOW_VOLUME: RunProgram("/sys/@VOLUME", NULL); break; |
167 | } |
165 | } |
168 | break; |
166 | break; |
169 | case evKey: |
167 | case evKey: |
170 | GetKeys(); |
168 | GetKeys(); |
171 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) { |
169 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) { |
172 | if (key_scancode==SCAN_CODE_LEFT) EventPlaybackPrevious(); |
170 | if (key_scancode==SCAN_CODE_LEFT) EventPlaybackPrevious(); |
173 | if (key_scancode==SCAN_CODE_RIGHT) EventPlaybackNext(); |
171 | if (key_scancode==SCAN_CODE_RIGHT) EventPlaybackNext(); |
174 | break; |
172 | break; |
175 | } |
173 | } |
176 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
174 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
177 | if (key_scancode==SCAN_CODE_DEL) EventPermanentlyDeleteFile(); |
175 | if (key_scancode==SCAN_CODE_DEL) EventPermanentlyDeleteFile(); |
178 | break; |
176 | break; |
179 | } |
177 | } |
180 | if (key_scancode==SCAN_CODE_KEY_O) EventFileDialogOpen(); |
178 | if (key_scancode==SCAN_CODE_KEY_O) EventFileDialogOpen(); |
181 | if (key_scancode==SCAN_CODE_KEY_M) RunProgram("/sys/@VOLUME", "m"); |
179 | if (key_scancode==SCAN_CODE_KEY_M) RunProgram("/sys/@VOLUME", "m"); |
182 | if (key_scancode==SCAN_CODE_KEY_R) EventRepeatClick(); |
180 | if (key_scancode==SCAN_CODE_KEY_R) EventRepeatClick(); |
183 | if (key_scancode==SCAN_CODE_KEY_S) EventShuffleClick(); |
181 | if (key_scancode==SCAN_CODE_KEY_S) EventShuffleClick(); |
184 | if (key_scancode==SCAN_CODE_KEY_I) EventShowTagInfo(); |
182 | if (key_scancode==SCAN_CODE_KEY_I) EventShowTagInfo(); |
185 | if (key_scancode==SCAN_CODE_RIGHT) RunProgram("/sys/@VOLUME", "+"); |
183 | if (key_scancode==SCAN_CODE_RIGHT) RunProgram("/sys/@VOLUME", "+"); |
186 | if (key_scancode==SCAN_CODE_LEFT) RunProgram("/sys/@VOLUME", "-"); |
184 | if (key_scancode==SCAN_CODE_LEFT) RunProgram("/sys/@VOLUME", "-"); |
187 | if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem(); |
185 | if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem(); |
188 | if (key_scancode==SCAN_CODE_DEL) EventRemoveItemFromList(); |
186 | if (key_scancode==SCAN_CODE_DEL) EventRemoveItemFromList(); |
189 | if (key_scancode==SCAN_CODE_KEY_P)||(key_scancode==SCAN_CODE_SPACE) EventPlayAndPause(); |
187 | if (key_scancode==SCAN_CODE_KEY_P)||(key_scancode==SCAN_CODE_SPACE) EventPlayAndPause(); |
190 | if (key_scancode==SCAN_CODE_F1) EventShowAbout(); |
188 | if (key_scancode==SCAN_CODE_F1) EventShowAbout(); |
191 | if (list.ProcessKey(key_scancode)) DrawPlayList(); |
189 | if (list.ProcessKey(key_scancode)) DrawPlayList(); |
192 | break; |
190 | break; |
193 | case evReDraw: |
191 | case evReDraw: |
194 | if (window_mode == WINDOW_MODE_NORMAL) |
192 | if (window_mode == WINDOW_MODE_NORMAL) |
195 | DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h-1); |
193 | DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h-1); |
196 | if (window_mode == WINDOW_MODE_SMALL) |
194 | if (window_mode == WINDOW_MODE_SMALL) |
197 | DefineDragableWindow(win_x_small, win_y_small, WIN_W_SMALL, WIN_H_SMALL); |
195 | DefineDragableWindow(win_x_small, win_y_small, WIN_W_SMALL, WIN_H_SMALL); |
198 | draw_window(); |
196 | draw_window(); |
199 | if (param[0]) { |
197 | if (param[0]) { |
200 | if (param==LAST_FOLDER_EXISTS) EventOpenFolder(NULL); |
198 | if (param==LAST_FOLDER_EXISTS) EventOpenFolder(NULL); |
201 | else EventOpenFolder(#param); |
199 | else EventOpenFolder(#param); |
202 | param[0] = NULL; |
200 | param[0] = NULL; |
203 | } |
201 | } |
204 | break; |
202 | break; |
205 | default: |
203 | default: |
206 | EventCheckSongFinished(); |
204 | EventCheckSongFinished(); |
207 | } |
205 | } |
208 | } |
206 | } |
209 | 207 | ||
210 | 208 | ||
211 | void DrawPlayList() |
209 | void DrawPlayList() |
212 | { |
210 | { |
213 | int i; |
211 | int i; |
214 | int yyy; |
212 | int yyy; |
215 | int kfont_width; |
213 | int kfont_width; |
216 | char temp_filename[4096]; |
214 | char temp_filename[4096]; |
217 | dword text_color, bg_color; |
215 | dword text_color, bg_color; |
218 | for (i=0; i |
216 | for (i=0; i |
219 | { |
217 | { |
220 | strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72); |
218 | strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72); |
221 | temp_filename[strrchr(#temp_filename, '.')-1] = '\0'; |
219 | temp_filename[strrchr(#temp_filename, '.')-1] = '\0'; |
222 | 220 | ||
223 | yyy = i*list.item_h+list.y; |
221 | yyy = i*list.item_h+list.y; |
224 | 222 | ||
225 | //this is selected file |
223 | //this is selected file |
226 | if (list.cur_y - list.first == i) |
224 | if (list.cur_y - list.first == i) |
227 | { |
225 | { |
228 | if (i>=list.count) continue; |
226 | if (i>=list.count) continue; |
229 | bg_color = theme.color_list_active_bg; |
227 | bg_color = theme.color_list_active_bg; |
230 | text_color = theme.color_list_text; |
228 | text_color = theme.color_list_text; |
231 | } |
229 | } |
232 | //this is not selected file |
230 | //this is not selected file |
233 | else |
231 | else |
234 | { |
232 | { |
235 | if (i>=list.count) continue; |
233 | if (i>=list.count) continue; |
236 | bg_color = theme.color_list_bg; |
234 | bg_color = theme.color_list_bg; |
237 | text_color = theme.color_list_text; |
235 | text_color = theme.color_list_text; |
238 | } |
236 | } |
239 | //this is cur_y playing file |
237 | //this is cur_y playing file |
240 | if (i + list.first == current_playing_file_n) |
238 | if (i + list.first == current_playing_file_n) |
241 | && (playback_mode == PLAYBACK_MODE_PLAYING) |
239 | && (playback_mode == PLAYBACK_MODE_PLAYING) |
242 | { |
240 | { |
243 | text_color = theme.color_list_active_text; |
241 | text_color = theme.color_list_active_text; |
244 | } |
242 | } |
245 | DrawBar(list.x, yyy, list.w, list.item_h, bg_color); |
243 | DrawBar(list.x, yyy, list.w, list.item_h, bg_color); |
246 | kfont_width = kfont.WriteIntoWindow(6, yyy+list.text_y, bg_color, |
244 | kfont_width = kfont.WriteIntoWindow(6, yyy+list.text_y, bg_color, |
247 | text_color, list.font_type, #temp_filename); |
245 | text_color, list.font_type, #temp_filename); |
248 | if (kfont_width>skin.w-15) DrawBar(skin.w-1, yyy, 1, list.item_h, theme.color_list_border); |
246 | if (kfont_width>skin.w-15) DrawBar(skin.w-1, yyy, 1, list.item_h, theme.color_list_border); |
249 | } |
247 | } |
250 | DrawBar(list.x,list.visible * list.item_h + list.y, list.w, |
248 | DrawBar(list.x,list.visible * list.item_h + list.y, list.w, |
251 | -list.visible * list.item_h + list.h, theme.color_list_bg); |
249 | -list.visible * list.item_h + list.h, theme.color_list_bg); |
252 | DrawScroller(); |
250 | DrawScroller(); |
253 | } |
251 | } |
254 | 252 | ||
255 | 253 | ||
256 | void draw_window() { |
254 | void draw_window() { |
257 | GetProcessInfo(#Form, SelfInfo); |
255 | GetProcessInfo(#Form, SelfInfo); |
258 | DrawTopPanel(); |
256 | DrawTopPanel(); |
259 | IF (Form.status_window>=2) return; |
257 | IF (Form.status_window>=2) return; |
260 | if (window_mode == WINDOW_MODE_NORMAL) |
258 | if (window_mode == WINDOW_MODE_NORMAL) |
261 | { |
259 | { |
262 | DrawPlayList(); |
260 | DrawPlayList(); |
263 | DrawRectangle(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border); |
261 | DrawRectangle(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border); |
264 | } |
262 | } |
265 | } |
263 | } |
266 | 264 | ||
267 | void DrawTopPanel() |
265 | void DrawTopPanel() |
268 | { |
266 | { |
269 | int kfont_width; |
267 | int kfont_width; |
270 | int button_y; |
268 | int button_y; |
271 | //Mode depended |
269 | //Mode depended |
272 | if (window_mode == WINDOW_MODE_NORMAL) |
270 | if (window_mode == WINDOW_MODE_NORMAL) |
273 | { |
271 | { |
274 | button_y = 46; |
272 | button_y = 46; |
275 | img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0); |
273 | img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0); |
276 | if (playback_mode != PLAYBACK_MODE_STOPED) |
274 | if (playback_mode != PLAYBACK_MODE_STOPED) |
277 | img_draw stdcall(skin.image, 47, button_y, 41, 21, skin.w+1, WIN_H_SMALL+1); |
275 | img_draw stdcall(skin.image, 47, button_y, 41, 21, skin.w+1, WIN_H_SMALL+1); |
278 | if (repeat) |
276 | if (repeat) |
279 | img_draw stdcall(skin.image, 217, button_y+2, 17,17,skin.w+43, WIN_H_SMALL+1); |
277 | img_draw stdcall(skin.image, 217, button_y+2, 17,17,skin.w+43, WIN_H_SMALL+1); |
280 | if (shuffle) |
278 | if (shuffle) |
281 | img_draw stdcall(skin.image, 236, button_y+2, 17,17, skin.w+62, WIN_H_SMALL+1); |
279 | img_draw stdcall(skin.image, 236, button_y+2, 17,17, skin.w+62, WIN_H_SMALL+1); |
282 | 280 | ||
283 | if (!work_folder) DrawPixieTitle("Pixie"); |
281 | if (!work_folder) DrawPixieTitle("Pixie"); |
284 | else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/')); |
282 | else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/')); |
285 | kfont_width = kfont.WriteIntoWindow(8, 24, theme.color_top_panel_bg, |
283 | kfont_width = kfont.WriteIntoWindow(8, 24, theme.color_top_panel_bg, |
286 | theme.color_top_panel_song_name, list.font_type, #current_filename); |
284 | theme.color_top_panel_song_name, list.font_type, #current_filename); |
287 | if (kfont_width>skin.w-15) DrawBar(skin.w-1, 24, 1, list.item_h, theme.color_list_border); |
285 | if (kfont_width>skin.w-15) DrawBar(skin.w-1, 24, 1, list.item_h, theme.color_list_border); |
288 | //Playing control buttons |
286 | //Playing control buttons |
289 | DefineHiddenButton(7, button_y, 38, 20, BUTTON_PLAYBACK_PREV); |
287 | DefineHiddenButton(7, button_y, 38, 20, BUTTON_PLAYBACK_PREV); |
290 | DefineHiddenButton(48, button_y, 38, 20, BUTTON_PLAYBACK_PLAY_PAUSE); |
288 | DefineHiddenButton(48, button_y, 38, 20, BUTTON_PLAYBACK_PLAY_PAUSE); |
291 | DefineHiddenButton(87, button_y, 38, 20, BUTTON_PLAYBACK_NEXT); |
289 | DefineHiddenButton(87, button_y, 38, 20, BUTTON_PLAYBACK_NEXT); |
292 | //Window control buttons |
290 | //Window control buttons |
293 | DefineHiddenButton(Form.width - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); |
291 | DefineHiddenButton(Form.width - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); |
294 | DefineHiddenButton(Form.width - 55, 1, 26, 15, BUTTON_WINDOW_MINIMIZE); |
292 | DefineHiddenButton(Form.width - 55, 1, 26, 15, BUTTON_WINDOW_MINIMIZE); |
295 | DefineHiddenButton(Form.width - 83, 1, 26, 15, BUTTON_WINDOW_REDUCE); |
293 | DefineHiddenButton(Form.width - 83, 1, 26, 15, BUTTON_WINDOW_REDUCE); |
296 | //Other buttons |
294 | //Other buttons |
297 | DefineHiddenButton(218, button_y+3, 17, 16, BUTTON_REPEAT); |
295 | DefineHiddenButton(218, button_y+3, 17, 16, BUTTON_REPEAT); |
298 | DefineHiddenButton(237, button_y+3, 17, 16, BUTTON_SHUFFLE); |
296 | DefineHiddenButton(237, button_y+3, 17, 16, BUTTON_SHUFFLE); |
299 | DefineHiddenButton(270, button_y+3, 17, 16, BUTTON_OPEN_DIALOG); |
297 | DefineHiddenButton(270, button_y+3, 17, 16, BUTTON_OPEN_DIALOG); |
300 | DefineHiddenButton(289, button_y+3, 17, 16, BUTTON_SHOW_VOLUME); |
298 | DefineHiddenButton(289, button_y+3, 17, 16, BUTTON_SHOW_VOLUME); |
301 | } |
299 | } |
302 | else if (window_mode == WINDOW_MODE_SMALL) |
300 | else if (window_mode == WINDOW_MODE_SMALL) |
303 | { |
301 | { |
304 | button_y = 7; |
302 | button_y = 7; |
305 | img_draw stdcall(skin.image, 0, 0, WIN_W_SMALL, WIN_H_SMALL, skin.w-1, 0); |
303 | img_draw stdcall(skin.image, 0, 0, WIN_W_SMALL, WIN_H_SMALL, skin.w-1, 0); |
306 | if (playback_mode != PLAYBACK_MODE_STOPED) |
304 | if (playback_mode != PLAYBACK_MODE_STOPED) |
307 | img_draw stdcall(skin.image, 46, button_y-1, 27, 19, skin.w+83, WIN_H_SMALL+1); |
305 | img_draw stdcall(skin.image, 46, button_y-1, 27, 19, skin.w+83, WIN_H_SMALL+1); |
308 | DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME); |
306 | DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME); |
309 | //Playing control buttons |
307 | //Playing control buttons |
310 | DefineHiddenButton(20, button_y, 24, 16, BUTTON_PLAYBACK_PREV); |
308 | DefineHiddenButton(20, button_y, 24, 16, BUTTON_PLAYBACK_PREV); |
311 | DefineHiddenButton(46, button_y, 24, 16, BUTTON_PLAYBACK_PLAY_PAUSE); |
309 | DefineHiddenButton(46, button_y, 24, 16, BUTTON_PLAYBACK_PLAY_PAUSE); |
312 | DefineHiddenButton(72, button_y, 24, 16, BUTTON_PLAYBACK_NEXT); |
310 | DefineHiddenButton(72, button_y, 24, 16, BUTTON_PLAYBACK_NEXT); |
313 | //Window control buttons |
311 | //Window control buttons |
314 | DefineHiddenButton(Form.width - 20, 1, 19, 13, BUTTON_WINDOW_CLOSE); |
312 | DefineHiddenButton(Form.width - 20, 1, 19, 13, BUTTON_WINDOW_CLOSE); |
315 | DefineHiddenButton(Form.width - 20, 16, 19, 13, BUTTON_WINDOW_REDUCE); |
313 | DefineHiddenButton(Form.width - 20, 16, 19, 13, BUTTON_WINDOW_REDUCE); |
316 | } |
314 | } |
317 | } |
315 | } |
318 | 316 | ||
319 | 317 | ||
320 | void DrawScroller() |
318 | void DrawScroller() |
321 | { |
319 | { |
322 | scroll1.max_area = list.count; |
320 | scroll1.max_area = list.count; |
323 | scroll1.cur_area = list.visible; |
321 | scroll1.cur_area = list.visible; |
324 | scroll1.position = list.first; |
322 | scroll1.position = list.first; |
325 | scroll1.all_redraw = 0; |
323 | scroll1.all_redraw = 0; |
326 | scroll1.start_x = skin.w - scroll1.size_x-1; |
324 | scroll1.start_x = skin.w - scroll1.size_x-1; |
327 | scroll1.start_y = list.y-1; |
325 | scroll1.start_y = list.y-1; |
328 | scroll1.size_y = list.h+2; |
326 | scroll1.size_y = list.h+2; |
329 | if (list.count > list.visible) scrollbar_v_draw(#scroll1); |
327 | if (list.count > list.visible) scrollbar_v_draw(#scroll1); |
330 | } |
328 | } |
331 | 329 | ||
332 | void DrawPixieTitle(dword _t) |
330 | void DrawPixieTitle(dword _t) |
333 | { |
331 | { |
334 | char title[35]; |
332 | char title[35]; |
335 | strlcpy(#title, _t, sizeof(title)); |
333 | strlcpy(#title, _t, sizeof(title)); |
336 | if (strlen(#title)>30) strcpy(#title+30, "..."); |
334 | if (strlen(#title)>30) strcpy(#title+30, "..."); |
337 | kfont.WriteIntoWindow(8, 5, theme.color_top_panel_bg, |
335 | kfont.WriteIntoWindow(8, 5, theme.color_top_panel_bg, |
338 | theme.color_top_panel_folder_name, list.font_type, #title); |
336 | theme.color_top_panel_folder_name, list.font_type, #title); |
339 | } |
337 | } |
340 | 338 | ||
341 | void DrawAboutWindow() |
339 | void DrawAboutWindow() |
342 | { |
340 | { |
343 | #define ABOUT_W 400 |
341 | #define ABOUT_W 400 |
344 | #define ABOUT_H 410 |
342 | #define ABOUT_H 410 |
345 | loop() switch(@WaitEvent()) |
343 | loop() switch(@WaitEvent()) |
346 | { |
344 | { |
347 | case evButton: ExitProcess(); break; |
345 | case evButton: ExitProcess(); break; |
348 | case evKey: if (GetKeyScancode() == SCAN_CODE_ESC) ExitProcess(); break; |
346 | case evKey: if (GetKeyScancode() == SCAN_CODE_ESC) ExitProcess(); break; |
349 | case evReDraw: |
347 | case evReDraw: |
350 | DefineDragableWindow(150, 200, ABOUT_W, ABOUT_H); |
348 | DefineDragableWindow(150, 200, ABOUT_W, ABOUT_H); |
351 | 349 | ||
352 | DrawBar(0, 0, ABOUT_W, ABOUT_H, theme.color_top_panel_bg); |
350 | DrawBar(0, 0, ABOUT_W, ABOUT_H, theme.color_top_panel_bg); |
353 | DrawRectangle(0, 0, ABOUT_W, ABOUT_H, theme.color_list_border); |
351 | DrawRectangle(0, 0, ABOUT_W, ABOUT_H, theme.color_list_border); |
354 | 352 | ||
355 | //DefineHiddenButton(ABOUT_W - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); |
353 | //DefineHiddenButton(ABOUT_W - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); |
356 | //skin.draw(ABOUT_W-28, 0, 28, 18, skin.w - 29, 0); |
354 | //skin.draw(ABOUT_W-28, 0, 28, 18, skin.w - 29, 0); |
357 | DrawCaptButton(ABOUT_W-10-80, ABOUT_H - 34, 80, 24, 2, |
355 | DrawCaptButton(ABOUT_W-10-80, ABOUT_H - 34, 80, 24, 2, |
358 | theme.color_top_panel_bg, 0xF5EFB3, "Cool"); |
356 | theme.color_top_panel_bg, 0xF5EFB3, "Cool"); |
359 | 357 | ||
360 | WriteText(131,16, 0x81, 0x8E7C61, "Pixie Player"); |
358 | WriteText(131,16, 0x81, 0x8E7C61, "Pixie Player"); |
361 | WriteText(130,15, 0x81, 0xF5EFB3, "Pixie Player"); |
359 | WriteText(130,15, 0x81, 0xF5EFB3, "Pixie Player"); |
362 | 360 | ||
363 | WriteTextLines(10, 40, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); |
361 | WriteTextLines(10, 40, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); |
364 | DrawIcon32(45, 15, theme.color_top_panel_bg, 65); |
362 | DrawIcon32(45, 15, theme.color_top_panel_bg, 65); |
365 | DrawIcon32(ABOUT_W-32-45, 15, theme.color_top_panel_bg, 65); |
363 | DrawIcon32(ABOUT_W-32-45, 15, theme.color_top_panel_bg, 65); |
366 | } |
364 | } |
367 | } |
365 | } |
368 | 366 | ||
369 | //===================================================// |
367 | //===================================================// |
370 | // // |
368 | // // |
371 | // EVENTS // |
369 | // EVENTS // |
372 | // // |
370 | // // |
373 | //===================================================// |
371 | //===================================================// |
374 | 372 | ||
375 | 373 | ||
376 | void EventOpenFolder(dword _open_path) |
374 | void EventOpenFolder(dword _open_path) |
377 | { |
375 | { |
378 | if (!_open_path) |
376 | if (!_open_path) |
379 | { |
377 | { |
380 | OpenDirectory(#work_folder); |
378 | OpenDirectory(#work_folder); |
381 | } |
379 | } |
382 | else |
380 | else |
383 | { |
381 | { |
384 | strcpy(#work_folder, _open_path); |
382 | strcpy(#work_folder, _open_path); |
385 | work_folder[strrchr(#work_folder, '/')-1]='\0'; |
383 | work_folder[strrchr(#work_folder, '/')-1]='\0'; |
386 | OpenDirectory(#work_folder); |
384 | OpenDirectory(#work_folder); |
387 | SetOpenedFileFirst(_open_path); |
385 | SetOpenedFileFirst(_open_path); |
388 | } |
386 | } |
389 | list.SetSizes(1, skin.h, skin.w-1, 22*15, 22); |
387 | list.SetSizes(1, skin.h, skin.w-1, 22*15, 22); |
390 | if (list.count <= list.visible) |
388 | if (list.count <= list.visible) |
391 | { |
389 | { |
392 | list.h = list.count * list.item_h; |
390 | list.h = list.count * list.item_h; |
393 | list.visible = list.count; |
391 | list.visible = list.count; |
394 | list.w -= 1; |
392 | list.w -= 1; |
395 | } |
393 | } |
396 | else |
394 | else |
397 | { |
395 | { |
398 | list.w -= scroll1.size_x; |
396 | list.w -= scroll1.size_x; |
399 | } |
397 | } |
400 | if (window_mode==WINDOW_MODE_NORMAL) MoveSize(OLD, OLD, OLD, skin.h + list.h); |
398 | if (window_mode==WINDOW_MODE_NORMAL) MoveSize(OLD, OLD, OLD, skin.h + list.h); |
401 | list.KeyHome(); |
399 | list.KeyHome(); |
402 | current_playing_file_n=0; |
400 | current_playing_file_n=0; |
403 | EventStopPlaying(); |
401 | EventStopPlaying(); |
404 | if (_open_path) EventStartPlaying(); |
402 | if (_open_path) EventStartPlaying(); |
405 | } |
403 | } |
406 | 404 | ||
407 | 405 | ||
408 | void EventStopPlaying() |
406 | void EventStopPlaying() |
409 | { |
407 | { |
410 | if (player_run_id) player_run_id = KillProcess(player_run_id); |
408 | if (player_run_id) player_run_id = KillProcess(player_run_id); |
411 | if (notify_run_id) notify_run_id = KillProcess(notify_run_id); |
409 | if (notify_run_id) notify_run_id = KillProcess(notify_run_id); |
412 | playback_mode = PLAYBACK_MODE_STOPED; |
410 | playback_mode = PLAYBACK_MODE_STOPED; |
413 | DrawTopPanel(); |
411 | DrawTopPanel(); |
414 | DrawPlayList(); |
412 | DrawPlayList(); |
415 | } |
413 | } |
416 | 414 | ||
417 | 415 | ||
418 | void EventStartPlaying() |
416 | void EventStartPlaying() |
419 | { |
417 | { |
420 | word i; |
418 | word i; |
421 | char item_path[4096]; |
419 | char item_path[4096]; |
422 | char notify_message[512]; |
420 | char notify_message[512]; |
423 | EventStopPlaying(); |
421 | EventStopPlaying(); |
424 | if (current_playing_file_n >= list.count) { |
422 | if (current_playing_file_n >= list.count) { |
425 | current_playing_file_n = list.count-1; |
423 | current_playing_file_n = list.count-1; |
426 | return; |
424 | return; |
427 | } |
425 | } |
428 | if (current_playing_file_n < 0) { |
426 | if (current_playing_file_n < 0) { |
429 | current_playing_file_n = 0; |
427 | current_playing_file_n = 0; |
430 | return; |
428 | return; |
431 | } |
429 | } |
432 | playback_mode = PLAYBACK_MODE_PLAYING; |
430 | playback_mode = PLAYBACK_MODE_PLAYING; |
433 | strlcpy(#current_filename, GetPlayingItemName(), sizeof(current_filename)); |
431 | strlcpy(#current_filename, GetPlayingItemName(), sizeof(current_filename)); |
434 | sprintf(#item_path,"-h %s/%s",#work_folder,#current_filename); |
432 | sprintf(#item_path,"-h %s/%s",#work_folder,#current_filename); |
435 | current_filename[strrchr(#current_filename, '.')-1] = '\0'; |
433 | current_filename[strrchr(#current_filename, '.')-1] = '\0'; |
436 | DrawPlayList(); |
434 | DrawPlayList(); |
437 | DrawTopPanel(); |
435 | DrawTopPanel(); |
438 | //start_playing_time = |
436 | //start_playing_time = |
439 | player_run_id = RunProgram("/sys/media/ac97snd", #item_path); |
437 | player_run_id = RunProgram("/sys/media/ac97snd", #item_path); |
440 | //player_run_id = RunProgram("/kolibrios/media/minimp3", #item_path); |
438 | //player_run_id = RunProgram("/kolibrios/media/minimp3", #item_path); |
441 | sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename); |
439 | sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename); |
442 | if (!repeat) && (window_mode==WINDOW_MODE_SMALL) |
440 | if (!repeat) && (window_mode==WINDOW_MODE_SMALL) |
443 | { |
441 | { |
444 | for (i=2; i |
442 | for (i=2; i |
445 | { |
443 | { |
446 | //replace ' char to avoid @notify misunderstood |
444 | //replace ' char to avoid @notify misunderstood |
447 | if (notify_message[i]=='\'') notify_message[i]=96; |
445 | if (notify_message[i]=='\'') notify_message[i]=96; |
448 | } |
446 | } |
449 | notify_run_id = notify(#notify_message); |
447 | notify_run_id = notify(#notify_message); |
450 | } |
448 | } |
451 | } |
449 | } |
452 | 450 | ||
453 | 451 | ||
454 | void EventPlayAndPause() |
452 | void EventPlayAndPause() |
455 | { |
453 | { |
456 | if (playback_mode == PLAYBACK_MODE_PLAYING) |
454 | if (playback_mode == PLAYBACK_MODE_PLAYING) |
457 | { |
455 | { |
458 | playback_mode = PLAYBACK_MODE_STOPED; |
456 | playback_mode = PLAYBACK_MODE_STOPED; |
459 | EventStopPlaying(); |
457 | EventStopPlaying(); |
460 | } |
458 | } |
461 | else |
459 | else |
462 | { |
460 | { |
463 | playback_mode = PLAYBACK_MODE_PLAYING; |
461 | playback_mode = PLAYBACK_MODE_PLAYING; |
464 | EventStartPlaying(); |
462 | EventStartPlaying(); |
465 | } |
463 | } |
466 | } |
464 | } |
467 | 465 | ||
468 | 466 | ||
469 | void EventChangeWindowMode() |
467 | void EventChangeWindowMode() |
470 | { |
468 | { |
471 | if (window_mode == WINDOW_MODE_NORMAL) |
469 | if (window_mode == WINDOW_MODE_NORMAL) |
472 | { |
470 | { |
473 | window_mode = WINDOW_MODE_SMALL; |
471 | window_mode = WINDOW_MODE_SMALL; |
474 | win_x_normal = Form.left; |
472 | win_x_normal = Form.left; |
475 | win_y_normal = Form.top; |
473 | win_y_normal = Form.top; |
476 | MoveSize(OLD, OLD, WIN_W_SMALL-1, WIN_H_SMALL-1); |
474 | MoveSize(OLD, OLD, WIN_W_SMALL-1, WIN_H_SMALL-1); |
477 | MoveSize(OLD, win_y_small, OLD, OLD); |
475 | MoveSize(OLD, win_y_small, OLD, OLD); |
478 | MoveSize(win_x_small, OLD, OLD, OLD); |
476 | MoveSize(win_x_small, OLD, OLD, OLD); |
479 | } |
477 | } |
480 | else |
478 | else |
481 | { |
479 | { |
482 | window_mode = WINDOW_MODE_NORMAL; |
480 | window_mode = WINDOW_MODE_NORMAL; |
483 | win_x_small = Form.left; |
481 | win_x_small = Form.left; |
484 | win_y_small = Form.top; |
482 | win_y_small = Form.top; |
485 | MoveSize(win_x_normal, win_y_normal, skin.w -1 ,skin.h + list.h); |
483 | MoveSize(win_x_normal, win_y_normal, skin.w -1 ,skin.h + list.h); |
486 | } |
484 | } |
487 | } |
485 | } |
488 | 486 | ||
489 | void EventExitApp() |
487 | void EventExitApp() |
490 | { |
488 | { |
491 | EventStopPlaying(); |
489 | EventStopPlaying(); |
492 | SaveIniConfig(); |
490 | SaveIniConfig(); |
493 | ExitProcess(); |
491 | ExitProcess(); |
494 | } |
492 | } |
495 | 493 | ||
496 | void EventPlaybackPrevious() |
494 | void EventPlaybackPrevious() |
497 | { |
495 | { |
498 | if (shuffle) current_playing_file_n = random(list.count); |
496 | if (shuffle) current_playing_file_n = random(list.count); |
499 | else current_playing_file_n--; |
497 | else current_playing_file_n--; |
500 | EventStartPlaying(); |
498 | EventStartPlaying(); |
501 | } |
499 | } |
502 | 500 | ||
503 | void EventPlaybackNext() |
501 | void EventPlaybackNext() |
504 | { |
502 | { |
505 | if (shuffle) current_playing_file_n = random(list.count); |
503 | if (shuffle) current_playing_file_n = random(list.count); |
506 | else current_playing_file_n++; |
504 | else current_playing_file_n++; |
507 | EventStartPlaying(); |
505 | EventStartPlaying(); |
508 | } |
506 | } |
509 | 507 | ||
510 | void EventStartPlayingSelectedItem() |
508 | void EventStartPlayingSelectedItem() |
511 | { |
509 | { |
512 | current_playing_file_n=list.cur_y; |
510 | current_playing_file_n=list.cur_y; |
513 | EventStartPlaying(); |
511 | EventStartPlaying(); |
514 | } |
512 | } |
515 | 513 | ||
516 | void EventFileDialogOpen() |
514 | void EventFileDialogOpen() |
517 | { |
515 | { |
518 | OpenDialog_start stdcall (#o_dialog); |
516 | OpenDialog_start stdcall (#o_dialog); |
519 | if (o_dialog.status==1) EventOpenFolder(#openfile_path); |
517 | if (o_dialog.status==1) EventOpenFolder(#openfile_path); |
520 | } |
518 | } |
521 | 519 | ||
522 | void EventCheckSongFinished() |
520 | void EventCheckSongFinished() |
523 | { |
521 | { |
524 | if (playback_mode == PLAYBACK_MODE_PLAYING) |
522 | if (playback_mode == PLAYBACK_MODE_PLAYING) |
525 | && (!GetProcessSlot(player_run_id)) { |
523 | && (!GetProcessSlot(player_run_id)) { |
526 | if (repeat) EventStartPlaying(); |
524 | if (repeat) EventStartPlaying(); |
527 | else EventPlaybackNext(); |
525 | else EventPlaybackNext(); |
528 | } |
526 | } |
529 | } |
527 | } |
530 | 528 | ||
531 | void EventRepeatClick() |
529 | void EventRepeatClick() |
532 | { |
530 | { |
533 | repeat ^= 1; |
531 | repeat ^= 1; |
534 | DrawTopPanel(); |
532 | DrawTopPanel(); |
535 | } |
533 | } |
536 | 534 | ||
537 | void EventShuffleClick() |
535 | void EventShuffleClick() |
538 | { |
536 | { |
539 | shuffle ^= 1; |
537 | shuffle ^= 1; |
540 | DrawTopPanel(); |
538 | DrawTopPanel(); |
541 | } |
539 | } |
542 | 540 | ||
543 | void EventRemoveItemFromList() |
541 | void EventRemoveItemFromList() |
544 | { |
542 | { |
545 | int i; |
543 | int i; |
546 | if (list.cur_y == current_playing_file_n) EventStopPlaying(); |
544 | if (list.cur_y == current_playing_file_n) EventStopPlaying(); |
547 | for (i=list.cur_y; i |
545 | for (i=list.cur_y; i |
548 | list.count--; |
546 | list.count--; |
549 | if (list.cur_y <= current_playing_file_n) current_playing_file_n--; |
547 | if (list.cur_y <= current_playing_file_n) current_playing_file_n--; |
550 | list.CheckDoesValuesOkey(); |
548 | list.CheckDoesValuesOkey(); |
551 | if (list.count <= list.visible) |
549 | if (list.count <= list.visible) |
552 | { |
550 | { |
553 | list.h = list.count * list.item_h; |
551 | list.h = list.count * list.item_h; |
554 | list.visible = list.count; |
552 | list.visible = list.count; |
555 | if (window_mode==WINDOW_MODE_NORMAL) MoveSize(OLD, OLD, OLD, skin.h + list.h); |
553 | if (window_mode==WINDOW_MODE_NORMAL) MoveSize(OLD, OLD, OLD, skin.h + list.h); |
556 | } |
554 | } |
557 | else DrawPlayList(); |
555 | else DrawPlayList(); |
558 | } |
556 | } |
559 | 557 | ||
560 | void EventPermanentlyDeleteFile() |
558 | void EventPermanentlyDeleteFile() |
561 | { |
559 | { |
562 | char item_path[4096]; |
560 | char item_path[4096]; |
563 | sprintf(#item_path,"%s/%s",#work_folder,GetSelectedItemName()); |
561 | sprintf(#item_path,"%s/%s",#work_folder,GetSelectedItemName()); |
564 | DeleteFile(#item_path); |
562 | DeleteFile(#item_path); |
565 | EventRemoveItemFromList(); |
563 | EventRemoveItemFromList(); |
566 | } |
564 | } |
567 | 565 | ||
568 | void EventShowAbout() |
566 | void EventShowAbout() |
569 | { |
567 | { |
570 | CreateThread(#DrawAboutWindow,#menu_stak+4092); |
568 | CreateThread(#DrawAboutWindow,#menu_stak+4092); |
571 | } |
569 | } |
572 | 570 | ||
573 | /* |
571 | /* |
574 | struct { |
572 | struct { |
575 | char tag[4]; |
573 | char tag[4]; |
576 | char title[60]; |
574 | char title[60]; |
577 | char artist[60]; |
575 | char artist[60]; |
578 | char album[60]; |
576 | char album[60]; |
579 | char speed; |
577 | char speed; |
580 | char genre[30]; |
578 | char genre[30]; |
581 | char start_time[6]; |
579 | char start_time[6]; |
582 | char end_time[6]; |
580 | char end_time[6]; |
583 | } tag11; |
581 | } tag11; |
584 | 582 | ||
585 | struct { |
583 | struct { |
586 | char tag[3]; |
584 | char tag[3]; |
587 | char title[30]; |
585 | char title[30]; |
588 | char artist[30]; |
586 | char artist[30]; |
589 | char album[30]; |
587 | char album[30]; |
590 | char year[4]; |
588 | char year[4]; |
591 | char comment[30]; |
589 | char comment[30]; |
592 | unsigned char genre; //https://www.w3.org/People/Bos/MP3tag/mp3tag.c |
590 | unsigned char genre; //https://www.w3.org/People/Bos/MP3tag/mp3tag.c |
593 | } tag10; |
591 | } tag10; |
594 | */ |
592 | */ |
595 | 593 | ||
596 | void EventShowTagInfo() |
594 | void EventShowTagInfo() |
597 | { |
595 | { |
598 | char item_path[4096]; |
596 | char item_path[4096]; |
599 | sprintf(#item_path,"%s/%s",#work_folder,GetSelectedItemName()); |
597 | sprintf(#item_path,"%s/%s",#work_folder,GetSelectedItemName()); |
600 | RunProgram("/sys/media/mp3info", #item_path); |
598 | RunProgram("/sys/media/mp3info", #item_path); |
601 | } |
599 | } |
602 | 600 | ||
603 | 601 | ||
604 | stop: |
602 | stop: |
605 | 603 | ||
606 | char menu_stak[4096];=>=>>=>14)> |
604 | char menu_stak[4096];=>=>>=>14)> |