/usr/include/tse3/app/Choices.h is in libtse3-dev 0.3.1-4.3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | /*
* @(#)app/Choices.h 1.00 16 Nov 1999
*
* Copyright (c) 2000 Pete Goodliffe (pete@cthree.org)
*
* This file is part of TSE3 - the Trax Sequencer Engine version 3.00.
*
* This library is modifiable/redistributable under the terms of the GNU
* General Public License.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING. If not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef TSE3_APP_CHOICES_H
#define TSE3_APP_CHOICES_H
#include "tse3/Notifier.h"
#include "tse3/Serializable.h"
#include "tse3/FileBlockParser.h"
#include <string>
#include <list>
namespace TSE3
{
class Metronome;
class Transport;
class Panic;
class MidiMapper;
class MidiScheduler;
namespace Ins
{
class Destination;
}
namespace App
{
class Application;
/**
* ChoiceHandlers are used by the @ref ChoicesManger object. You access
* the choices save/load mechanism through that object.
*
* This is a base class for objects that can save a particular block of
* choices. ChoiceHandlers are registered with the @ref ChoicesManager
* which delegates responsibility for saving/loading to each
* ChoiceHandler.
*
* ChoiceHandlers implement the @ref Serializable interface as the
* mechansim with which to perform saving, however they differ from the
* normal @ref TSE3::Song hierarchy save method since the object whose
* state is being saved is not the @ref TSE3::Serializable object - it
* is a ChoiceHandler based on it that does the saving.
*
* A number of stock implementations of ChoiceHandler are provided to
* save the common @ref TSE3 objects that are not directly related to a
* @ref Song. However, an application will want to add many more
* ChoiceHandlers to save it's internal settings (e.g. window positions,
* feature statuses end so on).
*
* @short Choice save/load base class
* @author Pete Goodliffe
* @version 1.00
* @see ChoicesManager
*/
class ChoiceHandler : public TSE3::Serializable
{
public:
/**
* Create a ChoiceHandler with the given name.
*/
ChoiceHandler(const std::string &choicename);
virtual ~ChoiceHandler();
/**
* Returns the name of this ChoiceHandler. This is a unique
* text string that will identify a block of data in the
* choices file as having been saved by this ChoiceHandler.
*/
const std::string &name() const { return _name; }
protected:
std::string _name;
};
/**
* This class provides a mechanism for saving 'choices'. These are
* the configuration aspects of any objects in the @ref TSE3 sequencer
* application.
*
* It employs the singleton design pattern.
*
* The format of a choices file is the blocked @ref TSE3MDL format.
*
* @short Choices file saving management
* @author Pete Goodliffe
* @version 1.00
* @see TSE3
*/
class ChoicesManager// : public Listener
{
public:
ChoicesManager();
~ChoicesManager();
/**
* Add a new @ref ChoiceHandler to the manager. This ties the
* object's lifecycle to the ChoicesManager; if it is not
* removed then the destruction of this object will bring about
* the destruction of the added ChoiceHandler.
*/
void add(ChoiceHandler *ch) { handler.add(ch); }
/**
* Remove the @ref ChoiceHandler from the manager. The
* @ref ChoiceHandler's life is not tied to the manager's any
* more.
*/
void remove(ChoiceHandler *ch) { handler.remove(ch); }
/**
* This method steps through each @ref ChoiceHandler registered
* and requests that it saves it's choices in the appropriate
* file format.
*/
void save(const std::string &filename);
/**
* This method reads and interprets the given choices file.
* It reads each block and then intructs the appropriate
* @ref ChoiceHandler to perform the necessary settings based
* on it.
*
* If the file doesn't exist then no error is thrown.
*/
void load(const std::string &filename);
private:
/**
* This internal class does the real work of the
* @ref ChoicesHandler saving. We do this in a nested class
* since the agent performing the top level save needs to be a
* @ref ChoiceHandler, but it is unnecssarily messy for the
* ChoiesManager to be a @ref ChoiceHandler (this would give it
* member functions that could be called incorrectly).
*/
class ChoicesChoiceHandler : public ChoiceHandler
{
public:
ChoicesChoiceHandler();
~ChoicesChoiceHandler();
void add(ChoiceHandler *ch);
void remove(ChoiceHandler *ch);
/**
* @reimplemented
*/
virtual void save(std::ostream &out, int indent) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in,
TSE3::SerializableLoadInfo &info);
private:
std::list<ChoiceHandler *> handlers;
};
ChoicesChoiceHandler handler;
};
/**********************************************************************
* ChoiceHandlers
**********************************************************************/
/**
* ChoiceHandler for the @ref TSE3::App::Application class.
*
* @short @ref TSE3::App::Application ChoiceHandler
* @author Pete Goodliffe
* @version 3.0
*/
class ApplicationChoiceHandler : public ChoiceHandler
{
public:
ApplicationChoiceHandler(Application *a);
~ApplicationChoiceHandler();
/**
* @reimplemented
*/
virtual void save(std::ostream &out, int indent) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in,
TSE3::SerializableLoadInfo &info);
private:
Application *a;
};
/**
* ChoiceHandler for the @ref TSE3::Metronome class.
*
* @short @ref TSE3::Metronome ChoiceHandler
* @author Pete Goodliffe
* @version 3.0
*/
class MetronomeChoiceHandler : public ChoiceHandler
{
public:
MetronomeChoiceHandler(TSE3::Metronome *m);
~MetronomeChoiceHandler();
/**
* @reimplemented
*/
virtual void save(std::ostream &out, int indent) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in,
TSE3::SerializableLoadInfo &info);
private:
TSE3::Metronome *m;
};
/**
* ChoiceHandler for the @ref TSE3::Panic class.
*
* @short @ref TSE3::Panic ChoiceHandler
* @author Pete Goodliffe
* @version 3.0
*/
class PanicChoiceHandler : public ChoiceHandler
{
public:
PanicChoiceHandler(TSE3::Panic *p);
~PanicChoiceHandler();
/**
* @reimplemented
*/
virtual void save(std::ostream &out, int indent) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in,
TSE3::SerializableLoadInfo &info);
private:
TSE3::Panic *p;
};
/**
* ChoiceHandler for the @ref TSE3::MidiMapper class.
*
* @short @ref TSE3::MidiMapper ChoiceHandler
* @author Pete Goodliffe
* @version 3.0
*/
class MidiMapperChoiceHandler : public ChoiceHandler
{
public:
MidiMapperChoiceHandler(TSE3::MidiMapper *m);
~MidiMapperChoiceHandler();
/**
* @reimplemented
*/
virtual void save(std::ostream &out, int indent) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in,
TSE3::SerializableLoadInfo &info);
private:
TSE3::MidiMapper *m;
};
/**
* ChoiceHandler for the @ref TSE3::Transport class.
*
* @short @ref TSE3::Transport ChoiceHandler
* @author Pete Goodliffe
* @version 3.0
*/
class TransportChoiceHandler : public ChoiceHandler
{
public:
TransportChoiceHandler(TSE3::Transport *t);
~TransportChoiceHandler();
/**
* @reimplemented
*/
virtual void save(std::ostream &out, int indent) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in,
TSE3::SerializableLoadInfo &info);
private:
TSE3::Transport *t;
PanicChoiceHandler startPanicHandler;
PanicChoiceHandler endPanicHandler;
MidiMapperChoiceHandler mapperHandler;
};
/**
* ChoiceHandler for the @ref TSE3::Ins::Destination class.
*
* @short @ref TSE3::Ins::Destination ChoiceHandler
* @author Pete Goodliffe
* @version 3.0
*/
class DestinationChoiceHandler : public ChoiceHandler
{
public:
DestinationChoiceHandler(TSE3::Ins::Destination *d,
TSE3::MidiScheduler *ms);
~DestinationChoiceHandler();
/**
* @reimplemented
*/
virtual void save(std::ostream &out, int indent) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in,
TSE3::SerializableLoadInfo &info);
private:
TSE3::Ins::Destination *d;
TSE3::MidiScheduler *ms;
};
}
}
#endif
|