98 auto pAudioEngine = pHydrogen->getAudioEngine();
100 bool bIsSelectedPatternPlaying =
false;
102 if ( pHydrogen->getMode() == Song::Mode::Song &&
103 pHydrogen->isPatternEditorLocked() ) {
106 bIsSelectedPatternPlaying =
true;
114 auto pList = pAudioEngine->getPlayingPatterns();
115 for (uint i = 0; i < pList->size(); i++) {
117 bIsSelectedPatternPlaying =
true;
122 pAudioEngine->unlock();
125 int nTick = pAudioEngine->getTransportPosition()->getPatternTickPosition();
127 if ( nTick !=
m_nTick || bForce ) {
134 update( updateRect );
135 if ( nDiff > 1 || nDiff < -1 ) {
138 updateRect.translate( -nDiff, 0 );
139 update( updateRect );
142 if ( ! bIsSelectedPatternPlaying ) {
147 if ( pPatternEditorPanel !=
nullptr ) {
149 pPatternEditorPanel->getPianoRollEditor()->updatePosition( nTick );
150 pPatternEditorPanel->getVelocityEditor()->updatePosition( nTick );
151 pPatternEditorPanel->getPanEditor()->updatePosition( nTick );
152 pPatternEditorPanel->getLeadLagEditor()->updatePosition( nTick );
153 pPatternEditorPanel->getNoteKeyEditor()->updatePosition( nTick );
154 pPatternEditorPanel->getProbabilityEditor()->updatePosition( nTick );
197 if ( ev->button() == Qt::LeftButton &&
200 auto pCoreActionController = pHydrogen->getCoreActionController();
203 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr ) {
204 pDrumPatternEditor = pHydrogenApp->getPatternEditorPanel()->getDrumPatternEditor();
206 pDrumPatternEditor =
nullptr;
212 bool bIsUsingTriplets;
213 if ( pDrumPatternEditor !=
nullptr ) {
214 fResolution =
static_cast<float>(pDrumPatternEditor->
getResolution());
218 bIsUsingTriplets =
false;
221 float fTripletFactor;
222 if ( bIsUsingTriplets ) {
230 ( fTripletFactor * fResolution ) );
232 if ( pHydrogen->getMode() != Song::Mode::Pattern ) {
233 pCoreActionController->activateSongMode(
false );
234 pHydrogen->setIsModified(
true );
237 pCoreActionController->locateToTick( nNewTick );
328 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr ) {
329 pDrumPatternEditor = pHydrogenApp->getPatternEditorPanel()->getDrumPatternEditor();
331 pDrumPatternEditor =
nullptr;
336 qreal pixelRatio = devicePixelRatio();
345 QColor backgroundColor( pPref->getColorTheme()->m_patternEditor_alternateRowColor.darker( 120 ) );
346 QColor textColor = pPref->getColorTheme()->m_patternEditor_textColor;
347 textColor.setAlpha( 220 );
349 QColor lineColor = pPref->getColorTheme()->m_patternEditor_lineColor;
353 painter.fillRect( QRect( 0, 0, width(), height() ), backgroundColor );
359 pPref->getColorTheme()->m_midLightColor );
364 QFont font( pPref->getApplicationFontFamily(),
getPointSize( pPref->getFontSize() ) );
365 painter.setFont(font);
372 bool bIsUsingTriplets;
373 if ( pDrumPatternEditor !=
nullptr ) {
378 bIsUsingTriplets =
false;
382 painter.setPen( textColor );
383 for (
int ii = 0; ii < 64 ; ii += 4 ) {
385 painter.drawLine( nText_x, height() - 13, nText_x, height() - 1 );
387 Qt::AlignVCenter | Qt::AlignLeft,
388 QString(
"%1").arg(ii / 4 + 1) );
393 if ( bIsUsingTriplets ) {
399 painter.drawLine( xx, height() - 6, xx, height() - 1 );
402 painter.setPen( QPen( lineColor, 2, Qt::SolidLine ) );
415 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr ) {
416 pDrumPatternEditor = pHydrogenApp->getPatternEditorPanel()->getDrumPatternEditor();
418 pDrumPatternEditor =
nullptr;
425 qreal pixelRatio = devicePixelRatio();
430 QPainter painter(
this);
433 pixelRatio * ev->rect().y(),
434 pixelRatio * ev->rect().width(),
435 pixelRatio * ev->rect().height() ) );
438 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr &&
439 ( pDrumPatternEditor->hasFocus() ||
440 pHydrogenApp->getPatternEditorPanel()->getVelocityEditor()->hasFocus() ||
441 pHydrogenApp->getPatternEditorPanel()->getPanEditor()->hasFocus() ||
442 pHydrogenApp->getPatternEditorPanel()->getLeadLagEditor()->hasFocus() ||
443 pHydrogenApp->getPatternEditorPanel()->getNoteKeyEditor()->hasFocus() ||
444 pHydrogenApp->getPatternEditorPanel()->getProbabilityEditor()->hasFocus() ||
445 pHydrogenApp->getPatternEditorPanel()->getPianoRollEditor()->hasFocus() ) &&
446 ! pHydrogenApp->hideKeyboardCursor() ) {
449 pHydrogenApp->getPatternEditorPanel()->getCursorPosition() +
454 painter.setPen( QPen( pPref->getColorTheme()->m_cursorColor, 2 ) );
455 painter.setRenderHint( QPainter::Antialiasing );
456 painter.drawLine( nCursorX +
m_fGridWidth * 5 + 4, height() - 6,
458 painter.drawLine( nCursorX, 3, nCursorX +
m_fGridWidth * 10 + 8, 3 );
459 painter.drawLine( nCursorX, 4, nCursorX, 5 );
462 painter.drawLine( nCursorX, height() - 5,
464 painter.drawLine( nCursorX, height() - 7,
465 nCursorX, height() - 6 );
466 painter.drawLine( nCursorX +
m_fGridWidth * 10 + 8, height() - 6,
473 bool bIsUsingTriplets;
474 if ( pDrumPatternEditor !=
nullptr ) {
475 fResolution =
static_cast<float>(pDrumPatternEditor->
getResolution());
479 bIsUsingTriplets =
false;
482 float fTripletFactor;
483 if ( bIsUsingTriplets ) {
497 painter.drawLine( x, 8, x, height() - 1 );
509 painter.drawLine( x, 8, x, height() - 1 );