Diffstat (limited to 'noncore/multimedia/tonleiter/fretboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/tonleiter/fretboard.cpp | 13 |
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,46 +1,51 @@ #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())); } //**************************************************************************** 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; QPainter p(this); paintBoard(&p); paintFrets(&p); @@ -130,43 +135,43 @@ void Graph::FretBoard::paintScale(QPainter* p) int baseoctave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),inst.lowestNote()); for(int s=0;s<inst.noOfStrings();s++) { 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); else dotcolor=QColor(c,255,255); p->setBrush(dotcolor); |