1
//=========================================================
4
// $Id: musewidgetsplug.cpp,v 1.9.2.9 2009/12/01 03:52:40 terminator356 Exp $
5
// (C) Copyright 2001-2003 Werner Schweer (ws@seh.de)
6
//=========================================================
8
// this file makes some of the MusE widgets available
11
// #include <qwidgetplugin.h>
12
#include <QtCore/QtPlugin> // p4.0.2
13
#include <QtDesigner/QDesignerCustomWidgetInterface> //
17
#include "pitchedit.h"
18
#include "pitchlabel.h"
21
#include "tempolabel.h"
24
#include "doublelabel.h"
29
int sampleRate = 44100; // some dummy values to get things compiled/linked
34
static const char* vall[] = {
35
"c","c#","d","d#","e","f","f#","g","g#","a","a#","h"
37
static const char* valu[] = {
38
"C","C#","D","D#","E","F","F#","G","G#","A","A#","H"
41
GlobalConfigValues config = {
42
190, // globalAlphaBlend
44
QColor(0xff, 0xff, 0xff), // palette
45
QColor(0xff, 0xff, 0xff),
46
QColor(0xff, 0xff, 0xff),
47
QColor(0xff, 0xff, 0xff),
48
QColor(0xff, 0xff, 0xff),
49
QColor(0xff, 0xff, 0xff),
50
QColor(0xff, 0xff, 0xff),
51
QColor(0xff, 0xff, 0xff),
52
QColor(0xff, 0xff, 0xff),
53
QColor(0xff, 0xff, 0xff),
54
QColor(0xff, 0xff, 0xff),
55
QColor(0xff, 0xff, 0xff),
56
QColor(0xff, 0xff, 0xff),
57
QColor(0xff, 0xff, 0xff),
58
QColor(0xff, 0xff, 0xff),
59
QColor(0xff, 0xff, 0xff)
62
QColor(255, 232, 140), // part colors
63
QColor(0xff, 0x00, 0x00),
64
QColor(0x00, 0xff, 0x00),
65
QColor(0x00, 0x00, 0xff),
66
QColor(0xff, 0xff, 0x00),
67
QColor(0x00, 0xff, 0xff),
68
QColor(0xff, 0x00, 0xff),
69
QColor(0x9f, 0xc7, 0xef),
70
QColor(0x00, 0xff, 0x7f),
71
QColor(0x7f, 0x00, 0x00),
72
QColor(0x00, 0x7f, 0x00),
73
QColor(0x00, 0x00, 0x7f),
74
QColor(0x7f, 0x7f, 0x3f),
75
QColor(0x00, 0x7f, 0x7f),
76
QColor(0x7f, 0x00, 0x7f),
77
QColor(0x00, 0x7f, 0xff),
78
QColor(0x00, 0x3f, 0x3f)
81
QString("Default"), // Default part color names
89
QString("Percussion"),
99
QColor(0, 0, 255), // transportHandleColor;
100
QColor(255, 0, 0), // bigTimeForegroundColor;
101
QColor(0, 0, 0), // bigTimeBackgroundColor;
102
QColor(200, 200, 200), // waveEditBackgroundColor;
104
QFont(QString("arial"), 10, QFont::Normal),
105
QFont(QString("arial"), 8, QFont::Normal),
106
QFont(QString("arial"), 10, QFont::Normal),
107
QFont(QString("arial"), 10, QFont::Bold),
108
QFont(QString("arial"), 8, QFont::Bold), // timescale numbers
109
QFont(QString("Lucidatypewriter"), 14, QFont::Bold),
110
QFont(QString("arial"), 8, QFont::Bold, true) // Mixer strip labels. Looks and fits better with bold + italic than bold alone,
111
// at the price of only few more pixels than Normal mode.
113
QColor(0xff, 0xff, 0xff), // trackBg;
114
QColor(0x80, 0xff, 0x80), // selected track Bg;
115
QColor(0x00, 0x00, 0x00), // selected track Fg;
117
QColor(0, 160, 255), // midiTrackLabelBg; // Med blue
118
QColor(0, 160, 255), // drumTrackLabelBg; // Med blue
119
Qt::magenta, // waveTrackLabelBg;
120
Qt::green, // outputTrackLabelBg;
121
Qt::red, // inputTrackLabelBg;
122
Qt::yellow, // groupTrackLabelBg;
123
QColor(120, 255, 255), // auxTrackLabelBg; // Light blue
124
QColor(255, 130, 0), // synthTrackLabelBg; // Med orange
126
QColor(220, 220, 220), // midiTrackBg;
127
QColor(220, 220, 220), // drumTrackBg;
128
QColor(220, 220, 220), // waveTrackBg;
129
QColor(189, 220, 193), // outputTrackBg;
130
QColor(189, 220, 193), // inputTrackBg;
131
QColor(220, 220, 220), // groupTrackBg;
132
QColor(220, 220, 220), // auxTrackBg;
133
QColor(220, 220, 220), // synthTrackBg;
135
QColor(98, 124, 168), // part canvas bg
136
QColor(255, 170, 0), // ctrlGraphFg; Medium orange
137
QColor(98, 124, 168), // mixerBg;
141
-60, // int minMeter;
142
-60.0, // double minSlider;
143
false, // use Jack freewheel
144
20, // int guiRefresh;
145
QString(""), // helpBrowser
146
true, // extendedMidi
147
384, // division for smf export
148
QString(""), // copyright string for smf export
149
1, // smf export file format
150
false, // midi export file 2 byte timesigs instead of 4
151
true, // optimize midi export file note offs
152
true, // Split imported tracks into multiple parts.
154
QString(""), // start song path
156
QRect(0, 0, 400, 300), // GeometryMain;
157
QRect(0, 0, 200, 100), // GeometryTransport;
158
QRect(0, 0, 600, 200), // GeometryBigTime;
159
QRect(0, 0, 400, 300), // GeometryPianoroll;
160
QRect(0, 0, 400, 300), // GeometryDrumedit;
161
//QRect(0, 0, 300, 500), // GeometryMixer; // Obsolete
164
QRect(0, 0, 300, 500), // Mixer1
165
true, true, true, true,
166
true, true, true, true
170
QRect(200, 200, 300, 500), // Mixer2
171
true, true, true, true,
172
true, true, true, true
174
true, // TransportVisible;
175
false, // BigTimeVisible;
176
false, // mixer1Visible;
177
false, // mixer2Visible;
179
false, // markerVisible; // This line was missing 2007-01-08 (willyfoobar)
180
true, // showSplashScreen
181
1, // canvasShowPartType 1 - names, 2 events
182
5, // canvasShowPartEvent
183
false, // canvasShowGrid;
184
QString(""), // canvasBgPixmap;
185
QString(""), // styleSheetFile
186
QString(""), // style
187
QString(""), // externalWavEditor //this line was missing 2007-01-08 (willyfoobar)
188
false, // useOldStyleStopShortCut
189
true, // moveArmedCheckBox
190
true, // useDenormalBias
191
false, // useOutputLimiter
192
true, // showDidYouKnow
193
false, // vstInPlace Enable VST in-place processing
194
44100, // Dummy audio preferred sample rate
195
512 // Dummy audio buffer size
198
//---------------------------------------------------------
200
//---------------------------------------------------------
202
QString pitch2string(int v)
204
if (v < 0 || v > 127)
205
return QString("----");
206
int octave = (v / 12) - 2;
208
o.sprintf("%d", octave);
210
QString s(octave < 0 ? valu[i] : vall[i]);
222
static const char* slider_pixmap[]={
274
"......................",
275
"......................",
276
"......................",
277
"......................",
278
"......................",
279
"......###a............",
280
"......#bcad...........",
281
"......#bcad...........",
282
"......#bcad...........",
283
"..efgh#bcaihhhhhhhjk..",
284
".lmnop#bcaippppppqrst.",
285
".huvwx#bcayxxxxxxzABC.",
286
".DEFGH#bcaIHHHHHHJKLM.",
287
"..NOPQ#bcaRQQQQQQSTU..",
288
"......#bcad...........",
289
"......#bcad...........",
290
"......#bcad...........",
291
"......VVVVd...........",
292
".......dddd...........",
293
"......................",
294
"......................",
295
"......................"};
296
static const char *posedit_pixmap[] = {
306
"++++++++++++++++++++++",
307
"++++++++++++++++++++++",
308
"++++++++++++++++++++++",
309
"++++++++++++++++++++++",
310
"+OOOOOOOOOOOOOOOOOOOO+",
311
"OOXXXXXXXXXXXXXXXXXXOO",
318
"OX oo oo oo oo O O",
319
"OX oo oo oo oo O O",
322
"OO..................OO",
323
"+OOOOOOOOOOOOOOOOOOOO+",
324
"++++++++++++++++++++++",
325
"++++++++++++++++++++++",
326
"++++++++++++++++++++++",
327
"++++++++++++++++++++++"
330
static const char *pitchedit_pixmap[] = {
340
"++++++++++++++++++++++",
341
"++++++++++++++++++++++",
342
"++++++++++++++++++++++",
343
"++++++++++++++++++++++",
344
"+OOOOOOOOOOOOOOOOOOOO+",
345
"OOXXXXXXXXXXXXXXXXXXOO",
356
"OO..................OO",
357
"+OOOOOOOOOOOOOOOOOOOO+",
358
"++++++++++++++++++++++",
359
"++++++++++++++++++++++",
360
"++++++++++++++++++++++",
361
"++++++++++++++++++++++"
364
//---------------------------------------------------------
366
//---------------------------------------------------------
368
class MusEPlugin : public QWidgetPlugin {
372
QStringList keys() const;
373
QWidget* create(const QString& key, QWidget* parent=0,
374
const char* name = 0);
375
QString group(const QString& key) const;
376
QIcon iconSet(const QString& key) const;
377
QString includeFile(const QString& key) const;
378
QString toolTip(const QString& key) const;
379
QString whatsThis(const QString& key) const;
380
bool isContainer(const QString& key) const;
383
//---------------------------------------------------------
385
//---------------------------------------------------------
387
QStringList MusEPlugin::keys() const
390
list << QString("PosEdit")
391
<< QString("PitchEdit")
392
<< QString("PosLabel")
393
<< QString("PitchLabel")
394
<< QString("TempoLabel")
395
<< QString("TempoEdit")
396
<< QString("SigEdit")
398
<< QString("DoubleLabel")
399
<< QString("CheckBox")
400
<< QString("ComboBox")
405
//---------------------------------------------------------
407
//---------------------------------------------------------
409
QWidget* MusEPlugin::create(const QString& key, QWidget* parent,
412
if (key == QString("PosEdit"))
413
return new PosEdit(parent, name);
414
else if (key == QString("PitchEdit"))
415
return new PitchEdit(parent, name);
416
else if (key == QString("PitchLabel"))
417
return new PitchLabel(parent, name);
418
else if (key == QString("PosLabel"))
419
return new PosLabel(parent, name);
420
else if (key == QString("TempoLabel"))
421
return new TempoLabel(parent, name);
422
else if (key == QString("TempoEdit"))
423
return new TempoEdit(parent, name);
424
else if (key == QString("SigEdit"))
425
return new SigEdit(parent, name);
426
else if (key == QString("Slider"))
427
return new Slider(parent, name);
428
else if (key == QString("DoubleLabel"))
429
return new DoubleLabel(parent, name);
430
else if (key == QString("CheckBox"))
431
return new CheckBox(parent, -1, name);
432
else if (key == QString("ComboBox"))
433
return new ComboBox(parent, name);
437
//---------------------------------------------------------
439
//---------------------------------------------------------
441
QString MusEPlugin::group(const QString& /*key*/) const
443
return QString("MusE");
446
//---------------------------------------------------------
448
//---------------------------------------------------------
450
QIcon MusEPlugin::iconSet(const QString& key) const
452
if (key == "PosEdit" || key == "PosLabel")
453
return QIcon(QPixmap(posedit_pixmap));
454
else if (key == "PitchEdit" || key == "PitchLabel")
455
return QIcon(QPixmap(pitchedit_pixmap));
456
else if (key == "TempoEdit" || key == "TempoLabel")
457
return QIcon(QPixmap(pitchedit_pixmap));
458
else if (key == "SigEdit")
459
return QIcon(QPixmap(pitchedit_pixmap));
460
else if (key == QString("Slider"))
461
return QIcon(QPixmap(slider_pixmap));
462
// else if (key == QString("CheckBox"))
463
// return QIconSet(QPixmap(slider_pixmap));
464
// else if (key == QString("ComboBox"))
465
// return QIconSet(QPixmap(slider_pixmap));
469
//---------------------------------------------------------
471
//---------------------------------------------------------
473
QString MusEPlugin::includeFile(const QString& key) const
475
if (key == QString("PosEdit"))
476
return QString("posedit.h");
477
else if (key == QString("PitchEdit"))
478
return QString("pitchedit.h");
479
else if (key == QString("PitchLabel"))
480
return QString("pitchlabel.h");
481
else if (key == QString("PosLabel"))
482
return QString("poslabel.h");
483
else if (key == QString("TempoLabel"))
484
return QString("tempolabel.h");
485
else if (key == QString("TempoEdit"))
486
return QString("tempolabel.h");
487
else if (key == QString("SigEdit"))
488
return QString("sigedit.h");
489
else if (key == QString("Slider"))
490
return QString("slider.h");
491
else if (key == QString("DoubleLabel"))
492
return QString("dentry.h");
493
else if (key == QString("CheckBox"))
494
return QString("checkbox.h");
495
else if (key == QString("ComboBox"))
496
return QString("combobox.h");
497
return QString::null;
500
//---------------------------------------------------------
502
//---------------------------------------------------------
504
QString MusEPlugin::toolTip (const QString& key) const
506
if (key == QString("PosEdit"))
507
return QString("midi time position editor");
508
else if (key == QString("PitchEdit"))
509
return QString("midi pitch spinbox");
510
else if (key == QString("PitchLabel"))
511
return QString("midi pitch label");
512
else if (key == QString("PosLabel"))
513
return QString("midi time position label");
514
else if (key == QString("TempoLabel"))
515
return QString("midi tempo label");
516
else if (key == QString("TempoEdit"))
517
return QString("midi tempo spinbox");
518
else if (key == QString("SigEdit"))
519
return QString("midi signature spinbox");
520
else if (key == QString("Slider"))
521
return QString("slider for double values");
522
else if (key == QString("DoubleLabel"))
523
return QString("entry/label for double values");
524
else if (key == QString("CheckBox"))
525
return QString("checkbox with id");
526
else if (key == QString("ComboBox"))
527
return QString("combobox with id");
528
return QString::null;
531
//---------------------------------------------------------
533
//---------------------------------------------------------
535
QString MusEPlugin::whatsThis (const QString& key) const
537
if (key == QString("PosEdit"))
538
return QString("midi time position editor");
539
else if (key == QString("PitchEdit"))
540
return QString("midi pitch spinbox");
541
else if (key == QString("PitchLabel"))
542
return QString("midi pitch label");
543
else if (key == QString("PosLabel"))
544
return QString("midi time position label");
545
else if (key == QString("TempoLabel"))
546
return QString("midi tempo label");
547
else if (key == QString("TempoEdit"))
548
return QString("midi tempo spinbox");
549
else if (key == QString("SigEdit"))
550
return QString("midi signature spinbox");
551
else if (key == QString("Slider"))
552
return QString("slider for double values");
553
else if (key == QString("DoubleLabel"))
554
return QString("entry/label for double values");
555
else if (key == QString("CheckBox"))
556
return QString("checkbox with id");
557
else if (key == QString("ComboBox"))
558
return QString("combobox with id");
559
return QString::null;
562
//---------------------------------------------------------
564
//---------------------------------------------------------
566
bool MusEPlugin::isContainer (const QString& /*key*/) const
571
Q_EXPORT_PLUGIN(MusEPlugin)