[r13118]: trunk / rosegarden / src / misc / Debug.cpp Maximize Restore History

Download this file

Debug.cpp    132 lines (102 with data), 3.4 kB

  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
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rosegarden
A sequencer and musical notation editor.
Copyright 2000-2012 the Rosegarden development team.
See the AUTHORS file for more details.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#include "Strings.h"
#include "Debug.h"
#ifndef NDEBUG
#include "base/Event.h"
#include "base/Segment.h"
#include "base/RealTime.h"
#include "base/Colour.h"
#include "gui/editors/guitar/Chord.h"
#include "gui/editors/guitar/Fingering.h"
namespace Rosegarden
{
QDebug &
operator<<(QDebug &dbg, const std::string &s)
{
dbg << strtoqstr(s);
return dbg;
}
QDebug &
operator<<(QDebug &dbg, const Rosegarden::Event &e)
{
dbg << "Event type : " << e.getType() << endl;
dbg << "\tDuration : " << e.getDuration()
<< "\n\tAbsolute Time : " << e.getAbsoluteTime()
<< endl;
// for (Event::PropertyMap::const_iterator i = e.properties().begin();
// i != e.properties().end(); ++i) {
// dbg << "\t\t" << (*i).first << " : "
// << ((*i).second)->unparse() << '\n';
// }
// e.dump(std::cerr);
return dbg;
}
QDebug &
operator<<(QDebug &dbg, const Rosegarden::Segment &t)
{
// dbg << "Segment for instrument " << t.getTrack()
// << " starting at " << t.getStartTime() << endl;
dbg << "Segment Object" << endl;
dbg << " Label: " << t.getLabel() << endl;
dbg << " Track: " << t.getTrack() << endl;
// Assume 4/4 time and provide a potentially helpful bar number.
dbg << " Start Time: " << t.getStartTime() <<
"(4/4 bar" << t.getStartTime() / (960.0*4.0) + 1 << ")" << endl;
dbg << " End Time: " << t.getEndTime() <<
"(4/4 bar" << t.getEndTime() / (960.0*4.0) + 1 << ")" << endl;
dbg << " End Marker Time: " << t.getEndMarkerTime() <<
"(4/4 bar" << t.getEndMarkerTime() / (960.0*4.0) + 1 << ")" << endl;
dbg << "Events:" << endl;
for (Rosegarden::Segment::const_iterator i = t.begin();
i != t.end(); ++i) {
if (!(*i)) {
dbg << "WARNING : skipping null event ptr\n";
continue;
}
dbg << *(*i) << endl;
}
return dbg;
}
QDebug &
operator<<(QDebug &dbg, const Rosegarden::RealTime &t)
{
dbg << t.toString();
return dbg;
}
QDebug &
operator<<(QDebug &dbg, const Rosegarden::Colour &c)
{
dbg << "Colour : rgb = " << c.getRed() << "," << c.getGreen() << "," << c.getBlue();
return dbg;
}
QDebug &
operator<<(QDebug &dbg, const Rosegarden::Guitar::Chord &c)
{
dbg << "Chord root = " << c.getRoot() << ", ext = '" << c.getExt() << "'";
// for(unsigned int i = 0; i < c.getNbFingerings(); ++i) {
// dbg << "\nFingering " << i << " : " << c.getFingering(i).toString().c_str();
// }
Rosegarden::Guitar::Fingering f = c.getFingering();
dbg << ", fingering : ";
for(unsigned int j = 0; j < 6; ++j) {
int pos = f[j];
if (pos >= 0)
dbg << pos << ' ';
else
dbg << "x ";
}
return dbg;
}
}
#endif