Subversion Repositories Kolibri OS

Rev

Rev 7051 | Rev 7177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7051 Rev 7166
Line 32... Line 32...
32
 
32
 
33
//simple open dialog data
33
//simple open dialog data
34
char default_dir[] = "/rd/1";
34
char default_dir[] = "/rd/1";
Line 35... Line 35...
35
od_filter filter2 = { 8, "MP3\0\0" };
35
od_filter filter2 = { 8, "MP3\0\0" };
36
 
36
 
Line 37... Line 37...
37
#define ABOUT_MESSAGE "'Pixies Player v2.0
37
#define ABOUT_MESSAGE "'Pixies Player v2.3
38
A tiny MP3 folder player.
38
A tiny MP3 folder player.
39
 
39
 
40
Controls:
40
Controls:
41
Open file: O key
41
Open file: O key
42
Play/Stop: Space or P key
42
Play/Stop: Space or P key
43
Start playing selected file: Enter
43
Start playing selected file: Enter
44
Goto next/previous track: Ctrl + Left/Right
-
 
45
Change sound volume: Left/Right key
-
 
Line 46... Line 44...
46
Mute: M key' -Std"
44
Goto next/previous track: Ctrl + Left/Right
Line 47... Line 45...
47
#define WIN_W_SMALL 127
45
Change sound volume: Left/Right key
48
#define WIN_H_SMALL 39
46
Mute: M key' -td"
Line 165... Line 163...
165
			if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem();
163
			if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem();
166
			if (key_scancode==SCAN_CODE_KEY_P) || (key_scancode==SCAN_CODE_SPACE) EventPlayAndPause();
164
			if (key_scancode==SCAN_CODE_KEY_P) || (key_scancode==SCAN_CODE_SPACE) EventPlayAndPause();
167
			if (list.ProcessKey(key_scancode)) DrawPlayList();
165
			if (list.ProcessKey(key_scancode)) DrawPlayList();
168
			break;
166
			break;
169
		case evReDraw:
167
		case evReDraw:
170
			if (window_mode == WINDOW_MODE_NORMAL) DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h);
168
			if (window_mode == WINDOW_MODE_NORMAL) DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h-1);
171
			if (window_mode == WINDOW_MODE_SMALL) DefineDragableWindow(win_x_small, win_y_small, WIN_W_SMALL, WIN_H_SMALL);
169
			if (window_mode == WINDOW_MODE_SMALL) DefineDragableWindow(win_x_small, win_y_small, WIN_W_SMALL, WIN_H_SMALL);
172
			draw_window();
170
			draw_window();
173
			if (param[0]) {
171
			if (param[0]) {
174
				EventOpenFolder(#param);
172
				EventOpenFolder(#param);
175
				param[0] = NULL;
173
				param[0] = NULL;
Line 230... Line 228...
230
		DrawPlayList();
228
		DrawPlayList();
231
		DrawRectangle(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border);
229
		DrawRectangle(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border);
232
	}
230
	}
233
}
231
}
Line -... Line 232...
-
 
232
 
-
 
233
dword GetSongTitle()
-
 
234
{
-
 
235
	char cur_y_playing_title[245];
-
 
236
	strcpy(#cur_y_playing_title, #current_filename);
-
 
237
	cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
-
 
238
	if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "..."); 
-
 
239
	return #cur_y_playing_title;
-
 
240
}
Line 234... Line 241...
234
 
241
 
235
 
242
 
236
void DrawTopPanel()
-
 
-
 
