~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to kmid/channel4d.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
 
 
3
    channel4d.cpp  - KMidChannel4D widget, with 3D look and filled
 
4
    Copyright (C) 1998  Antonio Larrosa Jimenez
 
5
 
 
6
    This program is free software; you can redistribute it and/or modify
 
7
    it under the terms of the GNU General Public License as published by
 
8
    the Free Software Foundation; either version 2 of the License, or
 
9
    (at your option) any later version.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
    GNU General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU General Public License
 
17
    along with this program; if not, write to the Free Software
 
18
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 
 
20
    Send comments and bug fixes to larrosa@kde.org
 
21
    or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
 
22
 
 
23
***************************************************************************/
 
24
 
 
25
#include "channel4d.h"
 
26
#include <qpainter.h>
 
27
 
 
28
KMidChannel4D::KMidChannel4D  (int chn,QWidget *parent) : KMidChannel(chn,parent)
 
29
{
 
30
    brushR = new QBrush (red);
 
31
    brushW = new QBrush (white);
 
32
    brushB = new QBrush (black);
 
33
    penR   = new QPen   (red);
 
34
};
 
35
 
 
36
 
 
37
void KMidChannel4D::drawDo(QPainter *qpaint,int x,int p)
 
38
{
 
39
    qpaint->setPen(p?(*penR):(*penB));
 
40
    
 
41
    qpaint->drawLine(x,KEYBOARDY+43,x+6,KEYBOARDY+43);
 
42
    qpaint->drawLine(x,KEYBOARDY+44,x+6,KEYBOARDY+44);
 
43
    
 
44
    qpaint->setPen(p?(*penB):(*penT));
 
45
    qpaint->drawLine(x-1,KEYBOARDY+45,x+8,KEYBOARDY+45);
 
46
    qpaint->setPen(p?(*penB):(*penW));
 
47
    qpaint->drawLine(x+7,KEYBOARDY+28,x+7,KEYBOARDY+42);
 
48
 
 
49
    qpaint->fillRect(x,KEYBOARDY+28,7,15,((p)?*brushR:*brushW));
 
50
    qpaint->fillRect(x,KEYBOARDY+1,5,27,((p)?*brushR:*brushW));
 
51
    qpaint->setPen(p?(*penR):(*penW));
 
52
    qpaint->drawPoint(x+5,KEYBOARDY+27);
 
53
};
 
54
void KMidChannel4D::drawDo__(QPainter *qpaint,int x,int p)
 
55
{
 
56
    qpaint->fillRect(x+6,KEYBOARDY+1,5,26,((p)?*brushR:*brushB));
 
57
 
 
58
    if (!p)
 
59
    {
 
60
        qpaint->setPen(*penW);
 
61
        qpaint->drawLine(x+6,KEYBOARDY+2,x+6,KEYBOARDY+25);
 
62
        qpaint->drawLine(x+7,KEYBOARDY+25,x+11,KEYBOARDY+25);
 
63
    };
 
64
    
 
65
    qpaint->setPen(p?(*penW):(*penB));
 
66
    qpaint->drawLine(x+11,KEYBOARDY+1,x+11,KEYBOARDY+27);
 
67
    qpaint->drawPoint(x+10,KEYBOARDY+27);
 
68
 
 
69
 
 
70
};
 
71
void KMidChannel4D::drawRe(QPainter *qpaint,int x,int p)
 
72
{
 
73
    qpaint->setPen(p?(*penR):(*penB));
 
74
    qpaint->drawLine(x+9,KEYBOARDY+43,x+15,KEYBOARDY+43);
 
75
    qpaint->drawLine(x+9,KEYBOARDY+44,x+15,KEYBOARDY+44);
 
76
    qpaint->setPen(p?(*penB):(*penT));
 
77
    qpaint->drawLine(x+8,KEYBOARDY+45,x+17,KEYBOARDY+45);
 
78
    qpaint->setPen(p?(*penB):(*penW));
 
79
    qpaint->drawLine(x+16,KEYBOARDY+28,x+16,KEYBOARDY+42);
 
80
 
 
81
    qpaint->fillRect(x+9,KEYBOARDY+28,7,15,((p)?*brushR:*brushW));
 
82
    qpaint->fillRect(x+12,KEYBOARDY+1,2,27,((p)?*brushR:*brushW));
 
83
    qpaint->setPen(p?(*penR):(*penW));
 
84
    qpaint->drawPoint(x+11,KEYBOARDY+27);
 
85
    qpaint->drawPoint(x+14,KEYBOARDY+27);
 
86
 
 
87
};
 
88
 
 
89
void KMidChannel4D::drawRe__(QPainter *qpaint,int x,int p)
 
