Subversion Repositories Kolibri OS

Rev

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

Rev 5803 Rev 5825
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
#define MEMSIZE 0xFFFFF
5
#define MEMSIZE 0xFFFFF
6
 
6
 
7
#include "..\lib\obj\proc_lib.h"
7
#include "..\lib\obj\proc_lib.h"
8
#include "..\lib\patterns\simple_open_dialog.h"
8
#include "..\lib\patterns\simple_open_dialog.h"
9
char default_dir[] = "/rd/1";
9
char default_dir[] = "/rd/1";
10
od_filter filter2 = { "MP3", 0 };
10
od_filter filter2 = { "MP3", 0 };
11
 
11
 
12
#include "..\lib\file_system.h"
12
#include "..\lib\file_system.h"
13
#include "..\lib\list_box.h"
13
#include "..\lib\list_box.h"
14
#include "..\lib\gui.h"
14
#include "..\lib\gui.h"
15
 
15
 
16
#include "..\lib\obj\box_lib.h"
16
#include "..\lib\obj\box_lib.h"
17
#include "..\lib\obj\libio_lib.h"
17
#include "..\lib\obj\libio_lib.h"
18
#include "..\lib\obj\libimg_lib.h"
18
#include "..\lib\obj\libimg_lib.h"
19
#include "..\lib\obj\libini.h"
19
#include "..\lib\obj\libini.h"
20
 
20
 
21
#include "..\lib\patterns\libimg_load_skin.h"
21
#include "..\lib\patterns\libimg_load_skin.h"
22
 
22
 
23
#define ABOUT_MESSAGE "'Pixies Player v1.33\n\nOpen file: O key\nChange skin: F1/F2
23
#define ABOUT_MESSAGE "'Pixies Player v1.33\n\nOpen file: O key\nChange skin: F1/F2
24
Play/Stop: Space or P key\nStart playing selected file: Enter
24
Play/Stop: Space or P key\nStart playing selected file: Enter
25
Goto next/previous track: Ctrl + Left/Right
25
Goto next/previous track: Ctrl + Left/Right
26
Change sound volume: Left/Right key\nMute: M key' -St\n"
26
Change sound volume: Left/Right key\nMute: M key' -St\n"
27
 
27
 
28
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};
28
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};
29
llist list;
29
 
30
proc_info Form;
30
proc_info Form;
-
 
31
llist list;
31
 
32
 
32
char pixie_ini_path[4096];
33
char pixie_ini_path[4096];
33
 
34
 
34
enum {
35
enum {
35
	BUTTON_WINDOW_CLOSE = 1,
36
	BUTTON_WINDOW_CLOSE = 1,
36
	BUTTON_WINDOW_MINIMIZE,
37
	BUTTON_WINDOW_MINIMIZE,
37
	BUTTON_WINDOW_REDUCE,
38
	BUTTON_WINDOW_REDUCE,
38
	BUTTON_PLAYBACK_PLAY_PAUSE = 10,
39
	BUTTON_PLAYBACK_PLAY_PAUSE = 10,
39
	BUTTON_PLAYBACK_PREV, 
40
	BUTTON_PLAYBACK_PREV, 
40
	BUTTON_PLAYBACK_NEXT
41
	BUTTON_PLAYBACK_NEXT
41
};
42
};
42
 
43
 
43
int player_run_id,
44
int player_run_id,
44
    notify_run_id;
45
    notify_run_id;
45
 
46
 
46
int current_playing_file_n=0;
47
int current_playing_file_n=0;
47
 
48
 
48
word win_x_normal, win_y_normal;
49
word win_x_normal, win_y_normal;
49
word win_x_small, win_y_small;
50
word win_x_small, win_y_small;
50
 
51
 
51
byte window_mode;
52
byte window_mode;
52
enum {
53
enum {
53
	WINDOW_MODE_NORMAL,
54
	WINDOW_MODE_NORMAL,
54
	WINDOW_MODE_SMALL
55
	WINDOW_MODE_SMALL
55
};
56
};
56
 
