summaryrefslogtreecommitdiff
path: root/muse2/muse/mplugins/rhythm.cpp
blob: 7c51227ced86367e7f23ff15fd2768662cf27de1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
//=========================================================
//  MusE
//  Linux Music Editor
//  $Id: rhythm.cpp,v 1.1.1.1 2003/10/27 18:52:49 wschweer Exp $
//
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; version 2 of
//  the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
//
//  This code is an adaption of the random rhythm generator taken
//  from "The JAZZ++ Midi Sequencer"
//  Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all
//  rights reserved.
//  Distributed under the GNU General Public License
//=========================================================

#include "rhythm.h"

namespace MusEGui {

//---------------------------------------------------------
//   RhythmGen
//---------------------------------------------------------

RhythmGen::RhythmGen(QWidget* parent, Qt::WFlags fo)
   : QMainWindow(parent, fo)
      {
      setupUi(this);
      }
RhythmGen::~RhythmGen()
      {
      }

//---------------------------------------------------------
//   closeEvent
//---------------------------------------------------------

void RhythmGen::closeEvent(QCloseEvent* ev)
      {
      emit hideWindow();
      QWidget::closeEvent(ev);
      }



#if 0
/****************************************************************************
** Form implementation generated from reading ui file 'rhythm.ui'
**
** Created: Tue Feb 26 13:43:04 2002
**      by:  The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "rhythm.h"

#include <QCloseEvent>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QVariant>
#include <QCheckBox>
#include <QFrame>
#include <QLabel>
#include <QLCDNumber>
#include <QPushButton>
#include <QSlider>
#include <QToolButton>
#include <QLayout>
#include <QToolTip>
#include <QImage>
#include <QPixmap>

static const char* const image0_data[] = {
"16 16 56 1",
". c None",
"F c #000000",
"L c #000101",
"E c #010304",
"C c #06101d",
"j c #071728",
"w c #07182a",
"1 c #071c2c",
"0 c #081c2d",
"e c #081e31",
"a c #0a121f",
"Z c #0a1929",
"Q c #0a263b",
"T c #0a273b",
"z c #0e97bf",
"s c #0ea0c5",
"K c #0f5d7e",
"B c #105375",
"G c #114760",
"N c #1197b9",
"x c #124c6d",
"# c #124d6f",
"u c #1290b5",
"v c #135476",
"h c #1390b4",
"Y c #14839f",
"b c #155474",
"i c #155678",
"o c #155a7a",
"J c #159abc",
"d c #17587a",
"V c #178eac",
"f c #194a6a",
"r c #19b3ce",
"k c #1b4b6a",
"p c #1b4f6f",
"A c #1ca2c3",
"D c #20374f",
"P c #2294b1",
"I c #22bad1",
"S c #2a98b3",
"U c #2cc7d5",
"n c #3cd7e1",
"O c #43d5de",
"t c #48dfe9",
"X c #58acc5",
"m c #59c3da",
"q c #71d1e0",
"W c #80c2db",
"c c #819eba",
"H c #9ddeee",
"M c #cdebf6",
"g c #ddeff8",
"y c #e2f0f9",
"R c #fdfafd",
"l c #fdfcfd",
"................",
"................",
".......#a.......",
"......bcde......",
".....fcghij.....",
"....kclmnhoj....",
"...pclqrstuvw...",
"..xcymrzzsnABC..",
".BDEFGHzIJKLFFF.",
".....BMNOPQ.....",
".....BRNOST.....",
".....BMNUVT.....",
".....BWXIYF.....",
".....BZ01FF.....",
"................",
"................"};

static const char* const image1_data[] = {
"16 16 50 1",
". c None",
"E c #010001",
"O c #03060c",
"U c #050b12",
"u c #05151e",
"S c #060f19",
"m c #06141d",
"q c #06141f",
"h c #071620",
"D c #0b293e",
"c c #0d324c",
"v c #0d3652",
"A c #0e5775",
"J c #0e8fb6",
"x c #0e94b9",
"r c #0e97bf",
"Q c #0e9ec3",
"n c #0eadcb",
"R c #0fa0c4",
"N c #106589",
"V c #10698f",
"B c #114560",
"# c #124d6f",
"z c #1299bb",
"C c #144059",
"T c #14a5c9",
"K c #15c1da",
"b c #18425f",
"y c #1bbad1",
"M c #1ca2c3",
"t c #1f95b2",
"a c #254a64",
"p c #2695b1",
"l c #2b91ae",
"F c #337f9e",
"o c #40d1db",
"s c #46dbe6",
"L c #48dfe9",
"I c #54bdd7",
"j c #5fc0d8",
"g c #64a3bd",
"k c #8fcce2",
"d c #a0cbdf",
"H c #a7dcec",
"w c #bfdfee",
"f c #d3e5f0",
"G c #dfeff8",
"i c #e0f1fb",
"e c #eff3fc",
"P c #ffffff",
"................",
"................",
".....###abc.....",
".....#defgh.....",
".....#ijklm.....",
".....#enopq.....",
".....airstu.....",
".v##aawxyzABCDE.",
"..vFGHIJrKLMNO..",
"...vFPQrRLMNS...",
"....vFPTLMNU....",
".....vFGMNU.....",
"......vVNS......",
".......vO.......",
"................",
"................"};


/*
 *  Constructs a RhythmGenerator which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
RhythmGenerator::RhythmGenerator( QWidget* parent,  const char* name, bool modal, Qt::WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    QPixmap image0( ( const char** ) image0_data );
    QPixmap image1( ( const char** ) image1_data );
    if ( !name )
	setName( "RhythmGenerator" );
    resize( 500, 777 );
    setCaption( trUtf8( "Form3" ) );
    RhythmGeneratorLayout = new Q3VBoxLayout( this, 11, 6, "RhythmGeneratorLayout");

    Frame6 = new QFrame( this);
    Frame6->setFrameShape( QFrame::StyledPanel );
    Frame6->setFrameShadow( QFrame::Raised );
    Frame6Layout = new Q3VBoxLayout( Frame6, 11, 6, "Frame6Layout");

    TextLabel1 = new QLabel( Frame6, "TextLabel1" );
    QFont TextLabel1_font(  TextLabel1->font() );
    TextLabel1_font.setBold( TRUE );
    TextLabel1_font.setUnderline( TRUE );
    TextLabel1->setFont( TextLabel1_font );
    TextLabel1->setText( trUtf8( "Instrument Settings:" ) );
    Frame6Layout->addWidget( TextLabel1 );

    Layout17 = new Q3HBoxLayout( 0, 0, 15, "Layout17");

    Layout16 = new Q3VBoxLayout( 0, 0, 6, "Layout16");

    InstrumentListLabel = new QLabel( Frame6, "InstrumentListLabel" );
    InstrumentListLabel->setText( trUtf8( "Instrument" ) );
    Layout16->addWidget( InstrumentListLabel );

    InstrumentList = new Q3ListBox( Frame6, "InstrumentList" );
    InstrumentList->insertItem( trUtf8( "Hi-Hat" ) );
    InstrumentList->setMinimumSize( QSize( 150, 70 ) );
    Layout16->addWidget( InstrumentList );

    Layout11 = new Q3HBoxLayout( 0, 0, 2, "Layout11");

    InstrumentUp = new QToolButton( Frame6, "InstrumentUp" );
    InstrumentUp->setMinimumSize( QSize( 40, 20 ) );
    InstrumentUp->setText( trUtf8( "" ) );
    InstrumentUp->setPixmap( image0 );
    Layout11->addWidget( InstrumentUp );

    InstrumentDown = new QToolButton( Frame6, "InstrumentDown" );
    InstrumentDown->setMinimumSize( QSize( 40, 20 ) );
    InstrumentDown->setText( trUtf8( "" ) );
    InstrumentDown->setPixmap( image1 );
    Layout11->addWidget( InstrumentDown );

    InstrumentAdd = new QToolButton( Frame6, "InstrumentAdd" );
    InstrumentAdd->setMinimumSize( QSize( 40, 20 ) );
    InstrumentAdd->setText( trUtf8( "add" ) );
    Layout11->addWidget( InstrumentAdd );

    InstrumentDel = new QToolButton( Frame6, "InstrumentDel" );
    InstrumentDel->setMinimumSize( QSize( 40, 20 ) );
    InstrumentDel->setText( trUtf8( "delete" ) );
    Layout11->addWidget( InstrumentDel );
    Layout16->addLayout( Layout11 );
    Layout17->addLayout( Layout16 );

    Layout20 = new Q3VBoxLayout( 0, 0, 6, "Layout20");

    StepsLabel = new QLabel( Frame6, "StepsLabel" );
    StepsLabel->setText( trUtf8( "steps/count" ) );
    Layout20->addWidget( StepsLabel );

    StepsLayout = new Q3HBoxLayout( 0, 0, 6, "StepsLayout");

    StepsSlider = new QSlider( Frame6, "StepsSlider" );
    StepsSlider->setMaxValue( 16 );
    StepsSlider->setValue( 4 );
    StepsSlider->setOrientation( Qt::Horizontal );
    StepsLayout->addWidget( StepsSlider );

    StepsNumber = new QLCDNumber( Frame6, "StepsNumber" );
    StepsNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
    StepsNumber->setLineWidth( 1 );
    StepsNumber->setNumDigits( 2 );
    StepsNumber->setSegmentStyle( QLCDNumber::Flat );
    StepsNumber->setProperty( "value", 4 );
    StepsLayout->addWidget( StepsNumber );
    Layout20->addLayout( StepsLayout );

    CountLabel = new QLabel( Frame6, "CountLabel" );
    CountLabel->setText( trUtf8( "count/bar" ) );
    Layout20->addWidget( CountLabel );

    CountLayout = new Q3HBoxLayout( 0, 0, 6, "CountLayout");

    CountSlider = new QSlider( Frame6, "CountSlider" );
    CountSlider->setMaxValue( 16 );
    CountSlider->setValue( 4 );
    CountSlider->setOrientation( Qt::Horizontal );
    CountLayout->addWidget( CountSlider );

    CountNumber = new QLCDNumber( Frame6, "CountNumber" );
    CountNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
    CountNumber->setNumDigits( 2 );
    CountNumber->setSegmentStyle( QLCDNumber::Flat );
    CountNumber->setProperty( "value", 4 );
    CountLayout->addWidget( CountNumber );
    Layout20->addLayout( CountLayout );

    BarsLabel = new QLabel( Frame6, "BarsLabel" );
    BarsLabel->setText( trUtf8( "# bars" ) );
    Layout20->addWidget( BarsLabel );

    BarsLayout = new Q3HBoxLayout( 0, 0, 6, "BarsLayout");

    BarsSlider = new QSlider( Frame6, "BarsSlider" );
    BarsSlider->setMaxValue( 16 );
    BarsSlider->setValue( 1 );
    BarsSlider->setOrientation( Qt::Horizontal );
    BarsLayout->addWidget( BarsSlider );

    BarsNumber = new QLCDNumber( Frame6, "BarsNumber" );
    BarsNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
    BarsNumber->setNumDigits( 2 );
    BarsNumber->setSegmentStyle( QLCDNumber::Flat );
    BarsNumber->setProperty( "value", 1 );
    BarsLayout->addWidget( BarsNumber );
    Layout20->addLayout( BarsLayout );
    Layout17->addLayout( Layout20 );
    Frame6Layout->addLayout( Layout17 );
    RhythmGeneratorLayout->addWidget( Frame6 );

    Layout27 = new Q3HBoxLayout( 0, 0, 15, "Layout27");

    Frame5 = new QFrame( this );
    Frame5->setFrameShape( QFrame::StyledPanel );
    Frame5->setFrameShadow( QFrame::Raised );
    Frame5Layout = new Q3VBoxLayout( Frame5, 11, 6, "Frame5Layout");

    TextLabel2 = new QLabel( Frame5, "TextLabel2" );
    QFont TextLabel2_font(  TextLabel2->font() );
    TextLabel2_font.setBold( TRUE );
    TextLabel2_font.setUnderline( TRUE );
    TextLabel2->setFont( TextLabel2_font );
    TextLabel2->setText( trUtf8( "Group Settings:" ) );
    Frame5Layout->addWidget( TextLabel2 );

    Layout20_2 = new Q3HBoxLayout( 0, 0, 15, "Layout20_2");

    GroupListLayout = new Q3VBoxLayout( 0, 0, 6, "GroupListLayout");

    GroupListLabel = new QLabel( Frame5, "GroupListLabel" );
    GroupListLabel->setText( trUtf8( "Group" ) );
    GroupListLayout->addWidget( GroupListLabel );

    GroupList = new Q3ListBox( Frame5, "GroupList" );
    GroupList->insertItem( trUtf8( "Group 1" ) );
    GroupList->insertItem( trUtf8( "Group 2" ) );
    GroupList->insertItem( trUtf8( "Group 3" ) );
    GroupList->insertItem( trUtf8( "Group 4" ) );
    GroupList->insertItem( trUtf8( "Group 5" ) );
    GroupList->setMinimumSize( QSize( 150, 90 ) );
    GroupListLayout->addWidget( GroupList );
    Layout20_2->addLayout( GroupListLayout );

    Layout19 = new Q3VBoxLayout( 0, 0, 6, "Layout19");

    ContribLabel = new QLabel( Frame5, "ContribLabel" );
    ContribLabel->setText( trUtf8( "contrib" ) );
    Layout19->addWidget( ContribLabel );

    ContribLayout = new Q3HBoxLayout( 0, 0, 6, "ContribLayout");

    ContribSlider = new QSlider( Frame5, "ContribSlider" );
    ContribSlider->setMinimumSize( QSize( 100, 0 ) );
    ContribSlider->setMaxValue( 100 );
    ContribSlider->setOrientation( Qt::Horizontal );
    ContribLayout->addWidget( ContribSlider );

    ContribNumber = new QLCDNumber( Frame5, "ContribNumber" );
    ContribNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
    ContribNumber->setNumDigits( 3 );
    ContribNumber->setSegmentStyle( QLCDNumber::Flat );
    ContribLayout->addWidget( ContribNumber );
    Layout19->addLayout( ContribLayout );

    ListenLabel = new QLabel( Frame5, "ListenLabel" );
    ListenLabel->setText( trUtf8( "listen" ) );
    Layout19->addWidget( ListenLabel );

    ListenLayout = new Q3HBoxLayout( 0, 0, 6, "ListenLayout");

    ListenSlider = new QSlider( Frame5, "ListenSlider" );
    ListenSlider->setMinimumSize( QSize( 100, 0 ) );
    ListenSlider->setMinValue( -99 );
    ListenSlider->setMaxValue( 100 );
    ListenSlider->setOrientation( Qt::Horizontal );
    ListenLayout->addWidget( ListenSlider );

    ListenNumber = new QLCDNumber( Frame5, "ListenNumber" );
    ListenNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
    ListenNumber->setNumDigits( 3 );
    ListenNumber->setSegmentStyle( QLCDNumber::Flat );
    ListenLayout->addWidget( ListenNumber );
    Layout19->addLayout( ListenLayout );
    Layout20_2->addLayout( Layout19 );
    Frame5Layout->addLayout( Layout20_2 );

    RandomizeCheck = new QCheckBox( Frame5, "RandomizeCheck" );
    RandomizeCheck->setText( trUtf8( "Randomize" ) );
    Frame5Layout->addWidget( RandomizeCheck );
    Layout27->addWidget( Frame5 );

    Frame5_2 = new QFrame( this );
    Frame5_2->setFrameShape( QFrame::StyledPanel );
    Frame5_2->setFrameShadow( QFrame::Raised );
    Frame5_2Layout = new Q3VBoxLayout( Frame5_2, 11, 6, "Frame5_2Layout");

    TextLabel3 = new QLabel( Frame5_2, "TextLabel3" );
    QFont TextLabel3_font(  TextLabel3->font() );
    TextLabel3_font.setBold( TRUE );
    TextLabel3_font.setUnderline( TRUE );
    TextLabel3->setFont( TextLabel3_font );
    TextLabel3->setText( trUtf8( "Rhythm Style:" ) );
    Frame5_2Layout->addWidget( TextLabel3 );

    Layout21 = new Q3VBoxLayout( 0, 0, 2, "Layout21");

    ToolButton7 = new QToolButton( Frame5_2, "ToolButton7" );
    ToolButton7->setText( trUtf8( "Clear" ) );
    Layout21->addWidget( ToolButton7 );

    ToolButton8 = new QToolButton( Frame5_2, "ToolButton8" );
    ToolButton8->setText( trUtf8( "Open..." ) );
    Layout21->addWidget( ToolButton8 );

    ToolButton9 = new QToolButton( Frame5_2, "ToolButton9" );
    ToolButton9->setText( trUtf8( "Save" ) );
    Layout21->addWidget( ToolButton9 );

    ToolButton10 = new QToolButton( Frame5_2, "ToolButton10" );
    ToolButton10->setText( trUtf8( "Save as..." ) );
    Layout21->addWidget( ToolButton10 );
    Frame5_2Layout->addLayout( Layout21 );

    Layout22 = new Q3VBoxLayout( 0, 0, 2, "Layout22");

    ToolButton5 = new QToolButton( Frame5_2, "ToolButton5" );
    ToolButton5->setText( trUtf8( "Generate" ) );
    Layout22->addWidget( ToolButton5 );

    ToolButton6 = new QToolButton( Frame5_2, "ToolButton6" );
    ToolButton6->setText( trUtf8( "Close" ) );
    Layout22->addWidget( ToolButton6 );
    Frame5_2Layout->addLayout( Layout22 );
    Layout27->addWidget( Frame5_2 );
    RhythmGeneratorLayout->addLayout( Layout27 );

    Layout29 = new Q3HBoxLayout( 0, 0, 6, "Layout29");

    Frame6_2 = new QFrame( this );
    Frame6_2->setMinimumSize( QSize( 200, 150 ) );
    Frame6_2->setFrameShape( QFrame::StyledPanel );
    Frame6_2->setFrameShadow( QFrame::Raised );
    Layout29->addWidget( Frame6_2 );

    Frame7 = new QFrame( this );
    Frame7->setMinimumSize( QSize( 200, 150 ) );
    Frame7->setFrameShape( QFrame::StyledPanel );
    Frame7->setFrameShadow( QFrame::Raised );
    Layout29->addWidget( Frame7 );
    RhythmGeneratorLayout->addLayout( Layout29 );

    Frame8 = new QFrame( this );
    Frame8->setMinimumSize( QSize( 400, 150 ) );
    Frame8->setFrameShape( QFrame::StyledPanel );
    Frame8->setFrameShadow( QFrame::Raised );
    RhythmGeneratorLayout->addWidget( Frame8 );

    // signals and slots connections
    connect( StepsSlider, SIGNAL( valueChanged(int) ), StepsNumber, SLOT( display(int) ) );
    connect( CountSlider, SIGNAL( valueChanged(int) ), CountNumber, SLOT( display(int) ) );
    connect( BarsSlider, SIGNAL( valueChanged(int) ), BarsNumber, SLOT( display(int) ) );
    connect( ContribSlider, SIGNAL( valueChanged(int) ), ContribNumber, SLOT( display(int) ) );
    connect( ListenSlider, SIGNAL( valueChanged(int) ), ListenNumber, SLOT( display(int) ) );
    connect( InstrumentDel, SIGNAL( pressed() ), InstrumentList, SLOT( clearSelection() ) );
}

/*
 *  Destroys the object and frees any allocated resources
 */
RhythmGenerator::~RhythmGenerator()
{
    // no need to delete child widgets, Qt does it all for us
}

#endif

} // namespace MusEGui