mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-11 09:31:13 +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
|
bool AudioIO::IsCapturing() const
|
||||||
{
|
{
|
||||||
// Includes a test of mTime, used in the main thread
|
// Includes a test of mTime, used in the main thread
|
||||||
return GetNumCaptureChannels() > 0 &&
|
return IsStreamActive() &&
|
||||||
|
GetNumCaptureChannels() > 0 &&
|
||||||
mPlaybackSchedule.GetTrackTime() >=
|
mPlaybackSchedule.GetTrackTime() >=
|
||||||
mPlaybackSchedule.mT0 + mRecordingSchedule.mPreRoll;
|
mPlaybackSchedule.mT0 + mRecordingSchedule.mPreRoll;
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,11 @@ std::pair<wxRect, bool> PlayIndicatorOverlayBase::DoGetRectangle(wxSize size)
|
|||||||
|
|
||||||
// May be excessive height, but little matter
|
// May be excessive height, but little matter
|
||||||
wxRect rect(mLastIndicatorX - width / 2, 0, width, size.GetHeight());
|
wxRect rect(mLastIndicatorX - width / 2, 0, width, size.GetHeight());
|
||||||
return std::make_pair(
|
return {
|
||||||
rect,
|
rect,
|
||||||
mLastIndicatorX != mNewIndicatorX
|
(mLastIndicatorX != mNewIndicatorX
|
||||||
);
|
|| mLastIsCapturing != mNewIsCapturing)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,6 +63,17 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
|
|||||||
// Set play/record color
|
// Set play/record color
|
||||||
bool rec = gAudioIO->IsCapturing();
|
bool rec = gAudioIO->IsCapturing();
|
||||||
AColor::IndicatorColor(&dc, !rec);
|
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;
|
mLastIndicatorX = mNewIndicatorX;
|
||||||
if (!between_incexc(0, mLastIndicatorX, dc.GetSize().GetWidth()))
|
if (!between_incexc(0, mLastIndicatorX, dc.GetSize().GetWidth()))
|
||||||
return;
|
return;
|
||||||
@ -136,6 +148,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
|||||||
|
|
||||||
if (!mProject->IsAudioActive()) {
|
if (!mProject->IsAudioActive()) {
|
||||||
mNewIndicatorX = -1;
|
mNewIndicatorX = -1;
|
||||||
|
mNewIsCapturing = false;
|
||||||
const auto &scrubber = mProject->GetScrubber();
|
const auto &scrubber = mProject->GetScrubber();
|
||||||
if (scrubber.HasMark()) {
|
if (scrubber.HasMark()) {
|
||||||
auto position = scrubber.GetScrubStartPosition();
|
auto position = scrubber.GetScrubStartPosition();
|
||||||
@ -195,6 +208,8 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
|||||||
mNewIndicatorX = viewInfo.TimeToPosition(playPos, trackPanel->GetLeftOffset());
|
mNewIndicatorX = viewInfo.TimeToPosition(playPos, trackPanel->GetLeftOffset());
|
||||||
else
|
else
|
||||||
mNewIndicatorX = -1;
|
mNewIndicatorX = -1;
|
||||||
|
|
||||||
|
mNewIsCapturing = gAudioIO->IsCapturing();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPartner)
|
if(mPartner)
|
||||||
|
@ -37,6 +37,8 @@ protected:
|
|||||||
const bool mIsMaster;
|
const bool mIsMaster;
|
||||||
int mLastIndicatorX { -1 };
|
int mLastIndicatorX { -1 };
|
||||||
int mNewIndicatorX { -1 };
|
int mNewIndicatorX { -1 };
|
||||||
|
bool mNewIsCapturing { false };
|
||||||
|
bool mLastIsCapturing { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Master object for track panel, creates the other object for the ruler
|
// Master object for track panel, creates the other object for the ruler
|
||||||
|
@ -3287,7 +3287,8 @@ void AdornedRulerPanel::UpdateButtonStates()
|
|||||||
pinButton->PopUp();
|
pinButton->PopUp();
|
||||||
else
|
else
|
||||||
pinButton->PushDown();
|
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.
|
// Bug 1584: Toltip now shows what clicking will do.
|
||||||
const auto label = state
|
const auto label = state
|
||||||
? _("Click to unpin")
|
? _("Click to unpin")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user