79 setFocusPolicy( Qt::StrongFocus );
88 setMouseTracking(
true );
114 if ( ev->modifiers() == Qt::ControlModifier ||
115 ev->modifiers() == Qt::AltModifier ) {
120 if ( ev->angleDelta().y() < 0 ) {
121 fDelta = fDelta * -1.0;
124 int nColumn =
getColumn( pEv->position().x() );
129 bool bOldCursorHidden = pHydrogenApp->hideKeyboardCursor();
130 pHydrogenApp->setHideKeyboardCursor(
true );
133 if ( pSelectedInstrument ==
nullptr ) {
134 ERRORLOG(
"No instrument selected" );
139 std::list< Note *> notes;
142 notes.push_back( pNote );
146 notes.push_back( it->second );
150 bool bValueChanged =
false;
151 for (
Note *pNote : notes ) {
153 if ( pNote->get_instrument() != pSelectedInstrument && !
m_selection.isSelected( pNote ) ) {
156 bValueChanged =
true;
160 if ( bOldCursorHidden != pHydrogenApp->hideKeyboardCursor() ) {
163 if ( ! bValueChanged ) {
168 if ( bValueChanged ) {
179 if ( ev->button() == Qt::RightButton ) {
203 bool bOldCursorHidden = pHydrogenApp->hideKeyboardCursor();
204 pHydrogenApp->setHideKeyboardCursor(
true );
207 if ( bOldCursorHidden != pHydrogenApp->hideKeyboardCursor() ) {
214 if ( ! pHydrogenApp->hideKeyboardCursor() ) {
215 int nColumn =
getColumn( pEv->position().x(),
true );
257 if ( pSelectedInstrument ==
nullptr ) {
258 ERRORLOG(
"No instrument selected" );
266 fDelta = (float)-movingOffset.y() /
269 fDelta = (float)-movingOffset.y() / height();
274 bool bSendStatusMsg =
false;
280 bSendStatusMsg =
true;
283 bool bValueChanged =
false;
285 if ( pNote->get_instrument() == pSelectedInstrument ||
m_selection.isSelected( pNote ) ) {
293 bValueChanged =
true;
297 if ( bValueChanged ) {
320 Note *pNote = it.first, *pOldNote = it.second;
326 pNote->
setPan( pOldNote->getPan() );
332 pNote->
set_key_octave( pOldNote->get_key(), pOldNote->get_octave() );
360 if ( ev->buttons() == Qt::NoButton ) {
361 int nColumn =
getColumn( pEv->position().x() );
368 setCursor( Qt::PointingHandCursor );
383 setCursor( Qt::CrossCursor );
401 if ( pSelectedInstrument ==
nullptr ) {
402 ERRORLOG(
"No instrument selected" );
410 if ( pNote->get_instrument() == pSelectedInstrument ||
m_selection.isSelected( pNote ) ) {
420 Note *pNote = it->second;
441 int nColumn =
getColumn( pEv->position().x() );
448 bool bOldCursorHidden = pHydrogenApp->hideKeyboardCursor();
449 pHydrogenApp->setHideKeyboardCursor(
true );
457 float val = height() - pEv->position().y();
458 if (val > height()) {
461 else if (val < 0.0) {
464 val = val / height();
465 auto pSelectedInstrument = pHydrogen->getSelectedInstrument();
466 if ( pSelectedInstrument ==
nullptr ) {
467 ERRORLOG(
"No instrument selected" );
471 bool bValueSet =
false;
474 Note *pNote = it->second;
486 if ( (ev->button() == Qt::MiddleButton)
487 || (ev->modifiers() == Qt::ControlModifier && ev->button() == Qt::LeftButton) ) {
496 if ( (ev->button() == Qt::MiddleButton) ||
497 (ev->modifiers() == Qt::ControlModifier &&
498 ev->button() == Qt::LeftButton) ) {
510 if ( ev->button() != Qt::MiddleButton &&
511 ! ( ev->modifiers() == Qt::ControlModifier &&
512 ev->button() == Qt::LeftButton ) ) {
515 if ( pEv->position().y() > 0 &&
517 nOctave = std::round(
520 pEv->position().y() -
527 nKey = ( height() - pEv->position().y() -
533 if ( nKey != 666 || nOctave != 666 ) {
554 if ( bOldCursorHidden != pHydrogenApp->hideKeyboardCursor() ) {
582 bool bValueSet =
false;
611 float fProbability = qBound( 0.0f, pOldNote->
get_probability() + fDelta, 1.0f );
652 bool bOldCursorHidden = pHydrogenApp->hideKeyboardCursor();
654 const int nWordSize = 5;
655 bool bIsSelectionKey =
m_selection.keyPressEvent( ev );
656 bool bUnhideCursor =
true;
658 bool bValueChanged =
false;
660 if ( bIsSelectionKey ) {
662 }
else if ( ev->matches( QKeySequence::MoveToNextChar ) || ev->matches( QKeySequence::SelectNextChar ) ) {
666 }
else if ( ev->matches( QKeySequence::MoveToNextWord ) || ev->matches( QKeySequence::SelectNextWord ) ) {
670 }
else if ( ev->matches( QKeySequence::MoveToEndOfLine ) || ev->matches( QKeySequence::SelectEndOfLine ) ) {
674 }
else if ( ev->matches( QKeySequence::MoveToPreviousChar ) || ev->matches( QKeySequence::SelectPreviousChar ) ) {
678 }
else if ( ev->matches( QKeySequence::MoveToPreviousWord ) || ev->matches( QKeySequence::SelectPreviousWord ) ) {
682 }
else if ( ev->matches( QKeySequence::MoveToStartOfLine ) || ev->matches( QKeySequence::SelectStartOfLine ) ) {
686 }
else if ( ev->key() == Qt::Key_Delete ) {
688 bUnhideCursor =
false;
697 pHydrogen->getSelectedInstrumentNumber(),
705 bool bRepeatLastValue =
false;
707 if ( ev->matches( QKeySequence::MoveToPreviousLine ) ) {
711 }
else if ( ev->key() == Qt::Key_Up && ev->modifiers() & Qt::AltModifier ) {
715 }
else if ( ev->matches( QKeySequence::MoveToNextLine ) ) {
719 }
else if ( ev->key() == Qt::Key_Down && ev->modifiers() & Qt::AltModifier ) {
723 }
else if ( ev->matches( QKeySequence::MoveToStartOfDocument ) ) {
727 }
else if ( ev->matches( QKeySequence::MoveToEndOfDocument ) ) {
731 }
else if ( ev->key() == Qt::Key_Enter || ev->key() == Qt::Key_Return ) {
734 bRepeatLastValue =
true;
737 }
else if ( ev->matches( QKeySequence::SelectAll ) ) {
739 bUnhideCursor =
false;
742 }
else if ( ev->matches( QKeySequence::Deselect ) ) {
744 bUnhideCursor =
false;
749 if ( fDelta != 0.0 || bRepeatLastValue ) {
752 auto pSelectedInstrument = pHydrogen->getSelectedInstrument();
753 if ( pSelectedInstrument ==
nullptr ) {
754 ERRORLOG(
"No instrument selected" );
761 std::list< Note *> notes;
765 notes.push_back( pNote );
769 Note *pNote = it->second;
774 notes.push_back( pNote );
781 if ( fDelta > 0.0 ) {
783 }
else if ( fDelta < 0.0 ) {
790 for (
Note *pNote : notes ) {
791 bValueChanged =
true;
793 if ( !bRepeatLastValue ) {
800 bool bValueSet =
false;
805 if ( !pNote->get_note_off() ) {
811 if ( !pNote->get_note_off() ) {
813 printf(
"reached m_fLastSetValue > 1 in NotePropertiesRuler.cpp\n" );
824 if ( !pNote->get_note_off() ) {
846 pHydrogenApp->setHideKeyboardCursor(
true );
850 if ( bOldCursorHidden != pHydrogenApp->hideKeyboardCursor() ) {
858 if ( bUnhideCursor ) {
859 pHydrogenApp->setHideKeyboardCursor(
false );
864 bOldCursorHidden != pHydrogenApp->hideKeyboardCursor() ) {
871 if ( bValueChanged ) {
893 pUndoStack->beginMacro( QString( tr(
"Edit [%1] property of [%2] notes" ) )
898 Note *pNewNote = it.first, *pOldNote = it.second;
904 pOldNote->get_velocity(),
908 pOldNote->get_lead_lag(),
910 pOldNote->get_probability(),
914 pOldNote->get_octave() ) );
917 pUndoStack->endMacro();
931 qreal pixelRatio = devicePixelRatio();
937 QPainter painter(
this);
939 QRectF( pixelRatio * ev->rect().x(),
940 pixelRatio * ev->rect().y(),
941 pixelRatio * ev->rect().width(),
942 pixelRatio * ev->rect().height() ) );
952 painter.drawLine( nX, 0, nX, height() );
963 QPen pen( pPref->getColorTheme()->m_cursorColor );
965 painter.setPen( pen );
966 painter.setBrush( Qt::NoBrush );
967 painter.setRenderHint( QPainter::Antialiasing );
980 QColor color = pPref->getColorTheme()->m_highlightColor;
985 if ( ! hasFocus() ) {
986 color.setAlpha( 125 );
989 const QScrollArea* pScrollArea;
1010 int nStartY = pScrollArea->verticalScrollBar()->value();
1011 int nStartX = pScrollArea->horizontalScrollBar()->value();
1012 int nEndY = nStartY + pScrollArea->viewport()->size().height();
1014 int nEndX = std::min( nStartX + pScrollArea->viewport()->size().width(),
1027 painter.setPen( pen );
1028 painter.drawLine( QPoint( nStartX, nStartY ), QPoint( nEndX, nStartY ) );
1029 painter.drawLine( QPoint( nStartX, nStartY ), QPoint( nStartX, nEndY ) );
1030 painter.drawLine( QPoint( nEndX, nEndY ), QPoint( nStartX, nEndY ) );
1038 painter.setPen( pen );
1040 painter.drawLine( QPoint( nEndX +
nMargin, nStartY ), QPoint( nEndX +
nMargin, nEndY ) );
1049#ifdef H2CORE_HAVE_QT6
1069 const QColor borderColor( pPref->getColorTheme()->m_patternEditor_lineColor );
1070 const QColor lineColor( pPref->getColorTheme()->m_patternEditor_line5Color );
1071 const QColor lineInactiveColor( pPref->getColorTheme()->m_windowTextColor.darker( 170 ) );
1072 const QColor backgroundColor( pPref->getColorTheme()->m_patternEditor_backgroundColor );
1073 const QColor backgroundInactiveColor( pPref->getColorTheme()->m_windowColor );
1075 if ( nHeight == 0 ) {
1078 if ( nIncrement == 0 ) {
1079 nIncrement = nHeight / 10;
1082 painter.fillRect( 0, 0,
m_nActiveWidth, height(), backgroundColor );
1084 height(), backgroundInactiveColor );
1088 painter.setPen( lineColor );
1089 for (
unsigned y = 0; y < nHeight; y += nIncrement ) {
1093 painter.setPen( borderColor );
1098 painter.setPen( lineInactiveColor );
1099 for (
unsigned y = 0; y < nHeight; y += nIncrement ) {
1114 QColor borderColor( pPref->getColorTheme()->m_patternEditor_lineColor );
1115 const QColor lineInactiveColor( pPref->getColorTheme()->m_windowTextColor.darker( 170 ) );
1116 QPainter p( pixmap );
1122 auto pSelectedInstrument = pHydrogen->getSelectedInstrument();
1123 if ( pSelectedInstrument ==
nullptr ) {
1124 ERRORLOG(
"No instrument selected" );
1129 selectedPen.setWidth( 2 );
1133 Note *pposNote = it->second;
1138 Note *pNote = coit->second;
1145 uint line_end = height();
1155 uint line_start = line_end - value;
1159 p.fillRect( x_pos - 1 + xoffset, line_start,
1160 nLineWidth, line_end - line_start,
1162 p.setPen( QPen( Qt::black, 1 ) );
1163 p.setRenderHint( QPainter::Antialiasing );
1164 p.drawRoundedRect( x_pos - 1 - 1 + xoffset, line_start - 1,
1165 nLineWidth + 2, line_end - line_start + 2, 2, 2 );
1168 p.setPen( selectedPen );
1169 p.setRenderHint( QPainter::Antialiasing );
1170 p.drawRoundedRect( x_pos - 1 -2 + xoffset, line_start - 2,
1171 nLineWidth + 4, line_end - line_start + 4 ,
1179 p.setPen( borderColor );
1180 p.setRenderHint( QPainter::Antialiasing );
1182 p.setPen( QPen( borderColor, 2 ) );
1186 p.setPen( lineInactiveColor );
1188 p.setPen( QPen( lineInactiveColor, 2 ) );
1199 QColor baseLineColor( pPref->getColorTheme()->m_patternEditor_lineColor );
1200 QColor borderColor( pPref->getColorTheme()->m_patternEditor_lineColor );
1201 const QColor lineInactiveColor( pPref->getColorTheme()->m_windowTextColor.darker( 170 ) );
1203 QPainter p( pixmap );
1208 p.setPen( baseLineColor );
1211 p.setPen( lineInactiveColor );
1217 auto pSelectedInstrument = pHydrogen->getSelectedInstrument();
1218 if ( pSelectedInstrument ==
nullptr ) {
1219 ERRORLOG(
"No instrument selected" );
1224 selectedPen.setWidth( 2 );
1228 Note *pposNote = it->second;
1233 Note *pNote = coit->second;
1236 != pSelectedInstrument
1243 p.setPen( Qt::NoPen );
1247 fValue = pNote->
getPan();
1256 fValue = std::round( fValue );
1260 p.setPen( QPen( Qt::black, 1 ) );
1261 p.setRenderHint( QPainter::Antialiasing );
1262 if ( fValue == 0.f ) {
1264 int y_pos = (int)( height() * 0.5 );
1265 p.setBrush(QColor( noteColor ));
1266 p.drawEllipse( x_pos-4 + xoffset, y_pos-4, 8, 8);
1267 p.setBrush( Qt::NoBrush );
1270 p.setPen( selectedPen );
1271 p.setRenderHint( QPainter::Antialiasing );
1272 p.drawEllipse( x_pos - 6 + xoffset, y_pos - 6,
1278 int nHeight = 0.5 * height() * std::abs( fValue ) + 5;
1279 int nStartY = height() * 0.5 - 2;
1280 if ( fValue >= 0 ) {
1281 nStartY = nStartY - nHeight + 5;
1284 p.fillRect( x_pos - 1 + xoffset, nStartY,
1285 nLineWidth, nHeight, QColor( noteColor ) );
1286 p.drawRoundedRect( x_pos - 1 + xoffset - 1, nStartY - 1,
1287 nLineWidth + 2, nHeight + 2, 2, 2 );
1290 p.setPen( selectedPen );
1291 p.drawRoundedRect( x_pos - 1 - 2 + xoffset, nStartY - 2,
1292 nLineWidth + 4, nHeight + 4,
1302 p.setPen( borderColor );
1303 p.setRenderHint( QPainter::Antialiasing );
1305 p.setPen( QPen( borderColor, 2 ) );
1309 p.setPen( lineInactiveColor );
1311 p.setPen( QPen( lineInactiveColor, 2 ) );
1320 QColor backgroundColor = pPref->getColorTheme()->m_patternEditor_backgroundColor;
1321 const QColor backgroundInactiveColor( pPref->getColorTheme()->m_windowColor );
1322 QColor alternateRowColor = pPref->getColorTheme()->m_patternEditor_alternateRowColor;
1323 QColor octaveColor = pPref->getColorTheme()->m_patternEditor_octaveRowColor;
1324 QColor lineColor( pPref->getColorTheme()->m_patternEditor_lineColor );
1325 const QColor lineInactiveColor( pPref->getColorTheme()->m_windowTextColor.darker( 170 ) );
1326 QColor textColor( pPref->getColorTheme()->m_patternEditor_textColor );
1328 QPainter p( pixmap );
1341 if ( nRow == 1 || nRow == 3 || nRow == 5 || nRow == 8 || nRow == 10 ) {
1343 p.setPen( QPen( alternateRowColor,
1345 Qt::SolidLine, Qt::FlatCap ) );
1348 p.setPen( QPen( octaveColor,
1350 Qt::SolidLine, Qt::FlatCap ) );
1359 static QString noteNames[] = { tr(
"B" ), tr(
"A#" ), tr(
"A" ), tr(
"G#" ), tr(
"G" ), tr(
"F#" ),
1360 tr(
"F" ), tr(
"E" ), tr(
"D#" ), tr(
"D" ), tr(
"C#" ), tr(
"C" ) };
1362 QFont font( pPref->getApplicationFontFamily(),
getPointSize( pPref->getFontSize() ) );
1365 p.setPen( textColor );
1373 p.setPen( QPen( lineColor, 1, Qt::SolidLine));
1384 p.setPen( lineInactiveColor );
1397 if ( pSelectedInstrument ==
nullptr ) {
1398 DEBUGLOG(
"No instrument selected" );
1402 selectedPen.setWidth( 2 );
1406 Note *pNote = it->second;
1414 const int nRadiusOctave = 3;
1417 const int nOctaveY = ( 4 - pNote->
get_octave() ) *
1419 p.setPen( QPen( Qt::black, 1 ) );
1422 p.drawEllipse( QPoint( nX, nOctaveY ), nRadiusOctave,
1426 const int nRadiusKey = 5;
1433 p.drawEllipse( QPoint( nX, nKeyY ), nRadiusKey, nRadiusKey);
1437 p.setPen( selectedPen );
1438 p.setBrush( Qt::NoBrush );
1439 p.setRenderHint( QPainter::Antialiasing );
1441 p.drawEllipse( QPoint( nX, nOctaveY ), nRadiusOctave + 1,
1442 nRadiusOctave + 1 );
1445 p.drawEllipse( QPoint( nX, nKeyY ), nRadiusKey + 1,
1452 p.setPen( lineColor );
1453 p.setRenderHint( QPainter::Antialiasing );
1455 p.setPen( QPen( lineColor, 2 ) );
1459 p.setPen( lineInactiveColor );
1461 p.setPen( QPen( lineInactiveColor, 2 ) );
1473 if ( (nSelectedPatternNumber != -1) && ( (uint)nSelectedPatternNumber < pPatternList->size() ) ) {
1490 qreal pixelRatio = devicePixelRatio();
1531 std::vector<SelectionIndex> result;
1533 return std::move( result );
1539 auto pSelectedInstrument = pHydrogen->getSelectedInstrument();
1540 if ( pSelectedInstrument ==
nullptr ) {
1541 ERRORLOG(
"No instrument selected" );
1542 return std::move( result );
1549 if ( r.top() == r.bottom() && r.left() == r.right() ) {
1550 r += QMargins( 2, 2, 2, 2 );
1552 r += QMargins( 4, 4, 4, 4 );
1555 if ( it->second->get_instrument() != pSelectedInstrument
1560 int pos = it->first;
1562 if ( r.intersects( QRect( x_pos, 0, 1, height() ) ) ) {
1563 result.push_back( it->second );
1571 return std::move(result);
#define FOREACH_NOTE_CST_IT_BOUND_LENGTH(_notes, _it, _bound, _pattern)
Iterate over all notes in column _bound in an immutable way if it is contained in _pattern.
#define FOREACH_NOTE_CST_IT_BEGIN_LENGTH(_notes, _it, _pattern)
Iterate over all accessible notes between position 0 and length of _pattern in an immutable way.
std::shared_ptr< Song > getSong() const
Get the current song.
int getSelectedPatternNumber() const
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
std::shared_ptr< Instrument > getSelectedInstrument() const
void setIsModified(bool bIsModified)
Wrapper around Song::setIsModified() that checks whether a song is set.
A note plays an associated instrument with a velocity left and right pan.
int get_position() const
__position accessor
float getPanWithRangeFrom0To1() const
get pan of the note, scaling and translating the range from [-1;1] to [0;1]
void set_lead_lag(float value)
__lead_lag setter
void set_key_octave(const QString &str)
parse str and set __key and __octave
Octave get_octave()
__octave accessor
void set_probability(float value)
std::shared_ptr< Instrument > get_instrument()
__instrument accessor
float get_lead_lag() const
__lead_lag accessor
float get_notekey_pitch() const
note key pitch accessor
float get_velocity() const
__velocity accessor
void setPanWithRangeFrom0To1(float fVal)
set pan of the note, assuming the input range in [0;1]
bool get_note_off() const
__note_off accessor
void setPan(float val)
set pan of the note.
void set_velocity(float value)
__velocity setter
Key get_key()
__key accessor
float get_probability() const
float getPan() const
get pan of the note.
PatternList is a collection of patterns.
Pattern * get(int idx)
get a pattern from the list
std::multimap< int, Note * > notes_t
< multimap note type
static Preferences * get_instance()
Returns a pointer to the current Preferences singleton stored in __instance.
Changes
Bitwise or-able options showing which part of the Preferences were altered using the PreferencesDialo...
@ Font
Either the font size or font family have changed.
@ Colors
At least one of the colors has changed.
void addEventListener(EventListener *pListener)
static HydrogenApp * get_instance()
Returns the instance of HydrogenApp class.
QUndoStack * m_pUndoStack
PatternEditorPanel * getPatternEditorPanel()
void preferencesChanged(H2Core::Preferences::Changes changes)
Propagates a change in the Preferences through the GUI.
Compatibility class to support QMouseEvent more esily in Qt5 and Qt6.
virtual void mouseDragUpdateEvent(QMouseEvent *ev) override
std::map< H2Core::Note *, H2Core::Note * > m_oldNotes
Map of notes currently in the pattern -> old notes with their properties.
virtual void mouseMoveEvent(QMouseEvent *ev) override
int m_nSelectedPatternNumber
virtual void updateEditor(bool bPatternOnly=false) override
virtual void mousePressEvent(QMouseEvent *ev) override
Raw Qt mouse events are passed to the Selection.
virtual void selectionMoveEndEvent(QInputEvent *ev) override
virtual QRect getKeyboardCursorRect() override
The screen area occupied by the keyboard cursor.
static constexpr int nNoteKeyOctaveHeight
Height of the whole octave section.
void prepareUndoAction(int x)
Preserve current note properties at position x (or in selection, if any) for use in later UndoAction.
int m_nDragPreviousColumn
static constexpr int nNoteKeyLineHeight
Height of a single line in the key section.
void adjustNotePropertyDelta(H2Core::Note *pNote, float fDelta, bool bMessage=false)
Adjust a note's property by applying a delta to the current value, and clipping to the appropriate ra...
virtual void selectionMoveUpdateEvent(QMouseEvent *ev) override
static constexpr int nDefaultHeight
Height of all editors except the NoteKey one.
virtual void deleteSelection() override
virtual void selectAll() override
void onPreferencesChanged(H2Core::Preferences::Changes changes)
virtual void songModeActivationEvent() override
void leaveEvent(QEvent *ev) override
void wheelEvent(QWheelEvent *ev) override
Scroll wheel gestures will adjust the property of notes under the mouse cursor (or selected notes,...
void createNoteKeyBackground(QPixmap *pixmap)
void keyPressEvent(QKeyEvent *ev) override
void createNormalizedBackground(QPixmap *pixmap)
virtual void mouseDragStartEvent(QMouseEvent *ev) override
void propertyDragUpdate(QMouseEvent *ev)
Update notes for a property adjust drag, in response to the mouse moving.
void createBackground() override
Updates m_pBackgroundPixmap to show the latest content.
virtual void selectedInstrumentChangedEvent() override
static int nNoteKeyHeight
The height of the overall NoteKey Editor.
void drawDefaultBackground(QPainter &painter, int nHeight=0, int nIncrement=0)
virtual void mouseDragEndEvent(QMouseEvent *ev) override
virtual void mouseClickEvent(QMouseEvent *ev) override
void paintEvent(QPaintEvent *ev) override
void createCenteredBackground(QPixmap *pixmap)
virtual void selectionMoveCancelEvent() override
Move of selection is cancelled. Revert notes to preserved state.
static constexpr int nNoteKeySpaceHeight
Height of the non-interactive space in NoteKey editor between octave and key section.
virtual void selectedPatternChangedEvent() override
void drawFocus(QPainter &painter)
void propertyDragStart(QMouseEvent *ev)
virtual void enterEvent(QEvent *ev) override
virtual std::vector< SelectionIndex > elementsIntersecting(QRect r) override
Find list of elements which intersect a rectangular area.
const QScrollArea * getNotePanScrollArea() const
const QScrollArea * getNoteLeadLagScrollArea() const
const QScrollArea * getNoteNoteKeyScrollArea() const
const QScrollArea * getNoteVelocityScrollArea() const
const QScrollArea * getNoteProbabilityScrollArea() const
static QString modeToQString(Mode mode)
virtual void selectInstrumentNotes(int nInstrument)
virtual void mouseMoveEvent(QMouseEvent *ev) override
static QColor computeNoteColor(float velocity)
Calculate colour to use for note representation based on note velocity.
virtual void mousePressEvent(QMouseEvent *ev) override
Raw Qt mouse events are passed to the Selection.
virtual void selectNone()
QColor selectedNoteColor() const
Colour to use for outlining selected notes.
static void triggerStatusMessage(H2Core::Note *pNote, Mode mode)
static constexpr int nMargin
PatternEditorPanel * m_pPatternEditorPanel
QPixmap * m_pBackgroundPixmap
PatternEditor(QWidget *pParent, PatternEditorPanel *panel)
int getColumn(int x, bool bUseFineGrained=false) const
H2Core::Pattern * m_pPattern
void invalidateBackground()
void updateWidth()
Adjusts m_nActiveWidth and m_nEditorWidth to the current state of the editor.
Selection< SelectionIndex > m_selection
The Selection object.
bool m_bBackgroundInvalid
void drawGridLines(QPainter &p, Qt::PenStyle style=Qt::SolidLine) const
Draw lines for note grid.
static void setPlayheadPen(QPainter *p, bool bHovered=false)
static int getPlayheadShaftOffset()
Compatibility class to support QWheelEvent more esily in Qt5 and Qt6.
#define MAX_INSTRUMENTS
Maximum number of instruments allowed in Hydrogen.
#define MAX_NOTES
Maximum number of notes.