243
void DrawTopPanel()
237
{
244
{
238
	char cur_y_playing_title[245];
-
 
239
	int button_y;
245
	
240
	//if (playback_mode == PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0);
246
	int button_y;
241
	//Mode depended
247
	//Mode depended
-
 
248
	if (window_mode == WINDOW_MODE_NORMAL)
242
	if (window_mode == WINDOW_MODE_NORMAL)
249
	{
243
	{
-
 
244
		img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0);
250
		button_y = 47;
245
		strcpy(#cur_y_playing_title, #current_filename);
251
		img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0);
246
		cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
252
		if (playback_mode != PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 38, button_y, 33, 17, skin.w+1, WIN_H_SMALL+1);
247
		if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 33, "..."); 
253
		if /*(!list.count) && */ (!work_folder) DrawPixieTitle("Pixie");
-
 
254
		else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/'));
-
 
255
		WriteText(10, 26, list.font_type, theme.color_top_panel_song_name, GetSongTitle());
-
 
256
	 	//Playing control buttons
-
 
257
		DefineHiddenButton(7, button_y, 30, 16, BUTTON_PLAYBACK_PREV);
-
 
258
		DefineHiddenButton(39, button_y, 30, 16, BUTTON_PLAYBACK_PLAY_PAUSE);
-
 
259
		DefineHiddenButton(71, button_y, 30, 16, BUTTON_PLAYBACK_NEXT);
-
 
260
		//Window control buttons
-
 
261
		DefineHiddenButton(Form.width - 21, 1, 20, 13, BUTTON_WINDOW_CLOSE);
248
		DrawPixieTitle(#work_folder + strrchr(#work_folder, '/'));
262
		DefineHiddenButton(Form.width - 43, 1, 20, 13, BUTTON_WINDOW_MINIMIZE);
249
		WriteText(10, 26, list.font_type, theme.color_top_panel_text, #cur_y_playing_title);
263
		DefineHiddenButton(Form.width - 65, 1, 20, 13, BUTTON_WINDOW_REDUCE);
250
		button_y = 45;
264
		//Open and volume
251
		DefineHiddenButton(Form.width - 56, button_y, 23, 23, BUTTON_OPEN_DIALOG);
265
		DefineHiddenButton(Form.width - 56, button_y, 23, 23, BUTTON_OPEN_DIALOG);
252
		DefineHiddenButton(Form.width - 27, button_y, 23, 23, BUTTON_SHOW_VOLUME);
266
		DefineHiddenButton(Form.width - 27, button_y, 23, 23, BUTTON_SHOW_VOLUME);
253
	}
267
	}
-
 
268
	else if (window_mode == WINDOW_MODE_SMALL)
254
	else if (window_mode == WINDOW_MODE_SMALL)
269
	{
255
	{
270
		button_y = 7;
256
		img_draw stdcall(skin.image, 0, 0, WIN_W_SMALL, WIN_H_SMALL, skin.w-1, 0);
-
 
257
		DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME);
-
 
258
		button_y = 9;
-
 
259
	}
271
		img_draw stdcall(skin.image, 0, 0, WIN_W_SMALL, WIN_H_SMALL, skin.w-1, 0);
260
	if (!list.count) DrawPixieTitle("Pixie");
272
		DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME);
261
 	//Playing control buttons
273
	 	//Playing control buttons
262
	DefineHiddenButton(5, button_y, 23, 23, BUTTON_PLAYBACK_PREV);
274
		DefineHiddenButton(8, button_y, 24, 16, BUTTON_PLAYBACK_PREV);
263
	DefineHiddenButton(34, button_y-2, 27, 25, BUTTON_PLAYBACK_PLAY_PAUSE);
275
		DefineHiddenButton(34, button_y, 24, 16, BUTTON_PLAYBACK_PLAY_PAUSE);
264
	DefineHiddenButton(65, button_y, 23, 23, BUTTON_PLAYBACK_NEXT);
276
		DefineHiddenButton(60, button_y, 24, 16, BUTTON_PLAYBACK_NEXT);
265
	//Window control buttons
277
		//Window control buttons
266
	DefineHiddenButton(Form.width - 18,  1, 15, 15, BUTTON_WINDOW_CLOSE);
-
 
-
 
278
		DefineHiddenButton(Form.width - 20, 1, 19, 13, BUTTON_WINDOW_CLOSE);
267
	DefineHiddenButton(Form.width - 18, 16, 15, 15, BUTTON_WINDOW_REDUCE);
279
		DefineHiddenButton(Form.width - 20, 16, 19, 13, BUTTON_WINDOW_REDUCE);
Line 268... Line 280...
268
	DefineHiddenButton(Form.width - 32,  1, 15, 15, BUTTON_WINDOW_MINIMIZE);
280
	}
269
}
281
}
Line 281... Line 293...
281
	if (list.count > list.visible) scrollbar_v_draw(#scroll1);
293
	if (list.count > list.visible) scrollbar_v_draw(#scroll1);
282
}
294
}
Line 283... Line 295...
283
 
295
 
284
void DrawPixieTitle(dword _title)
296
void DrawPixieTitle(dword _title)
285
{
297
{
286
	WriteTextB(10, 6, list.font_type, theme.color_top_panel_text, _title);
298
	WriteTextB(10, 6, list.font_type, theme.color_top_panel_folder_name, _title);
Line 287... Line 299...
287
}
299
}
288
 
300
 
289
//===================================================//
301
//===================================================//