@@ -185,6 +185,40 @@ qtractorMidiEditorForm::qtractorMidiEditorForm (
185
185
m_pSnapToScaleKeyComboBox->setToolTip (tr (" Scale key" ));
186
186
m_pSnapToScaleTypeComboBox->setToolTip (tr (" Scale type" ));
187
187
188
+ // Late view/note type menu...
189
+ const QString sViewTypeObjectName (" viewNoteType%1" );
190
+ const QString sViewTypeStatusTip (" Set note type to %1" );
191
+ const int iViewTypeCount = m_pViewTypeComboBox->count ();
192
+ for (int iIndex = 0 ; iIndex < iViewTypeCount; ++iIndex) {
193
+ const QString& sViewTypeText = m_pViewTypeComboBox->itemText (iIndex);
194
+ QAction *pAction = new QAction (sViewTypeText , this );
195
+ pAction->setObjectName (sViewTypeObjectName .arg (iIndex));
196
+ pAction->setStatusTip (sViewTypeStatusTip .arg (sViewTypeText ));
197
+ pAction->setCheckable (true );
198
+ pAction->setData (iIndex);
199
+ QObject::connect (pAction,
200
+ SIGNAL (triggered (bool )),
201
+ SLOT (viewNoteType ()));
202
+ m_ui.viewNoteTypeMenu ->addAction (pAction);
203
+ }
204
+
205
+ // Late event/type type menu...
206
+ const QString sEventTypeObjectName (" viewValueType%1" );
207
+ const QString sEventTypeStatusTip (" Set value type to %1" );
208
+ const int iEventTypeCount = m_pEventTypeComboBox->count ();
209
+ for (int iIndex = 0 ; iIndex < iEventTypeCount; ++iIndex) {
210
+ const QString& sEventTypeText = m_pEventTypeComboBox->itemText (iIndex);
211
+ QAction *pAction = new QAction (sEventTypeText , this );
212
+ pAction->setObjectName (sEventTypeObjectName .arg (iIndex));
213
+ pAction->setStatusTip (sEventTypeStatusTip .arg (sEventTypeText ));
214
+ pAction->setCheckable (true );
215
+ pAction->setData (iIndex);
216
+ QObject::connect (pAction,
217
+ SIGNAL (triggered (bool )),
218
+ SLOT (viewValueType ()));
219
+ m_ui.viewValueTypeMenu ->addAction (pAction);
220
+ }
221
+
188
222
// Add combo-boxes to toolbars...
189
223
m_ui.viewToolbar ->addSeparator ();
190
224
m_ui.viewToolbar ->addWidget (m_pSnapPerBeatComboBox);
@@ -463,6 +497,12 @@ qtractorMidiEditorForm::qtractorMidiEditorForm (
463
497
QObject::connect (m_ui.fileTrackInstrumentMenu ,
464
498
SIGNAL (aboutToShow ()),
465
499
SLOT (updateTrackInstrumentMenu ()));
500
+ QObject::connect (m_ui.viewNoteTypeMenu ,
501
+ SIGNAL (aboutToShow ()),
502
+ SLOT (updateNoteTypeMenu ()));
503
+ QObject::connect (m_ui.viewValueTypeMenu ,
504
+ SIGNAL (aboutToShow ()),
505
+ SLOT (updateValueTypeMenu ()));
466
506
QObject::connect (m_ui.viewZoomMenu ,
467
507
SIGNAL (aboutToShow ()),
468
508
SLOT (updateZoomMenu ()));
@@ -627,7 +667,7 @@ qtractorMidiEditorForm::qtractorMidiEditorForm (
627
667
const qtractorMidiControl::ControlType ctype
628
668
= m_pEventTypeGroup->controlTypeFromIndex (pOptions->iMidiEventType );
629
669
m_pEventTypeGroup->setControlType (ctype);
630
- eventTypeChanged (ctype );
670
+ eventTypeChanged (pOptions-> iMidiEventType );
631
671
m_pEventTypeGroup->setControlParam (pOptions->iMidiEventParam );
632
672
viewTypeChanged (pOptions->iMidiViewType );
633
673
} else {
@@ -1466,6 +1506,36 @@ void qtractorMidiEditorForm::viewNoteDuration ( bool bOn )
1466
1506
}
1467
1507
1468
1508
1509
+ // Change view/note type setting via menu.
1510
+ void qtractorMidiEditorForm::viewNoteType (void )
1511
+ {
1512
+ // Retrieve view/note type index from from action data...
1513
+ QAction *pAction = qobject_cast<QAction *> (sender ());
1514
+ if (pAction) {
1515
+ const int iIndex = pAction->data ().toInt ();
1516
+ // Update the other toolbar control...
1517
+ m_pViewTypeComboBox->setCurrentIndex (iIndex);
1518
+ // Commit the change as usual...
1519
+ viewTypeChanged (iIndex);
1520
+ }
1521
+ }
1522
+
1523
+
1524
+ // Change event/value type setting via menu.
1525
+ void qtractorMidiEditorForm::viewValueType (void )
1526
+ {
1527
+ // Retrieve event/value type index from from action data...
1528
+ QAction *pAction = qobject_cast<QAction *> (sender ());
1529
+ if (pAction) {
1530
+ const int iIndex = pAction->data ().toInt ();
1531
+ // Update the other toolbar control...
1532
+ m_pEventTypeComboBox->setCurrentIndex (iIndex);
1533
+ // Commit the change as usual...
1534
+ eventTypeChanged (iIndex);
1535
+ }
1536
+ }
1537
+
1538
+
1469
1539
// Show/hide the events window view.
1470
1540
void qtractorMidiEditorForm::viewEvents ( bool bOn )
1471
1541
{
@@ -1841,11 +1911,35 @@ void qtractorMidiEditorForm::updatePlayHead ( unsigned long iPlayHead )
1841
1911
// -------------------------------------------------------------------------
1842
1912
// qtractorMidiEditorForm -- Selection widget slots.
1843
1913
1914
+ // Note type view menu stabilizer.
1915
+ void qtractorMidiEditorForm::updateNoteTypeMenu (void )
1916
+ {
1917
+ const int iCurrentIndex = m_pViewTypeComboBox->currentIndex ();
1918
+ QListIterator<QAction *> iter (m_ui.viewNoteTypeMenu ->actions ());
1919
+ while (iter.hasNext ()) {
1920
+ QAction *pAction = iter.next ();
1921
+ pAction->setChecked (pAction->data ().toInt () == iCurrentIndex);
1922
+ }
1923
+ }
1924
+
1925
+
1926
+ // Event type view menu stabilizer.
1927
+ void qtractorMidiEditorForm::updateValueTypeMenu (void )
1928
+ {
1929
+ const int iCurrentIndex = m_pEventTypeComboBox->currentIndex ();
1930
+ QListIterator<QAction *> iter (m_ui.viewValueTypeMenu ->actions ());
1931
+ while (iter.hasNext ()) {
1932
+ QAction *pAction = iter.next ();
1933
+ pAction->setChecked (pAction->data ().toInt () == iCurrentIndex);
1934
+ }
1935
+ }
1936
+
1937
+
1844
1938
// Zoom view menu stabilizer.
1845
1939
void qtractorMidiEditorForm::updateZoomMenu (void )
1846
1940
{
1847
1941
const int iZoomMode = m_pMidiEditor->zoomMode ();
1848
-
1942
+
1849
1943
m_ui.viewZoomHorizontalAction ->setChecked (
1850
1944
iZoomMode == qtractorMidiEditor::ZoomHorizontal);
1851
1945
m_ui.viewZoomVerticalAction ->setChecked (
@@ -1975,10 +2069,11 @@ void qtractorMidiEditorForm::viewTypeChanged ( int iIndex )
1975
2069
}
1976
2070
1977
2071
1978
- void qtractorMidiEditorForm::eventTypeChanged ( int etype )
2072
+ void qtractorMidiEditorForm::eventTypeChanged ( int iIndex )
1979
2073
{
1980
2074
const qtractorMidiEvent::EventType eventType
1981
- = qtractorMidiEvent::EventType (etype);
2075
+ = qtractorMidiEvent::EventType (
2076
+ m_pEventTypeComboBox->itemData (iIndex).toInt ());
1982
2077
1983
2078
m_pEventParamComboBox->setEnabled (
1984
2079
eventType == qtractorMidiEvent::CONTROLLER ||
@@ -1989,6 +2084,10 @@ void qtractorMidiEditorForm::eventTypeChanged ( int etype )
1989
2084
// updateInstrumentNames();
1990
2085
1991
2086
m_pMidiEditor->editEvent ()->setEventType (eventType);
2087
+ m_pMidiEditor->updateContents ();
2088
+ m_pMidiEventList->refresh ();
2089
+
2090
+ stabilizeForm ();
1992
2091
}
1993
2092
1994
2093
0 commit comments