90
{
 
91
    qpaint->fillRect(x+15,KEYBOARDY+1,5,26,((p)?*brushR:*brushB));
 
92
 
 
93
    if (!p)
 
94
    {
 
95
        qpaint->setPen(*penW);
 
96
        qpaint->drawLine(x+15,KEYBOARDY+2,x+15,KEYBOARDY+25);
 
97
        qpaint->drawLine(x+16,KEYBOARDY+25,x+20,KEYBOARDY+25);
 
98
    };
 
99
 
 
100
    qpaint->setPen(p?(*penW):(*penB));
 
101
    qpaint->drawLine(x+20,KEYBOARDY+1,x+20,KEYBOARDY+27);
 
102
    qpaint->drawPoint(x+19,KEYBOARDY+27);
 
103
 
 
104
 
 
105
};
 
106
void KMidChannel4D::drawMi(QPainter *qpaint,int x,int p)
 
107
{
 
108
    qpaint->setPen(p?(*penR):(*penB));
 
109
    qpaint->drawLine(x+18,KEYBOARDY+43,x+24,KEYBOARDY+43);
 
110
    qpaint->drawLine(x+18,KEYBOARDY+44,x+24,KEYBOARDY+44);
 
111
    qpaint->setPen(p?(*penB):(*penT));
 
112
    qpaint->drawLine(x+17,KEYBOARDY+45,x+26,KEYBOARDY+45);
 
113
    qpaint->setPen(p?(*penB):(*penW));
 
114
    qpaint->drawLine(x+25,KEYBOARDY+1,x+25,KEYBOARDY+42);
 
115
 
 
116
    qpaint->fillRect(x+18,KEYBOARDY+28,7,15,((p)?*brushR:*brushW));
 
117
    qpaint->fillRect(x+21,KEYBOARDY+1,4,27,((p)?*brushR:*brushW));
 
118
    qpaint->setPen(p?(*penR):(*penW));
 
119
    qpaint->drawPoint(x+20,KEYBOARDY+27);
 
120
 
 
121
};
 
122
void KMidChannel4D::drawFa(QPainter *qpaint,int x,int p)
 
123
{
 
124
    qpaint->setPen(p?(*penR):(*penB));
 
125
    qpaint->drawLine(x+27,KEYBOARDY+43,x+33,KEYBOARDY+43);
 
126
    qpaint->drawLine(x+27,KEYBOARDY+44,x+33,KEYBOARDY+44);
 
127
    qpaint->setPen(p?(*penB):(*penT));
 
128
    qpaint->drawLine(x+26,KEYBOARDY+45,x+35,KEYBOARDY+45);
 
129
    qpaint->setPen(p?(*penB):(*penW));
 
130
    qpaint->drawLine(x+34,KEYBOARDY+28,x+34,KEYBOARDY+42);
 
131
 
 
132
    qpaint->fillRect(x+27,KEYBOARDY+28,7,15,((p)?*brushR:*brushW));
 
133
    qpaint->fillRect(x+27,KEYBOARDY+1,5,27,((p)?*brushR:*brushW));
 
134
    qpaint->setPen(p?(*penR):(*penW));
 
135
    qpaint->drawPoint(x+32,KEYBOARDY+27);
 
136
 
 
137
};
 
138
void KMidChannel4D::drawFa__(QPainter *qpaint,int x,int p)
 
139
{
 
140
    qpaint->fillRect(x+33,KEYBOARDY+1,5,26,((p)?*brushR:*brushB));
 
141
    if (!p)
 
142
    {
 
143
        qpaint->setPen(*penW);
 
144
        qpaint->drawLine(x+33,KEYBOARDY+2,x+33,KEYBOARDY+25);
 
145
        qpaint->drawLine(x+34,KEYBOARDY+25,x+38,KEYBOARDY+25);
 
146
    };
 
147
    qpaint->setPen(p?(*penW):(*penB));
 
148
    qpaint->drawLine(x+38,KEYBOARDY+1,x+38,KEYBOARDY+27);
 
149
    qpaint->drawPoint(x+37,KEYBOARDY+27);
 
150
 
 
151
};
 
152
 
 
153
void KMidChannel4D::drawSol(QPainter *qpaint,int x,int p)
 
154
{
 
155
    qpaint->setPen(p?(*penR):(*penB));
 
156
    qpaint->drawLine(x+36,KEYBOARDY+43,x+42,KEYBOARDY+43);
 
157
    qpaint->drawLine(x+36,KEYBOARDY+44,x+42,KEYBOARDY+44);
 
158
    qpaint->setPen(p?(*penB):(*penT));
 
159
    qpaint->drawLine(x+35,KEYBOARDY+45,x+44,KEYBOARDY+45);
 
160
    qpaint->setPen(p?(*penB):(*penW));
 
161
    qpaint->drawLine(x+43,KEYBOARDY+28,x+43,KEYBOARDY+42);
 
162
 
 
163
    qpaint->fillRect(x+36,KEYBOARDY+28,7,15,((p)?*brushR:*brushW));
 
164
    qpaint->fillRect(x+39,KEYBOARDY+1,2,27,((p)?*brushR:*brushW));
 
165
    qpaint->setPen(p?(*penR):(*penW));
 
166
    qpaint->drawPoint(x+38,KEYBOARDY+27);
 
167
    qpaint->drawPoint(x+41,KEYBOARDY+27);
 
168
 
 
169
};
 
