mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 16:48:44 +02:00
Bugs2151,2156: playhead ruler overlay was leaving black marks behind
This commit is contained in:
parent
f89d96a870
commit
960fe47412
@ -2150,13 +2150,8 @@ void AdornedRulerPanel::DoDrawIndicator
|
||||
dc->DrawPolygon( 3, tri );
|
||||
}
|
||||
else {
|
||||
bool pinned = Scrubber::Get( *mProject ).IsTransportingPinned();
|
||||
wxBitmap & bmp = theTheme.Bitmap( pinned ?
|
||||
(playing ? bmpPlayPointerPinned : bmpRecordPointerPinned) :
|
||||
(playing ? bmpPlayPointer : bmpRecordPointer)
|
||||
);
|
||||
const int IndicatorHalfWidth = bmp.GetWidth() / 2;
|
||||
dc->DrawBitmap( bmp, xx - IndicatorHalfWidth -1, mInner.y );
|
||||
auto pair = GetIndicatorBitmap( xx, playing );
|
||||
dc->DrawBitmap( pair.second, pair.first.x, pair.first.y );
|
||||
#if 0
|
||||
|
||||
// Down pointing triangle
|
||||
@ -2173,6 +2168,23 @@ void AdornedRulerPanel::DoDrawIndicator
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the appropriate bitmap, and panel-relative coordinates for its
|
||||
// upper left corner.
|
||||
std::pair< wxPoint, wxBitmap >
|
||||
AdornedRulerPanel::GetIndicatorBitmap(wxCoord xx, bool playing) const
|
||||
{
|
||||
bool pinned = Scrubber::Get( *mProject ).IsTransportingPinned();
|
||||
wxBitmap & bmp = theTheme.Bitmap( pinned ?
|
||||
(playing ? bmpPlayPointerPinned : bmpRecordPointerPinned) :
|
||||
(playing ? bmpPlayPointer : bmpRecordPointer)
|
||||
);
|
||||
const int IndicatorHalfWidth = bmp.GetWidth() / 2;
|
||||
return {
|
||||
{ xx - IndicatorHalfWidth - 1, mInner.y },
|
||||
bmp
|
||||
};
|
||||
}
|
||||
|
||||
void AdornedRulerPanel::SetPlayRegion(double playRegionStart,
|
||||
double playRegionEnd)
|
||||
{
|
||||
|
@ -100,6 +100,8 @@ private:
|
||||
void DoDrawSelection(wxDC * dc);
|
||||
|
||||
public:
|
||||
std::pair< wxPoint, wxBitmap >
|
||||
GetIndicatorBitmap(wxCoord xx, bool playing) const;
|
||||
void DoDrawIndicator(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub, bool seek);
|
||||
void UpdateButtonStates();
|
||||
|
||||
|
@ -55,10 +55,19 @@ unsigned PlayIndicatorOverlayBase::SequenceNumber() const
|
||||
|
||||
std::pair<wxRect, bool> PlayIndicatorOverlayBase::DoGetRectangle(wxSize size)
|
||||
{
|
||||
auto width = mIsMaster ? 1 : IndicatorMediumWidth;
|
||||
wxCoord width = 1, xx = mLastIndicatorX;
|
||||
|
||||
if ( !mIsMaster ) {
|
||||
auto &ruler = AdornedRulerPanel::Get( *mProject );
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
bool rec = gAudioIO->IsCapturing();
|
||||
auto pair = ruler.GetIndicatorBitmap( xx, !rec );
|
||||
xx = pair.first.x;
|
||||
width = pair.second.GetWidth();
|
||||
}
|
||||
|
||||
// May be excessive height, but little matter
|
||||
wxRect rect(mLastIndicatorX - width / 2, 0, width, size.GetHeight());
|
||||
wxRect rect( xx, 0, width, size.GetHeight());
|
||||
return {
|
||||
rect,
|
||||
(mLastIndicatorX != mNewIndicatorX
|
||||
@ -113,7 +122,8 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
|
||||
else if(auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
|
||||
wxASSERT(!mIsMaster);
|
||||
|
||||
ruler->DoDrawIndicator(&dc, mLastIndicatorX, !rec, IndicatorMediumWidth, false, false);
|
||||
auto pair = ruler->GetIndicatorBitmap( mLastIndicatorX, !rec );
|
||||
dc.DrawBitmap( pair.second, pair.first.x, pair.first.y );
|
||||
}
|
||||
else
|
||||
wxASSERT(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user