@@ -101,7 +101,7 @@ void SequencerScreen::open()
101101 {
102102 findBackground ()->setBackgroundName (" sequencer-2nd" );
103103 }
104- else if (punchScreen-> on && !sequencer.lock ()->isRecordingOrOverdubbing ())
104+ else if (sequencer. lock ()-> isPunchEnabled () && !sequencer.lock ()->isRecordingOrOverdubbing ())
105105 {
106106 findBackground ()->setBackgroundName (" sequencer-punch-active" );
107107 }
@@ -123,7 +123,7 @@ void SequencerScreen::open()
123123
124124 findChild (" footer-label" )->Hide (footerIsInvisible);
125125
126- findChild (" function-keys" )->Hide (!footerIsInvisible || punchScreen-> on || (mpc.getHardware ()->getButton (hardware::ComponentId::ERASE)->isPressed () && sequencerIsRecordingOrOverdubbing));
126+ findChild (" function-keys" )->Hide (!footerIsInvisible || sequencer. lock ()-> isPunchEnabled () || (mpc.getHardware ()->getButton (hardware::ComponentId::ERASE)->isPressed () && sequencerIsRecordingOrOverdubbing));
127127}
128128
129129void SequencerScreen::erase ()
@@ -164,8 +164,7 @@ void SequencerScreen::close()
164164
165165 if (find (begin (screensThatDisablePunch), end (screensThatDisablePunch), nextScreen) != end (screensThatDisablePunch))
166166 {
167- auto punchScreen = mpc.screens ->get <PunchScreen>();
168- punchScreen->on = false ;
167+ sequencer.lock ()->setPunchEnabled (false );
169168 }
170169
171170 sequencer.lock ()->resetUndo ();
@@ -542,13 +541,11 @@ void SequencerScreen::pressEnter()
542541void SequencerScreen::function (int i)
543542{
544543 ScreenComponent::function (i);
545- auto punchScreen = mpc.screens ->get <PunchScreen>();
546-
547- if (punchScreen->on )
544+ if (sequencer.lock ()->isPunchEnabled ())
548545 {
549546 if (!sequencer.lock ()->isRecordingOrOverdubbing () && i == 5 )
550547 {
551- punchScreen-> on = false ;
548+ sequencer. lock ()-> setPunchEnabled ( false ) ;
552549 findBackground ()->setBackgroundName (" sequencer" );
553550 findChild (" function-keys" )->Hide (false );
554551 }
@@ -700,11 +697,9 @@ void SequencerScreen::turnWheel(int i)
700697 }
701698 else if (focusedFieldName == " sq" )
702699 {
703- auto punchScreen = mpc.screens ->get <PunchScreen>();
704-
705700 if (sequencer.lock ()->isPlaying ())
706701 {
707- if (!punchScreen-> on )
702+ if (!sequencer. lock ()-> isPunchEnabled () )
708703 {
709704 const auto seqIndex = sequencer.lock ()->getCurrentlyPlayingSequenceIndex ();
710705
@@ -716,9 +711,9 @@ void SequencerScreen::turnWheel(int i)
716711 }
717712 else
718713 {
719- if (punchScreen-> on )
714+ if (sequencer. lock ()-> isPunchEnabled () )
720715 {
721- punchScreen-> on = false ;
716+ sequencer. lock ()-> setPunchEnabled ( false ) ;
722717 findBackground ()->setBackgroundName (" sequencer" );
723718 findChild (" function-keys" )->Hide (false );
724719 }
@@ -925,31 +920,31 @@ void SequencerScreen::displayPunchWhileRecording()
925920 auto isRecPressedOrLocked = hardware->getButton (hardware::ComponentId::REC)->isPressed () || mpc.clientEventController ->clientHardwareEventController ->buttonLockTracker .isLocked (hardware::ComponentId::REC);
926921 auto isOverdubPressedOrLocked = hardware->getButton (hardware::ComponentId::OVERDUB)->isPressed () || mpc.clientEventController ->clientHardwareEventController ->buttonLockTracker .isLocked (hardware::ComponentId::OVERDUB);
927922
928- if (punchScreen-> on && (isRecPressedOrLocked || isOverdubPressedOrLocked))
923+ if (sequencer. lock ()-> isPunchEnabled () && (isRecPressedOrLocked || isOverdubPressedOrLocked))
929924 {
930925 findBackground ()->setBackgroundName (" sequencer" );
931926
932927 for (int i = 0 ; i < 3 ; i++)
933928 {
934929 auto punchRect = findChild<PunchRect>(" punch-rect-" + std::to_string (i));
935- punchRect->Hide ((i == 0 && punchScreen-> autoPunch == 1 ) || (i == 2 && punchScreen-> autoPunch == 0 ));
936- punchRect->setOn ((i == 0 && punchScreen-> autoPunch != 1 ) || (i == 1 && punchScreen-> autoPunch == 1 ));
930+ punchRect->Hide ((i == 0 && sequencer. lock ()-> getAutoPunchMode () == 1 ) || (i == 2 && sequencer. lock ()-> getAutoPunchMode () == 0 ));
931+ punchRect->setOn ((i == 0 && sequencer. lock ()-> getAutoPunchMode () != 1 ) || (i == 1 && sequencer. lock ()-> getAutoPunchMode () == 1 ));
937932 }
938933
939934 auto time0 = findLabel (" punch-time-0" );
940935 auto time1 = findLabel (" punch-time-1" );
941936
942- time0->Hide (punchScreen-> autoPunch == 1 );
943- time1->Hide (punchScreen-> autoPunch == 0 );
937+ time0->Hide (sequencer. lock ()-> getAutoPunchMode () == 1 );
938+ time1->Hide (sequencer. lock ()-> getAutoPunchMode () == 0 );
944939
945940 auto seq = sequence.lock ();
946941
947- auto text1 = StrUtil::padLeft (std::to_string (SeqUtil::getBar (seq.get (), punchScreen-> time0 ) + 1 ), " 0" , 3 );
948- auto text2 = StrUtil::padLeft (std::to_string (SeqUtil::getBeat (seq.get (), punchScreen-> time0 ) + 1 ), " 0" , 2 );
949- auto text3 = StrUtil::padLeft (std::to_string (SeqUtil::getClock (seq.get (), punchScreen-> time0 )), " 0" , 2 );
950- auto text4 = StrUtil::padLeft (std::to_string (SeqUtil::getBar (seq.get (), punchScreen-> time1 ) + 1 ), " 0" , 3 );
951- auto text5 = StrUtil::padLeft (std::to_string (SeqUtil::getBeat (seq.get (), punchScreen-> time1 ) + 1 ), " 0" , 2 );
952- auto text6 = StrUtil::padLeft (std::to_string (SeqUtil::getClock (seq.get (), punchScreen-> time1 )), " 0" , 2 );
942+ auto text1 = StrUtil::padLeft (std::to_string (SeqUtil::getBar (seq.get (), sequencer. lock ()-> getPunchInTime () ) + 1 ), " 0" , 3 );
943+ auto text2 = StrUtil::padLeft (std::to_string (SeqUtil::getBeat (seq.get (), sequencer. lock ()-> getPunchInTime () ) + 1 ), " 0" , 2 );
944+ auto text3 = StrUtil::padLeft (std::to_string (SeqUtil::getClock (seq.get (), sequencer. lock ()-> getPunchInTime () )), " 0" , 2 );
945+ auto text4 = StrUtil::padLeft (std::to_string (SeqUtil::getBar (seq.get (), sequencer. lock ()-> getPunchOutTime () ) + 1 ), " 0" , 3 );
946+ auto text5 = StrUtil::padLeft (std::to_string (SeqUtil::getBeat (seq.get (), sequencer. lock ()-> getPunchOutTime () ) + 1 ), " 0" , 2 );
947+ auto text6 = StrUtil::padLeft (std::to_string (SeqUtil::getClock (seq.get (), sequencer. lock ()-> getPunchOutTime () )), " 0" , 2 );
953948
954949 time0->setText (" IN:" + text1 + " ." + text2 + " ." + text3);
955950 time1->setText (" OUT:" + text4 + " ." + text5 + " ." + text6);
@@ -988,9 +983,7 @@ void SequencerScreen::stop()
988983{
989984 ScreenComponent::stop ();
990985
991- auto punchScreen = mpc.screens ->get <PunchScreen>();
992-
993- if (punchScreen->on )
986+ if (sequencer.lock ()->isPunchEnabled ())
994987 {
995988 findBackground ()->setBackgroundName (" sequencer-punch-active" );
996989
0 commit comments