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
|
||||
3ds=15
|
||||
asc=15
|
||||
vox=15
|
||||
kex=16
|
||||
skn=17
|
||||
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.height = GetScreenHeight()+1;
|
||||
|
||||
DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
|
||||
__generator = GetStartTime();
|
||||
|
||||
mem_init();
|
||||
|
@ -25,13 +25,11 @@
|
||||
* drag - drag the element event
|
||||
*/
|
||||
|
||||
:dword __TMP_TIME,DOUBLE_CLICK_DELAY;
|
||||
:struct MOUSE
|
||||
{
|
||||
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top;
|
||||
dword handle,_;
|
||||
byte cmd;
|
||||
void clearTime();
|
||||
void get();
|
||||
void set();
|
||||
void center();
|
||||
@ -39,10 +37,7 @@
|
||||
void slider();
|
||||
void show();
|
||||
} mouse;
|
||||
:void MOUSE::clearTime()
|
||||
{
|
||||
tmp_time = GetStartTime()+DOUBLE_CLICK_DELAY;
|
||||
}
|
||||
|
||||
:void MOUSE::show()
|
||||
{
|
||||
if(!handle)return;
|
||||
@ -147,13 +142,12 @@
|
||||
down = false;
|
||||
drag = false;
|
||||
if(!move) click = true;
|
||||
__TMP_TIME = GetStartTime();
|
||||
if(__TMP_TIME-tmp_time<=DOUBLE_CLICK_DELAY)
|
||||
if(GetStartTime()-GetMouseDoubleClickDelay()<=tmp_time)
|
||||
{
|
||||
dblclick = true;
|
||||
click = false;
|
||||
}
|
||||
tmp_time = __TMP_TIME;
|
||||
tmp_time = GetStartTime();
|
||||
//returns the key code
|
||||
key = tmp;
|
||||
lkm = 1&tmp;
|
||||
|
@ -2,7 +2,7 @@
|
||||
@echo #define LANG_ENG 1 >lang.h--
|
||||
|
||||
@c-- mblocks.c
|
||||
@del mblocks.kex
|
||||
@del mblocks
|
||||
@rename mblocks.com mblocks
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
|
@ -13,15 +13,16 @@
|
||||
#include "../lib/file_system.h"
|
||||
#include "../lib/list_box.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/libimg.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/obj/proc_lib.h"
|
||||
#include "../lib/patterns/simple_open_dialog.h"
|
||||
|
||||
//===================================================//
|
||||
@ -34,7 +35,7 @@
|
||||
char default_dir[] = "/rd/1";
|
||||
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.
|
||||
|
||||
Controls:
|
||||
@ -85,6 +86,8 @@ enum {
|
||||
PLAYBACK_MODE_PLAYING
|
||||
};
|
||||
|
||||
collection music_col;
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// CODE //
|
||||
@ -113,7 +116,8 @@ void main()
|
||||
if (!param) notify("'Pixie Player\nPress O key to open MP3 file' -St");
|
||||
LoadLibraries();
|
||||
LoadIniConfig();
|
||||
SetEventMask(0100111b);
|
||||
kfont.init(DEFAULT_FONT);
|
||||
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
||||
loop()
|
||||
{
|
||||
WaitEventTimeout(10);
|
||||
@ -185,11 +189,12 @@ void DrawPlayList()
|
||||
int i;
|
||||
int yyy;
|
||||
char temp_filename[4096];
|
||||
dword text_color, bg_color;
|
||||
for (i=0; i<list.visible; i++;)
|
||||
{
|
||||
strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72);
|
||||
temp_filename[strlen(#temp_filename)-4] = '\0';
|
||||
if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "...");
|
||||
//temp_filename[strlen(#temp_filename)-4] = '\0';
|
||||
//if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "...");
|
||||
|
||||
yyy = i*list.item_h+list.y;
|
||||
|
||||
@ -197,22 +202,23 @@ void DrawPlayList()
|
||||
if (list.cur_y - list.first == i)
|
||||
{
|
||||
if (i>=list.count) continue;
|
||||
DrawBar(list.x, yyy, list.w, list.item_h, theme.color_list_active_bg);
|
||||
WriteText(12,yyy+list.text_y,list.font_type, theme.color_list_active_text, #temp_filename);
|
||||
bg_color = theme.color_list_active_bg;
|
||||
text_color = theme.color_list_text;
|
||||
}
|
||||
//this is not selected file
|
||||
else
|
||||
{
|
||||
if (i>=list.count) continue;
|
||||
DrawBar(list.x,yyy,list.w, list.item_h, theme.color_list_bg);
|
||||
WriteText(12,yyy+list.text_y,list.font_type, theme.color_list_text, #temp_filename);
|
||||
bg_color = theme.color_list_bg;
|
||||
text_color = theme.color_list_text;
|
||||
}
|
||||
//this is cur_y playing file
|
||||
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");
|
||||
WriteText(12,yyy+list.text_y,list.font_type, theme.color_list_active_text, #temp_filename);
|
||||
text_color = theme.color_list_active_text;
|
||||
}
|
||||
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);
|
||||
DrawScroller();
|
||||
@ -234,8 +240,8 @@ dword GetSongTitle()
|
||||
{
|
||||
char cur_y_playing_title[245];
|
||||
strcpy(#cur_y_playing_title, #current_filename);
|
||||
cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
|
||||
if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "...");
|
||||
//cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
|
||||
//if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "...");
|
||||
return #cur_y_playing_title;
|
||||
}
|
||||
|
||||
@ -247,16 +253,16 @@ void DrawTopPanel()
|
||||
//Mode depended
|
||||
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);
|
||||
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");
|
||||
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
|
||||
DefineHiddenButton(7, button_y, 30, 16, BUTTON_PLAYBACK_PREV);
|
||||
DefineHiddenButton(39, button_y, 30, 16, BUTTON_PLAYBACK_PLAY_PAUSE);
|
||||
DefineHiddenButton(71, button_y, 30, 16, BUTTON_PLAYBACK_NEXT);
|
||||
DefineHiddenButton(7, button_y, 32, 18, BUTTON_PLAYBACK_PREV);
|
||||
DefineHiddenButton(41, button_y, 32, 18, BUTTON_PLAYBACK_PLAY_PAUSE);
|
||||
DefineHiddenButton(75, button_y, 32, 18, BUTTON_PLAYBACK_NEXT);
|
||||
//Window control buttons
|
||||
DefineHiddenButton(Form.width - 21, 1, 20, 13, BUTTON_WINDOW_CLOSE);
|
||||
DefineHiddenButton(Form.width - 43, 1, 20, 13, BUTTON_WINDOW_MINIMIZE);
|
||||
@ -295,7 +301,9 @@ void DrawScroller()
|
||||
|
||||
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 notify_message[512];
|
||||
EventStopPlayingMp3();
|
||||
if (current_playing_file_n > list.count) {
|
||||
current_playing_file_n = list.count;
|
||||
if (current_playing_file_n >= list.count) {
|
||||
current_playing_file_n = list.count-1;
|
||||
return;
|
||||
}
|
||||
if (current_playing_file_n < 0) {
|
||||
@ -362,7 +370,7 @@ void EventStartPlayingMp3()
|
||||
sprintf(#item_path,"-h %s/%s",#work_folder,#current_filename);
|
||||
DrawPlayList();
|
||||
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);
|
||||
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);
|
||||
|
@ -1,4 +1,3 @@
|
||||
[Config]
|
||||
current_theme=0
|
||||
window_mode=0
|
||||
last_folder=
|
@ -1,5 +1,6 @@
|
||||
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_list_bg,
|
||||
color_list_text,
|
||||
@ -10,31 +11,32 @@ struct struct_pixie_colors {
|
||||
color_list_border;
|
||||
} theme;
|
||||
|
||||
char config_section[] = "Config";
|
||||
_ini ini = { "/sys/media/pixie/pixie.ini", "Config" };
|
||||
|
||||
#define WIN_W_SMALL 114
|
||||
#define WIN_H_SMALL 31
|
||||
|
||||
void LoadIniConfig()
|
||||
{
|
||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "window_mode", WINDOW_MODE_NORMAL); window_mode = EAX;
|
||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_x_normal", 100); win_x_normal = EAX;
|
||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_y_normal", 90); win_y_normal = EAX;
|
||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_x_small", -1); win_x_small = EAX;
|
||||
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_y_small", -1); win_y_small = EAX;
|
||||
ini_get_str stdcall (#pixie_ini_path, #config_section, "last_folder", #work_folder, sizeof(work_folder), 0);
|
||||
window_mode = ini.GetInt("window_mode", WINDOW_MODE_NORMAL);
|
||||
win_x_normal = ini.GetInt("win_x_normal", 100);
|
||||
win_y_normal = ini.GetInt("win_y_normal", 90);
|
||||
win_x_small = ini.GetInt("win_x_small", -1);
|
||||
win_y_small = ini.GetInt("win_y_small", -1);
|
||||
ini.GetString("last_folder", #work_folder, sizeof(work_folder), 0);
|
||||
|
||||
Libimg_LoadImage(#skin, abspath("skin.png"));
|
||||
skin.w = 322;
|
||||
theme.color_top_panel_bg = 0x242424;
|
||||
theme.color_top_panel_folder_name = 0xDDDDDB;
|
||||
theme.color_top_panel_song_name = 0xBEBEBE;
|
||||
theme.color_list_bg = 0xE2E2E2;
|
||||
theme.color_list_text = 0x595959;
|
||||
theme.color_list_active_bg = 0xFAF3AF;
|
||||
theme.color_list_active_text = 0x85663F;
|
||||
theme.color_list_active_pointer = 0x85663F;
|
||||
theme.color_list_bg = 0x313031;
|
||||
theme.color_list_text = 0xADAEAD;
|
||||
theme.color_list_active_bg = 0x434343;
|
||||
theme.color_list_active_text = 0x17A2CC;
|
||||
theme.color_list_active_pointer = 0xD6D6D6;
|
||||
theme.color_list_scroller = 0xBBBbbb;
|
||||
theme.color_list_border = 0x010101;
|
||||
theme.color_list_border = 0x121212;
|
||||
scroll1.bckg_col = theme.color_list_bg;
|
||||
scroll1.frnt_col = theme.color_list_border;
|
||||
scroll1.line_col = theme.color_list_border;
|
||||
@ -56,11 +58,11 @@ void SaveIniConfig()
|
||||
win_x_small = Form.left;
|
||||
win_y_small = Form.top;
|
||||
}
|
||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "window_mode", window_mode);
|
||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_x_normal", win_x_normal);
|
||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_y_normal", win_y_normal);
|
||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_x_small", win_x_small);
|
||||
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_y_small", win_y_small);
|
||||
ini_set_str stdcall (#pixie_ini_path, #config_section, "last_folder", #work_folder, strlen(#work_folder));
|
||||
ini.SetInt("window_mode", window_mode);
|
||||
ini.SetInt("win_x_normal", win_x_normal);
|
||||
ini.SetInt("win_y_normal", win_y_normal);
|
||||
ini.SetInt("win_x_small", win_x_small);
|
||||
ini.SetInt("win_y_small", win_y_small);
|
||||
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