00001 /* 00002 * @(#)app/Application.h 1.00 16 Nov 1999 00003 * 00004 * Copyright (c) 2000 Pete Goodliffe (pete@cthree.org) 00005 * 00006 * This file is part of TSE3 - the Trax Sequencer Engine version 3.00. 00007 * 00008 * This library is modifiable/redistributable under the terms of the GNU 00009 * General Public License. 00010 * 00011 * You should have received a copy of the GNU General Public License along 00012 * with this program; see the file COPYING. If not, write to the Free Software 00013 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00014 * 00015 */ 00016 00017 #ifndef TSE3_APP_APPLICATION_H 00018 #define TSE3_APP_APPLICATION_H 00019 00020 #include "tse3/Song.h" 00021 00022 #include <string> 00023 #include <vector> 00024 #include <map> 00025 #include <cstddef> 00026 00027 namespace TSE3 00028 { 00029 class Metronome; 00030 class Transport; 00031 class MidiScheduler; 00032 class MidiSchedulerFactory; 00033 class PresetColours; 00034 00035 namespace Cmd 00036 { 00037 class CommandHistory; 00038 }; 00039 00040 namespace Ins 00041 { 00042 class Destination; 00043 }; 00044 00055 namespace App 00056 { 00057 class ChoicesManager; 00058 class Record; 00059 00075 class Application : public TSE3::Listener<TSE3::SongListener> 00076 { 00077 public: 00078 00098 Application(const std::string &appname, 00099 const std::string &appversion, 00100 TSE3::MidiSchedulerFactory *msf, 00101 const std::string &choicesFile = ""); 00102 00107 ~Application(); 00108 00116 const std::string &appName() const { return _appname; } 00117 00125 const std::string &appVersion() const { return _appversion; } 00126 00127 /************************************************************** 00128 * Access to the main non-Song TSE3 components 00129 *************************************************************/ 00130 00135 TSE3::Metronome *metronome() const { return _metronome; } 00136 00141 TSE3::Transport *transport() const { return _transport; } 00142 00148 TSE3::MidiScheduler *scheduler() const { return _scheduler; } 00149 00153 ChoicesManager *choicesManager() const { return _cm; } 00154 00159 Record *record() const; 00160 00165 TSE3::Ins::Destination *destination() const 00166 { return _destination; } 00167 00172 TSE3::PresetColours *presetColours() const 00173 { return _presetColours; } 00174 00175 /************************************************************** 00176 * Configuration of the application behaviour 00177 *************************************************************/ 00178 00184 bool saveChoicesOnDestroy() const 00185 { return _saveChoicesOnDestroy; } 00186 00192 void setSaveChoicesOnDestroy(bool s); 00193 00194 /************************************************************** 00195 * Functionality 00196 *************************************************************/ 00197 00202 void saveChoices(const std::string &filename = ""); 00203 00216 TSE3::Song *addSong(TSE3::Song *song = 0); 00217 00222 size_t numSongs() const; 00223 00230 TSE3::Cmd::CommandHistory *history(TSE3::Song *song); 00231 00235 virtual void Notifier_Deleted(TSE3::Song *song); 00236 00237 protected: 00238 00239 std::string _appname; 00240 std::string _appversion; 00241 std::string _choicesFile; 00242 00243 TSE3::Metronome *_metronome; 00244 TSE3::Transport *_transport; 00245 TSE3::MidiScheduler *_scheduler; 00246 ChoicesManager *_cm; 00247 Record *_record; 00248 TSE3::Ins::Destination *_destination; 00249 TSE3::PresetColours *_presetColours; 00250 00251 bool _saveChoicesOnDestroy; 00252 00253 std::vector<TSE3::Song *> songs; 00254 std::map<TSE3::Song *, TSE3::Cmd::CommandHistory *> histories; 00255 }; 00256 } 00257 } 00258 00259 #endif