author | waspe <waspe> | 2003-11-20 19:34:08 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-11-20 19:34:08 (UTC) |
commit | e6a5ed6de7e821a070d571045ff063f8c41b0b79 (patch) (unidiff) | |
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,30 +1,30 @@ | |||
1 | #include "fretboard.h" | 1 | #include "fretboard.h" |
2 | 2 | ||
3 | #include <qpainter.h> | 3 | #include <qpainter.h> |
4 | 4 | ||
5 | FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) | 5 | Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) |
6 | :QWidget(parent,name,f),data(data) | 6 | :QWidget(parent,name,f),data(data) |
7 | { | 7 | { |
8 | setBackgroundColor(QColor(0,0,0)); | 8 | setBackgroundColor(QColor(0,0,0)); |
9 | fretpen=QPen(QColor(155,155,155),0); | 9 | fretpen=QPen(QColor(155,155,155),0); |
10 | markerbrush=QBrush(QColor(155,155,155)); | 10 | markerbrush=QBrush(QColor(155,155,155)); |
11 | stringpen=QPen(QColor(255,255,255),3); | 11 | stringpen=QPen(QColor(255,255,255),3); |
12 | connect(data,SIGNAL(dataChange()),this,SLOT(dataChange())); | 12 | connect(data,SIGNAL(dataChange()),this,SLOT(dataChange())); |
13 | } | 13 | } |
14 | //**************************************************************************** | 14 | //**************************************************************************** |
15 | FretBoard::~FretBoard() | 15 | Graph::FretBoard::~FretBoard() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | //**************************************************************************** | 18 | //**************************************************************************** |
19 | void FretBoard::dataChange() | 19 | void Graph::FretBoard::dataChange() |
20 | { | 20 | { |
21 | repaint(true); | 21 | repaint(true); |
22 | } | 22 | } |
23 | //**************************************************************************** | 23 | //**************************************************************************** |
24 | void FretBoard::paintEvent(QPaintEvent* pe) | 24 | void Graph::FretBoard::paintEvent(QPaintEvent* pe) |
25 | { | 25 | { |
26 | Q_UNUSED(pe); | 26 | Q_UNUSED(pe); |
27 | 27 | ||
28 | int instid=data->getCurrentInstrumentID(); | 28 | int instid=data->getCurrentInstrumentID(); |
29 | inst=data->getInstrument(instid); | 29 | inst=data->getInstrument(instid); |
30 | //qDebug("inst %d is %s",instid,inst.instName().data()); | 30 | //qDebug("inst %d is %s",instid,inst.instName().data()); |
@@ -45,30 +45,30 @@ void FretBoard::paintEvent(QPaintEvent* pe) | |||
45 | paintBoard(&p); | 45 | paintBoard(&p); |
46 | paintFrets(&p); | 46 | paintFrets(&p); |
47 | paintStrings(&p); | 47 | paintStrings(&p); |
48 | paintScale(&p); | 48 | paintScale(&p); |
49 | } | 49 | } |
50 | //**************************************************************************** | 50 | //**************************************************************************** |
51 | void FretBoard::resizeEvent(QResizeEvent* re) | 51 | void Graph::FretBoard::resizeEvent(QResizeEvent* re) |
52 | { | 52 | { |
53 | Q_UNUSED(re); | 53 | Q_UNUSED(re); |
54 | } | 54 | } |
55 | //**************************************************************************** | 55 | //**************************************************************************** |
56 | void FretBoard::paintBoard(QPainter* p) | 56 | void Graph::FretBoard::paintBoard(QPainter* p) |
57 | { | 57 | { |
58 | //debug | 58 | //debug |
59 | QColor bgc=QColor(142,138,120); | 59 | QColor bgc=QColor(142,138,120); |
60 | p->setPen(QPen(bgc,5)); | 60 | p->setPen(QPen(bgc,5)); |
61 | p->setBrush(QBrush(bgc)); | 61 | p->setBrush(QBrush(bgc)); |
62 | p->drawRect(xmin,ymin,xwidth,yheight); | 62 | p->drawRect(xmin,ymin,xwidth,yheight); |
63 | 63 | ||
64 | } | 64 | } |
65 | //**************************************************************************** | 65 | //**************************************************************************** |
66 | void FretBoard::paintFrets(QPainter* p) | 66 | void Graph::FretBoard::paintFrets(QPainter* p) |
67 | { | 67 | { |
68 | //draw frets | 68 | //draw frets |
69 | p->setPen(fretpen); | 69 | p->setPen(fretpen); |
70 | p->setBrush(markerbrush); | 70 | p->setBrush(markerbrush); |
71 | fretdist=(double)(xwidth)/(double)(inst.noOfFrets()); | 71 | fretdist=(double)(xwidth)/(double)(inst.noOfFrets()); |
72 | 72 | ||
73 | int markerwidth = (int)(fretdist/4.0); | 73 | int markerwidth = (int)(fretdist/4.0); |
74 | if(markerwidth>5) | 74 | if(markerwidth>5) |
@@ -96,13 +96,13 @@ void FretBoard::paintFrets(QPainter* p) | |||
96 | p->drawEllipse(fretpos+xmin,ymax+ymargin-2*markerwidth,markerwidth,markerwidth); | 96 | p->drawEllipse(fretpos+xmin,ymax+ymargin-2*markerwidth,markerwidth,markerwidth); |
97 | } | 97 | } |
98 | 98 | ||
99 | } | 99 | } |
100 | } | 100 | } |
101 | //**************************************************************************** | 101 | //**************************************************************************** |
102 | void FretBoard::paintStrings(QPainter* p) | 102 | void Graph::FretBoard::paintStrings(QPainter* p) |
103 | { | 103 | { |
104 | //draw strings | 104 | //draw strings |
105 | p->setPen(stringpen); | 105 | p->setPen(stringpen); |
106 | 106 | ||
107 | stringdist=(double)(yheight)/(double)(inst.noOfStrings()-1); | 107 | stringdist=(double)(yheight)/(double)(inst.noOfStrings()-1); |
108 | for(int s=0;s<inst.noOfStrings();s++) | 108 | for(int s=0;s<inst.noOfStrings();s++) |
@@ -113,13 +113,13 @@ void FretBoard::paintStrings(QPainter* p) | |||
113 | int stinglabelid=inst.noOfStrings()-(s+1); | 113 | int stinglabelid=inst.noOfStrings()-(s+1); |
114 | QString label=Note::getNameOfNote(inst.string(stinglabelid)); | 114 | QString label=Note::getNameOfNote(inst.string(stinglabelid)); |
115 | p->drawText(xmargin/2,stringpos+ymin,label); | 115 | p->drawText(xmargin/2,stringpos+ymin,label); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | //**************************************************************************** | 118 | //**************************************************************************** |
119 | void FretBoard::paintScale(QPainter* p) | 119 | void Graph::FretBoard::paintScale(QPainter* p) |
120 | { | 120 | { |
121 | int dotsize=10; | 121 | int dotsize=10; |
122 | int scaleid=data->getCurrentScaleID(); | 122 | int scaleid=data->getCurrentScaleID(); |
123 | Scale scale=data->getScale(scaleid); | 123 | Scale scale=data->getScale(scaleid); |
124 | 124 | ||
125 | int colorstart=255%inst.noOfOctaves(); | 125 | int colorstart=255%inst.noOfOctaves(); |