57
 
57
 
58
 
58
byte playback_mode;
59
byte playback_mode;
59
enum {
60
enum {
60
	PLAYBACK_MODE_STOPED,
61
	PLAYBACK_MODE_STOPED,
61
	PLAYBACK_MODE_PLAYING
62
	PLAYBACK_MODE_PLAYING
62
};
63
};
63
 
64
 
64
char work_folder[4096],
65
char work_folder[4096],
65
     current_filename[256];
66
     current_filename[256];
66
 
67
 
67
 
68
 
68
#include "get_files_list.h"
69
#include "get_files_list.h"
69
#include "settings.h"
70
#include "settings.h"
70
#include "check_default_player.h"
71
#include "check_default_player.h"
71
 
72
 
72
 
73
 
73
void OpenFolder(dword path111)
74
void OpenFolder(dword path111)
74
{
75
{
75
	if (ESBYTE[path111]) 
76
	if (ESBYTE[path111]) 
76
	{
77
	{
77
		strcpy(#work_folder, path111);
78
		strcpy(#work_folder, path111);
78
		work_folder[strrchr(#work_folder, '/')-1]='\0';
79
		work_folder[strrchr(#work_folder, '/')-1]='\0';
79
		OpenDirectory(#work_folder);
80
		OpenDirectory(#work_folder);
80
		SetOpenedFileFirst(path111);
81
		SetOpenedFileFirst(path111);
81
	}
82
	}
82
	list.SetFont(6, 9, 10000000b);
83
	list.SetFont(6, 9, 10000000b);
83
	list.SetSizes(1, skin.h, skin.w-1, 198, 18);
84
	list.SetSizes(1, skin.h, skin.w-1, 198, 18);
84
	if (list.count <= list.visible) 
85
	if (list.count <= list.visible) 
85
	{
86
	{
86
		list.h = list.count * list.line_h;
87
		list.h = list.count * list.item_h;
87
		list.visible = list.count;
88
		list.visible = list.count;
88
	}
89
	}
89
	else
90
	else
90
	{
91
	{
91
		list.w -= scroll1.size_x;
92
		list.w -= scroll1.size_x;
92
	}
93
	}
93
	MoveSize(OLD, OLD, OLD, skin.h + list.h);
94
	MoveSize(OLD, OLD, OLD, skin.h + list.h);
94
	list.KeyHome();
95
	list.KeyHome();
95
	current_playing_file_n=0;
96
	current_playing_file_n=0;
96
	StopPlayingMp3();
97
	StopPlayingMp3();
97
	StartPlayingMp3();	
98
	StartPlayingMp3();	
98
}
99
}
99
 
100
 
100
void main()
101
void main()
101
{
102
{
102
	int id;
103
	int id;
103
 
104
 
104
	byte mouse_clicked;
105
	byte mouse_clicked;
105
	dword tmp_x,tmp_y;
106
	dword tmp_x,tmp_y;
106
	dword z1,z2;
107
	dword z1,z2;
107
	
108
	
108
	mem_Init();
109
	mem_Init();
109
	load_dll(boxlib, #box_lib_init,0);
110
	load_dll(boxlib, #box_lib_init,0);
110
	load_dll(libio, #libio_init,1);
111
	load_dll(libio, #libio_init,1);
111
	load_dll(libimg, #libimg_init,1);
112
	load_dll(libimg, #libimg_init,1);
112
	load_dll(libini, #lib_init,1);
113
	load_dll(libini, #lib_init,1);
113
	load_dll(Proc_lib, #OpenDialog_init,0);
114
	load_dll(Proc_lib, #OpenDialog_init,0);
114
	OpenDialog_init stdcall (#o_dialog);
115
	OpenDialog_init stdcall (#o_dialog);
115
 
116
 
116
	id = abspath("pixie.ini");
117
	id = abspath("pixie.ini");
117
	strcpy(#pixie_ini_path, id);
118
	strcpy(#pixie_ini_path, id);
118
	LoadIniConfig();
119
	LoadIniConfig();
119
	CheckDefaultForTheFirstStart();
120
	CheckDefaultForTheFirstStart();
120
	OpenFolder(#param);
121
	OpenFolder(#param);
121
	SetEventMask(0100111b);
122
	SetEventMask(0100111b);
122
	loop()
123
	loop()
123
	{
124
	{
124
	  WaitEventTimeout(10);
125
	  WaitEventTimeout(10);
125
	  switch(EAX & 0xFF) {
126
	  switch(EAX & 0xFF) {
126
	  	case evMouse:
127
	  	case evMouse:
127
			if (!CheckActiveProcess(Form.ID)) break;
128
			if (!CheckActiveProcess(Form.ID)) break;
128
			mouse.get();
129
			mouse.get();
129
			scrollbar_v_mouse (#scroll1);
130
			scrollbar_v_mouse (#scroll1);
130
			if (list.first != scroll1.position)
131
			if (list.first != scroll1.position)
131
			{
132
			{
132
				list.first = scroll1.position;
133
				list.first = scroll1.position;
133
				DrawPlayList();
134
				DrawPlayList();
134
				break;
135
				break;
135
			}
136
			}
136
			if (list.MouseOver(mouse.x, mouse.y))
137
			if (list.MouseOver(mouse.x, mouse.y))
137
			{
138
			{
138
				if (mouse.vert) if (list.MouseScroll(mouse.vert)) DrawPlayList();
139
				if (mouse.vert) if (list.MouseScroll(mouse.vert)) DrawPlayList();
139
				if (mouse.dblclick) {current_playing_file_n=list.current; StartPlayingMp3();}
140
				if (mouse.dblclick) {current_playing_file_n=list.cur_y; StartPlayingMp3();}
140
				if (mouse.down) && (mouse.key&MOUSE_LEFT) if (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList();
141
				if (mouse.down) && (mouse.key&MOUSE_LEFT) if (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList();
141
				if (mouse.down) && (mouse.key&MOUSE_RIGHT) NotifyAndBackFocus(ABOUT_MESSAGE);
142
				if (mouse.down) && (mouse.key&MOUSE_RIGHT) NotifyAndBackFocus(ABOUT_MESSAGE);
142
			}
143
			}
143
			//drag window - emulate windows header
144
			//drag window - emulate windows header
144
			if(mouse.key&MOUSE_LEFT) && (mouse.y
145
			if(mouse.key&MOUSE_LEFT) && (mouse.y
145
			{
146
			{
146
				tmp_x = mouse.x;
147
				tmp_x = mouse.x;
147
				tmp_y = mouse.y;
148
				tmp_y = mouse.y;
148
				do {
149
				do {
149
					mouse.get();
150
					mouse.get();
150
					if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) 
151
					if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) 
151
					{
152
					{
152
						z1 = Form.left + mouse.x - tmp_x;
153
						z1 = Form.left + mouse.x - tmp_x;
153
						z2 = Form.top + mouse.y - tmp_y;
154
						z2 = Form.top + mouse.y - tmp_y;
154
						if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form.width-10)z1=screen.width-Form.width;
155
						if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form.width-10)z1=screen.width-Form.width;
155
						if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form.height-10)z2=screen.height-Form.height;
156
						if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form.height-10)z2=screen.height-Form.height;
156
						MoveSize(z1 , z2, OLD, OLD);
157
						MoveSize(z1 , z2, OLD, OLD);
157
						draw_window();
158
						draw_window();
158
					}
159
					}
159
					pause(1);
160
					pause(1);
160
				} while (mouse.lkm);
161
				} while (mouse.lkm);
161
			}
162
			}
162
			break;
163
			break;
163
		case evButton:
164
		case evButton:
164
			id=GetButtonID();
165
			id=GetButtonID();
165
			switch(id) {
166
			switch(id) {
166
				case BUTTON_WINDOW_CLOSE:
167
				case BUTTON_WINDOW_CLOSE:
167
					StopPlayingMp3();
168
					StopPlayingMp3();
168
					SaveIniConfig();
169
					SaveIniConfig();
169
					ExitProcess();
170
					ExitProcess();
170
					break;
171
					break;
171
				case BUTTON_WINDOW_MINIMIZE:
172
				case BUTTON_WINDOW_MINIMIZE:
172
					MinimizeWindow();
173
					MinimizeWindow();
173
					break;
174
					break;
174
				case BUTTON_WINDOW_REDUCE:
175
				case BUTTON_WINDOW_REDUCE:
175
					if (window_mode == WINDOW_MODE_NORMAL)
176
					if (window_mode == WINDOW_MODE_NORMAL)
176
					{
177
					{
177
						window_mode = WINDOW_MODE_SMALL;
178
						window_mode = WINDOW_MODE_SMALL;
178
						win_x_normal = Form.left;
179
						win_x_normal = Form.left;
179
						win_y_normal = Form.top;
180
						win_y_normal = Form.top;
180
						MoveSize(OLD, OLD, 99, skin.h - 1);
181
						MoveSize(OLD, OLD, 99, skin.h - 1);
181
						MoveSize(OLD, win_y_small, OLD, OLD);
182
						MoveSize(OLD, win_y_small, OLD, OLD);
182
						MoveSize(win_x_small, OLD, OLD, OLD);
183
						MoveSize(win_x_small, OLD, OLD, OLD);
183
					}
184
					}
184
					else
185
					else
185
					{
186
					{
186
						window_mode = WINDOW_MODE_NORMAL;
187
						window_mode = WINDOW_MODE_NORMAL;
187
						win_x_small = Form.left;
188
						win_x_small = Form.left;
188
						win_y_small = Form.top;
189
						win_y_small = Form.top;
189
						MoveSize(win_x_normal, win_y_normal, skin.w -1 ,skin.h + list.h);
190
						MoveSize(win_x_normal, win_y_normal, skin.w -1 ,skin.h + list.h);
190
					}
191
					}
191
					break;
192
					break;
192
				case BUTTON_PLAYBACK_PREV: _PLAY_PREVIOUS:
193
				case BUTTON_PLAYBACK_PREV: _PLAY_PREVIOUS:
193
					current_playing_file_n--;
194
					current_playing_file_n--;
194
					StartPlayingMp3();
195
					StartPlayingMp3();
195
					break;
196
					break;
196
				case BUTTON_PLAYBACK_NEXT: _PLAY_NEXT:
197
				case BUTTON_PLAYBACK_NEXT: _PLAY_NEXT:
197
					current_playing_file_n++;
198
					current_playing_file_n++;
198
					StartPlayingMp3();
199
					StartPlayingMp3();
199
					break;
200
					break;
200
				case BUTTON_PLAYBACK_PLAY_PAUSE:
201
				case BUTTON_PLAYBACK_PLAY_PAUSE:
201
					PlayAndPauseClick();
202
					PlayAndPauseClick();
202
					break;
203
					break;
203
			}
204
			}
204
			break;	  
205
			break;	  
205
		case evKey:
206
		case evKey:
206
			GetKeys();
207
			GetKeys();
207
			if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
208
			if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
208
				if (key_scancode==SCAN_CODE_LEFT) goto _PLAY_PREVIOUS;
209
				if (key_scancode==SCAN_CODE_LEFT) goto _PLAY_PREVIOUS;
209
				if (key_scancode==SCAN_CODE_RIGHT) goto _PLAY_NEXT;
210
				if (key_scancode==SCAN_CODE_RIGHT) goto _PLAY_NEXT;
210
				break;
211
				break;
211
			}		
212
			}		
212
			if (key_scancode==024) { OpenDialog_start stdcall (#o_dialog); if (o_dialog.status==1) OpenFolder(#openfile_path); }
213
			if (key_scancode==024) { OpenDialog_start stdcall (#o_dialog); if (o_dialog.status==1) OpenFolder(#openfile_path); }
213
			if (key_scancode==059) SetColorThemeLight();
214
			if (key_scancode==059) SetColorThemeLight();
214
			if (key_scancode==060) SetColorThemeDark();
215
			if (key_scancode==060) SetColorThemeDark();
215
			if (key_scancode==SCAN_CODE_LEFT) RunProgram("@VOLUME", "-");
216
			if (key_scancode==SCAN_CODE_LEFT) RunProgram("@VOLUME", "-");
216
			if (key_scancode==SCAN_CODE_RIGHT) RunProgram("@VOLUME", "+");
217
			if (key_scancode==SCAN_CODE_RIGHT) RunProgram("@VOLUME", "+");
217
			if (key_scancode==050) RunProgram("@VOLUME", "m");
218
			if (key_scancode==050) RunProgram("@VOLUME", "m");
218
			if (key_scancode==SCAN_CODE_ENTER) { current_playing_file_n=list.current; StartPlayingMp3(); }
219
			if (key_scancode==SCAN_CODE_ENTER) { current_playing_file_n=list.cur_y; StartPlayingMp3(); }
219
			if (key_scancode==025) || (key_scancode==SCAN_CODE_SPACE) PlayAndPauseClick();
220
			if (key_scancode==025) || (key_scancode==SCAN_CODE_SPACE) PlayAndPauseClick();
220
			if (list.ProcessKey(key_scancode)) DrawPlayList();
221
			if (list.ProcessKey(key_scancode)) DrawPlayList();
221
			break;
222
			break;
222
		case evReDraw:
223
		case evReDraw:
223
			if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h, 0x41,0,0,0);
224
			if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h, 0x41,0,0,0);
224
			if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x_small, win_y_small, 99, skin.h - 1, 0x41,0,0,0);
225
			if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x_small, win_y_small, 99, skin.h - 1, 0x41,0,0,0);
225
			draw_window();
226
			draw_window();
226
			break;
227
			break;
227
		default:
228
		default:
228
			if (playback_mode == PLAYBACK_MODE_PLAYING) && (!GetProcessSlot(player_run_id))
229
			if (playback_mode == PLAYBACK_MODE_PLAYING) && (!GetProcessSlot(player_run_id))
229
			{
230
			{
230
				current_playing_file_n++;
231
				current_playing_file_n++;
231
				StartPlayingMp3();
232
				StartPlayingMp3();
232
			}
233
			}
233
	  }
234
	  }
234
   }
235
   }
235
}
236
}
236
 
237
 
237
void PlayAndPauseClick() 
238
void PlayAndPauseClick() 
238
{
239
{
239
	if (playback_mode == PLAYBACK_MODE_PLAYING) 
240
	if (playback_mode == PLAYBACK_MODE_PLAYING) 
240
	{
241
	{
241
		playback_mode = PLAYBACK_MODE_STOPED;
242
		playback_mode = PLAYBACK_MODE_STOPED;
242
		StopPlayingMp3();
243
		StopPlayingMp3();
243
	}
244
	}
244
	else
245
	else
245
	{
246
	{
246
		playback_mode = PLAYBACK_MODE_PLAYING;
247
		playback_mode = PLAYBACK_MODE_PLAYING;
247
		StartPlayingMp3();
248
		StartPlayingMp3();
248
	}
249
	}
249
}
250
}
250
 
251
 
251
 
252
 
252
void DrawPlayList()
253
void DrawPlayList()
253
{
254
{
254
	int i;
255
	int i;
255
	int yyy;
256
	int yyy;
256
	char temp_filename[4096];
257
	char temp_filename[4096];
257
	for (i=0; i
258
	for (i=0; i
258
	{
259
	{
259
		strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72);
260
		strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72);
260
		temp_filename[strlen(#temp_filename)-4] = '\0';
261
		temp_filename[strlen(#temp_filename)-4] = '\0';
261
		if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "..."); 
262
		if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "..."); 
262
		
263
		
263
		yyy = i*list.line_h+list.y;
264
		yyy = i*list.item_h+list.y;
264
		
265
		
265
		//this is selected file
266
		//this is selected file
266
		if (list.current - list.first == i)
267
		if (list.cur_y - list.first == i)
267
		{
268
		{
268
			if (i>=list.count) continue;
269
			if (i>=list.count) continue;
269
			DrawBar(list.x, yyy, list.w, list.line_h, theme.color_list_active_bg);
270
			DrawBar(list.x, yyy, list.w, list.item_h, theme.color_list_active_bg);
270
			WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename);
271
			WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename);
271
		}
272
		}
272
		//this is not selected file
273
		//this is not selected file
273
		else
274
		else
274
		{
275
		{
275
			if (i>=list.count) continue;
276
			if (i>=list.count) continue;
276
			DrawBar(list.x,yyy,list.w, list.line_h, theme.color_list_bg);
277
			DrawBar(list.x,yyy,list.w, list.item_h, theme.color_list_bg);
277
			WriteText(12,yyy+list.text_y,0x80, theme.color_list_text, #temp_filename);
278
			WriteText(12,yyy+list.text_y,0x80, theme.color_list_text, #temp_filename);
278
		}
279
		}
279
		//this is current playing file
280
		//this is cur_y playing file
280
		if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING)
281
		if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING)
281
		{
282
		{
282
			WriteText(3, yyy+list.text_y,0x80, theme.color_list_active_pointer, "\x10");
283
			WriteText(3, yyy+list.text_y,0x80, theme.color_list_active_pointer, "\x10");
283
			WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename);
284
			WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename);
284
		}
285
		}
285
	}
286
	}
286
	DrawBar(list.x,list.visible * list.line_h + list.y, list.w, -list.visible * list.line_h + list.h, theme.color_list_bg);
287
	DrawBar(list.x,list.visible * list.item_h + list.y, list.w, -list.visible * list.item_h + list.h, theme.color_list_bg);
287
	DrawScroller();
288
	DrawScroller();
288
}
289
}
289
 
290
 
290
 
291
 
291
void StopPlayingMp3() 
292
void StopPlayingMp3() 
292
{
293
{
293
	if (player_run_id) player_run_id = KillProcess(player_run_id);
294
	if (player_run_id) player_run_id = KillProcess(player_run_id);
294
	if (notify_run_id) notify_run_id = KillProcess(notify_run_id);
295
	if (notify_run_id) notify_run_id = KillProcess(notify_run_id);
295
	playback_mode = PLAYBACK_MODE_STOPED;
296
	playback_mode = PLAYBACK_MODE_STOPED;
296
	DrawTopPanel();
297
	DrawTopPanel();
297
	DrawPlayList();
298
	DrawPlayList();
298
}
299
}
299
 
300
 
300
 
301
 
301
int NotifyAndBackFocus(dword msg)
302
int NotifyAndBackFocus(dword msg)
302
{
303
{
303
	int nid;
304
	int nid;
304
	nid = notify(msg);
305
	nid = notify(msg);
305
	pause(5);
306
	pause(5);
306
	Form.num_slot = GetProcessSlot(Form.ID);
307
	Form.num_slot = GetProcessSlot(Form.ID);
307
	if (Form.ID) ActivateWindow(Form.num_slot);
308
	if (Form.ID) ActivateWindow(Form.num_slot);
308
	return nid;
309
	return nid;
309
}
310
}
310
 
311
 
311
 
312
 
312
void StartPlayingMp3()
313
void StartPlayingMp3()
313
{
314
{
314
	word i;
315
	word i;
315
	char item_path[4096];
316
	char item_path[4096];
316
	char notify_message[512];
317
	char notify_message[512];
317
	StopPlayingMp3();
318
	StopPlayingMp3();
318
	if (!list.count) { NotifyAndBackFocus("'Pixie Player\nPress O key to open file' -St"); return; }
319
	if (!list.count) { NotifyAndBackFocus("'Pixie Player\nPress O key to open file' -St"); return; }
319
	if (current_playing_file_n > list.count) { current_playing_file_n = list.count; return; }
320
	if (current_playing_file_n > list.count) { current_playing_file_n = list.count; return; }
320
	if (current_playing_file_n < 0) { current_playing_file_n = 0; return; }
321
	if (current_playing_file_n < 0) { current_playing_file_n = 0; return; }
321
	playback_mode = PLAYBACK_MODE_PLAYING;
322
	playback_mode = PLAYBACK_MODE_PLAYING;
322
	strlcpy(#current_filename, GetCurrentItemName(), sizeof(current_filename));
323
	strlcpy(#current_filename, Getcur_yItemName(), sizeof(current_filename));
323
	sprintf(#item_path,"\"%s/%s\"",#work_folder,#current_filename);
324
	sprintf(#item_path,"\"%s/%s\"",#work_folder,#current_filename);
324
	DrawPlayList();
325
	DrawPlayList();
325
	DrawTopPanel();
326
	DrawTopPanel();
326
	if (strcmpi(#item_path+strlen(#item_path)-4,".mp3")) player_run_id = RunProgram(abspath("minimp3"), #item_path);	
327
	if (strcmpi(#item_path+strlen(#item_path)-4,".mp3")) player_run_id = RunProgram(abspath("minimp3"), #item_path);	
327
	sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename);
328
	sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename);
328
	for (i=2; i
329
	for (i=2; i
329
	notify_run_id = NotifyAndBackFocus(#notify_message);
330
	notify_run_id = NotifyAndBackFocus(#notify_message);
330
}
331
}
331
 
332
 
332
 
333
 
333
void draw_window() {
334
void draw_window() {
334
	GetProcessInfo(#Form, SelfInfo);
335
	GetProcessInfo(#Form, SelfInfo);
335
	DrawTopPanel();
336
	DrawTopPanel();
336
	IF (Form.status_window>=2) return;
337
	IF (Form.status_window>=2) return;
337
	if (window_mode == WINDOW_MODE_NORMAL)
338
	if (window_mode == WINDOW_MODE_NORMAL)
338
	{
339
	{
339
		DrawListBorder(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border);
340
		DrawListBorder(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border);
340
		DrawPlayList();
341
		DrawPlayList();
341
	}
342
	}
342
}
343
}
343
 
344
 
344
void DrawTopPanel()
345
void DrawTopPanel()
345
{
346
{
346
	char current_playing_title[245];
347
	char cur_y_playing_title[245];
347
	img_draw stdcall(skin.image, 0, 0, Form.width - 14, skin.h, 0, 0);
348
	img_draw stdcall(skin.image, 0, 0, Form.width - 14, skin.h, 0, 0);
348
	img_draw stdcall(skin.image, Form.width - 14, 0, 15, skin.h, skin.w - 15, 0);
349
	img_draw stdcall(skin.image, Form.width - 14, 0, 15, skin.h, skin.w - 15, 0);
349
	if (playback_mode == PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0);
350
	if (playback_mode == PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0);
350
	//Playing control buttons
351
	//Playing control buttons
351
	DefineButton(13, 1, 21, 21, BUTTON_PLAYBACK_PLAY_PAUSE + BT_HIDE, 0);
352
	DefineButton(13, 1, 21, 21, BUTTON_PLAYBACK_PLAY_PAUSE + BT_HIDE, 0);
352
	DefineButton(36, 1, 21, 21, BUTTON_PLAYBACK_PREV + BT_HIDE, 0);
353
	DefineButton(36, 1, 21, 21, BUTTON_PLAYBACK_PREV + BT_HIDE, 0);
353
	DefineButton(60, 1, 21, 21, BUTTON_PLAYBACK_NEXT + BT_HIDE, 0);
354
	DefineButton(60, 1, 21, 21, BUTTON_PLAYBACK_NEXT + BT_HIDE, 0);
354
	//Window control buttons
355
	//Window control buttons
355
	DefineButton(Form.width - 14,  1, 11, 11, BUTTON_WINDOW_CLOSE + BT_HIDE, 0);
356
	DefineButton(Form.width - 14,  1, 11, 11, BUTTON_WINDOW_CLOSE + BT_HIDE, 0);
356
	DefineButton(Form.width - 14, 12, 12, 11, BUTTON_WINDOW_REDUCE + BT_HIDE, 0);
357
	DefineButton(Form.width - 14, 12, 12, 11, BUTTON_WINDOW_REDUCE + BT_HIDE, 0);
357
	//Mode depended
358
	//Mode depended
358
	if (window_mode == WINDOW_MODE_NORMAL)
359
	if (window_mode == WINDOW_MODE_NORMAL)
359
	{
360
	{
360
		DefineButton(Form.width - 26,  1, 12, 11, BUTTON_WINDOW_MINIMIZE + BT_HIDE, 0);
361
		DefineButton(Form.width - 26,  1, 12, 11, BUTTON_WINDOW_MINIMIZE + BT_HIDE, 0);
361
		strcpy(#current_playing_title, #current_filename);
362
		strcpy(#cur_y_playing_title, #current_filename);
362
		current_playing_title[strlen(#current_playing_title)-4] = '\0';
363
		cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
363
		if (strlen(#current_playing_title) > 29) strcpy(#current_playing_title + 26, "..."); 
364
		if (strlen(#cur_y_playing_title) > 29) strcpy(#cur_y_playing_title + 26, "..."); 
364
		WriteText(90, 9, 0x80, theme.color_top_panel_text, #current_playing_title);
365
		WriteText(90, 9, 0x80, theme.color_top_panel_text, #cur_y_playing_title);
365
	}
366
	}
366
	else 
367
	else 
367
	{
368
	{
368
		DefineButton(0, 0, 12, skin.h, 99 + BT_HIDE + BT_NOFRAME, 0);
369
		DefineButton(0, 0, 12, skin.h, 99 + BT_HIDE + BT_NOFRAME, 0);
369
	}
370
	}
370
}
371
}
371
 
372
 
372
 
373
 
373
void DrawScroller()
374
void DrawScroller()
374
{
375
{
375
	scroll1.max_area = list.count;
376
	scroll1.max_area = list.count;
376
	scroll1.cur_area = list.visible;
377
	scroll1.cur_area = list.visible;
377
	scroll1.position = list.first;
378
	scroll1.position = list.first;
378
	scroll1.all_redraw = 0;
379
	scroll1.all_redraw = 0;
379
	scroll1.start_x = skin.w - scroll1.size_x - 1;
380
	scroll1.start_x = skin.w - scroll1.size_x - 1;
380
	scroll1.start_y = list.y-1;
381
	scroll1.start_y = list.y-1;
381
	scroll1.size_y = list.h+2;
382
	scroll1.size_y = list.h+2;
382
	if (list.count > list.visible) scrollbar_v_draw(#scroll1);
383
	if (list.count > list.visible) scrollbar_v_draw(#scroll1);
383
}
384
}
384
 
385
 
385
void DrawListBorder(dword x,y,w,h,color1)
386
void DrawListBorder(dword x,y,w,h,color1)
386
{
387
{
387
	DrawBar(x,y+h,w,1,color1);
388
	DrawBar(x,y+h,w,1,color1);
388
	DrawBar(x,y,1,h,color1);
389
	DrawBar(x,y,1,h,color1);
389
	DrawBar(x+w,y,1,h+1,color1);
390
	DrawBar(x+w,y,1,h+1,color1);
390
}
391
}
391
 
392
 
392
 
393
 
393
stop:
394
stop:
394
 
395
 
395
char menu_stak[4096];
396
char menu_stak[4096];