99 auto pAudioEngine = pHydrogen->getAudioEngine();
101 bool bIsSelectedPatternPlaying =
false;
104 pHydrogen->isPatternEditorLocked() ) {
107 bIsSelectedPatternPlaying =
true;
115 auto pList = pAudioEngine->getPlayingPatterns();
116 for (uint i = 0; i < pList->size(); i++) {
118 bIsSelectedPatternPlaying =
true;
123 pAudioEngine->unlock();
126 int nTick = pAudioEngine->getTransportPosition()->getPatternTickPosition();
128 if ( nTick !=
m_nTick || bForce ) {
135 update( updateRect );
136 if ( nDiff > 1 || nDiff < -1 ) {
139 updateRect.translate( -nDiff, 0 );
140 update( updateRect );
143 if ( ! bIsSelectedPatternPlaying ) {
148 if ( pPatternEditorPanel !=
nullptr ) {
149 pPatternEditorPanel->getDrumPatternEditor()->updatePosition( nTick );
150 pPatternEditorPanel->getPianoRollEditor()->updatePosition( nTick );
151 pPatternEditorPanel->getVelocityEditor()->updatePosition( nTick );
152 pPatternEditorPanel->getPanEditor()->updatePosition( nTick );
153 pPatternEditorPanel->getLeadLagEditor()->updatePosition( nTick );
154 pPatternEditorPanel->getNoteKeyEditor()->updatePosition( nTick );
155 pPatternEditorPanel->getProbabilityEditor()->updatePosition( nTick );
200 if ( ev->button() == Qt::LeftButton &&
203 auto pCoreActionController = pHydrogen->getCoreActionController();
206 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr ) {
207 pDrumPatternEditor = pHydrogenApp->getPatternEditorPanel()->getDrumPatternEditor();
209 pDrumPatternEditor =
nullptr;
215 bool bIsUsingTriplets;
216 if ( pDrumPatternEditor !=
nullptr ) {
217 fResolution =
static_cast<float>(pDrumPatternEditor->
getResolution());
221 bIsUsingTriplets =
false;
224 float fTripletFactor;
225 if ( bIsUsingTriplets ) {
233 ( fTripletFactor * fResolution ) );
236 pCoreActionController->activateSongMode(
false );
237 pHydrogen->setIsModified(
true );
240 pCoreActionController->locateToTick( nNewTick );
333 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr ) {
334 pDrumPatternEditor = pHydrogenApp->getPatternEditorPanel()->getDrumPatternEditor();
336 pDrumPatternEditor =
nullptr;
341 qreal pixelRatio = devicePixelRatio();
350 QColor backgroundColor( pPref->getColorTheme()->m_patternEditor_alternateRowColor.darker( 120 ) );
351 QColor textColor = pPref->getColorTheme()->m_patternEditor_textColor;
352 textColor.setAlpha( 220 );
354 QColor lineColor = pPref->getColorTheme()->m_patternEditor_lineColor;
358 painter.fillRect( QRect( 0, 0, width(), height() ), backgroundColor );
364 pPref->getColorTheme()->m_midLightColor );
369 QFont font( pPref->getApplicationFontFamily(),
getPointSize( pPref->getFontSize() ) );
370 painter.setFont(font);
377 bool bIsUsingTriplets;
378 if ( pDrumPatternEditor !=
nullptr ) {
383 bIsUsingTriplets =
false;
387 painter.setPen( textColor );
388 for (
int ii = 0; ii < 64 ; ii += 4 ) {
390 painter.drawLine( nText_x, height() - 13, nText_x, height() - 1 );
392 Qt::AlignVCenter | Qt::AlignLeft,
393 QString(
"%1").arg(ii / 4 + 1) );
398 if ( bIsUsingTriplets ) {
404 painter.drawLine( xx, height() - 6, xx, height() - 1 );
407 painter.setPen( QPen( lineColor, 2, Qt::SolidLine ) );
420 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr ) {
421 pDrumPatternEditor = pHydrogenApp->getPatternEditorPanel()->getDrumPatternEditor();
423 pDrumPatternEditor =
nullptr;
430 qreal pixelRatio = devicePixelRatio();
435 QPainter painter(
this);
438 pixelRatio * ev->rect().y(),
439 pixelRatio * ev->rect().width(),
440 pixelRatio * ev->rect().height() ) );
443 if ( pHydrogenApp->getPatternEditorPanel() !=
nullptr &&
444 ( pDrumPatternEditor->hasFocus() ||
445 pHydrogenApp->getPatternEditorPanel()->getVelocityEditor()->hasFocus() ||
446 pHydrogenApp->getPatternEditorPanel()->getPanEditor()->hasFocus() ||
447 pHydrogenApp->getPatternEditorPanel()->getLeadLagEditor()->hasFocus() ||
448 pHydrogenApp->getPatternEditorPanel()->getNoteKeyEditor()->hasFocus() ||
449 pHydrogenApp->getPatternEditorPanel()->getProbabilityEditor()->hasFocus() ||
450 pHydrogenApp->getPatternEditorPanel()->getPianoRollEditor()->hasFocus() ) &&
451 ! pHydrogenApp->hideKeyboardCursor() ) {
454 pHydrogenApp->getPatternEditorPanel()->getCursorPosition() +
459 painter.setPen( QPen( pPref->getColorTheme()->m_cursorColor, 2 ) );
460 painter.setRenderHint( QPainter::Antialiasing );
461 painter.drawLine( nCursorX +
m_fGridWidth * 5 + 4, height() - 6,
463 painter.drawLine( nCursorX, 3, nCursorX +
m_fGridWidth * 10 + 8, 3 );
464 painter.drawLine( nCursorX, 4, nCursorX, 5 );
467 painter.drawLine( nCursorX, height() - 5,
469 painter.drawLine( nCursorX, height() - 7,
470 nCursorX, height() - 6 );
471 painter.drawLine( nCursorX +
m_fGridWidth * 10 + 8, height() - 6,
478 bool bIsUsingTriplets;
479 if ( pDrumPatternEditor !=
nullptr ) {
480 fResolution =
static_cast<float>(pDrumPatternEditor->
getResolution());
484 bIsUsingTriplets =
false;
487 float fTripletFactor;
488 if ( bIsUsingTriplets ) {
502 painter.drawLine( x, 8, x, height() - 1 );
514 painter.drawLine( x, 8, x, height() - 1 );