Rev 7188 | Rev 7192 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7188 | Rev 7189 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | //TODO |
- | |
2 | //repeat track |
- | |
3 | //edit list manually |
- | |
4 | - | ||
5 | #define MEMSIZE 4096 * 50 |
1 | #define MEMSIZE 4096 * 50 |
Line 6... | Line 2... | ||
6 | 2 | ||
7 | //===================================================// |
3 | //===================================================// |
8 | // // |
4 | // // |
Line 32... | Line 28... | ||
32 | // // |
28 | // // |
33 | //===================================================// |
29 | //===================================================// |
Line 34... | Line 30... | ||
34 | 30 | ||
35 | //simple open dialog data |
31 | //simple open dialog data |
36 | char default_dir[] = "/rd/1"; |
32 | char default_dir[] = "/rd/1"; |
- | 33 | od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" }; |
|
- | 34 | ||
Line 37... | Line -... | ||
37 | od_filter filter2 = { 8, "MP3\0\0" }; |
- | |
38 | 35 | #define ABOUT_MESSAGE "Pixie Player v2.62 |
|
39 | #define ABOUT_MESSAGE "'Pixies Player v2.61 |
36 | |
Line 40... | Line 37... | ||
40 | A tiny music folder player. |
37 | A tiny music folder player. |
41 | Supports MP3, WAV, XM audio file formats. |
38 | Supports MP3, WAV, XM audio file formats. |
42 | 39 | ||
43 | Controls: |
40 | Controls: |
44 | Open file: O key |
41 | Open file: O key |
45 | Play/Stop: Space or P key |
42 | Play/Stop: Space or P key |
46 | Start playing selected file: Enter |
43 | Start playing selected file: Enter |
- | 44 | Goto next/previous track: Ctrl + Left/Right |
|
- | 45 | Change sound volume: Left/Right key |
|
Line 47... | Line 46... | ||
47 | Goto next/previous track: Ctrl + Left/Right |
46 | Mute: M key |
- | 47 | ||
Line 48... | Line 48... | ||
48 | Change sound volume: Left/Right key |
48 | kolibri-n.org & aspero.pro" |
49 | Mute: M key' -td" |
49 | |
Line 50... | Line 50... | ||
50 | 50 | scroll_bar scroll1 = { 5,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee, |
|
Line 141... | Line 141... | ||
141 | } |
141 | } |
142 | if (list.MouseOver(mouse.x, mouse.y)) |
142 | if (list.MouseOver(mouse.x, mouse.y)) |
143 | { |
143 | { |
144 | if (mouse.vert) && (list.MouseScroll(mouse.vert)) DrawPlayList(); |
144 | if (mouse.vert) && (list.MouseScroll(mouse.vert)) DrawPlayList(); |
145 | if (mouse.dblclick) EventStartPlayingSelectedItem(); |
145 | if (mouse.dblclick) EventStartPlayingSelectedItem(); |
- | 146 | if (mouse.down) && (mouse.key&MOUSE_LEFT) |
|
146 | if (mouse.down) && (mouse.key&MOUSE_LEFT) && (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList(); |
147 | && (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList(); |
147 | if (mouse.down) && (mouse.key&MOUSE_RIGHT) notify(ABOUT_MESSAGE); |
148 | if (mouse.down) && (mouse.key&MOUSE_RIGHT) CreateThread(#EventShowAbout,#menu_stak+4092); |
148 | } |
149 | } |
- | 150 | if(mouse.key&MOUSE_LEFT) && (mouse.x<14) |
|
149 | if(mouse.key&MOUSE_LEFT) && (mouse.y |
151 | && (window_mode == WINDOW_MODE_SMALL) EventDragWindow(); |
150 | break; |
152 | break; |
151 | case evButton: |
153 | case evButton: |
152 | switch(GetButtonID()) { |
154 | switch(GetButtonID()) { |
153 | case BUTTON_WINDOW_CLOSE: EventExitApp(); break; |
155 | case BUTTON_WINDOW_CLOSE: EventExitApp(); break; |
154 | case BUTTON_WINDOW_MINIMIZE: MinimizeWindow(); break; |
156 | case BUTTON_WINDOW_MINIMIZE: MinimizeWindow(); break; |
Line 176... | Line 178... | ||
176 | if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem(); |
178 | if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem(); |
177 | if (key_scancode==SCAN_CODE_KEY_P) || (key_scancode==SCAN_CODE_SPACE) EventPlayAndPause(); |
179 | if (key_scancode==SCAN_CODE_KEY_P)||(key_scancode==SCAN_CODE_SPACE) EventPlayAndPause(); |
178 | if (list.ProcessKey(key_scancode)) DrawPlayList(); |
180 | if (list.ProcessKey(key_scancode)) DrawPlayList(); |
179 | break; |
181 | break; |
180 | case evReDraw: |
182 | case evReDraw: |
- | 183 | if (window_mode == WINDOW_MODE_NORMAL) |
|
181 | if (window_mode == WINDOW_MODE_NORMAL) DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h-1); |
184 | DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h-1); |
- | 185 | if (window_mode == WINDOW_MODE_SMALL) |
|
182 | if (window_mode == WINDOW_MODE_SMALL) DefineDragableWindow(win_x_small, win_y_small, WIN_W_SMALL, WIN_H_SMALL); |
186 | DefineDragableWindow(win_x_small, win_y_small, WIN_W_SMALL, WIN_H_SMALL); |
183 | draw_window(); |
187 | draw_window(); |
184 | if (param[0]) { |
188 | if (param[0]) { |
185 | EventOpenFolder(#param); |
189 | EventOpenFolder(#param); |
186 | param[0] = NULL; |
190 | param[0] = NULL; |
187 | } |
191 | } |
Line 220... | Line 224... | ||
220 | if (i>=list.count) continue; |
224 | if (i>=list.count) continue; |
221 | bg_color = theme.color_list_bg; |
225 | bg_color = theme.color_list_bg; |
222 | text_color = theme.color_list_text; |
226 | text_color = theme.color_list_text; |
223 | } |
227 | } |
224 | //this is cur_y playing file |
228 | //this is cur_y playing file |
225 | if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING) |
229 | if (i + list.first == current_playing_file_n) |
- | 230 | && (playback_mode == PLAYBACK_MODE_PLAYING) |
|
226 | { |
231 | { |
227 | text_color = theme.color_list_active_text; |
232 | text_color = theme.color_list_active_text; |
228 | } |
233 | } |
229 | DrawBar(list.x, yyy, list.w, list.item_h, bg_color); |
234 | DrawBar(list.x, yyy, list.w, list.item_h, bg_color); |
230 | kfont.WriteIntoWindow(6, yyy+list.text_y, bg_color, text_color, list.font_type, #temp_filename); |
235 | kfont.WriteIntoWindow(6, yyy+list.text_y, bg_color, |
- | 236 | text_color, list.font_type, #temp_filename); |
|
231 | } |
237 | } |
- | 238 | DrawBar(list.x,list.visible * list.item_h + list.y, list.w, |
|
232 | DrawBar(list.x,list.visible * list.item_h + list.y, list.w, -list.visible * list.item_h + list.h, theme.color_list_bg); |
239 | -list.visible * list.item_h + list.h, theme.color_list_bg); |
233 | DrawScroller(); |
240 | DrawScroller(); |
234 | } |
241 | } |
Line 235... | Line 242... | ||
235 | 242 | ||
Line 247... | Line 254... | ||
247 | 254 | ||
248 | dword GetSongTitle() |
255 | dword GetSongTitle() |
249 | { |
256 | { |
250 | char cur_y_playing_title[245]; |
257 | char cur_y_playing_title[245]; |
251 | strcpy(#cur_y_playing_title, #current_filename); |
258 | strcpy(#cur_y_playing_title, #current_filename); |
252 | //cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0'; |
259 | cur_y_playing_title[strrchr(#cur_y_playing_title, '.')-1] = '\0'; |
253 | //if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "..."); |
260 | //if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "..."); |
254 | return #cur_y_playing_title; |
261 | return #cur_y_playing_title; |
Line 262... | Line 269... | ||
262 | //Mode depended |
269 | //Mode depended |
263 | if (window_mode == WINDOW_MODE_NORMAL) |
270 | if (window_mode == WINDOW_MODE_NORMAL) |
264 | { |
271 | { |
265 | button_y = 46; |
272 | button_y = 46; |
266 | 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); |
- | 274 | if (playback_mode != PLAYBACK_MODE_STOPED) |
|
267 | if (playback_mode != PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 46, button_y, 41, 21, skin.w+1, WIN_H_SMALL+1); |
275 | img_draw stdcall(skin.image, 46, button_y, 41, 21, skin.w+1, WIN_H_SMALL+1); |
- | 276 | if (repeat) |
|
268 | if (repeat) img_draw stdcall(skin.image, Form.width - 101-1, button_y+2, 17, 17, skin.w+43, WIN_H_SMALL+1); |
277 | img_draw stdcall(skin.image, Form.width-102, button_y+2, 17,17,skin.w+43, WIN_H_SMALL+1); |
- | 278 | if (shuffle) |
|
269 | if (shuffle) img_draw stdcall(skin.image, Form.width - 82-1, button_y+2, 17, 17, skin.w+62, WIN_H_SMALL+1); |
279 | img_draw stdcall(skin.image, Form.width-83, button_y+2, 17,17, skin.w+62, WIN_H_SMALL+1); |
Line 270... | Line 280... | ||
270 | 280 | ||
271 | if /*(!list.count) && */ (!work_folder) DrawPixieTitle("Pixie"); |
281 | if (!work_folder) DrawPixieTitle("Pixie"); |
- | 282 | else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/')); |
|
272 | else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/')); |
283 | kfont.WriteIntoWindow(8, 24, theme.color_top_panel_bg, |
273 | kfont.WriteIntoWindow(8, 24, theme.color_top_panel_bg, theme.color_top_panel_song_name, list.font_type, GetSongTitle()); |
284 | theme.color_top_panel_song_name, list.font_type, GetSongTitle()); |
274 | //Playing control buttons |
285 | //Playing control buttons |
275 | DefineHiddenButton(7, button_y, 38, 20, BUTTON_PLAYBACK_PREV); |
286 | DefineHiddenButton(7, button_y, 38, 20, BUTTON_PLAYBACK_PREV); |
276 | DefineHiddenButton(47, button_y, 38, 20, BUTTON_PLAYBACK_PLAY_PAUSE); |
287 | DefineHiddenButton(47, button_y, 38, 20, BUTTON_PLAYBACK_PLAY_PAUSE); |
277 | DefineHiddenButton(87, button_y, 38, 20, BUTTON_PLAYBACK_NEXT); |
288 | DefineHiddenButton(87, button_y, 38, 20, BUTTON_PLAYBACK_NEXT); |
Line 290... | Line 301... | ||
290 | { |
301 | { |
291 | button_y = 7; |
302 | button_y = 7; |
292 | 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); |
293 | DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME); |
304 | DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME); |
294 | //Playing control buttons |
305 | //Playing control buttons |
295 | DefineHiddenButton(8, button_y, 24, 16, BUTTON_PLAYBACK_PREV); |
306 | DefineHiddenButton(20, button_y, 24, 16, BUTTON_PLAYBACK_PREV); |
296 | DefineHiddenButton(34, button_y, 24, 16, BUTTON_PLAYBACK_PLAY_PAUSE); |
307 | DefineHiddenButton(46, button_y, 24, 16, BUTTON_PLAYBACK_PLAY_PAUSE); |
297 | DefineHiddenButton(60, button_y, 24, 16, BUTTON_PLAYBACK_NEXT); |
308 | DefineHiddenButton(72, button_y, 24, 16, BUTTON_PLAYBACK_NEXT); |
298 | //Window control buttons |
309 | //Window control buttons |
299 | DefineHiddenButton(Form.width - 20, 1, 19, 13, BUTTON_WINDOW_CLOSE); |
310 | DefineHiddenButton(Form.width - 20, 1, 19, 13, BUTTON_WINDOW_CLOSE); |
300 | DefineHiddenButton(Form.width - 20, 16, 19, 13, BUTTON_WINDOW_REDUCE); |
311 | DefineHiddenButton(Form.width - 20, 16, 19, 13, BUTTON_WINDOW_REDUCE); |
301 | } |
312 | } |
302 | } |
313 | } |
Line 314... | Line 325... | ||
314 | if (list.count > list.visible) scrollbar_v_draw(#scroll1); |
325 | if (list.count > list.visible) scrollbar_v_draw(#scroll1); |
315 | } |
326 | } |
Line 316... | Line 327... | ||
316 | 327 | ||
317 | void DrawPixieTitle(dword _title) |
328 | void DrawPixieTitle(dword _title) |
- | 329 | { |
|
318 | { |
330 | kfont.WriteIntoWindow(8, 5, theme.color_top_panel_bg, |
319 | kfont.WriteIntoWindow(8, 5, theme.color_top_panel_bg, theme.color_top_panel_folder_name, list.font_type, _title); |
331 | theme.color_top_panel_folder_name, list.font_type, _title); |
Line 320... | Line 332... | ||
320 | } |
332 | } |
321 | 333 | ||
322 | //===================================================// |
334 | //===================================================// |
Line 386... | Line 398... | ||
386 | player_run_id = RunProgram("/sys/media/ac97snd", #item_path); |
398 | player_run_id = RunProgram("/sys/media/ac97snd", #item_path); |
387 | sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename); |
399 | sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename); |
388 | if (!repeat) |
400 | if (!repeat) |
389 | { |
401 | { |
390 | for (i=2; i |
402 | for (i=2; i |
- | 403 | { |
|
- | 404 | //replace ' char to avoid @notify misunderstood |
|
391 | if (notify_message[i]=='\'') notify_message[i]=96; //replace ' char to avoid @notify misunderstood |
405 | if (notify_message[i]=='\'') notify_message[i]=96; |
- | 406 | } |
|
392 | notify_run_id = notify(#notify_message); |
407 | notify_run_id = notify(#notify_message); |
393 | } |
408 | } |
394 | } |
409 | } |
Line 462... | Line 477... | ||
462 | if (o_dialog.status==1) EventOpenFolder(#openfile_path); |
477 | if (o_dialog.status==1) EventOpenFolder(#openfile_path); |
463 | } |
478 | } |
Line 464... | Line 479... | ||
464 | 479 | ||
465 | void EventCheckSongFinished() |
480 | void EventCheckSongFinished() |
466 | { |
481 | { |
- | 482 | if (playback_mode == PLAYBACK_MODE_PLAYING) |
|
467 | if (playback_mode == PLAYBACK_MODE_PLAYING) && (!GetProcessSlot(player_run_id)) { |
483 | && (!GetProcessSlot(player_run_id)) { |
468 | if (repeat) EventStartPlayingMp3(); |
484 | if (repeat) EventStartPlayingMp3(); |
469 | else EventPlaybackNext(); |
485 | else EventPlaybackNext(); |
470 | } |
486 | } |
Line 480... | Line 496... | ||
480 | { |
496 | { |
481 | shuffle ^= 1; |
497 | shuffle ^= 1; |
482 | DrawTopPanel(); |
498 | DrawTopPanel(); |
483 | } |
499 | } |
Line -... | Line 500... | ||
- | 500 | ||
- | 501 | void EventShowAbout() |
|
- | 502 | { |
|
- | 503 | proc_info pop_up; |
|
- | 504 | loop() switch(WaitEvent()) |
|
- | 505 | { |
|
- | 506 | case evButton: |
|
- | 507 | ExitProcess(); |
|
- | 508 | break; |
|
- | 509 | case evKey: |
|
- | 510 | GetKeys(); |
|
- | 511 | if (key_scancode == SCAN_CODE_ESC) ExitProcess(); |
|
- | 512 | break; |
|
- | 513 | case evReDraw: |
|
- | 514 | DefineDragableWindow(150, 200, 363, 300); |
|
- | 515 | GetProcessInfo(#pop_up, SelfInfo); |
|
- | 516 | DrawBar(0, 0, pop_up.width, pop_up.height, theme.color_top_panel_bg); |
|
- | 517 | DrawRectangle(0, 0, pop_up.width, pop_up.height, theme.color_list_border); |
|
- | 518 | WriteTextLines(10, 10, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); |
|
- | 519 | ||
- | 520 | DefineHiddenButton(pop_up.width - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); |
|
- | 521 | img_draw stdcall(skin.image, pop_up.width-28, 0, 28, 18, skin.w - 29, 0); |
|
- | 522 | DrawCaptButton(pop_up.width-10-80, pop_up.height - 30, 80, 20, 11, |
|
- | 523 | theme.color_list_active_bg, theme.color_top_panel_song_name, "Clear"); |
|
- | 524 | } |
|
- | 525 | } |
|
- | 526 | ||
484 | 527 | ||
Line 485... | Line 528... | ||
485 | stop: |
528 | stop: |
486 | 529 |