00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TSE3_APP_CHOICES_H
00018 #define TSE3_APP_CHOICES_H
00019
00020 #include "tse3/Notifier.h"
00021 #include "tse3/Serializable.h"
00022 #include "tse3/FileBlockParser.h"
00023
00024 #include <string>
00025 #include <list>
00026
00027 namespace TSE3
00028 {
00029 class Metronome;
00030 class Transport;
00031 class Panic;
00032 class MidiMapper;
00033 class MidiScheduler;
00034
00035 namespace Ins
00036 {
00037 class Destination;
00038 }
00039
00040 namespace App
00041 {
00042 class Application;
00043
00070 class ChoiceHandler : public TSE3::Serializable
00071 {
00072 public:
00073
00077 ChoiceHandler(const std::string &choicename);
00078 virtual ~ChoiceHandler();
00079
00085 const std::string &name() const { return _name; }
00086
00087 protected:
00088
00089 std::string _name;
00090 };
00091
00106 class ChoicesManager
00107 {
00108 public:
00109
00110 ChoicesManager();
00111 ~ChoicesManager();
00112
00119 void add(ChoiceHandler *ch) { handler.add(ch); }
00120
00126 void remove(ChoiceHandler *ch) { handler.remove(ch); }
00127
00133 void save(const std::string &filename);
00134
00143 void load(const std::string &filename);
00144
00145 private:
00146
00155 class ChoicesChoiceHandler : public ChoiceHandler
00156 {
00157 public:
00158 ChoicesChoiceHandler();
00159 ~ChoicesChoiceHandler();
00160 void add(ChoiceHandler *ch);
00161 void remove(ChoiceHandler *ch);
00165 virtual void save(std::ostream &out, int indent) const;
00169 virtual void load(std::istream &in,
00170 TSE3::SerializableLoadInfo &info);
00171 private:
00172 std::list<ChoiceHandler *> handlers;
00173 };
00174 ChoicesChoiceHandler handler;
00175
00176 };
00177
00178
00179
00180
00181
00189 class ApplicationChoiceHandler : public ChoiceHandler
00190 {
00191 public:
00192 ApplicationChoiceHandler(Application *a);
00193 ~ApplicationChoiceHandler();
00197 virtual void save(std::ostream &out, int indent) const;
00201 virtual void load(std::istream &in,
00202 TSE3::SerializableLoadInfo &info);
00203 private:
00204 Application *a;
00205 };
00206
00214 class MetronomeChoiceHandler : public ChoiceHandler
00215 {
00216 public:
00217 MetronomeChoiceHandler(TSE3::Metronome *m);
00218 ~MetronomeChoiceHandler();
00222 virtual void save(std::ostream &out, int indent) const;
00226 virtual void load(std::istream &in,
00227 TSE3::SerializableLoadInfo &info);
00228 private:
00229 TSE3::Metronome *m;
00230 };
00231
00239 class PanicChoiceHandler : public ChoiceHandler
00240 {
00241 public:
00242 PanicChoiceHandler(TSE3::Panic *p);
00243 ~PanicChoiceHandler();
00247 virtual void save(std::ostream &out, int indent) const;
00251 virtual void load(std::istream &in,
00252 TSE3::SerializableLoadInfo &info);
00253 private:
00254 TSE3::Panic *p;
00255 };
00256
00264 class MidiMapperChoiceHandler : public ChoiceHandler
00265 {
00266 public:
00267 MidiMapperChoiceHandler(TSE3::MidiMapper *m);
00268 ~MidiMapperChoiceHandler();
00272 virtual void save(std::ostream &out, int indent) const;
00276 virtual void load(std::istream &in,
00277 TSE3::SerializableLoadInfo &info);
00278 private:
00279 TSE3::MidiMapper *m;
00280 };
00281
00289 class TransportChoiceHandler : public ChoiceHandler
00290 {
00291 public:
00292 TransportChoiceHandler(TSE3::Transport *t);
00293 ~TransportChoiceHandler();
00297 virtual void save(std::ostream &out, int indent) const;
00301 virtual void load(std::istream &in,
00302 TSE3::SerializableLoadInfo &info);
00303 private:
00304 TSE3::Transport *t;
00305 PanicChoiceHandler startPanicHandler;
00306 PanicChoiceHandler endPanicHandler;
00307 MidiMapperChoiceHandler mapperHandler;
00308 };
00309
00317 class DestinationChoiceHandler : public ChoiceHandler
00318 {
00319 public:
00320 DestinationChoiceHandler(TSE3::Ins::Destination *d,
00321 TSE3::MidiScheduler *ms);
00322 ~DestinationChoiceHandler();
00326 virtual void save(std::ostream &out, int indent) const;
00330 virtual void load(std::istream &in,
00331 TSE3::SerializableLoadInfo &info);
00332 private:
00333 TSE3::Ins::Destination *d;
00334 TSE3::MidiScheduler *ms;
00335 };
00336 }
00337 }
00338
00339 #endif