Subversion Repositories Kolibri OS

Rev

Rev 5509 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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