Skip to content

Commit db65d18

Browse files
author
rncbc
committed
- Added View/Note Type and Value Type command menus to the MIDI
clip editor (aka. piano-roll) which opens the possibility for discrete shortcuts to switching views eg. Note Velocity and Controller views (after a kind request by yubatake, thanks).
1 parent b7b37be commit db65d18

File tree

6 files changed

+128
-10
lines changed

6 files changed

+128
-10
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ ChangeLog
66

77
GIT HEAD
88

9+
- Added View/Note Type and Value Type command menus to the MIDI
10+
clip editor (aka. piano-roll) which opens the possibility for
11+
discrete shortcuts to switching views eg. Note Velocity and
12+
Controller views (after a kind request by yubatake, thanks).
13+
914
- Fixed the conversion and/or override of MIDI clip offsets when
1015
moving and copy/pasting across tempo/time-signature changes.
1116

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Process this file with autoconf to produce a configure script.
2-
AC_INIT(Qtractor, 0.7.2.4, rncbc@rncbc.org, qtractor)
2+
AC_INIT(Qtractor, 0.7.2.5, rncbc@rncbc.org, qtractor)
33

44
AC_CONFIG_SRCDIR(src/qtractor.cpp)
55
AC_CONFIG_HEADERS(src/config.h)

src/qtractorMidiControlTypeGroup.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,7 @@ void qtractorMidiControlTypeGroup::activateControlType ( int iControlType )
306306
{
307307
updateControlType(iControlType);
308308

309-
const qtractorMidiControl::ControlType ctype
310-
= qtractorMidiControl::ControlType(
311-
m_pControlTypeComboBox->itemData(iControlType).toInt());
312-
313-
emit controlTypeChanged(int(ctype));
309+
emit controlTypeChanged(iControlType);
314310

315311
activateControlParam(m_pControlParamComboBox->currentIndex());
316312
}

src/qtractorMidiEditorForm.cpp

Lines changed: 103 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,40 @@ qtractorMidiEditorForm::qtractorMidiEditorForm (
185185
m_pSnapToScaleKeyComboBox->setToolTip(tr("Scale key"));
186186
m_pSnapToScaleTypeComboBox->setToolTip(tr("Scale type"));
187187

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+
188222
// Add combo-boxes to toolbars...
189223
m_ui.viewToolbar->addSeparator();
190224
m_ui.viewToolbar->addWidget(m_pSnapPerBeatComboBox);
@@ -463,6 +497,12 @@ qtractorMidiEditorForm::qtractorMidiEditorForm (
463497
QObject::connect(m_ui.fileTrackInstrumentMenu,
464498
SIGNAL(aboutToShow()),
465499
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()));
466506
QObject::connect(m_ui.viewZoomMenu,
467507
SIGNAL(aboutToShow()),
468508
SLOT(updateZoomMenu()));
@@ -627,7 +667,7 @@ qtractorMidiEditorForm::qtractorMidiEditorForm (
627667
const qtractorMidiControl::ControlType ctype
628668
= m_pEventTypeGroup->controlTypeFromIndex(pOptions->iMidiEventType);
629669
m_pEventTypeGroup->setControlType(ctype);
630-
eventTypeChanged(ctype);
670+
eventTypeChanged(pOptions->iMidiEventType);
631671
m_pEventTypeGroup->setControlParam(pOptions->iMidiEventParam);
632672
viewTypeChanged(pOptions->iMidiViewType);
633673
} else {
@@ -1466,6 +1506,36 @@ void qtractorMidiEditorForm::viewNoteDuration ( bool bOn )
14661506
}
14671507

14681508

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+
14691539
// Show/hide the events window view.
14701540
void qtractorMidiEditorForm::viewEvents ( bool bOn )
14711541
{
@@ -1841,11 +1911,35 @@ void qtractorMidiEditorForm::updatePlayHead ( unsigned long iPlayHead )
18411911
//-------------------------------------------------------------------------
18421912
// qtractorMidiEditorForm -- Selection widget slots.
18431913

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+
18441938
// Zoom view menu stabilizer.
18451939
void qtractorMidiEditorForm::updateZoomMenu (void)
18461940
{
18471941
const int iZoomMode = m_pMidiEditor->zoomMode();
1848-
1942+
18491943
m_ui.viewZoomHorizontalAction->setChecked(
18501944
iZoomMode == qtractorMidiEditor::ZoomHorizontal);
18511945
m_ui.viewZoomVerticalAction->setChecked(
@@ -1975,10 +2069,11 @@ void qtractorMidiEditorForm::viewTypeChanged ( int iIndex )
19752069
}
19762070

19772071

1978-
void qtractorMidiEditorForm::eventTypeChanged ( int etype )
2072+
void qtractorMidiEditorForm::eventTypeChanged ( int iIndex )
19792073
{
19802074
const qtractorMidiEvent::EventType eventType
1981-
= qtractorMidiEvent::EventType(etype);
2075+
= qtractorMidiEvent::EventType(
2076+
m_pEventTypeComboBox->itemData(iIndex).toInt());
19822077

19832078
m_pEventParamComboBox->setEnabled(
19842079
eventType == qtractorMidiEvent::CONTROLLER ||
@@ -1989,6 +2084,10 @@ void qtractorMidiEditorForm::eventTypeChanged ( int etype )
19892084
// updateInstrumentNames();
19902085

19912086
m_pMidiEditor->editEvent()->setEventType(eventType);
2087+
m_pMidiEditor->updateContents();
2088+
m_pMidiEventList->refresh();
2089+
2090+
stabilizeForm();
19922091
}
19932092

19942093

src/qtractorMidiEditorForm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ protected slots:
147147
void viewToolbarThumb(bool bOn);
148148
void viewNoteDuration(bool bOn);
149149
void viewNoteColor(bool bOn);
150+
void viewNoteType();
150151
void viewValueColor(bool bOn);
152+
void viewValueType();
151153
void viewEvents(bool bOn);
152154
void viewPreview(bool bOn);
153155
void viewFollow(bool bOn);
@@ -169,6 +171,9 @@ protected slots:
169171
void helpAbout();
170172
void helpAboutQt();
171173

174+
void updateNoteTypeMenu();
175+
void updateValueTypeMenu();
176+
172177
void updateZoomMenu();
173178
void updateSnapMenu();
174179
void updateScaleMenu();

src/qtractorMidiEditorForm.ui

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@
100100
</property>
101101
<addaction name="viewEventsAction"/>
102102
</widget>
103+
<widget class="QMenu" name="viewNoteTypeMenu">
104+
<property name="title">
105+
<string>Not&amp;e Type</string>
106+
</property>
107+
</widget>
108+
<widget class="QMenu" name="viewValueTypeMenu">
109+
<property name="title">
110+
<string>Val&amp;ue Type</string>
111+
</property>
112+
</widget>
103113
<widget class="QMenu" name="viewZoomMenu">
104114
<property name="title">
105115
<string>&amp;Zoom</string>
@@ -135,7 +145,10 @@
135145
<addaction name="separator"/>
136146
<addaction name="viewNoteDurationAction"/>
137147
<addaction name="viewNoteColorAction"/>
148+
<addaction name="viewNoteTypeMenu"/>
149+
<addaction name="separator"/>
138150
<addaction name="viewValueColorAction"/>
151+
<addaction name="viewValueTypeMenu"/>
139152
<addaction name="separator"/>
140153
<addaction name="viewZoomMenu"/>
141154
<addaction name="viewSnapMenu"/>

0 commit comments

Comments
 (0)