Subversion Repositories Kolibri OS

Rev

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

Rev 5803 Rev 5825
Line 24... Line 24...
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"
Line 27... Line 27...
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;
Line 30... Line 31...
30
proc_info Form;
31
llist list;
Line 31... Line 32...
31
 
32
 
32
char pixie_ini_path[4096];
33
char pixie_ini_path[4096];
Line 81... Line 82...
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;
Line 134... Line 135...
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
Line 213... Line 214...
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);
Line 258... Line 259...
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, "..."); 
Line 262... Line 263...
262
		
263
		
Line 263... Line 264...
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);
Line 287... Line 288...
287
	DrawScroller();
288
	DrawScroller();
Line 317... Line 318...
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);
Line 341... Line 342...
341
	}
342
	}
342
}
343
}
Line 343... Line 344...
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
Line 356... Line 357...
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
	}