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 );
|
dc->DrawPolygon( 3, tri );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bool pinned = Scrubber::Get( *mProject ).IsTransportingPinned();
|
auto pair = GetIndicatorBitmap( xx, playing );
|
||||||
wxBitmap & bmp = theTheme.Bitmap( pinned ?
|
dc->DrawBitmap( pair.second, pair.first.x, pair.first.y );
|
||||||
(playing ? bmpPlayPointerPinned : bmpRecordPointerPinned) :
|
|
||||||
(playing ? bmpPlayPointer : bmpRecordPointer)
|
|
||||||
);
|
|
||||||
const int IndicatorHalfWidth = bmp.GetWidth() / 2;
|
|
||||||
dc->DrawBitmap( bmp, xx - IndicatorHalfWidth -1, mInner.y );
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
// Down pointing triangle
|
// 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,
|
void AdornedRulerPanel::SetPlayRegion(double playRegionStart,
|
||||||
double playRegionEnd)
|
double playRegionEnd)
|
||||||
{
|
{
|
||||||
|
@ -100,6 +100,8 @@ private:
|
|||||||
void DoDrawSelection(wxDC * dc);
|
void DoDrawSelection(wxDC * dc);
|
||||||
|
|
||||||
public:
|
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 DoDrawIndicator(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub, bool seek);
|
||||||
void UpdateButtonStates();
|
void UpdateButtonStates();
|
||||||
|
|
||||||
|
@ -55,10 +55,19 @@ unsigned PlayIndicatorOverlayBase::SequenceNumber() const
|
|||||||
|
|
||||||
std::pair<wxRect, bool> PlayIndicatorOverlayBase::DoGetRectangle(wxSize size)
|
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
|
// May be excessive height, but little matter
|
||||||
wxRect rect(mLastIndicatorX - width / 2, 0, width, size.GetHeight());
|
wxRect rect( xx, 0, width, size.GetHeight());
|
||||||
return {
|
return {
|
||||||
rect,
|
rect,
|
||||||
(mLastIndicatorX != mNewIndicatorX
|
(mLastIndicatorX != mNewIndicatorX
|
||||||
@ -113,7 +122,8 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
|
|||||||
else if(auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
|
else if(auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
|
||||||
wxASSERT(!mIsMaster);
|
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
|
else
|
||||||
wxASSERT(false);
|
wxASSERT(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user