/usr/include/tse3/DisplayParams.h is in libtse3-dev 0.3.1-4.3.
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 | /*
* @(#)DisplayParams.h 3.00 24 June 2000
*
* 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_DISPLAYPARAMS_H
#define TSE3_DISPLAYPARAMS_H
#include "tse3/listen/DisplayParams.h"
#include "tse3/Notifier.h"
#include "tse3/Serializable.h"
namespace TSE3
{
/**
* The DisplayParams class holds data related to how a TSE3 object should
* be drawn on the screen by some application that uses the TSE3 library.
*
* This is perhaps unusual for a pure 'sequencer engine' library, however
* it is a useful piece of application support. It also ensures that
* different applications based on TSE3 will display @ref Song data in
* a relatively similar manner (as deemed appropriate).
*
* Obviously, TSE3 does not use these display values itself (since it
* does no displaying whatsoever). An application is not required
* to use the information in this class; however for inter-application
* constency it is encouraged.
*
* The classes that contain a DisplayParams object are:
* @li @ref Part
* @li @ref Phrase
*
* The @ref Part's DisplayParams are considered to 'override' that of it's
* @ref Phrase.
*
* The DisplayParams object allows an object to be displayed in a number
* of different states (see the @ref DrawingStyle enum type). For some of
* these states the DisplayParams object holds extra information (for
* example a specific colour).
*
* @sect Command classes
*
* Use the following command classes to manipute this object in a undo/redo
* environment.
*
* @li @ref TSE3::Cmd::Track_SetInfo
* @li @ref TSE3::Cmd::Part_SetInfo
* @li @ref TSE3::Cmd::Phrase_SetInfo
*
* @short A collection of application display parameter values
* @author Pete Goodliffe
* @version 3.00
*/
class DisplayParams : public Notifier<DisplayParamsListener>,
public Serializable
{
public:
/**
* The default DisplayParams has the @ref DrawingStyle None
* (but the @ref colour() set to white, and @ref presetColour()
* set to Verse).
*/
DisplayParams();
DisplayParams(const DisplayParams &);
virtual ~DisplayParams();
DisplayParams &operator=(const DisplayParams &);
/**
* Enum type describing how colour should be displayed.
*
* The values are:
* @li @p Default Do whatever the default for this displayable
* object is. Usually this will be the same as
* None - some default system drawing style will
* be used. Default may allow a colour to be
* used, for example when a @ref Part is set to
* Default but its @ref Phrase is set to
* UseColour.
* @li @p PresetColour Display the object using the preset colour
* defined by this DisplayParams object (see
* @ref presetColour())
* @li @p Colour Display the object using the colour defined
* by this DisplayParams object (see @ref
* colour()).
* @li @p None Force no colour to be used, and the object to
* be displayed with some system default drawing
* style.
*/
enum DrawingStyle
{
Default,
PresetColour,
Colour,
None
};
/**
* As enum type describing a number of preset 'global' colours.
* The user may choose to display a DisplayParams object with
* a specific colour (see @ref setColour()) or use a global
* colour from this list.
*
* The @ref PresetColours object provides a central definiton
* of the colour rgb values.
*
* The final anum value (@p NoPresetColours) is not a valid value
* but a descrition of the number of PresetColours available.
*/
enum PresetColours
{
Intro,
Verse,
Chorus,
Bridge,
Coda,
Refrain,
Melody,
Solo,
Backing,
Brass,
Percussion,
Drums,
Guitar,
Bass,
Flute,
Strings,
Keyboard,
Piano,
Saxophone,
NoPresetColours
};
/**
* Returns a string containing a English representation of the
* specified @ref PresetColours value.
*
* @param pc @ref PresetColours value to get string for
* @return String represeting @p pc
*/
static const char *presetColourString(int pc);
/**
* Returns the drawing style of this displayable object.
*
* The value is defined by the @ref DrawingStyle enum type.
*
* @return Whether to use to r, g, b values
* @see setStyle
* @see colour
* @see DrawingStyle
*/
int style() { return _style; }
/**
* Sets the draing style of this displayable object. The value
* is defined by the @ref DrawingStyle enum type.
*
* @see style
*/
void setStyle(int s);
/**
* Returns the selected preset colour in the reference parameters.
* The colour is defined by the @ref PresetColours enum type.
*
* This describes the colour used when in the PresetColour
* @ref style().
*
* Note that although you can specify both a presetColour and a
* @ref colour, only one of them (or possibly neither) will be
* used at any once time, as specified by the @ref style() method.
*
* @return Current preset colour
* @see setPresetColour
*/
int presetColour() const { return _preset; }
/**
* Sets the preset colour value.
*
* @param pc New preset colour
* @see presetColour
*/
void setPresetColour(int pc);
/**
* Returns the selected colour in the reference parameters.
* The colour is returned as RGB values, each between 0-255.
*
* This is the colour used when in the Colour @ref style().
*
* Note that although you can specify both a @ref presetColour and
* a colour, only one of them (or possibly neither) will be
* used at any once time, as specified by the @ref style() method.
*
* @param r Integer the blue value is returned in (0-255)
* @param g Integer the green value is returned in (0-255)
* @param b Integer the red value is returned in (0-255)
* @see setColour
*/
void colour(int &r, int &g, int &b)
{
r = _r;
g = _g;
b = _b;
}
/**
* Sets the colour value.
*
* @param r New blue value (0-255)
* @param g New green value (0-255)
* @param b New red value (0-255)
* @see colour
*/
void setColour(int r, int g, int b);
/**
* @reimplemented
*/
virtual void save(std::ostream &o, int i) const;
/**
* @reimplemented
*/
virtual void load(std::istream &in, SerializableLoadInfo &info);
private:
int _style;
int _r, _g, _b;
int _preset;
};
/**
* This class holds information about a set of global colours that
* can be used by a @ref DisplayParams object whose
* @ref DisplayParams::style() is set to @p PresetColour.
*
* @short A collection of application display parameter values
* @author Pete Goodliffe
* @version 3.00
* @see DisplayParams
*/
class PresetColours : public Notifier<PresetColoursListener>
{
public:
PresetColours();
/**
* Returns the RGB values of the specified preset colour in the
* reference parameters. The colour is returned as RGB values, each
* between 0-255.
*
* @param preset @ref DisplayParams::PresetColours value to
* read RGB values for
* If you pass an invalid @p preset value, then the
* result is undefined.
* @param r Integer the blue value is returned in (0-255)
* @param g Integer the green value is returned in (0-255)
* @param b Integer the red value is returned in (0-255)
* @see setColour
*/
void colour(int preset, int &r, int &g, int &b)
{
r = _r[preset];
g = _g[preset];
b = _b[preset];
}
/**
* Sets the preset colour's RGB value.
*
* @param preset @ref DisplayParams::PresetColours value to
* set RGB values for
* If you pass an invalid @p preset value, then the
* result is undefined.
* @param r New blue value (0-255)
* @param g New green value (0-255)
* @param b New red value (0-255)
* @see colour
*/
void setColour(int preset, int r, int g, int b);
private:
int _r[DisplayParams::NoPresetColours];
int _g[DisplayParams::NoPresetColours];
int _b[DisplayParams::NoPresetColours];
};
}
#endif
|