annotate base/Clipboard.cpp @ 123:0f37e92e1782

* 1502816 file export is too slow and memory-hungry Use text stream when writing to file instead of accumulating into a string. * 1500625 Auto-align in MIDI layer confusing Make value extents convert to Hz in return value * 1494623: Duplicate display of frame 0 from vamp plugin output
author Chris Cannam
date Thu, 15 Jun 2006 15:48:05 +0000
parents 47fd14e29813
children 516819f2b97b 6f6ab834449d
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@74 24 m_label(label)
Chris@74 25 {
Chris@74 26 }
Chris@74 27
Chris@74 28 Clipboard::Point::Point(long frame, float value, QString label) :
Chris@74 29 m_haveFrame(true),
Chris@74 30 m_frame(frame),
Chris@74 31 m_haveValue(true),
Chris@74 32 m_value(value),
Chris@74 33 m_haveDuration(false),
Chris@74 34 m_haveLabel(true),
Chris@74 35 m_label(label)
Chris@74 36 {
Chris@74 37 }
Chris@74 38
Chris@74 39 Clipboard::Point::Point(long frame, float value, size_t duration, QString label) :
Chris@74 40 m_haveFrame(true),
Chris@74 41 m_frame(frame),
Chris@74 42 m_haveValue(true),
Chris@74 43 m_value(value),
Chris@74 44 m_haveDuration(true),
Chris@74 45 m_duration(duration),
Chris@74 46 m_haveLabel(true),
Chris@74 47 m_label(label)
Chris@74 48 {
Chris@74 49 }
Chris@74 50
Chris@74 51 Clipboard::Point::Point(const Point &point) :
Chris@74 52 m_haveFrame(point.m_haveFrame),
Chris@74 53 m_frame(point.m_frame),
Chris@74 54 m_haveValue(point.m_haveValue),
Chris@74 55 m_value(point.m_value),
Chris@74 56 m_haveDuration(point.m_haveDuration),
Chris@74 57 m_duration(point.m_duration),
Chris@74 58 m_haveLabel(point.m_haveLabel),
Chris@74 59 m_label(point.m_label)
Chris@74 60 {
Chris@74 61 }
Chris@74 62
Chris@74 63 Clipboard::Point &
Chris@74 64 Clipboard::Point::operator=(const Point &point)
Chris@74 65 {
Chris@74 66 if (this == &point) return *this;
Chris@74 67 m_haveFrame = point.m_haveFrame;
Chris@74 68 m_frame = point.m_frame;
Chris@74 69 m_haveValue = point.m_haveValue;
Chris@74 70 m_value = point.m_value;
Chris@74 71 m_haveDuration = point.m_haveDuration;
Chris@74 72 m_duration = point.m_duration;
Chris@74 73 m_haveLabel = point.m_haveLabel;
Chris@74 74 m_label = point.m_label;
Chris@74 75 return *this;
Chris@74 76 }
Chris@74 77
Chris@74 78 bool
Chris@74 79 Clipboard::Point::haveFrame() const
Chris@74 80 {
Chris@74 81 return m_haveFrame;
Chris@74 82 }
Chris@74 83
Chris@74 84 long
Chris@74 85 Clipboard::Point::getFrame() const
Chris@74 86 {
Chris@74 87 return m_frame;
Chris@74 88 }
Chris@74 89
Chris@74 90 bool
Chris@74 91 Clipboard::Point::haveValue() const
Chris@74 92 {
Chris@74 93 return m_haveValue;
Chris@74 94 }
Chris@74 95
Chris@74 96 float
Chris@74 97 Clipboard::Point::getValue() const
Chris@74 98 {
Chris@74 99 return m_value;
Chris@74 100 }
Chris@74 101
Chris@74 102 bool
Chris@74 103 Clipboard::Point::haveDuration() const
Chris@74 104 {
Chris@74 105 return m_haveDuration;
Chris@74 106 }
Chris@74 107
Chris@74 108 size_t
Chris@74 109 Clipboard::Point::getDuration() const
Chris@74 110 {
Chris@74 111 return m_duration;
Chris@74 112 }
Chris@74 113
Chris@74 114 bool
Chris@74 115 Clipboard::Point::haveLabel() const
Chris@74 116 {
Chris@74 117 return m_haveLabel;
Chris@74 118 }
Chris@74 119
Chris@74 120 QString
Chris@74 121 Clipboard::Point::getLabel() const
Chris@74 122 {
Chris@74 123 return m_label;
Chris@74 124 }
Chris@74 125
Chris@74 126 Clipboard::Clipboard() { }
Chris@74 127 Clipboard::~Clipboard() { }
Chris@74 128
Chris@74 129 void
Chris@74 130 Clipboard::clear()
Chris@74 131 {
Chris@74 132 m_points.clear();
Chris@74 133 }
Chris@74 134
Chris@74 135 bool
Chris@74 136 Clipboard::empty() const
Chris@74 137 {
Chris@74 138 return m_points.empty();
Chris@74 139 }
Chris@74 140
Chris@74 141 const Clipboard::PointList &
Chris@74 142 Clipboard::getPoints() const
Chris@74 143 {
Chris@74 144 return m_points;
Chris@74 145 }
Chris@74 146
Chris@74 147 void
Chris@74 148 Clipboard::setPoints(const PointList &pl)
Chris@74 149 {
Chris@74 150 m_points = pl;
Chris@74 151 }
Chris@74 152
Chris@74 153 void
Chris@74 154 Clipboard::addPoint(const Point &point)
Chris@74 155 {
Chris@74 156 m_points.push_back(point);
Chris@74 157 }
Chris@74 158