Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 7181 → Rev 7182

/programs/cmm/pixie2/pixie.c
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
PLAYBACK_MODE_PLAYING
};
 
collection music_col;
 
//===================================================//
// //
// CODE //
113,7 → 116,8
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
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
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
{
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
//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 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
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
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);
/programs/cmm/pixie2/pixie.ini
1,4 → 1,3
[Config]
current_theme=0
window_mode=0
last_folder=
/programs/cmm/pixie2/settings.h
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,7 → 11,7
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
17,24 → 18,25
 
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
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));
}
 
/programs/cmm/pixie2/skin.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream