annotate base/Clipboard.cpp @ 523:3f68eab92857

* remove some output
author Chris Cannam
date Fri, 12 Dec 2008 15:33:28 +0000
parents e73a1a1e8f24
children afeb580b1b57
rev   line source
Chris@74 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@74 2
Chris@74 3 /*
Chris@74 4 Sonic Visualiser
Chris@74 5 An audio file viewer and annotation editor.
Chris@74 6 Centre for Digital Music, Queen Mary, University of London.
Chris@74 7 This file copyright 2006 Chris Cannam.
Chris@74 8
Chris@74 9 This program is free software; you can redistribute it and/or
Chris@74 10 modify it under the terms of the GNU General Public License as
Chris@74 11 published by the Free Software Foundation; either version 2 of the
Chris@74 12 License, or (at your option) any later version. See the file
Chris@74 13 COPYING included with this distribution for more information.
Chris@74 14 */
Chris@74 15
Chris@74 16 #include "Clipboard.h"
Chris@74 17
Chris@74 18 Clipboard::Point::Point(long frame, QString label) :
Chris@74 19 m_haveFrame(true),
Chris@74 20 m_frame(frame),
Chris@74 21 m_haveValue(false),
Chris@74 22 m_haveDuration(false),
Chris@74 23 m_haveLabel(true),
Chris@340 24 m_label(label),
Chris@340 25 m_haveLevel(false),
Chris@340 26 m_level(0.f),
Chris@370 27 m_haveReferenceFrame(false),
Chris@340 28 m_referenceFrame(frame)
Chris@74 29 {
Chris@74 30 }
Chris@74 31
Chris@74 32 Clipboard::Point::Point(long frame, float value, QString label) :
Chris@74 33 m_haveFrame(true),
Chris@74 34 m_frame(frame),
Chris@74 35 m_haveValue(true),
Chris@74 36 m_value(value),
Chris@74 37 m_haveDuration(false),
Chris@74 38 m_haveLabel(true),
Chris@340 39 m_label(label),
Chris@340 40 m_haveLevel(false),
Chris@340 41 m_level(0.f),
Chris@370 42 m_haveReferenceFrame(false),
Chris@340 43 m_referenceFrame(frame)
Chris@74 44 {
Chris@74 45 }
Chris@74 46
Chris@74 47 Clipboard::Point::Point(long frame, float value, size_t duration, QString label) :
Chris@74 48 m_haveFrame(true),
Chris@74 49 m_frame(frame),
Chris@74 50 m_haveValue(true),
Chris@74 51 m_value(value),
Chris@74 52 m_haveDuration(true),
Chris@74 53 m_duration(duration),
Chris@74 54 m_haveLabel(true),
Chris@340 55 m_label(label),
Chris@340 56 m_haveLevel(false),
Chris@340 57 m_level(0.f),
Chris@370 58 m_haveReferenceFrame(false),
Chris@340 59 m_referenceFrame(frame)
Chris@340 60 {
Chris@340 61 }
Chris@340 62
Chris@340 63 Clipboard::Point::Point(long frame, float value, size_t duration, float level, QString label) :
Chris@340 64 m_haveFrame(true),
Chris@340 65 m_frame(frame),
Chris@340 66 m_haveValue(true),
Chris@340 67 m_value(value),
Chris@340 68 m_haveDuration(true),
Chris@340 69 m_duration(duration),
Chris@340 70 m_haveLabel(true),
Chris@340 71 m_label(label),
Chris@340 72 m_haveLevel(true),
Chris@340 73 m_level(level),
Chris@370 74 m_haveReferenceFrame(false),
Chris@340 75 m_referenceFrame(frame)
Chris@74 76 {
Chris@74 77 }
Chris@74 78
Chris@74 79 Clipboard::Point::Point(const Point &point) :
Chris@74 80 m_haveFrame(point.m_haveFrame),
Chris@74 81 m_frame(point.m_frame),
Chris@74 82 m_haveValue(point.m_haveValue),
Chris@74 83 m_value(point.m_value),
Chris@74 84 m_haveDuration(point.m_haveDuration),
Chris@74 85 m_duration(point.m_duration),
Chris@74 86 m_haveLabel(point.m_haveLabel),
Chris@340 87 m_label(point.m_label),
Chris@340 88 m_haveLevel(point.m_haveLevel),
Chris@340 89 m_level(point.m_level),
Chris@370 90 m_haveReferenceFrame(point.m_haveReferenceFrame),
Chris@340 91 m_referenceFrame(point.m_referenceFrame)
Chris@74 92 {
Chris@74 93 }
Chris@74 94
Chris@74 95 Clipboard::Point &
Chris@74 96 Clipboard::Point::operator=(const Point &point)
Chris@74 97 {
Chris@74 98 if (this == &point) return *this;
Chris@74 99 m_haveFrame = point.m_haveFrame;
Chris@74 100 m_frame = point.m_frame;
Chris@74 101 m_haveValue = point.m_haveValue;
Chris@74 102 m_value = point.m_value;
Chris@74 103 m_haveDuration = point.m_haveDuration;
Chris@74 104 m_duration = point.m_duration;
Chris@74 105 m_haveLabel = point.m_haveLabel;
Chris@74 106 m_label = point.m_label;
Chris@340 107 m_haveLevel = point.m_haveLevel;
Chris@340 108 m_level = point.m_level;
Chris@370 109 m_haveReferenceFrame = point.m_haveReferenceFrame;
Chris@340 110 m_referenceFrame = point.m_referenceFrame;
Chris@74 111 return *this;
Chris@74 112 }
Chris@74 113
Chris@74 114 bool
Chris@74 115 Clipboard::Point::haveFrame() const
Chris@74 116 {
Chris@74 117 return m_haveFrame;
Chris@74 118 }
Chris@74 119
Chris@74 120 long
Chris@74 121 Clipboard::Point::getFrame() const
Chris@74 122 {
Chris@74 123 return m_frame;
Chris@74 124 }
Chris@74 125
Chris@74 126 bool
Chris@74 127 Clipboard::Point::haveValue() const
Chris@74 128 {
Chris@74 129 return m_haveValue;
Chris@74 130 }
Chris@74 131
Chris@74 132 float
Chris@74 133 Clipboard::Point::getValue() const
Chris@74 134 {
Chris@74 135 return m_value;
Chris@74 136 }
Chris@74 137
Chris@74 138 bool
Chris@74 139 Clipboard::Point::haveDuration() const
Chris@74 140 {
Chris@74 141 return m_haveDuration;
Chris@74 142 }
Chris@74 143
Chris@74 144 size_t
Chris@74 145 Clipboard::Point::getDuration() const
Chris@74 146 {
Chris@74 147 return m_duration;
Chris@74 148 }
Chris@74 149
Chris@74 150 bool
Chris@74 151 Clipboard::Point::haveLabel() const
Chris@74 152 {
Chris@74 153 return m_haveLabel;
Chris@74 154 }
Chris@74 155
Chris@74 156 QString
Chris@74 157 Clipboard::Point::getLabel() const
Chris@74 158 {
Chris@74 159 return m_label;
Chris@74 160 }
Chris@74 161
Chris@340 162 bool
Chris@340 163 Clipboard::Point::haveLevel() const
Chris@340 164 {
Chris@340 165 return m_haveLevel;
Chris@340 166 }
Chris@340 167
Chris@340 168 float
Chris@340 169 Clipboard::Point::getLevel() const
Chris@340 170 {
Chris@340 171 return m_level;
Chris@340 172 }
Chris@340 173
Chris@340 174 bool
Chris@370 175 Clipboard::Point::haveReferenceFrame() const
Chris@340 176 {
Chris@370 177 return m_haveReferenceFrame;
Chris@370 178 }
Chris@370 179
Chris@370 180 bool
Chris@370 181 Clipboard::Point::referenceFrameDiffers() const
Chris@370 182 {
Chris@370 183 return m_haveReferenceFrame && (m_referenceFrame != m_frame);
Chris@340 184 }
Chris@340 185
Chris@340 186 long
Chris@340 187 Clipboard::Point::getReferenceFrame() const
Chris@340 188 {
Chris@340 189 return m_referenceFrame;
Chris@340 190 }
Chris@340 191
Chris@340 192 void
Chris@340 193 Clipboard::Point::setReferenceFrame(long f)
Chris@340 194 {
Chris@370 195 m_haveReferenceFrame = true;
Chris@340 196 m_referenceFrame = f;
Chris@340 197 }
Chris@340 198
Chris@74 199 Clipboard::Clipboard() { }
Chris@74 200 Clipboard::~Clipboard() { }
Chris@74 201
Chris@74 202 void
Chris@74 203 Clipboard::clear()
Chris@74 204 {
Chris@74 205 m_points.clear();
Chris@74 206 }
Chris@74 207
Chris@74 208 bool
Chris@74 209 Clipboard::empty() const
Chris@74 210 {
Chris@74 211 return m_points.empty();
Chris@74 212 }
Chris@74 213
Chris@74 214 const Clipboard::PointList &
Chris@74 215 Clipboard::getPoints() const
Chris@74 216 {
Chris@74 217 return m_points;
Chris@74 218 }
Chris@74 219
Chris@74 220 void
Chris@74 221 Clipboard::setPoints(const PointList &pl)
Chris@74 222 {
Chris@74 223 m_points = pl;
Chris@74 224 }
Chris@74 225
Chris@74 226 void
Chris@74 227 Clipboard::addPoint(const Point &point)
Chris@74 228 {
Chris@74 229 m_points.push_back(point);
Chris@74 230 }
Chris@74 231
Chris@340 232 bool
Chris@370 233 Clipboard::haveReferenceFrames() const
Chris@370 234 {
Chris@370 235 for (PointList::const_iterator i = m_points.begin();
Chris@370 236 i != m_points.end(); ++i) {
Chris@370 237 if (i->haveReferenceFrame()) return true;
Chris@370 238 }
Chris@370 239 return false;
Chris@370 240 }
Chris@370 241
Chris@370 242 bool
Chris@369 243 Clipboard::referenceFramesDiffer() const
Chris@340 244 {
Chris@340 245 for (PointList::const_iterator i = m_points.begin();
Chris@340 246 i != m_points.end(); ++i) {
Chris@370 247 if (i->referenceFrameDiffers()) return true;
Chris@340 248 }
Chris@340 249 return false;
Chris@340 250 }
Chris@340 251