@@ -165,26 +165,38 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
165
165
// Fill-up snap-per-beat items...
166
166
const QIcon snapIcon (" :/images/itemBeat.png" );
167
167
const QSize snapIconSize (8 , 16 );
168
- const QStringList& snapItems = qtractorTimeScale::snapItems (1 );
168
+ const QStringList& snapItems = qtractorTimeScale::snapItems ();
169
169
QStringListIterator snapIter (snapItems);
170
170
m_ui.QuantizeTimeComboBox ->clear ();
171
171
m_ui.QuantizeTimeComboBox ->setIconSize (snapIconSize);
172
172
// snapIter.toFront();
173
+ snapIter.next ();
173
174
while (snapIter.hasNext ())
174
175
m_ui.QuantizeTimeComboBox ->addItem (snapIcon, snapIter.next ());
175
176
// m_ui.QuantizeTimeComboBox->insertItems(0, snapItems);
176
177
m_ui.QuantizeDurationComboBox ->clear ();
177
178
m_ui.QuantizeDurationComboBox ->setIconSize (snapIconSize);
178
179
snapIter.toFront ();
180
+ snapIter.next ();
179
181
while (snapIter.hasNext ())
180
182
m_ui.QuantizeDurationComboBox ->addItem (snapIcon, snapIter.next ());
181
183
// m_ui.QuantizeDurationComboBox->insertItems(0, snapItems);
182
184
m_ui.QuantizeSwingComboBox ->clear ();
183
185
m_ui.QuantizeSwingComboBox ->setIconSize (snapIconSize);
184
186
snapIter.toFront ();
187
+ snapIter.next ();
185
188
while (snapIter.hasNext ())
186
189
m_ui.QuantizeSwingComboBox ->addItem (snapIcon, snapIter.next ());
187
190
// m_ui.QuantizeSwingComboBox->insertItems(0, snapItems);
191
+ m_ui.ResizeLegatoQuantizeComboBox ->clear ();
192
+ m_ui.ResizeLegatoQuantizeComboBox ->setIconSize (snapIconSize);
193
+ snapIter.toFront ();
194
+ if (snapIter.hasNext ())
195
+ m_ui.ResizeLegatoQuantizeComboBox ->addItem (
196
+ QIcon (" :/images/itemNone.png" ), snapIter.next ());
197
+ while (snapIter.hasNext ())
198
+ m_ui.ResizeLegatoQuantizeComboBox ->addItem (snapIcon, snapIter.next ());
199
+ // m_ui.ResizeLegatoQuantizeComboBox->insertItems(0, snapItems);
188
200
// Default quantization value...
189
201
unsigned short iSnapPerBeat = m_pTimeScale->snapPerBeat ();
190
202
if (iSnapPerBeat > 0 )
@@ -194,6 +206,7 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
194
206
m_ui.QuantizeDurationComboBox ->setCurrentIndex (iSnapIndex);
195
207
m_ui.QuantizeSwingComboBox ->setCurrentIndex (0 );
196
208
m_ui.QuantizeSwingTypeComboBox ->setCurrentIndex (0 );
209
+ m_ui.ResizeLegatoQuantizeComboBox ->setCurrentIndex (0 );
197
210
// Initial tempo-ramp range...
198
211
if (pSession->editHead () < pSession->editTail ()) {
199
212
qtractorTimeScale::Cursor cursor (m_pTimeScale);
@@ -377,7 +390,7 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
377
390
QObject::connect (m_ui.ResizeDurationSpinBox ,
378
391
SIGNAL (valueChanged (unsigned long )),
379
392
SLOT (changed ()));
380
- QObject::connect (m_ui.ResizeFormatComboBox ,
393
+ QObject::connect (m_ui.ResizeDurationFormatComboBox ,
381
394
SIGNAL (activated (int )),
382
395
SLOT (formatChanged (int )));
383
396
@@ -399,7 +412,10 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
399
412
QObject::connect (m_ui.ResizeLegatoSpinBox ,
400
413
SIGNAL (valueChanged (double )),
401
414
SLOT (changed ()));
402
- QObject::connect (m_ui.ResizeLegatoComboBox ,
415
+ QObject::connect (m_ui.ResizeLegatoQuantizeComboBox ,
416
+ SIGNAL (activated (int )),
417
+ SLOT (changed ()));
418
+ QObject::connect (m_ui.ResizeLegatoModeComboBox ,
403
419
SIGNAL (activated (int )),
404
420
SLOT (changed ()));
405
421
@@ -609,10 +625,11 @@ void qtractorMidiToolsForm::loadPreset ( const QString& sPreset )
609
625
m_ui.ResizeValue2SpinBox ->setValue (vlist[6 ].toInt ());
610
626
}
611
627
// Resize legato mode tool...
612
- if (vlist.count () > 9 ) {
628
+ if (vlist.count () > 10 ) {
613
629
m_ui.ResizeLegatoCheckBox ->setChecked (vlist[7 ].toBool ());
614
630
m_ui.ResizeLegatoSpinBox ->setValue (vlist[8 ].toDouble ());
615
- m_ui.ResizeLegatoComboBox ->setCurrentIndex (vlist[9 ].toInt ());
631
+ m_ui.ResizeLegatoQuantizeComboBox ->setCurrentIndex (vlist[9 ].toInt ());
632
+ m_ui.ResizeLegatoModeComboBox ->setCurrentIndex (vlist[10 ].toInt ());
616
633
}
617
634
// Rescale tool...
618
635
vlist = settings.value (" /Rescale" ).toList ();
@@ -719,7 +736,8 @@ void qtractorMidiToolsForm::savePreset ( const QString& sPreset )
719
736
vlist.append (m_ui.ResizeValue2SpinBox ->value ());
720
737
vlist.append (m_ui.ResizeLegatoCheckBox ->isChecked ());
721
738
vlist.append (m_ui.ResizeLegatoSpinBox ->value ());
722
- vlist.append (m_ui.ResizeLegatoComboBox ->currentIndex ());
739
+ vlist.append (m_ui.ResizeLegatoQuantizeComboBox ->currentIndex ());
740
+ vlist.append (m_ui.ResizeLegatoModeComboBox ->currentIndex ());
723
741
settings.setValue (" /Resize" , vlist);
724
742
// Rescale tool...
725
743
vlist.clear ();
@@ -1174,16 +1192,23 @@ qtractorMidiEditCommand *qtractorMidiToolsForm::midiEditCommand (
1174
1192
if (m_ui.ResizeLegatoCheckBox ->isChecked ()
1175
1193
&& pEvent->type () == qtractorMidiEvent::NOTEON) {
1176
1194
if (pLastEvent) {
1177
- const float p
1195
+ const float p2
1178
1196
= 0 .01f * float (m_ui.ResizeLegatoSpinBox ->value ());
1179
1197
const long d2
1180
- = long (p * float (pLastEvent->time () - pEvent->time ()));
1181
- if (m_ui.ResizeLegatoComboBox ->currentIndex () > 0 ) {
1182
- if (iDuration < d2 && d2 > 0 )
1183
- iDuration = d2;
1198
+ = long (p2 * float (pLastEvent->time () - pEvent->time ()));
1199
+ const unsigned short p = qtractorTimeScale::snapFromIndex (
1200
+ m_ui.ResizeLegatoQuantizeComboBox ->currentIndex ());
1201
+ long iDuration2 = d2;
1202
+ if (p > 0 ) {
1203
+ const unsigned long q = pNode->ticksPerBeat / p;
1204
+ iDuration2 = q * ((iDuration2 + q - 1 ) / q);
1205
+ }
1206
+ if (m_ui.ResizeLegatoModeComboBox ->currentIndex () > 0 ) {
1207
+ if (iDuration < iDuration2 && iDuration2 > 0 )
1208
+ iDuration = iDuration2;
1184
1209
}
1185
- else if (d2 > 0 )
1186
- iDuration = d2 ;
1210
+ else if (iDuration2 > 0 )
1211
+ iDuration = iDuration2 ;
1187
1212
}
1188
1213
pLastEvent = pEvent;
1189
1214
}
@@ -1343,7 +1368,7 @@ void qtractorMidiToolsForm::formatChanged ( int iDisplayFormat )
1343
1368
= qtractorTimeScale::DisplayFormat (iDisplayFormat);
1344
1369
1345
1370
m_ui.TransposeFormatComboBox ->setCurrentIndex (iDisplayFormat);
1346
- m_ui.ResizeFormatComboBox ->setCurrentIndex (iDisplayFormat);
1371
+ m_ui.ResizeDurationFormatComboBox ->setCurrentIndex (iDisplayFormat);
1347
1372
1348
1373
if (m_pTimeScale) {
1349
1374
// Set from local time-scale instance...
@@ -1481,12 +1506,7 @@ void qtractorMidiToolsForm::stabilizeForm (void)
1481
1506
if (bEnabled2)
1482
1507
++iEnabled;
1483
1508
m_ui.ResizeDurationSpinBox ->setEnabled (bEnabled2);
1484
- m_ui.ResizeFormatComboBox ->setEnabled (bEnabled2);
1485
- bEnabled2 = bEnabled && m_ui.ResizeLegatoCheckBox ->isChecked ();
1486
- if (bEnabled2)
1487
- ++iEnabled;
1488
- m_ui.ResizeLegatoSpinBox ->setEnabled (bEnabled2);
1489
- m_ui.ResizeLegatoComboBox ->setEnabled (bEnabled2);
1509
+ m_ui.ResizeDurationFormatComboBox ->setEnabled (bEnabled2);
1490
1510
1491
1511
m_ui.ResizeValueCheckBox ->setEnabled (bEnabled);
1492
1512
bEnabled2 = bEnabled && m_ui.ResizeValueCheckBox ->isChecked ();
@@ -1498,6 +1518,15 @@ void qtractorMidiToolsForm::stabilizeForm (void)
1498
1518
bEnabled2 = (m_ui.ResizeValue2ComboBox ->currentIndex () > 0 );
1499
1519
m_ui.ResizeValue2SpinBox ->setEnabled (bEnabled2);
1500
1520
1521
+ m_ui.ResizeLegatoCheckBox ->setEnabled (bEnabled);
1522
+ bEnabled2 = bEnabled && m_ui.ResizeLegatoCheckBox ->isChecked ();
1523
+ if (bEnabled2)
1524
+ ++iEnabled;
1525
+ m_ui.ResizeLegatoSpinBox ->setEnabled (bEnabled2);
1526
+ m_ui.ResizeLegatoQuantizeComboBox ->setEnabled (bEnabled2
1527
+ && qAbs (float (m_ui.ResizeLegatoSpinBox ->value ()) - 100 .0f ) > 0 .05f );
1528
+ m_ui.ResizeLegatoModeComboBox ->setEnabled (bEnabled2);
1529
+
1501
1530
// Rescale tool...
1502
1531
1503
1532
bEnabled = m_ui.RescaleCheckBox ->isChecked ();
0 commit comments