summaryrefslogtreecommitdiff
path: root/noncore/multimedia/tonleiter/fretboard.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/tonleiter/fretboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/tonleiter/fretboard.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/noncore/multimedia/tonleiter/fretboard.cpp b/noncore/multimedia/tonleiter/fretboard.cpp
index 7e63e01..58bdb86 100644
--- a/noncore/multimedia/tonleiter/fretboard.cpp
+++ b/noncore/multimedia/tonleiter/fretboard.cpp
@@ -1,14 +1,19 @@
#include "fretboard.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qpainter.h>
Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f)
:QWidget(parent,name,f),data(data)
{
setBackgroundColor(QColor(0,0,0));
fretpen=QPen(QColor(155,155,155),0);
markerbrush=QBrush(QColor(155,155,155));
stringpen=QPen(QColor(255,255,255),3);
connect(data,SIGNAL(dataChange()),this,SLOT(dataChange()));
}
//****************************************************************************
@@ -18,25 +23,25 @@ Graph::FretBoard::~FretBoard()
//****************************************************************************
void Graph::FretBoard::dataChange()
{
repaint(true);
}
//****************************************************************************
void Graph::FretBoard::paintEvent(QPaintEvent* pe)
{
Q_UNUSED(pe);
int instid=data->getCurrentInstrumentID();
inst=data->getInstrument(instid);
- //qDebug("inst %d is %s",instid,inst.instName().data());
+ //odebug << "inst " << instid << " is " << inst.instName().data() << "" << oendl;
QRect mysize=rect();
xmargin=(int)(mysize.width()*0.05);
xmin=2*xmargin;
xmax=mysize.width()-xmargin;
xwidth=xmax-xmin;
ymargin=(int)(mysize.height()*0.1);
ymin=ymargin;
ymax=mysize.height()-2*ymargin;
yheight=ymax-ymin;
@@ -134,35 +139,35 @@ void Graph::FretBoard::paintScale(QPainter* p)
int y=(int)(stringdist*s)+ymin;
int stingid=inst.noOfStrings()-(s+1);
for(int f=0;f<=inst.noOfFrets();f++)
{
int note=inst.string(stingid)+f;
if(scale.noteInScale(data->getCurrentBaseNote(),note))
{
int x=(int)(fretdist*f)+xmin;
//no more than six octaves can be visualised (there is a zero octave)
int octave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),note)-baseoctave;
if(octave<0)
- qDebug("%d,%d",octave,baseoctave);
+ odebug << "" << octave << "," << baseoctave << "" << oendl;
if(octave>5)
{
- qDebug("octave out of range");
+ odebug << "octave out of range" << oendl;
octave=5;
}
p->setPen(QColor(255,0,0));
int c= ( (note-12*baseoctave) - (12*octave+data->getCurrentBaseNote()) )*15;
if(c<0 || c>255)
- qDebug("%d = %d - ( %d + %d)",c,note,12*octave,data->getCurrentBaseNote());
+ odebug << "" << c << " = " << note << " - ( " << 12*octave << " + " << data->getCurrentBaseNote() << ")" << oendl;
QColor dotcolor(255,255,255);
if(octave==0)
dotcolor=QColor(c,c,255);
else if(octave==1)
dotcolor=QColor(c,255,c);
else if(octave==2)
dotcolor=QColor(255,c,c);
else if(octave==3)
dotcolor=QColor(255,255,c);
else if(octave==4)
dotcolor=QColor(255,c,255);