annotate base/Clipboard.h @ 1370:54fabf5aceb8

Update piper-cpp to github repo, and adjust build for revised layout in it
author Chris Cannam
date Fri, 20 Jan 2017 18:05:41 +0000
parents 31f01931b781
children ad5f892c0c4d
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 #ifndef _CLIPBOARD_H_
Chris@74 17 #define _CLIPBOARD_H_
Chris@74 18
Chris@74 19 #include <QString>
Chris@74 20 #include <vector>
Chris@74 21
Chris@1044 22 #include "BaseTypes.h"
Chris@1044 23
Chris@74 24 class Clipboard
Chris@74 25 {
Chris@74 26 public:
Chris@74 27 class Point
Chris@74 28 {
Chris@74 29 public:
Chris@1044 30 Point(sv_frame_t frame, QString label);
Chris@1044 31 Point(sv_frame_t frame, float value, QString label);
Chris@1044 32 Point(sv_frame_t frame, float value, sv_frame_t duration, QString label);
Chris@1044 33 Point(sv_frame_t frame, float value, sv_frame_t duration, float level, QString label);
Chris@74 34 Point(const Point &point);
Chris@74 35 Point &operator=(const Point &point);
Chris@74 36
Chris@74 37 bool haveFrame() const;
Chris@1044 38 sv_frame_t getFrame() const;
Chris@1044 39 Point withFrame(sv_frame_t frame) const;
Chris@74 40
Chris@74 41 bool haveValue() const;
Chris@74 42 float getValue() const;
Chris@872 43 Point withValue(float value) const;
Chris@74 44
Chris@74 45 bool haveDuration() const;
Chris@1044 46 sv_frame_t getDuration() const;
Chris@1044 47 Point withDuration(sv_frame_t duration) const;
Chris@74 48
Chris@74 49 bool haveLabel() const;
Chris@74 50 QString getLabel() const;
Chris@872 51 Point withLabel(QString label) const;
Chris@74 52
Chris@340 53 bool haveLevel() const;
Chris@340 54 float getLevel() const;
Chris@872 55 Point withLevel(float level) const;
Chris@340 56
Chris@370 57 bool haveReferenceFrame() const;
Chris@370 58 bool referenceFrameDiffers() const; // from point frame
Chris@370 59
Chris@1044 60 sv_frame_t getReferenceFrame() const;
Chris@1044 61 void setReferenceFrame(sv_frame_t);
Chris@340 62
Chris@74 63 private:
Chris@74 64 bool m_haveFrame;
Chris@1044 65 sv_frame_t m_frame;
Chris@74 66 bool m_haveValue;
Chris@74 67 float m_value;
Chris@74 68 bool m_haveDuration;
Chris@1044 69 sv_frame_t m_duration;
Chris@74 70 bool m_haveLabel;
Chris@74 71 QString m_label;
Chris@340 72 bool m_haveLevel;
Chris@340 73 float m_level;
Chris@370 74 bool m_haveReferenceFrame;
Chris@1044 75 sv_frame_t m_referenceFrame;
Chris@74 76 };
Chris@74 77
Chris@74 78 Clipboard();
Chris@74 79 ~Clipboard();
Chris@74 80
Chris@74 81 typedef std::vector<Point> PointList;
Chris@74 82
Chris@74 83 void clear();
Chris@74 84 bool empty() const;
Chris@74 85 const PointList &getPoints() const;
Chris@74 86 void setPoints(const PointList &points);
Chris@74 87 void addPoint(const Point &point);
Chris@74 88
Chris@370 89 bool haveReferenceFrames() const;
Chris@369 90 bool referenceFramesDiffer() const;
Chris@340 91
Chris@74 92 protected:
Chris@74 93 PointList m_points;
Chris@74 94 };
Chris@74 95
Chris@74 96 #endif