author | waspe <waspe> | 2003-11-20 19:34:08 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-11-20 19:34:08 (UTC) |
commit | e6a5ed6de7e821a070d571045ff063f8c41b0b79 (patch) (side-by-side diff) | |
tree | 8455d7bf537cf804337b6c03b28f891ee3f286ce /noncore/multimedia/tonleiter/fretboard.cpp | |
parent | f43e28fe8f226039d96ebda4e6c4d26e4f3320ba (diff) | |
download | opie-e6a5ed6de7e821a070d571045ff063f8c41b0b79.zip opie-e6a5ed6de7e821a070d571045ff063f8c41b0b79.tar.gz opie-e6a5ed6de7e821a070d571045ff063f8c41b0b79.tar.bz2 |
added preliminary edit dialogs
default config added
Diffstat (limited to 'noncore/multimedia/tonleiter/fretboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/tonleiter/fretboard.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/multimedia/tonleiter/fretboard.cpp b/noncore/multimedia/tonleiter/fretboard.cpp index 57806be..7936c83 100644 --- a/noncore/multimedia/tonleiter/fretboard.cpp +++ b/noncore/multimedia/tonleiter/fretboard.cpp @@ -1,36 +1,36 @@ #include "fretboard.h" #include <qpainter.h> -FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) +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())); } //**************************************************************************** -FretBoard::~FretBoard() +Graph::FretBoard::~FretBoard() { } //**************************************************************************** -void FretBoard::dataChange() +void Graph::FretBoard::dataChange() { repaint(true); } //**************************************************************************** -void FretBoard::paintEvent(QPaintEvent* pe) +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()); QRect mysize=rect(); xmargin=(int)(mysize.width()*0.05); xmin=2*xmargin; xmax=mysize.width()-xmargin; @@ -39,42 +39,42 @@ void FretBoard::paintEvent(QPaintEvent* pe) ymargin=(int)(mysize.height()*0.1); ymin=ymargin; ymax=mysize.height()-2*ymargin; yheight=ymax-ymin; QPainter p(this); paintBoard(&p); paintFrets(&p); paintStrings(&p); paintScale(&p); } //**************************************************************************** -void FretBoard::resizeEvent(QResizeEvent* re) +void Graph::FretBoard::resizeEvent(QResizeEvent* re) { Q_UNUSED(re); } //**************************************************************************** -void FretBoard::paintBoard(QPainter* p) +void Graph::FretBoard::paintBoard(QPainter* p) { //debug QColor bgc=QColor(142,138,120); p->setPen(QPen(bgc,5)); p->setBrush(QBrush(bgc)); p->drawRect(xmin,ymin,xwidth,yheight); } //**************************************************************************** -void FretBoard::paintFrets(QPainter* p) +void Graph::FretBoard::paintFrets(QPainter* p) { - //draw frets + //draw frets p->setPen(fretpen); p->setBrush(markerbrush); fretdist=(double)(xwidth)/(double)(inst.noOfFrets()); int markerwidth = (int)(fretdist/4.0); if(markerwidth>5) markerwidth=5; else if(markerwidth<2) markerwidth=2; for(int f=0;f<=inst.noOfFrets();f++) { @@ -90,42 +90,42 @@ void FretBoard::paintFrets(QPainter* p) { p->drawEllipse(fretpos+xmin,ymax+ymargin,markerwidth,markerwidth); } else if(marker==0 && f!=0) { p->drawEllipse(fretpos+xmin,ymax+ymargin+2*markerwidth,markerwidth,markerwidth); p->drawEllipse(fretpos+xmin,ymax+ymargin-2*markerwidth,markerwidth,markerwidth); } } } //**************************************************************************** -void FretBoard::paintStrings(QPainter* p) +void Graph::FretBoard::paintStrings(QPainter* p) { //draw strings p->setPen(stringpen); stringdist=(double)(yheight)/(double)(inst.noOfStrings()-1); for(int s=0;s<inst.noOfStrings();s++) { int stringpos=(int)(stringdist*s); p->drawLine(xmin,stringpos+ymin,xmax,stringpos+ymin); int stinglabelid=inst.noOfStrings()-(s+1); QString label=Note::getNameOfNote(inst.string(stinglabelid)); p->drawText(xmargin/2,stringpos+ymin,label); } } //**************************************************************************** -void FretBoard::paintScale(QPainter* p) +void Graph::FretBoard::paintScale(QPainter* p) { int dotsize=10; int scaleid=data->getCurrentScaleID(); Scale scale=data->getScale(scaleid); int colorstart=255%inst.noOfOctaves(); int colorintervall=(255-colorstart)/inst.noOfOctaves(); for(int s=0;s<inst.noOfStrings();s++) { int y=(int)(stringdist*s)+ymin; int stingid=inst.noOfStrings()-(s+1); |