mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-06 14:52:34 +02:00
P & R recording: change color of pin button, as for play indicator
This commit is contained in:
parent
0d9972b3e0
commit
3f1d9ab8c1
@ -5583,7 +5583,8 @@ double AudioIO::RecordingSchedule::ToDiscard() const
|
||||
bool AudioIO::IsCapturing() const
|
||||
{
|
||||
// Includes a test of mTime, used in the main thread
|
||||
return GetNumCaptureChannels() > 0 &&
|
||||
return IsStreamActive() &&
|
||||
GetNumCaptureChannels() > 0 &&
|
||||
mPlaybackSchedule.GetTrackTime() >=
|
||||
mPlaybackSchedule.mT0 + mRecordingSchedule.mPreRoll;
|
||||
}
|
||||
|
@ -50,10 +50,11 @@ std::pair<wxRect, bool> PlayIndicatorOverlayBase::DoGetRectangle(wxSize size)
|
||||
|
||||
// May be excessive height, but little matter
|
||||
wxRect rect(mLastIndicatorX - width / 2, 0, width, size.GetHeight());
|
||||
return std::make_pair(
|
||||
return {
|
||||
rect,
|
||||
mLastIndicatorX != mNewIndicatorX
|
||||
);
|
||||
(mLastIndicatorX != mNewIndicatorX
|
||||
|| mLastIsCapturing != mNewIsCapturing)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +63,17 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
|
||||
// Set play/record color
|
||||
bool rec = gAudioIO->IsCapturing();
|
||||
AColor::IndicatorColor(&dc, !rec);
|
||||
|
||||
if (mIsMaster
|
||||
&& mLastIsCapturing != mNewIsCapturing) {
|
||||
// Detect transition to recording during punch and roll; make ruler
|
||||
// change its button color too
|
||||
const auto ruler = mProject->GetRulerPanel();
|
||||
ruler->UpdateButtonStates();
|
||||
ruler->Refresh();
|
||||
}
|
||||
mLastIsCapturing = mNewIsCapturing;
|
||||
|
||||
mLastIndicatorX = mNewIndicatorX;
|
||||
if (!between_incexc(0, mLastIndicatorX, dc.GetSize().GetWidth()))
|
||||
return;
|
||||
@ -136,6 +148,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
||||
|
||||
if (!mProject->IsAudioActive()) {
|
||||
mNewIndicatorX = -1;
|
||||
mNewIsCapturing = false;
|
||||
const auto &scrubber = mProject->GetScrubber();
|
||||
if (scrubber.HasMark()) {
|
||||
auto position = scrubber.GetScrubStartPosition();
|
||||
@ -195,6 +208,8 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
||||
mNewIndicatorX = viewInfo.TimeToPosition(playPos, trackPanel->GetLeftOffset());
|
||||
else
|
||||
mNewIndicatorX = -1;
|
||||
|
||||
mNewIsCapturing = gAudioIO->IsCapturing();
|
||||
}
|
||||
|
||||
if(mPartner)
|
||||
|
@ -37,6 +37,8 @@ protected:
|
||||
const bool mIsMaster;
|
||||
int mLastIndicatorX { -1 };
|
||||
int mNewIndicatorX { -1 };
|
||||
bool mNewIsCapturing { false };
|
||||
bool mLastIsCapturing { false };
|
||||
};
|
||||
|
||||
// Master object for track panel, creates the other object for the ruler
|
||||
|
@ -3287,7 +3287,8 @@ void AdornedRulerPanel::UpdateButtonStates()
|
||||
pinButton->PopUp();
|
||||
else
|
||||
pinButton->PushDown();
|
||||
pinButton->SetAlternateIdx((mIsRecording ? 2 : 0) + (state ? 0 : 1));
|
||||
pinButton->SetAlternateIdx(
|
||||
(gAudioIO->IsCapturing() ? 2 : 0) + (state ? 0 : 1));
|
||||
// Bug 1584: Toltip now shows what clicking will do.
|
||||
const auto label = state
|
||||
? _("Click to unpin")
|
||||
|
Loading…
x
Reference in New Issue
Block a user