From d6c5005f966cba32bab289a587ced5c4fbcd97f2 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 20 Mar 2018 08:24:20 +0000 Subject: [PATCH] Pixie 2.8: fix play button while playing, delete from the list, bugfixes git-svn-id: svn://kolibrios.org@7196 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/pixie2/get_files_list.h | 5 +- programs/cmm/pixie2/pixie.c | 79 ++++++++++++++++----------- programs/cmm/pixie2/skin.png | Bin 4204 -> 4495 bytes 3 files changed, 49 insertions(+), 35 deletions(-) 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; ipbqXF5>ceniI&>=`bDge1fWXNFG8_b5PJ|3CEG*R3 z)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