1 #ifndef _UltimatePlayer_UltimatePlayer_h 2 #define _UltimatePlayer_UltimatePlayer_h 3 4 using namespace Upp; 5 6 #define SCHEMADIALECT <plugin/Sqlite3/Sqlite3Schema.h> 7 #define MODEL <UltimatePlayer/UltimatePlayer.sch> 8 #include "Sql/sch_header.h" 9 10 #define LAYOUTFILE <UltimatePlayer/UltimatePlayer.lay> 11 #include <CtrlCore/lay.h> 12 13 #define IMAGEFILE <UltimatePlayer/UltimatePlayer.iml> 14 #define IMAGECLASS Images 15 #include <Draw/iml_header.h> 16 #include "FMod.h" 17 18 enum 19 { 20 ORDER_DSC = 0, 21 ORDER_ASC = 1, 22 ORDER_SHUFLE = 2, 23 REPEAT_ONE = 0, 24 REPEAT_PLAYLIST = 1, 25 REPEAT_ALL = 2, 26 REPEAT_NONE = 3 27 }; 28 29 struct ConvMs : Convert 30 { 31 virtual Value Format(const Value& q) const; 32 }; 33 34 class FileAssoc : public WithFilesLayout<TopWindow> 35 { 36 public: 37 typedef FileAssoc CLASSNAME; 38 39 FileAssoc(); 40 41 }; 42 43 class Player : public WithPlayerLayout<TopWindow> 44 { 45 public: 46 typedef Player CLASSNAME; 47 48 SoundSystem sndsys; 49 SoundStream mpx_stream, cd_stream, stream; 50 51 FileSel filesel; 52 FileSel foldersel; 53 MenuBar menu; 54 int lang, curlang; 55 int prevpos; 56 int track; 57 58 bool isplaying; 59 int playid; 60 int prev_playid; 61 int playrow; 62 63 int order_mode; 64 int repeat_mode; 65 bool rebuild_songs_list; 66 bool stop_play; 67 68 EditString name; 69 //NOTIFYICONDATA tray; 70 HICON trayicon; 71 TaskbarButton tray; 72 //TrayIcon tray; 73 74 Array<GridCtrl> pls; 75 Array<GridCtrl> sys; 76 GridCtrl * cpl, * opl; 77 GridCtrl list; 78 GridCtrl system; 79 80 bool register_startup; 81 bool follow_song; 82 bool play_last_song; 83 bool goto_last_song; 84 bool bring_to_front; 85 86 VectorMap<String, int> register_exts; 87 Vector<int> songs; 88 89 Splitter left; 90 91 Player(); 92 ~Player(); 93 94 void Initialize(); 95 96 void AddPlaylist(bool append); 97 void ReadPlaylists(); 98 GridCtrl& AddPlaylistControl(Array<GridCtrl> &pls, int n = -1, bool cd = false); 99 100 bool MakeDefaultPlaylistName(String &name); 101 102 void SystemChangeRow(); 103 104 void ListInsertRow(); 105 void ListUpdateRow(); 106 void ListNewRow(); 107 void ListRemoveRow(); 108 void ListChangeRow(); 109 ListAdd()110 void ListAdd() { AddPlaylist(1); } ListInsert()111 void ListInsert() { AddPlaylist(0); } 112 113 void ListAppendFolders(bool append); 114 void ListAddFolders(); 115 void ListInsertFolders(); 116 117 bool IsMusicFile(String &path); 118 bool IsCDFile(String &path); 119 String GetCDDrive(String &path); 120 121 void AddFiles(bool append, String path); 122 void AddFile(bool append, const String &file); 123 124 void AddFiles(bool append); 125 void AddFolders(bool append); 126 PLAddFiles()127 void PLAddFiles() { AddFiles(1); } PLAddFolders()128 void PLAddFolders() { AddFolders(1); } PLInsertFiles()129 void PLInsertFiles() { AddFiles(0); } PLInsertFolders()130 void PLInsertFolders() { AddFolders(0); } 131 132 void PLRemoveRow(); 133 134 void ShowAddPlaylistMenu(); 135 void ShowAddMusicMenu(); 136 void AddMusicBar(Bar &bar); 137 138 int GetPlayRow(); 139 int FindPlaylist(GridCtrl &pl); 140 int FindPlaylistId(GridCtrl &pl); 141 142 void PopupMenuBar(Bar &bar); 143 void SystemMenuBar(Bar &bar); 144 145 void StorePositions(); 146 147 void LoadCD(); 148 149 GridCtrl& GetPlaylist(); 150 151 void SetShellPlaylist(); 152 bool IsShellPlaylist(GridCtrl &pl); 153 bool IsSystemPlaylist(GridCtrl &pl, bool noexplorator = false); 154 bool IsCDPlaylist(GridCtrl &pl); 155 156 int GetCDTrackNum(const String& filename); 157 158 void StopPlay(); 159 160 void Play(); 161 void Stop(bool stopstream = false, bool resetcpl = true); RealStop()162 void RealStop() { Stop(true); } 163 164 void TrayPlay(); 165 void TrayStop(); 166 167 bool PlayDir(bool forward); PlayNext()168 bool PlayNext() { return PlayDir(true); } PlayPrev()169 bool PlayPrev() { return PlayDir(false); } 170 OnPlayNext()171 void OnPlayNext() { PlayNext(); } OnPlayPrev()172 void OnPlayPrev() { PlayPrev(); } 173 174 bool IsPlaying(); 175 176 void OnSetPos(); 177 void OnSetVol(); 178 179 void SetOrder(); 180 void OnChangeOrder(); 181 void SetRepeat(); 182 void OnChangeRepeat(); 183 184 void UpdateProgress(); 185 void UpdatePlayButton(); 186 187 void ChangePlaylistName(); 188 void AddPlaylistBar(Bar &bar); 189 void PopupListMenuBar(Bar &bar); 190 191 void MenuBar(Bar &bar); 192 void FilesBar(Bar &bar); 193 void LanguagesBar(Bar &bar); 194 void OptionsBar(Bar &bar); Nothing()195 void Nothing() {}; 196 197 void Serialize(Stream &s); 198 199 void SetLang(int l); 200 201 void RegisterExt(const char * ext); 202 void RegisterExts(bool force); 203 void FileAssociations(); 204 void Test(); 205 void GoToSong(); 206 void GoTo(bool gothere); 207 //void GoTo(int); 208 void FollowSong(); 209 void PlayLastSong(); 210 void GotoLastSong(); 211 void BringToFront(); 212 213 void BuildSongsList(); 214 int GetSongRow0(GridCtrl &pl, int played_col); 215 int GetSongRow(); 216 217 void ToTray(); 218 void ShowPlayer(); 219 bool AddCmd(const Vector<String> &cmd, bool play = true); 220 221 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); 222 virtual void State(int reason); 223 }; 224 225 #endif 226 227