@@ -188,14 +188,12 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
188
188
while (snapIter.hasNext ())
189
189
m_ui.QuantizeSwingComboBox ->addItem (snapIcon, snapIter.next ());
190
190
// m_ui.QuantizeSwingComboBox->insertItems(0, snapItems);
191
- m_ui.ResizeLegatoQuantizeComboBox ->clear ();
192
- m_ui.ResizeLegatoQuantizeComboBox ->setIconSize (snapIconSize);
191
+ m_ui.ResizeLegatoLengthComboBox ->clear ();
192
+ m_ui.ResizeLegatoLengthComboBox ->setIconSize (snapIconSize);
193
193
snapIter.toFront ();
194
- if (snapIter.hasNext ())
195
- m_ui.ResizeLegatoQuantizeComboBox ->addItem (
196
- QIcon (" :/images/itemNone.png" ), snapIter.next ());
194
+ snapIter.next ();
197
195
while (snapIter.hasNext ())
198
- m_ui.ResizeLegatoQuantizeComboBox ->addItem (snapIcon, snapIter.next ());
196
+ m_ui.ResizeLegatoLengthComboBox ->addItem (snapIcon, snapIter.next ());
199
197
// m_ui.ResizeLegatoQuantizeComboBox->insertItems(0, snapItems);
200
198
// Default quantization value...
201
199
unsigned short iSnapPerBeat = m_pTimeScale->snapPerBeat ();
@@ -206,7 +204,7 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
206
204
m_ui.QuantizeDurationComboBox ->setCurrentIndex (iSnapIndex);
207
205
m_ui.QuantizeSwingComboBox ->setCurrentIndex (0 );
208
206
m_ui.QuantizeSwingTypeComboBox ->setCurrentIndex (0 );
209
- m_ui.ResizeLegatoQuantizeComboBox ->setCurrentIndex (0 );
207
+ m_ui.ResizeLegatoLengthComboBox ->setCurrentIndex (iSnapIndex );
210
208
// Initial tempo-ramp range...
211
209
if (pSession->editHead () < pSession->editTail ()) {
212
210
qtractorTimeScale::Cursor cursor (m_pTimeScale);
@@ -393,7 +391,6 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
393
391
QObject::connect (m_ui.ResizeDurationFormatComboBox ,
394
392
SIGNAL (activated (int )),
395
393
SLOT (formatChanged (int )));
396
-
397
394
QObject::connect (m_ui.ResizeValueCheckBox ,
398
395
SIGNAL (toggled (bool )),
399
396
SLOT (changed ()));
@@ -409,10 +406,10 @@ qtractorMidiToolsForm::qtractorMidiToolsForm ( QWidget *pParent )
409
406
QObject::connect (m_ui.ResizeLegatoCheckBox ,
410
407
SIGNAL (toggled (bool )),
411
408
SLOT (changed ()));
412
- QObject::connect (m_ui.ResizeLegatoSpinBox ,
413
- SIGNAL (valueChanged ( double )),
409
+ QObject::connect (m_ui.ResizeLegatoTypeComboBox ,
410
+ SIGNAL (activated ( int )),
414
411
SLOT (changed ()));
415
- QObject::connect (m_ui.ResizeLegatoQuantizeComboBox ,
412
+ QObject::connect (m_ui.ResizeLegatoLengthComboBox ,
416
413
SIGNAL (activated (int )),
417
414
SLOT (changed ()));
418
415
QObject::connect (m_ui.ResizeLegatoModeComboBox ,
@@ -627,8 +624,8 @@ void qtractorMidiToolsForm::loadPreset ( const QString& sPreset )
627
624
// Resize legato mode tool...
628
625
if (vlist.count () > 10 ) {
629
626
m_ui.ResizeLegatoCheckBox ->setChecked (vlist[7 ].toBool ());
630
- m_ui.ResizeLegatoSpinBox -> setValue (vlist[8 ].toDouble ());
631
- m_ui.ResizeLegatoQuantizeComboBox ->setCurrentIndex (vlist[9 ].toInt ());
627
+ m_ui.ResizeLegatoTypeComboBox -> setCurrentIndex (vlist[8 ].toInt ());
628
+ m_ui.ResizeLegatoLengthComboBox ->setCurrentIndex (vlist[9 ].toInt ());
632
629
m_ui.ResizeLegatoModeComboBox ->setCurrentIndex (vlist[10 ].toInt ());
633
630
}
634
631
// Rescale tool...
@@ -735,8 +732,8 @@ void qtractorMidiToolsForm::savePreset ( const QString& sPreset )
735
732
vlist.append (m_ui.ResizeValue2ComboBox ->currentIndex ());
736
733
vlist.append (m_ui.ResizeValue2SpinBox ->value ());
737
734
vlist.append (m_ui.ResizeLegatoCheckBox ->isChecked ());
738
- vlist.append (m_ui.ResizeLegatoSpinBox -> value ());
739
- vlist.append (m_ui.ResizeLegatoQuantizeComboBox ->currentIndex ());
735
+ vlist.append (m_ui.ResizeLegatoTypeComboBox -> currentIndex ());
736
+ vlist.append (m_ui.ResizeLegatoLengthComboBox ->currentIndex ());
740
737
vlist.append (m_ui.ResizeLegatoModeComboBox ->currentIndex ());
741
738
settings.setValue (" /Resize" , vlist);
742
739
// Rescale tool...
@@ -1192,23 +1189,20 @@ qtractorMidiEditCommand *qtractorMidiToolsForm::midiEditCommand (
1192
1189
if (m_ui.ResizeLegatoCheckBox ->isChecked ()
1193
1190
&& pEvent->type () == qtractorMidiEvent::NOTEON) {
1194
1191
if (pLastEvent) {
1195
- const float p2
1196
- = 0 .01f * float (m_ui.ResizeLegatoSpinBox ->value ());
1197
- const long 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 ) {
1192
+ long d2 = long (float (pLastEvent->time () - pEvent->time ()));
1193
+ const int i = m_ui.ResizeLegatoTypeComboBox ->currentIndex ();
1194
+ if (i > 0 ) {
1195
+ const unsigned short p = qtractorTimeScale::snapFromIndex (
1196
+ m_ui.ResizeLegatoLengthComboBox ->currentIndex ());
1203
1197
const unsigned long q = pNode->ticksPerBeat / p;
1204
- iDuration2 = q * ((iDuration2 + q - 1 ) / q );
1198
+ d2 += (i == 1 ? - long (q) : + long (q) );
1205
1199
}
1206
1200
if (m_ui.ResizeLegatoModeComboBox ->currentIndex () > 0 ) {
1207
- if (iDuration < iDuration2 && iDuration2 > 0 )
1208
- iDuration = iDuration2 ;
1201
+ if (iDuration < d2 && d2 > 0 )
1202
+ iDuration = d2 ;
1209
1203
}
1210
- else if (iDuration2 > 0 )
1211
- iDuration = iDuration2 ;
1204
+ else if (d2 > 0 )
1205
+ iDuration = d2 ;
1212
1206
}
1213
1207
pLastEvent = pEvent;
1214
1208
}
@@ -1522,9 +1516,9 @@ void qtractorMidiToolsForm::stabilizeForm (void)
1522
1516
bEnabled2 = bEnabled && m_ui.ResizeLegatoCheckBox ->isChecked ();
1523
1517
if (bEnabled2)
1524
1518
++iEnabled;
1525
- m_ui.ResizeLegatoSpinBox ->setEnabled (bEnabled2);
1526
- m_ui.ResizeLegatoQuantizeComboBox ->setEnabled (bEnabled2
1527
- && qAbs ( float ( m_ui.ResizeLegatoSpinBox -> value ()) - 100 . 0f ) > 0 . 05f );
1519
+ m_ui.ResizeLegatoTypeComboBox ->setEnabled (bEnabled2);
1520
+ m_ui.ResizeLegatoLengthComboBox ->setEnabled (bEnabled2
1521
+ && m_ui.ResizeLegatoTypeComboBox -> currentIndex () > 0 );
1528
1522
m_ui.ResizeLegatoModeComboBox ->setEnabled (bEnabled2);
1529
1523
1530
1524
// Rescale tool...
0 commit comments