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