forked from KolibriOS/kolibrios
Pixie 2.5: use kfont and some fixes
git-svn-id: svn://kolibrios.org@7182 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
78771712ad
commit
9e84bacadb
@ -140,6 +140,7 @@ eml=13
|
|||||||
lif=14
|
lif=14
|
||||||
3ds=15
|
3ds=15
|
||||||
asc=15
|
asc=15
|
||||||
|
vox=15
|
||||||
kex=16
|
kex=16
|
||||||
skn=17
|
skn=17
|
||||||
obj=18
|
obj=18
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 8.2 KiB |
@ -713,7 +713,6 @@ void ______INIT______()
|
|||||||
screen.width = GetScreenWidth()+1;
|
screen.width = GetScreenWidth()+1;
|
||||||
screen.height = GetScreenHeight()+1;
|
screen.height = GetScreenHeight()+1;
|
||||||
|
|
||||||
DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
|
|
||||||
__generator = GetStartTime();
|
__generator = GetStartTime();
|
||||||
|
|
||||||
mem_init();
|
mem_init();
|
||||||
|
@ -25,13 +25,11 @@
|
|||||||
* drag - drag the element event
|
* drag - drag the element event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:dword __TMP_TIME,DOUBLE_CLICK_DELAY;
|
|
||||||
:struct MOUSE
|
:struct MOUSE
|
||||||
{
|
{
|
||||||
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top;
|
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top;
|
||||||
dword handle,_;
|
dword handle,_;
|
||||||
byte cmd;
|
byte cmd;
|
||||||
void clearTime();
|
|
||||||
void get();
|
void get();
|
||||||
void set();
|
void set();
|
||||||
void center();
|
void center();
|
||||||
@ -39,10 +37,7 @@
|
|||||||
void slider();
|
void slider();
|
||||||
void show();
|
void show();
|
||||||
} mouse;
|
} mouse;
|
||||||
:void MOUSE::clearTime()
|
|
||||||
{
|
|
||||||
tmp_time = GetStartTime()+DOUBLE_CLICK_DELAY;
|
|
||||||
}
|
|
||||||
:void MOUSE::show()
|
:void MOUSE::show()
|
||||||
{
|
{
|
||||||
if(!handle)return;
|
if(!handle)return;
|
||||||
@ -147,13 +142,12 @@
|
|||||||
down = false;
|
down = false;
|
||||||
drag = false;
|
drag = false;
|
||||||
if(!move) click = true;
|
if(!move) click = true;
|
||||||
__TMP_TIME = GetStartTime();
|
if(GetStartTime()-GetMouseDoubleClickDelay()<=tmp_time)
|
||||||
if(__TMP_TIME-tmp_time<=DOUBLE_CLICK_DELAY)
|
|
||||||
{
|
{
|
||||||
dblclick = true;
|
dblclick = true;
|
||||||
click = false;
|
click = false;
|
||||||
}
|
}
|
||||||
tmp_time = __TMP_TIME;
|
tmp_time = GetStartTime();
|
||||||
//returns the key code
|
//returns the key code
|
||||||
key = tmp;
|
key = tmp;
|
||||||
lkm = 1&tmp;
|
lkm = 1&tmp;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
@echo #define LANG_ENG 1 >lang.h--
|
@echo #define LANG_ENG 1 >lang.h--
|
||||||
|
|
||||||
@c-- mblocks.c
|
@c-- mblocks.c
|
||||||
@del mblocks.kex
|
@del mblocks
|
||||||
@rename mblocks.com mblocks
|
@rename mblocks.com mblocks
|
||||||
@del warning.txt
|
@del warning.txt
|
||||||
@del lang.h--
|
@del lang.h--
|
||||||
|
@ -13,15 +13,16 @@
|
|||||||
#include "../lib/file_system.h"
|
#include "../lib/file_system.h"
|
||||||
#include "../lib/list_box.h"
|
#include "../lib/list_box.h"
|
||||||
#include "../lib/gui.h"
|
#include "../lib/gui.h"
|
||||||
|
#include "../lib/kfont.h"
|
||||||
|
#include "../lib/collection.h"
|
||||||
|
|
||||||
#include "../lib/obj/box_lib.h"
|
|
||||||
#include "../lib/obj/libio.h"
|
#include "../lib/obj/libio.h"
|
||||||
#include "../lib/obj/libimg.h"
|
#include "../lib/obj/libimg.h"
|
||||||
#include "../lib/obj/libini.h"
|
#include "../lib/obj/libini.h"
|
||||||
|
#include "../lib/obj/proc_lib.h"
|
||||||
|
#include "../lib/obj/box_lib.h"
|
||||||
|
|
||||||
#include "../lib/patterns/libimg_load_skin.h"
|
#include "../lib/patterns/libimg_load_skin.h"
|
||||||
|
|
||||||
#include "../lib/obj/proc_lib.h"
|
|
||||||
#include "../lib/patterns/simple_open_dialog.h"
|
#include "../lib/patterns/simple_open_dialog.h"
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@ -34,7 +35,7 @@
|
|||||||
char default_dir[] = "/rd/1";
|
char default_dir[] = "/rd/1";
|
||||||
od_filter filter2 = { 8, "MP3\0\0" };
|
od_filter filter2 = { 8, "MP3\0\0" };
|
||||||
|
|
||||||
#define ABOUT_MESSAGE "'Pixies Player v2.4
|
#define ABOUT_MESSAGE "'Pixies Player v2.5
|
||||||
A tiny MP3 folder player.
|
A tiny MP3 folder player.
|
||||||
|
|
||||||
Controls:
|
Controls:
|
||||||
@ -85,6 +86,8 @@ enum {
|
|||||||
PLAYBACK_MODE_PLAYING
|
PLAYBACK_MODE_PLAYING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
collection music_col;
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
// CODE //
|
// CODE //
|
||||||
@ -113,7 +116,8 @@ void main()
|
|||||||
if (!param) notify("'Pixie Player\nPress O key to open MP3 file' -St");
|
if (!param) notify("'Pixie Player\nPress O key to open MP3 file' -St");
|
||||||
LoadLibraries();
|
LoadLibraries();
|
||||||
LoadIniConfig();
|
LoadIniConfig();
|
||||||
SetEventMask(0100111b);
|
kfont.init(DEFAULT_FONT);
|
||||||
|
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
||||||
loop()
|
loop()
|
||||||
{
|
{
|
||||||
WaitEventTimeout(10);
|
WaitEventTimeout(10);
|
||||||
@ -185,11 +189,12 @@ void DrawPlayList()
|
|||||||
int i;
|
int i;
|
||||||
int yyy;
|
int yyy;
|
||||||
char temp_filename[4096];
|
char temp_filename[4096];
|
||||||
|
dword text_color, bg_color;
|
||||||
for (i=0; i<list.visible; i++;)
|
for (i=0; i<list.visible; i++;)
|
||||||
{
|
{
|
||||||
strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72);
|
strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72);
|
||||||
temp_filename[strlen(#temp_filename)-4] = '\0';
|
//temp_filename[strlen(#temp_filename)-4] = '\0';
|
||||||
if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "...");
|
//if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "...");
|
||||||
|
|
||||||
yyy = i*list.item_h+list.y;
|
yyy = i*list.item_h+list.y;
|
||||||
|
|
||||||
@ -197,22 +202,23 @@ void DrawPlayList()
|
|||||||
if (list.cur_y - list.first == i)
|
if (list.cur_y - list.first == i)
|
||||||
{
|
{
|
||||||
if (i>=list.count) continue;
|
if (i>=list.count) continue;
|
||||||
DrawBar(list.x, yyy, list.w, list.item_h, theme.color_list_active_bg);
|
bg_color = theme.color_list_active_bg;
|
||||||
WriteText(12,yyy+list.text_y,list.font_type, theme.color_list_active_text, #temp_filename);
|
text_color = theme.color_list_text;
|
||||||
}
|
}
|
||||||
//this is not selected file
|
//this is not selected file
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (i>=list.count) continue;
|
if (i>=list.count) continue;
|
||||||
DrawBar(list.x,yyy,list.w, list.item_h, theme.color_list_bg);
|
bg_color = theme.color_list_bg;
|
||||||
WriteText(12,yyy+list.text_y,list.font_type, theme.color_list_text, #temp_filename);
|
text_color = theme.color_list_text;
|
||||||
}
|
}
|
||||||
//this is cur_y playing file
|
//this is cur_y playing file
|
||||||
if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING)
|
if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING)
|
||||||
{
|
{
|
||||||
WriteText(3, yyy+list.text_y+3,0x80, theme.color_list_active_pointer, "\x10");
|
text_color = theme.color_list_active_text;
|
||||||
WriteText(12,yyy+list.text_y,list.font_type, theme.color_list_active_text, #temp_filename);
|
|
||||||
}
|
}
|
||||||
|
DrawBar(list.x, yyy, list.w, list.item_h, bg_color);
|
||||||
|
kfont.WriteIntoWindow(12, yyy+list.text_y, bg_color, text_color, 11, #temp_filename);
|
||||||
}
|
}
|
||||||
DrawBar(list.x,list.visible * list.item_h + list.y, list.w, -list.visible * list.item_h + list.h, theme.color_list_bg);
|
DrawBar(list.x,list.visible * list.item_h + list.y, list.w, -list.visible * list.item_h + list.h, theme.color_list_bg);
|
||||||
DrawScroller();
|
DrawScroller();
|
||||||
@ -234,8 +240,8 @@ dword GetSongTitle()
|
|||||||
{
|
{
|
||||||
char cur_y_playing_title[245];
|
char cur_y_playing_title[245];
|
||||||
strcpy(#cur_y_playing_title, #current_filename);
|
strcpy(#cur_y_playing_title, #current_filename);
|
||||||
cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
|
//cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
|
||||||
if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "...");
|
//if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "...");
|
||||||
return #cur_y_playing_title;
|
return #cur_y_playing_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,16 +253,16 @@ void DrawTopPanel()
|
|||||||
//Mode depended
|
//Mode depended
|
||||||
if (window_mode == WINDOW_MODE_NORMAL)
|
if (window_mode == WINDOW_MODE_NORMAL)
|
||||||
{
|
{
|
||||||
button_y = 47;
|
button_y = 46;
|
||||||
img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0);
|
img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0);
|
||||||
if (playback_mode != PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 38, button_y, 33, 17, skin.w+1, WIN_H_SMALL+1);
|
if (playback_mode != PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 40, button_y, 35, 19, skin.w+1, WIN_H_SMALL+1);
|
||||||
if /*(!list.count) && */ (!work_folder) DrawPixieTitle("Pixie");
|
if /*(!list.count) && */ (!work_folder) DrawPixieTitle("Pixie");
|
||||||
else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/'));
|
else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/'));
|
||||||
WriteText(10, 26, list.font_type, theme.color_top_panel_song_name, GetSongTitle());
|
kfont.WriteIntoWindow(10, 26, theme.color_top_panel_bg, theme.color_top_panel_song_name, 11, GetSongTitle());
|
||||||
//Playing control buttons
|
//Playing control buttons
|
||||||
DefineHiddenButton(7, button_y, 30, 16, BUTTON_PLAYBACK_PREV);
|
DefineHiddenButton(7, button_y, 32, 18, BUTTON_PLAYBACK_PREV);
|
||||||
DefineHiddenButton(39, button_y, 30, 16, BUTTON_PLAYBACK_PLAY_PAUSE);
|
DefineHiddenButton(41, button_y, 32, 18, BUTTON_PLAYBACK_PLAY_PAUSE);
|
||||||
DefineHiddenButton(71, button_y, 30, 16, BUTTON_PLAYBACK_NEXT);
|
DefineHiddenButton(75, button_y, 32, 18, BUTTON_PLAYBACK_NEXT);
|
||||||
//Window control buttons
|
//Window control buttons
|
||||||
DefineHiddenButton(Form.width - 21, 1, 20, 13, BUTTON_WINDOW_CLOSE);
|
DefineHiddenButton(Form.width - 21, 1, 20, 13, BUTTON_WINDOW_CLOSE);
|
||||||
DefineHiddenButton(Form.width - 43, 1, 20, 13, BUTTON_WINDOW_MINIMIZE);
|
DefineHiddenButton(Form.width - 43, 1, 20, 13, BUTTON_WINDOW_MINIMIZE);
|
||||||
@ -295,7 +301,9 @@ void DrawScroller()
|
|||||||
|
|
||||||
void DrawPixieTitle(dword _title)
|
void DrawPixieTitle(dword _title)
|
||||||
{
|
{
|
||||||
WriteTextB(10, 6, list.font_type, theme.color_top_panel_folder_name, _title);
|
kfont.bold = true;
|
||||||
|
kfont.WriteIntoWindow(10, 6, theme.color_top_panel_bg, theme.color_top_panel_folder_name, 12, _title);
|
||||||
|
kfont.bold = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@ -349,8 +357,8 @@ void EventStartPlayingMp3()
|
|||||||
char item_path[4096];
|
char item_path[4096];
|
||||||
char notify_message[512];
|
char notify_message[512];
|
||||||
EventStopPlayingMp3();
|
EventStopPlayingMp3();
|
||||||
if (current_playing_file_n > list.count) {
|
if (current_playing_file_n >= list.count) {
|
||||||
current_playing_file_n = list.count;
|
current_playing_file_n = list.count-1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_playing_file_n < 0) {
|
if (current_playing_file_n < 0) {
|
||||||
@ -362,7 +370,7 @@ void EventStartPlayingMp3()
|
|||||||
sprintf(#item_path,"-h %s/%s",#work_folder,#current_filename);
|
sprintf(#item_path,"-h %s/%s",#work_folder,#current_filename);
|
||||||
DrawPlayList();
|
DrawPlayList();
|
||||||
DrawTopPanel();
|
DrawTopPanel();
|
||||||
if (strcmpi(#item_path+strlen(#item_path)-3,".mp3")) player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
||||||
sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename);
|
sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename);
|
||||||
for (i=2; i<strlen(#notify_message)-6; i++) if (notify_message[i]=='\'') notify_message[i]=96; //replace ' char to avoid @notify misunderstood
|
for (i=2; i<strlen(#notify_message)-6; i++) if (notify_message[i]=='\'') notify_message[i]=96; //replace ' char to avoid @notify misunderstood
|
||||||
notify_run_id = notify(#notify_message);
|
notify_run_id = notify(#notify_message);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
[Config]
|
[Config]
|
||||||
current_theme=0
|
|
||||||
window_mode=0
|
window_mode=0
|
||||||
last_folder=
|
last_folder=
|
@ -1,5 +1,6 @@
|
|||||||
struct struct_pixie_colors {
|
struct struct_pixie_colors {
|
||||||
dword color_top_panel_folder_name,
|
dword color_top_panel_bg,
|
||||||
|
color_top_panel_folder_name,
|
||||||
color_top_panel_song_name,
|
color_top_panel_song_name,
|
||||||
color_list_bg,
|
color_list_bg,
|
||||||
color_list_text,
|
color_list_text,
|
||||||
@ -10,31 +11,32 @@ struct struct_pixie_colors {
|
|||||||
color_list_border;
|
color_list_border;
|
||||||
} theme;
|
} theme;
|
||||||
|
|
||||||
char config_section[] = "Config";
|
_ini ini = { "/sys/media/pixie/pixie.ini", "Config" };
|
||||||
|
|
||||||
#define WIN_W_SMALL 114
|
#define WIN_W_SMALL 114
|
||||||
#define WIN_H_SMALL 31
|
#define WIN_H_SMALL 31
|
||||||
|
|
||||||
void LoadIniConfig()
|
void LoadIniConfig()
|
||||||
{
|
{
|
||||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "window_mode", WINDOW_MODE_NORMAL); window_mode = EAX;
|
window_mode = ini.GetInt("window_mode", WINDOW_MODE_NORMAL);
|
||||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_x_normal", 100); win_x_normal = EAX;
|
win_x_normal = ini.GetInt("win_x_normal", 100);
|
||||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_y_normal", 90); win_y_normal = EAX;
|
win_y_normal = ini.GetInt("win_y_normal", 90);
|
||||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_x_small", -1); win_x_small = EAX;
|
win_x_small = ini.GetInt("win_x_small", -1);
|
||||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_y_small", -1); win_y_small = EAX;
|
win_y_small = ini.GetInt("win_y_small", -1);
|
||||||
ini_get_str stdcall (#pixie_ini_path, #config_section, "last_folder", #work_folder, sizeof(work_folder), 0);
|
ini.GetString("last_folder", #work_folder, sizeof(work_folder), 0);
|
||||||
|
|
||||||
Libimg_LoadImage(#skin, abspath("skin.png"));
|
Libimg_LoadImage(#skin, abspath("skin.png"));
|
||||||
skin.w = 322;
|
skin.w = 322;
|
||||||
|
theme.color_top_panel_bg = 0x242424;
|
||||||
theme.color_top_panel_folder_name = 0xDDDDDB;
|
theme.color_top_panel_folder_name = 0xDDDDDB;
|
||||||
theme.color_top_panel_song_name = 0xBEBEBE;
|
theme.color_top_panel_song_name = 0xBEBEBE;
|
||||||
theme.color_list_bg = 0xE2E2E2;
|
theme.color_list_bg = 0x313031;
|
||||||
theme.color_list_text = 0x595959;
|
theme.color_list_text = 0xADAEAD;
|
||||||
theme.color_list_active_bg = 0xFAF3AF;
|
theme.color_list_active_bg = 0x434343;
|
||||||
theme.color_list_active_text = 0x85663F;
|
theme.color_list_active_text = 0x17A2CC;
|
||||||
theme.color_list_active_pointer = 0x85663F;
|
theme.color_list_active_pointer = 0xD6D6D6;
|
||||||
theme.color_list_scroller = 0xBBBbbb;
|
theme.color_list_scroller = 0xBBBbbb;
|
||||||
theme.color_list_border = 0x010101;
|
theme.color_list_border = 0x121212;
|
||||||
scroll1.bckg_col = theme.color_list_bg;
|
scroll1.bckg_col = theme.color_list_bg;
|
||||||
scroll1.frnt_col = theme.color_list_border;
|
scroll1.frnt_col = theme.color_list_border;
|
||||||
scroll1.line_col = theme.color_list_border;
|
scroll1.line_col = theme.color_list_border;
|
||||||
@ -56,11 +58,11 @@ void SaveIniConfig()
|
|||||||
win_x_small = Form.left;
|
win_x_small = Form.left;
|
||||||
win_y_small = Form.top;
|
win_y_small = Form.top;
|
||||||
}
|
}
|
||||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "window_mode", window_mode);
|
ini.SetInt("window_mode", window_mode);
|
||||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_x_normal", win_x_normal);
|
ini.SetInt("win_x_normal", win_x_normal);
|
||||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_y_normal", win_y_normal);
|
ini.SetInt("win_y_normal", win_y_normal);
|
||||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_x_small", win_x_small);
|
ini.SetInt("win_x_small", win_x_small);
|
||||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_y_small", win_y_small);
|
ini.SetInt("win_y_small", win_y_small);
|
||||||
ini_set_str stdcall (#pixie_ini_path, #config_section, "last_folder", #work_folder, strlen(#work_folder));
|
ini.SetString("last_folder", #work_folder, strlen(#work_folder));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.1 KiB |
Loading…
Reference in New Issue
Block a user