diff --git a/programs/cmm/pixie2/Tupfile.lua b/programs/cmm/pixie2/Tupfile.lua new file mode 100644 index 0000000000..30782d51dc --- /dev/null +++ b/programs/cmm/pixie2/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("pixie.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "pixie.com") diff --git a/programs/cmm/pixie2/compile_en.bat b/programs/cmm/pixie2/compile_en.bat new file mode 100644 index 0000000000..5466fa8d8e --- /dev/null +++ b/programs/cmm/pixie2/compile_en.bat @@ -0,0 +1,10 @@ +@del lang.h-- +@echo #define LANG_ENG 1 >lang.h-- + +@C-- pixie.c +@del pixie +@kpack pixie.com +@rename pixie.com pixie +@del warning.txt +@del lang.h-- +@pause \ No newline at end of file diff --git a/programs/cmm/pixie2/get_files_list.h b/programs/cmm/pixie2/get_files_list.h new file mode 100644 index 0000000000..19a774c814 --- /dev/null +++ b/programs/cmm/pixie2/get_files_list.h @@ -0,0 +1,53 @@ +int files_mas[2000]; +dword buf; + + +void OpenDirectory(dword folder_path) +{ + int cur; + char temp_filename[4096]; + dword j, filesnum, end_pointer; + + list.count = 0; + if (buf) free(buf); + if (GetDir(#buf, #filesnum, folder_path, DIRS_ONLYREAL)==0) + if (filesnum==0) + { + notify("'Error opening folder' -E"); + } + + for (j=0; j= b) return; + for (j = a; j <= b; j++) + if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j]; i++;} + SortByName(a, i-2); + SortByName(i, b); +} + +void SetOpenedFileFirst(dword in_name) +{ + int i; + dword opened_filename = in_name + strrchr(in_name, '/'); + for (i=0; i47) strcpy(#temp_filename+44, "..."); + + yyy = i*list.item_h+list.y; + + //this is selected file + 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); + } + //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); + } + //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); + } + } + DrawBar(list.x,list.visible * list.item_h + list.y, list.w, -list.visible * list.item_h + list.h, theme.color_list_bg); + DrawScroller(); +} + + +void draw_window() { + GetProcessInfo(#Form, SelfInfo); + DrawTopPanel(); + IF (Form.status_window>=2) return; + if (window_mode == WINDOW_MODE_NORMAL) + { + DrawPlayList(); + DrawRectangle(0, skin.h-1, skin.w-1, list.h+1, theme.color_list_border); + } +} + + +void DrawTopPanel() +{ + char cur_y_playing_title[245]; + int button_y; + //if (playback_mode == PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0); + //Mode depended + if (window_mode == WINDOW_MODE_NORMAL) + { + img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0); + 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 + 33, "..."); + DrawPixieTitle(#work_folder + strrchr(#work_folder, '/')); + WriteText(10, 26, list.font_type, theme.color_top_panel_text, #cur_y_playing_title); + button_y = 45; + DefineHiddenButton(Form.width - 56, button_y, 23, 23, BUTTON_OPEN_DIALOG); + DefineHiddenButton(Form.width - 27, button_y, 23, 23, BUTTON_SHOW_VOLUME); + } + else if (window_mode == WINDOW_MODE_SMALL) + { + img_draw stdcall(skin.image, 0, 0, WIN_W_SMALL, WIN_H_SMALL, skin.w-1, 0); + DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME); + button_y = 9; + } + if (!list.count) DrawPixieTitle("Pixie"); + //Playing control buttons + DefineHiddenButton(5, button_y, 23, 23, BUTTON_PLAYBACK_PREV); + DefineHiddenButton(34, button_y-2, 27, 25, BUTTON_PLAYBACK_PLAY_PAUSE); + DefineHiddenButton(65, button_y, 23, 23, BUTTON_PLAYBACK_NEXT); + //Window control buttons + DefineHiddenButton(Form.width - 18, 1, 15, 15, BUTTON_WINDOW_CLOSE); + DefineHiddenButton(Form.width - 18, 16, 15, 15, BUTTON_WINDOW_REDUCE); + DefineHiddenButton(Form.width - 32, 1, 15, 15, BUTTON_WINDOW_MINIMIZE); +} + + +void DrawScroller() +{ + scroll1.max_area = list.count; + scroll1.cur_area = list.visible; + scroll1.position = list.first; + scroll1.all_redraw = 0; + scroll1.start_x = skin.w - scroll1.size_x-1; + scroll1.start_y = list.y-1; + scroll1.size_y = list.h+2; + if (list.count > list.visible) scrollbar_v_draw(#scroll1); +} + +void DrawPixieTitle(dword _title) +{ + WriteTextB(10, 6, list.font_type, theme.color_top_panel_text, _title); +} + +//===================================================// +// // +// EVENTS // +// // +//===================================================// + + +void EventOpenFolder(dword _open_path) +{ + if (ESBYTE[_open_path]) + { + strcpy(#work_folder, _open_path); + work_folder[strrchr(#work_folder, '/')-1]='\0'; + OpenDirectory(#work_folder); + SetOpenedFileFirst(_open_path); + } + list.SetSizes(1, skin.h, skin.w-1, 22*15, 22); + if (list.count <= list.visible) + { + list.h = list.count * list.item_h; + list.visible = list.count; + list.w -= 1; + } + else + { + list.w -= scroll1.size_x; + } + MoveSize(OLD, OLD, OLD, skin.h + list.h); + list.KeyHome(); + current_playing_file_n=0; + EventStopPlayingMp3(); + EventStartPlayingMp3(); +} + + +void EventStopPlayingMp3() +{ + if (player_run_id) player_run_id = KillProcess(player_run_id); + if (notify_run_id) notify_run_id = KillProcess(notify_run_id); + playback_mode = PLAYBACK_MODE_STOPED; + DrawTopPanel(); + DrawPlayList(); +} + + +void EventStartPlayingMp3() +{ + word i; + char item_path[4096]; + char notify_message[512]; + EventStopPlayingMp3(); + if (current_playing_file_n > list.count) { + current_playing_file_n = list.count; + return; + } + if (current_playing_file_n < 0) { + current_playing_file_n = 0; + return; + } + playback_mode = PLAYBACK_MODE_PLAYING; + strlcpy(#current_filename, Getcur_yItemName(), sizeof(current_filename)); + sprintf(#item_path,"\"%s/%s\"",#work_folder,#current_filename); + DrawPlayList(); + DrawTopPanel(); + if (strcmpi(#item_path+strlen(#item_path)-4,".mp3")) player_run_id = RunProgram(abspath("minimp3"), #item_path); + sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename); + for (i=2; i