170
 
 
171
void KMidChannel4D::drawSol__(QPainter *qpaint,int x,int p)
 
172
{
 
173
    qpaint->fillRect(x+42,KEYBOARDY+1,5,26,((p)?*brushR:*brushB));
 
174
 
 
175
    if (!p)
 
176
    {
 
177
        qpaint->setPen(*penW);
 
178
        qpaint->drawLine(x+42,KEYBOARDY+2,x+42,KEYBOARDY+25);
 
179
        qpaint->drawLine(x+43,KEYBOARDY+25,x+47,KEYBOARDY+25);
 
180
    };
 
181
    qpaint->setPen(p?(*penW):(*penB));
 
182
    qpaint->drawLine(x+47,KEYBOARDY+1,x+47,KEYBOARDY+27);
 
183
    qpaint->drawPoint(x+46,KEYBOARDY+27);
 
184
 
 
185
 
 
186
};
 
187
void KMidChannel4D::drawLa(QPainter *qpaint,int x,int p)
 
188
{
 
189
    qpaint->setPen(p?(*penR):(*penB));
 
190
    qpaint->drawLine(x+45,KEYBOARDY+43,x+51,KEYBOARDY+43);
 
191
    qpaint->drawLine(x+45,KEYBOARDY+44,x+51,KEYBOARDY+44);
 
192
    qpaint->setPen(p?(*penB):(*penT));
 
193
    qpaint->drawLine(x+44,KEYBOARDY+45,x+53,KEYBOARDY+45);
 
194
    qpaint->setPen(p?(*penB):(*penW));
 
195
    qpaint->drawLine(x+52,KEYBOARDY+28,x+52,KEYBOARDY+42);
 
196
 
 
197
    qpaint->fillRect(x+45,KEYBOARDY+28,7,15,((p)?*brushR:*brushW));
 
198
    qpaint->fillRect(x+48,KEYBOARDY+1,2,27,((p)?*brushR:*brushW));
 
199
    qpaint->setPen(p?(*penR):(*penW));
 
200
    qpaint->drawPoint(x+47,KEYBOARDY+27);
 
201
    qpaint->drawPoint(x+50,KEYBOARDY+27);
 
202
};
 
203
void KMidChannel4D::drawLa__(QPainter *qpaint,int x,int p)
 
204
{
 
205
    qpaint->fillRect(x+51,KEYBOARDY+1,5,26,((p)?*brushR:*brushB));
 
206
 
 
207
    if (!p)
 
208
    {
 
209
        qpaint->setPen(*penW);
 
210
        qpaint->drawLine(x+51,KEYBOARDY+2,x+51,KEYBOARDY+25);
 
211
        qpaint->drawLine(x+52,KEYBOARDY+25,x+56,KEYBOARDY+25);
 
212
    };
 
213
    qpaint->setPen(p?(*penW):(*penB));
 
214
    qpaint->drawLine(x+56,KEYBOARDY+1,x+56,KEYBOARDY+27);
 
215
    qpaint->drawPoint(x+55,KEYBOARDY+27);
 
216
 
 
217
};
 
218
void KMidChannel4D::drawSi(QPainter *qpaint,int x,int p)
 
219
{
 
220
    qpaint->setPen(p?(*penR):(*penB));
 
221
    qpaint->drawLine(x+54,KEYBOARDY+43,x+60,KEYBOARDY+43);
 
222
    qpaint->drawLine(x+54,KEYBOARDY+44,x+60,KEYBOARDY+44);
 
223
    qpaint->setPen(p?(*penB):(*penT));
 
224
    qpaint->drawLine(x+53,KEYBOARDY+45,x+62,KEYBOARDY+45);
 
225
    qpaint->setPen(p?(*penB):(*penW));
 
226
    qpaint->drawLine(x+61,KEYBOARDY+1,x+61,KEYBOARDY+42);
 
227
 
 
228
    qpaint->fillRect(x+54,KEYBOARDY+28,7,15,((p)?*brushR:*brushW));
 
229
    qpaint->fillRect(x+57,KEYBOARDY+1,4,27,((p)?*brushR:*brushW));
 
230
    qpaint->setPen(p?(*penR):(*penW));
 
231
    qpaint->drawPoint(x+56,KEYBOARDY+27);
 
232
};