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