Rev 5627 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5627 | Rev 5640 | ||
---|---|---|---|
1 | //flac |
1 | //flac |
2 | //do not open multiple threads |
2 | //do not open multiple threads |
3 | //edit list manually |
3 | //edit list manually |
4 | 4 | ||
5 | 5 | ||
6 | #define MEMSIZE 0xFFFFF |
6 | #define MEMSIZE 0xFFFFF |
7 | #include "..\lib\kolibri.h" |
7 | #include "..\lib\kolibri.h" |
8 | #include "..\lib\mem.h" |
8 | #include "..\lib\mem.h" |
9 | #include "..\lib\strings.h" |
9 | #include "..\lib\strings.h" |
10 | #include "..\lib\dll.h" |
10 | #include "..\lib\dll.h" |
11 | #include "..\lib\file_system.h" |
11 | #include "..\lib\file_system.h" |
12 | #include "..\lib\list_box.h" |
12 | #include "..\lib\list_box.h" |
13 | #include "..\lib\gui.h" |
13 | #include "..\lib\gui.h" |
14 | 14 | ||
15 | #include "..\lib\obj\box_lib.h" |
15 | #include "..\lib\obj\box_lib.h" |
16 | #include "..\lib\obj\libio_lib.h" |
16 | #include "..\lib\obj\libio_lib.h" |
17 | #include "..\lib\obj\libimg_lib.h" |
17 | #include "..\lib\obj\libimg_lib.h" |
18 | #include "..\lib\obj\libini.h" |
18 | #include "..\lib\obj\libini.h" |
19 | 19 | ||
20 | #include "..\lib\patterns\libimg_load_skin.h" |
20 | #include "..\lib\patterns\libimg_load_skin.h" |
21 | 21 | ||
22 | scroll_bar scroll1 = { 5,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
22 | scroll_bar scroll1 = { 5,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
23 | llist list; |
23 | llist list; |
24 | proc_info Form; |
24 | proc_info Form; |
25 | libimg_image skin; |
25 | libimg_image skin; |
26 | 26 | ||
27 | char pixie_ini_path[4096]; |
27 | char pixie_ini_path[4096]; |
28 | 28 | ||
29 | enum { |
29 | enum { |
30 | BUTTON_WINDOW_CLOSE = 1, |
30 | BUTTON_WINDOW_CLOSE = 1, |
31 | BUTTON_WINDOW_MINIMIZE, |
31 | BUTTON_WINDOW_MINIMIZE, |
32 | BUTTON_WINDOW_REDUCE, |
32 | BUTTON_WINDOW_REDUCE, |
33 | BUTTON_PLAYBACK_PLAY_PAUSE = 10, |
33 | BUTTON_PLAYBACK_PLAY_PAUSE = 10, |
34 | BUTTON_PLAYBACK_PREV, |
34 | BUTTON_PLAYBACK_PREV, |
35 | BUTTON_PLAYBACK_NEXT |
35 | BUTTON_PLAYBACK_NEXT |
36 | }; |
36 | }; |
37 | 37 | ||
38 | int player_run_id, |
38 | int player_run_id, |
39 | notify_run_id; |
39 | notify_run_id; |
40 | 40 | ||
41 | int current_playing_file_n; |
41 | int current_playing_file_n; |
42 | 42 | ||
43 | word win_x_normal, win_y_normal; |
43 | word win_x_normal, win_y_normal; |
44 | word win_x_small, win_y_small; |
44 | word win_x_small, win_y_small; |
45 | 45 | ||
46 | byte window_mode; |
46 | byte window_mode; |
47 | enum { |
47 | enum { |
48 | WINDOW_MODE_NORMAL, |
48 | WINDOW_MODE_NORMAL, |
49 | WINDOW_MODE_SMALL |
49 | WINDOW_MODE_SMALL |
50 | }; |
50 | }; |
51 | 51 | ||
52 | 52 | ||
53 | byte playback_mode; |
53 | byte playback_mode; |
54 | enum { |
54 | enum { |
55 | PLAYBACK_MODE_STOPED, |
55 | PLAYBACK_MODE_STOPED, |
56 | PLAYBACK_MODE_PLAYING |
56 | PLAYBACK_MODE_PLAYING |
57 | }; |
57 | }; |
58 | 58 | ||
59 | byte current_theme; |
59 | byte current_theme; |
60 | enum { |
60 | enum { |
61 | THEME_DARK, |
61 | THEME_DARK, |
62 | THEME_LIGHT |
62 | THEME_LIGHT |
63 | }; |
63 | }; |
64 | 64 | ||
65 | char work_folder[4096], |
65 | char work_folder[4096], |
66 | current_filename[256]; |
66 | current_filename[256]; |
67 | 67 | ||
68 | 68 | ||
69 | #include "get_files_list.h" |
69 | #include "get_files_list.h" |
70 | #include "settings.h" |
70 | #include "settings.h" |
71 | #include "check_default_player.h" |
71 | #include "check_default_player.h" |
72 | 72 | ||
73 | 73 | ||
74 | void main() |
74 | void main() |
75 | { |
75 | { |
- | 76 | int id, key; |
|
76 | int id, key, mouse_clicked; |
77 | byte mouse_clicked; |
77 | mouse m, drag_mouse; |
78 | dword tmp_x,tmp_y; |
- | 79 | dword z1,z2; |
|
78 | 80 | ||
79 | mem_Init(); |
81 | mem_Init(); |
80 | SetEventMask(0x27); |
82 | SetEventMask(0x27); |
81 | load_dll(boxlib, #box_lib_init,0); |
83 | load_dll(boxlib, #box_lib_init,0); |
82 | load_dll(libio, #libio_init,1); |
84 | load_dll(libio, #libio_init,1); |
83 | load_dll(libimg, #libimg_init,1); |
85 | load_dll(libimg, #libimg_init,1); |
84 | load_dll(libini, #lib_init,1); |
86 | load_dll(libini, #lib_init,1); |
85 | 87 | ||
86 | id = abspath("pixie.ini"); |
88 | id = abspath("pixie.ini"); |
87 | strcpy(#pixie_ini_path, id); |
89 | strcpy(#pixie_ini_path, id); |
88 | LoadIniConfig(); |
90 | LoadIniConfig(); |
89 | CheckDefaultForTheFirstStart(); |
91 | CheckDefaultForTheFirstStart(); |
90 | if (param) |
92 | if (param) |
91 | { |
93 | { |
92 | strcpy(#work_folder, #param); |
94 | strcpy(#work_folder, #param); |
93 | work_folder[strrchr(#work_folder, '/')-1]='\0'; |
95 | work_folder[strrchr(#work_folder, '/')-1]='\0'; |
94 | } |
96 | } |
95 | if (work_folder) |
97 | if (work_folder) |
96 | { |
98 | { |
97 | OpenDirectory(#work_folder); |
99 | OpenDirectory(#work_folder); |
98 | SetOpenedFileFirst(#param); |
100 | SetOpenedFileFirst(#param); |
99 | } |
101 | } |
100 | 102 | ||
101 | StartPlayingMp3(); |
103 | StartPlayingMp3(); |
102 | list.SetSizes(1, skin.h, skin.w-1, 198, 40, 18); |
104 | list.SetSizes(1, skin.h, skin.w-1, 198, 40, 18); |
103 | if (list.count <= list.visible) |
105 | if (list.count <= list.visible) |
104 | { |
106 | { |
105 | list.h = list.count * list.line_h; |
107 | list.h = list.count * list.line_h; |
106 | list.visible = list.count; |
108 | list.visible = list.count; |
107 | } |
109 | } |
108 | else |
110 | else |
109 | { |
111 | { |
110 | list.w -= scroll1.size_x; |
112 | list.w -= scroll1.size_x; |
111 | } |
113 | } |
112 | 114 | ||
113 | loop() |
115 | loop() |
114 | { |
116 | { |
115 | WaitEventTimeout(60); |
117 | WaitEventTimeout(10); |
- | 118 | ||
- | 119 | //ActivateWindow(Form.ID); |
|
116 | switch(EAX & 0xFF) { |
120 | switch(EAX & 0xFF) { |
117 | case evMouse: |
121 | case evMouse: |
118 | if (!CheckActiveProcess(Form.ID)) break; |
122 | if (!CheckActiveProcess(Form.ID)) break; |
- | 123 | mouse.get(); |
|
119 | scrollbar_v_mouse (#scroll1); |
124 | scrollbar_v_mouse (#scroll1); |
120 | if (list.first <> scroll1.position) |
125 | if (list.first != scroll1.position) |
121 | { |
126 | { |
122 | list.first = scroll1.position; |
127 | list.first = scroll1.position; |
123 | DrawPlayList(); |
128 | DrawPlayList(); |
124 | break; |
129 | break; |
125 | } |
130 | } |
126 | m.get(); |
131 | if(mouse.down) |
127 | 132 | { |
|
128 | if (m.vert) if (list.MouseScroll(m.vert)) |
133 | if (mouse.vert) if (list.MouseScroll(mouse.vert)) |
129 | { |
134 | { |
130 | DrawPlayList(); |
135 | DrawPlayList(); |
131 | } |
136 | } |
132 | - | ||
- | 137 | if (list.MouseOver(mouse.x, mouse.y)) mouse_clicked = true; |
|
133 | if (mouse_clicked) |
138 | else if(mouse.y < skin.h) && (mouse.x < 13) |
134 | { |
139 | { |
135 | if (!m.lkm) && (list.ProcessMouse(m.x, m.y)) StartPlayingMp3(); |
- | |
136 | mouse_clicked=0; |
- | |
137 | } |
- | |
138 | if (m.lkm) && (list.MouseOver(m.x, m.y)) mouse_clicked=1; |
- | |
139 | //drag window - emulate windows header |
140 | //drag window - emulate windows header |
140 | if (window_mode == WINDOW_MODE_SMALL) && (m.lkm) && (m.y < skin.h) && (m.x < 13) |
141 | tmp_x = mouse.x; |
141 | { |
142 | tmp_y = mouse.y; |
142 | do { |
143 | do { |
143 | drag_mouse.get(); |
144 | mouse.get(); |
144 | if (drag_mouse.x!=m.x) || (drag_mouse.y!=m.y) |
145 | if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) |
145 | { |
146 | { |
146 | MoveSize(Form.left + drag_mouse.x - m.x, Form.top + drag_mouse.y - m.y, OLD, OLD); |
147 | z1 = Form.left + mouse.x - tmp_x; |
- | 148 | z2 = Form.top + mouse.y - tmp_y; |
|
- | 149 | if(z1<=10)z1=0; |
|
- | 150 | if(z2<=10)z2=0; |
|
- | 151 | if(z1>screen.width-Form.width-10)z1=screen.width-Form.width; |
|
- | 152 | if(z2>screen.height-Form.height-10)z2=screen.height-Form.height; |
|
- | 153 | //if(z2<10)z2=0; |
|
- | 154 | MoveSize(z1 , z2, OLD, OLD); |
|
147 | DrawWindow(); |
155 | DrawWindow(); |
148 | } |
156 | } |
149 | pause(2); |
157 | pause(1); |
150 | } while (drag_mouse.lkm); |
158 | } while (mouse.lkm); |
151 | } |
- | |
152 | if (m.pkm) && (m.y > skin.h) |
159 | if (mouse.pkm) && (mouse.y > skin.h) |
153 | notify("'Pixies Player v1.11\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n"); |
160 | notify("'Pixies Player v1.11\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n"); |
154 | break; |
161 | break; |
- | 162 | } |
|
- | 163 | else if(mouse.up) |
|
- | 164 | { |
|
- | 165 | if (mouse_clicked)&&(list.ProcessMouse(mouse.x, mouse.y)) |
|
- | 166 | { |
|
- | 167 | StartPlayingMp3(); |
|
- | 168 | mouse_clicked = false; |
|
- | 169 | } |
|
- | 170 | break; |
|
- | 171 | } |
|
155 | 172 | } |
|
156 | case evButton: |
173 | case evButton: |
157 | id=GetButtonID(); |
174 | id=GetButtonID(); |
158 | switch(id) { |
175 | switch(id) { |
159 | case BUTTON_WINDOW_CLOSE: |
176 | case BUTTON_WINDOW_CLOSE: |
160 | StopPlayingMp3(); |
177 | StopPlayingMp3(); |
161 | SaveIniConfig(); |
178 | SaveIniConfig(); |
162 | ExitProcess(); |
179 | ExitProcess(); |
163 | break; |
180 | break; |
164 | case BUTTON_WINDOW_MINIMIZE: |
181 | case BUTTON_WINDOW_MINIMIZE: |
165 | MinimizeWindow(); |
182 | MinimizeWindow(); |
166 | break; |
183 | break; |
167 | case BUTTON_WINDOW_REDUCE: |
184 | case BUTTON_WINDOW_REDUCE: |
168 | if (window_mode == WINDOW_MODE_NORMAL) |
185 | if (window_mode == WINDOW_MODE_NORMAL) |
169 | { |
186 | { |
170 | window_mode = WINDOW_MODE_SMALL; |
187 | window_mode = WINDOW_MODE_SMALL; |
171 | win_x_normal = Form.left; |
188 | win_x_normal = Form.left; |
172 | win_y_normal = Form.top; |
189 | win_y_normal = Form.top; |
173 | MoveSize(OLD, OLD, 99, skin.h - 1); |
190 | MoveSize(OLD, OLD, 99, skin.h - 1); |
174 | MoveSize(OLD, win_y_small, OLD, OLD); |
191 | MoveSize(OLD, win_y_small, OLD, OLD); |
175 | MoveSize(win_x_small, OLD, OLD, OLD); |
192 | MoveSize(win_x_small, OLD, OLD, OLD); |
176 | } |
193 | } |
177 | else |
194 | else |
178 | { |
195 | { |
179 | window_mode = WINDOW_MODE_NORMAL; |
196 | window_mode = WINDOW_MODE_NORMAL; |
180 | win_x_small = Form.left; |
197 | win_x_small = Form.left; |
181 | win_y_small = Form.top; |
198 | win_y_small = Form.top; |
182 | MoveSize(win_x_normal, win_y_normal, skin.w -1 ,skin.h + list.h); |
199 | MoveSize(win_x_normal, win_y_normal, skin.w -1 ,skin.h + list.h); |
183 | } |
200 | } |
184 | break; |
201 | break; |
185 | case BUTTON_PLAYBACK_PREV: |
202 | case BUTTON_PLAYBACK_PREV: |
186 | if (list.KeyUp()) { |
203 | if (list.KeyUp()) { |
187 | current_playing_file_n = list.current; |
204 | current_playing_file_n = list.current; |
188 | StartPlayingMp3(); |
205 | StartPlayingMp3(); |
189 | } |
206 | } |
190 | break; |
207 | break; |
191 | case BUTTON_PLAYBACK_NEXT: |
208 | case BUTTON_PLAYBACK_NEXT: |
192 | if (list.KeyDown()) |
209 | if (list.KeyDown()) |
193 | { |
210 | { |
194 | current_playing_file_n = list.current; |
211 | current_playing_file_n = list.current; |
195 | StartPlayingMp3(); |
212 | StartPlayingMp3(); |
196 | } |
213 | } |
197 | break; |
214 | break; |
198 | case BUTTON_PLAYBACK_PLAY_PAUSE: |
215 | case BUTTON_PLAYBACK_PLAY_PAUSE: |
199 | if (playback_mode == PLAYBACK_MODE_PLAYING) |
216 | if (playback_mode == PLAYBACK_MODE_PLAYING) |
200 | { |
217 | { |
201 | playback_mode = PLAYBACK_MODE_STOPED; |
218 | playback_mode = PLAYBACK_MODE_STOPED; |
202 | DrawInactivePlayButton(); |
219 | DrawInactivePlayButton(); |
203 | StopPlayingMp3(); |
220 | StopPlayingMp3(); |
204 | } |
221 | } |
205 | else |
222 | else |
206 | { |
223 | { |
207 | playback_mode = PLAYBACK_MODE_PLAYING; |
224 | playback_mode = PLAYBACK_MODE_PLAYING; |
208 | StartPlayingMp3(); |
225 | StartPlayingMp3(); |
209 | } |
226 | } |
210 | break; |
227 | break; |
211 | } |
228 | } |
212 | break; |
229 | break; |
213 | 230 | ||
214 | case evKey: |
231 | case evKey: |
215 | key = GetKey(); |
232 | key = GetKey(); |
216 | if (key==50) SetColorThemeLight(); |
233 | if (key==50) SetColorThemeLight(); |
217 | if (key==51) SetColorThemeDark(); |
234 | if (key==51) SetColorThemeDark(); |
218 | if (key==ASCII_KEY_LEFT) RunProgram("@VOLUME", "-"); |
235 | if (key==ASCII_KEY_LEFT) RunProgram("@VOLUME", "-"); |
219 | if (key==ASCII_KEY_RIGHT) RunProgram("@VOLUME", "+"); |
236 | if (key==ASCII_KEY_RIGHT) RunProgram("@VOLUME", "+"); |
220 | if (key=='m') RunProgram("@VOLUME", "m"); |
237 | if (key=='mouse') RunProgram("@VOLUME", "mouse"); |
221 | if (key==ASCII_KEY_ENTER) StartPlayingMp3(); |
238 | if (key==ASCII_KEY_ENTER) StartPlayingMp3(); |
222 | if (key=='p') || (key==ASCII_KEY_SPACE) |
239 | if (key=='p') || (key==ASCII_KEY_SPACE) |
223 | { |
240 | { |
224 | if (playback_mode == PLAYBACK_MODE_PLAYING) StopPlayingMp3(); |
241 | if (playback_mode == PLAYBACK_MODE_PLAYING) StopPlayingMp3(); |
225 | else StartPlayingMp3(); |
242 | else StartPlayingMp3(); |
226 | } |
243 | } |
227 | if (list.ProcessKey(key)) DrawPlayList(); |
244 | if (list.ProcessKey(key)) DrawPlayList(); |
228 | break; |
245 | break; |
229 | 246 | ||
230 | case evReDraw: |
247 | case evReDraw: |
231 | if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h, 0x01,0,0,0); |
248 | if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h, 0x41,0,0,0); |
232 | if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x_small, win_y_small, 99, skin.h - 1, 0x01,0,0,0); |
249 | if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x_small, win_y_small, 99, skin.h - 1, 0x41,0,0,0); |
233 | DrawWindow(); |
250 | DrawWindow(); |
234 | break; |
251 | break; |
235 | 252 | ||
236 | default: |
253 | default: |
237 | if (playback_mode == PLAYBACK_MODE_PLAYING) && (GetProcessSlot(player_run_id)==0) |
254 | if (playback_mode == PLAYBACK_MODE_PLAYING) && (GetProcessSlot(player_run_id)==0) |
238 | { |
255 | { |
239 | if (current_playing_file_n < list.count) |
256 | if (current_playing_file_n < list.count) |
240 | { |
257 | { |
241 | current_playing_file_n = list.current; |
258 | current_playing_file_n = list.current; |
242 | if (list.KeyDown()) StartPlayingMp3(); |
259 | if (list.KeyDown()) StartPlayingMp3(); |
243 | } |
260 | } |
244 | else |
261 | else |
245 | { |
262 | { |
246 | StopPlayingMp3(); |
263 | StopPlayingMp3(); |
247 | DrawWindow(); |
264 | DrawWindow(); |
248 | } |
265 | } |
249 | } |
266 | } |
250 | } |
267 | } |
251 | } |
268 | } |
252 | } |
269 | } |
253 | 270 | ||
254 | 271 | ||
255 | void DrawPlayList() |
272 | void DrawPlayList() |
256 | { |
273 | { |
257 | int i; |
274 | int i; |
258 | int yyy; |
275 | int yyy; |
259 | char temp_filename[4096]; |
276 | char temp_filename[4096]; |
260 | 277 | ||
261 | for (i=0; i |
278 | for (i=0; i |
262 | { |
279 | { |
263 | strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72); |
280 | strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72); |
264 | temp_filename[strlen(#temp_filename)-4] = '\0'; |
281 | temp_filename[strlen(#temp_filename)-4] = '\0'; |
265 | if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "..."); |
282 | if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "..."); |
266 | 283 | ||
267 | yyy = i*list.line_h+list.y; |
284 | yyy = i*list.line_h+list.y; |
268 | 285 | ||
269 | //this is selected file |
286 | //this is selected file |
270 | if (list.current - list.first == i) |
287 | if (list.current - list.first == i) |
271 | { |
288 | { |
272 | if (i>=list.count) continue; |
289 | if (i>=list.count) continue; |
273 | DrawBar(list.x, yyy, list.w, list.line_h, theme.color_list_active_bg); |
290 | DrawBar(list.x, yyy, list.w, list.line_h, theme.color_list_active_bg); |
274 | WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename); |
291 | WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename); |
275 | } |
292 | } |
276 | //this is not selected file |
293 | //this is not selected file |
277 | else |
294 | else |
278 | { |
295 | { |
279 | if (i>=list.count) continue; |
296 | if (i>=list.count) continue; |
280 | DrawBar(list.x,yyy,list.w, list.line_h, theme.color_list_bg); |
297 | DrawBar(list.x,yyy,list.w, list.line_h, theme.color_list_bg); |
281 | WriteText(12,yyy+list.text_y,0x80, theme.color_list_text, #temp_filename); |
298 | WriteText(12,yyy+list.text_y,0x80, theme.color_list_text, #temp_filename); |
282 | } |
299 | } |
283 | //this is current playing file |
300 | //this is current playing file |
284 | if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING) |
301 | if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING) |
285 | { |
302 | { |
286 | WriteText(3, yyy+list.text_y,0x80, theme.color_list_active_pointer, "\x10"); |
303 | WriteText(3, yyy+list.text_y,0x80, theme.color_list_active_pointer, "\x10"); |
287 | WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename); |
304 | WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename); |
288 | } |
305 | } |
289 | } |
306 | } |
290 | DrawBar(list.x,list.visible * list.line_h + list.y, list.w, -list.visible * list.line_h + list.h, theme.color_list_bg); |
307 | DrawBar(list.x,list.visible * list.line_h + list.y, list.w, -list.visible * list.line_h + list.h, theme.color_list_bg); |
291 | DrawScroller(); |
308 | DrawScroller(); |
292 | } |
309 | } |
293 | 310 | ||
294 | 311 | ||
295 | void StopPlayingMp3() |
312 | void StopPlayingMp3() |
296 | { |
313 | { |
297 | if (player_run_id) player_run_id = KillProcess(player_run_id); |
314 | if (player_run_id) player_run_id = KillProcess(player_run_id); |
298 | if (notify_run_id) notify_run_id = KillProcess(notify_run_id); |
315 | if (notify_run_id) notify_run_id = KillProcess(notify_run_id); |
299 | playback_mode = PLAYBACK_MODE_STOPED; |
316 | playback_mode = PLAYBACK_MODE_STOPED; |
300 | } |
317 | } |
301 | 318 | ||
302 | 319 | ||
303 | void StartPlayingMp3() |
320 | void StartPlayingMp3() |
304 | { |
321 | { |
305 | word i; |
322 | word i; |
306 | char item_path[4096], notify_message[512]; |
323 | char item_path[4096], notify_message[512]; |
307 | dword item_path_end_pointer; |
324 | dword item_path_end_pointer; |
308 | StopPlayingMp3(); |
325 | StopPlayingMp3(); |
309 | 326 | ||
310 | if (list.current > list.count) |
327 | if (list.current > list.count) |
311 | { |
328 | { |
312 | list.current = list.count; |
329 | list.current = list.count; |
313 | return; |
330 | return; |
314 | } |
331 | } |
315 | if (!list.count) |
332 | if (!list.count) |
316 | { |
333 | { |
317 | notify_run_id = notify("'Pixie Player\nStopped, no file specified' -St"); |
334 | notify_run_id = notify("'Pixie Player\nStopped, no file specified' -St"); |
318 | return; |
335 | return; |
319 | } |
336 | } |
320 | 337 | ||
321 | current_playing_file_n = list.current; |
338 | current_playing_file_n = list.current; |
322 | 339 | ||
323 | playback_mode = PLAYBACK_MODE_PLAYING; |
340 | playback_mode = PLAYBACK_MODE_PLAYING; |
324 | 341 | ||
325 | strlcpy(#current_filename, GetCurrentItemName(), sizeof(current_filename)); |
342 | strlcpy(#current_filename, GetCurrentItemName(), sizeof(current_filename)); |
326 | strcpy(#item_path, "\""); |
343 | strcpy(#item_path, "\""); |
327 | strcat(#item_path, #work_folder); |
344 | strcat(#item_path, #work_folder); |
328 | strcat(#item_path, "/"); |
345 | strcat(#item_path, "/"); |
329 | strcat(#item_path, #current_filename); |
346 | strcat(#item_path, #current_filename); |
330 | strcat(#item_path, "\""); |
347 | strcat(#item_path, "\""); |
331 | 348 | ||
332 | DrawPlayList(); |
349 | DrawPlayList(); |
333 | DrawTopPanel(); |
350 | DrawTopPanel(); |
334 | 351 | ||
335 | item_path_end_pointer = #item_path+strlen(#item_path); |
352 | item_path_end_pointer = #item_path+strlen(#item_path); |
336 | if (strcmpi(item_path_end_pointer-4,".mp3")!=0) player_run_id = RunProgram(abspath("minimp3"), #item_path); |
353 | if (strcmpi(item_path_end_pointer-4,".mp3")!=0) player_run_id = RunProgram(abspath("minimp3"), #item_path); |
337 | strcpy(#notify_message, "'Now playing:\n"); |
354 | strcpy(#notify_message, "'Now playing:\n"); |
338 | strcat(#notify_message, #current_filename); |
355 | strcat(#notify_message, #current_filename); |
339 | for (i=2; i |
356 | for (i=2; i |
340 | strcat(#notify_message, "' -St"); |
357 | strcat(#notify_message, "' -St"); |
341 | notify_run_id = notify(#notify_message); |
358 | notify_run_id = notify(#notify_message); |
342 | } |
359 | } |
343 | 360 | ||
344 | 361 | ||
345 | void DrawInactivePlayButton() |
362 | void DrawInactivePlayButton() |
346 | { |
363 | { |
347 | img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0); |
364 | img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0); |
348 | } |
365 | } |
349 | 366 | ||
350 | void DrawWindow() { |
367 | void DrawWindow() { |
351 | GetProcessInfo(#Form, SelfInfo); |
368 | GetProcessInfo(#Form, SelfInfo); |
352 | DrawTopPanel(); |
369 | DrawTopPanel(); |
353 | IF (Form.status_window>=2) return; |
370 | IF (Form.status_window>=2) return; |
354 | if (window_mode == WINDOW_MODE_NORMAL) |
371 | if (window_mode == WINDOW_MODE_NORMAL) |
355 | { |
372 | { |
356 | DrawListBorder(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border); |
373 | DrawListBorder(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border); |
357 | DrawPlayList(); |
374 | DrawPlayList(); |
358 | } |
375 | } |
359 | } |
376 | } |
360 | 377 | ||
361 | 378 | ||
362 | void DrawTopPanel() |
379 | void DrawTopPanel() |
363 | { |
380 | { |
364 | char current_playing_title[245]; |
381 | char current_playing_title[245]; |
365 | img_draw stdcall(skin.image, 0, 0, Form.width - 14, skin.h, 0, 0); |
382 | img_draw stdcall(skin.image, 0, 0, Form.width - 14, skin.h, 0, 0); |
366 | img_draw stdcall(skin.image, Form.width - 14, 0, 15, skin.h, skin.w - 15, 0); |
383 | img_draw stdcall(skin.image, Form.width - 14, 0, 15, skin.h, skin.w - 15, 0); |
367 | if (playback_mode == PLAYBACK_MODE_STOPED) DrawInactivePlayButton(); |
384 | if (playback_mode == PLAYBACK_MODE_STOPED) DrawInactivePlayButton(); |
368 | //Playing control buttons |
385 | //Playing control buttons |
369 | DefineButton(13, 1, 21, 21, BUTTON_PLAYBACK_PLAY_PAUSE + BT_HIDE, 0); |
386 | DefineButton(13, 1, 21, 21, BUTTON_PLAYBACK_PLAY_PAUSE + BT_HIDE, 0); |
370 | DefineButton(36, 1, 21, 21, BUTTON_PLAYBACK_PREV + BT_HIDE, 0); |
387 | DefineButton(36, 1, 21, 21, BUTTON_PLAYBACK_PREV + BT_HIDE, 0); |
371 | DefineButton(60, 1, 21, 21, BUTTON_PLAYBACK_NEXT + BT_HIDE, 0); |
388 | DefineButton(60, 1, 21, 21, BUTTON_PLAYBACK_NEXT + BT_HIDE, 0); |
372 | //Window control buttons |
389 | //Window control buttons |
373 | DefineButton(Form.width - 14, 1, 11, 11, BUTTON_WINDOW_CLOSE + BT_HIDE, 0); |
390 | DefineButton(Form.width - 14, 1, 11, 11, BUTTON_WINDOW_CLOSE + BT_HIDE, 0); |
374 | DefineButton(Form.width - 14, 12, 12, 11, BUTTON_WINDOW_REDUCE + BT_HIDE, 0); |
391 | DefineButton(Form.width - 14, 12, 12, 11, BUTTON_WINDOW_REDUCE + BT_HIDE, 0); |
375 | //Mode depended |
392 | //Mode depended |
376 | if (window_mode == WINDOW_MODE_NORMAL) |
393 | if (window_mode == WINDOW_MODE_NORMAL) |
377 | { |
394 | { |
378 | DefineButton(Form.width - 26, 1, 12, 11, BUTTON_WINDOW_MINIMIZE + BT_HIDE, 0); |
395 | DefineButton(Form.width - 26, 1, 12, 11, BUTTON_WINDOW_MINIMIZE + BT_HIDE, 0); |
379 | strcpy(#current_playing_title, #current_filename); |
396 | strcpy(#current_playing_title, #current_filename); |
380 | current_playing_title[strlen(#current_playing_title)-4] = '\0'; |
397 | current_playing_title[strlen(#current_playing_title)-4] = '\0'; |
381 | if (strlen(#current_playing_title) > 29) strcpy(#current_playing_title + 26, "..."); |
398 | if (strlen(#current_playing_title) > 29) strcpy(#current_playing_title + 26, "..."); |
382 | WriteText(90, 9, 0x80, theme.color_top_panel_text, #current_playing_title); |
399 | WriteText(90, 9, 0x80, theme.color_top_panel_text, #current_playing_title); |
383 | } |
400 | } |
384 | else |
401 | else |
385 | { |
402 | { |
386 | DefineButton(0, 0, 12, skin.h, 99 + BT_HIDE + BT_NOFRAME, 0); |
403 | DefineButton(0, 0, 12, skin.h, 99 + BT_HIDE + BT_NOFRAME, 0); |
387 | } |
404 | } |
388 | } |
405 | } |
389 | 406 | ||
390 | 407 | ||
391 | void DrawScroller() |
408 | void DrawScroller() |
392 | { |
409 | { |
393 | scroll1.max_area = list.count; |
410 | scroll1.max_area = list.count; |
394 | scroll1.cur_area = list.visible; |
411 | scroll1.cur_area = list.visible; |
395 | scroll1.position = list.first; |
412 | scroll1.position = list.first; |
396 | 413 | ||
397 | scroll1.all_redraw = 0; |
414 | scroll1.all_redraw = 0; |
398 | scroll1.start_x = skin.w - scroll1.size_x - 1; |
415 | scroll1.start_x = skin.w - scroll1.size_x - 1; |
399 | scroll1.start_y = list.y-1; |
416 | scroll1.start_y = list.y-1; |
400 | scroll1.size_y = list.h+2; |
417 | scroll1.size_y = list.h+2; |
401 | 418 | ||
402 | if (list.count > list.visible) scrollbar_v_draw(#scroll1); |
419 | if (list.count > list.visible) scrollbar_v_draw(#scroll1); |
403 | } |
420 | } |
404 | 421 | ||
405 | void DrawListBorder(dword x,y,w,h,color1) |
422 | void DrawListBorder(dword x,y,w,h,color1) |
406 | { |
423 | { |
407 | DrawBar(x,y+h,w,1,color1); |
424 | DrawBar(x,y+h,w,1,color1); |
408 | DrawBar(x,y,1,h,color1); |
425 | DrawBar(x,y,1,h,color1); |
409 | DrawBar(x+w,y,1,h+1,color1); |
426 | DrawBar(x+w,y,1,h+1,color1); |
410 | } |
427 | } |
411 | 428 | ||
412 | 429 | ||
413 | stop: |
430 | stop: |
414 | 431 | ||
415 | char menu_stak[4096];>>>>=> |
432 | char menu_stak[4096];>10)z2=0; |
- | 433 | >=10)z2=0; |
|
- | 434 | >=10)z1=0; |
|
- | 435 | >>>=> |