diff --git a/programs/cmm/pixie2/get_files_list.h b/programs/cmm/pixie2/get_files_list.h index 3083ae4844..a44455f635 100644 --- a/programs/cmm/pixie2/get_files_list.h +++ b/programs/cmm/pixie2/get_files_list.h @@ -15,7 +15,7 @@ void OpenDirectory(dword folder_path) { notify("'Error opening folder' -E"); } - + debugval("sizeof(files_mas)", sizeof(files_mas)); for (j=0; j=sizeof(files_mas)*sizeof(int)) break; } } SortByName(0, list.count-1); diff --git a/programs/cmm/pixie2/pixie.c b/programs/cmm/pixie2/pixie.c index 74ed93c360..851a65618e 100644 --- a/programs/cmm/pixie2/pixie.c +++ b/programs/cmm/pixie2/pixie.c @@ -11,7 +11,6 @@ #include "../lib/gui.h" #include "../lib/random.h" #include "../lib/kfont.h" -#include "../lib/collection.h" #include "../lib/obj/libio.h" #include "../lib/obj/libimg.h" @@ -32,7 +31,7 @@ char default_dir[] = "/rd/1"; od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" }; -#define ABOUT_MESSAGE "Pixie Player v2.7 +#define ABOUT_MESSAGE "Pixie Player v2.8 A tiny music folder player. Supports MP3, WAV, XM audio file formats. @@ -43,6 +42,7 @@ Play/Stop: Space or P key Start playing selected file: Enter Goto next/previous track: Ctrl + Left/Right Change sound volume: Left/Right key +Remove from the list: Delete Repeat: R Shuffle: S Mute: M @@ -95,8 +95,6 @@ enum { PLAYBACK_MODE_PLAYING }; -collection music_col; - #define LAST_FOLDER_EXISTS 1 //===================================================// @@ -183,6 +181,7 @@ void main() if (key_scancode==SCAN_CODE_RIGHT) RunProgram("/sys/@VOLUME", "+"); if (key_scancode==SCAN_CODE_LEFT) RunProgram("/sys/@VOLUME", "-"); if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem(); + if (key_scancode==SCAN_CODE_DEL) EventDeleteItem(); if (key_scancode==SCAN_CODE_KEY_P)||(key_scancode==SCAN_CODE_SPACE) EventPlayAndPause(); if (list.ProcessKey(key_scancode)) DrawPlayList(); break; @@ -209,6 +208,7 @@ void DrawPlayList() { int i; int yyy; + int kfont_width; char temp_filename[4096]; dword text_color, bg_color; for (i=0; iskin.w-15) DrawBar(skin.w-1, yyy, 1, list.item_h, theme.color_list_border); } DrawBar(list.x,list.visible * list.item_h + list.y, list.w, -list.visible * list.item_h + list.h, theme.color_list_bg); @@ -260,19 +261,9 @@ void draw_window() { } } -dword GetSongTitle() -{ - char cur_y_playing_title[245]; - strcpy(#cur_y_playing_title, #current_filename); - cur_y_playing_title[strrchr(#cur_y_playing_title, '.')-1] = '\0'; - //if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "..."); - return #cur_y_playing_title; -} - - void DrawTopPanel() { - + int kfont_width; int button_y; //Mode depended if (window_mode == WINDOW_MODE_NORMAL) @@ -288,8 +279,9 @@ void DrawTopPanel() if (!work_folder) DrawPixieTitle("Pixie"); else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/')); - kfont.WriteIntoWindow(8, 24, theme.color_top_panel_bg, - theme.color_top_panel_song_name, list.font_type, GetSongTitle()); + kfont_width = kfont.WriteIntoWindow(8, 24, theme.color_top_panel_bg, + theme.color_top_panel_song_name, list.font_type, #current_filename); + if (kfont_width>skin.w-15) DrawBar(skin.w-1, 24, 1, list.item_h, theme.color_list_border); //Playing control buttons DefineHiddenButton(7, button_y, 38, 20, BUTTON_PLAYBACK_PREV); DefineHiddenButton(47, button_y, 38, 20, BUTTON_PLAYBACK_PLAY_PAUSE); @@ -308,6 +300,8 @@ void DrawTopPanel() { button_y = 7; img_draw stdcall(skin.image, 0, 0, WIN_W_SMALL, WIN_H_SMALL, skin.w-1, 0); + if (playback_mode != PLAYBACK_MODE_STOPED) + img_draw stdcall(skin.image, 46, button_y-1, 27, 19, skin.w+83, WIN_H_SMALL+1); DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME); //Playing control buttons DefineHiddenButton(20, button_y, 24, 16, BUTTON_PLAYBACK_PREV); @@ -369,15 +363,15 @@ void EventOpenFolder(dword _open_path) { list.w -= scroll1.size_x; } - MoveSize(OLD, OLD, OLD, skin.h + list.h); + if (window_mode==WINDOW_MODE_NORMAL) MoveSize(OLD, OLD, OLD, skin.h + list.h); list.KeyHome(); current_playing_file_n=0; - EventStopPlayingMp3(); - if (_open_path) EventStartPlayingMp3(); + EventStopPlaying(); + if (_open_path) EventStartPlaying(); } -void EventStopPlayingMp3() +void EventStopPlaying() { if (player_run_id) player_run_id = KillProcess(player_run_id); if (notify_run_id) notify_run_id = KillProcess(notify_run_id); @@ -387,12 +381,12 @@ void EventStopPlayingMp3() } -void EventStartPlayingMp3() +void EventStartPlaying() { word i; char item_path[4096]; char notify_message[512]; - EventStopPlayingMp3(); + EventStopPlaying(); if (current_playing_file_n >= list.count) { current_playing_file_n = list.count-1; return; @@ -404,11 +398,12 @@ void EventStartPlayingMp3() playback_mode = PLAYBACK_MODE_PLAYING; strlcpy(#current_filename, Getcur_yItemName(), sizeof(current_filename)); sprintf(#item_path,"-h %s/%s",#work_folder,#current_filename); + current_filename[strrchr(#current_filename, '.')-1] = '\0'; DrawPlayList(); DrawTopPanel(); player_run_id = RunProgram("/sys/media/ac97snd", #item_path); sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename); - if (!repeat) + if (!repeat) && (window_mode==WINDOW_MODE_SMALL) { for (i=2; i