mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-22 15:20:15 +02:00
Bug1076: Don't obliterate the point selection display during playback
This commit is contained in:
parent
85cf4e6fff
commit
87965cf164
@ -604,8 +604,8 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
|||||||
mSnapLeft = -1;
|
mSnapLeft = -1;
|
||||||
mSnapRight = -1;
|
mSnapRight = -1;
|
||||||
|
|
||||||
mLastCursor = -1;
|
mLastCursorX = -1;
|
||||||
mLastIndicator = -1;
|
mLastIndicatorX = -1;
|
||||||
mOldQPIndicatorPos = -1;
|
mOldQPIndicatorPos = -1;
|
||||||
|
|
||||||
// Register for tracklist updates
|
// Register for tracklist updates
|
||||||
@ -1279,41 +1279,36 @@ void TrackPanel::DoDrawIndicator
|
|||||||
(wxDC & dc, bool repairOld /* = false */, double indicator /* = -1 */)
|
(wxDC & dc, bool repairOld /* = false */, double indicator /* = -1 */)
|
||||||
{
|
{
|
||||||
bool onScreen;
|
bool onScreen;
|
||||||
int x;
|
|
||||||
double pos;
|
double pos;
|
||||||
|
|
||||||
if (!repairOld)
|
if (!repairOld)
|
||||||
{
|
{
|
||||||
// Erase the old indicator.
|
// Erase the old indicator.
|
||||||
if( mLastIndicator != -1 )
|
if (mLastIndicatorX != -1)
|
||||||
{
|
{
|
||||||
onScreen = between_inclusive( mViewInfo->h,
|
onScreen = between_inclusive(GetLeftOffset(),
|
||||||
mLastIndicator,
|
mLastIndicatorX,
|
||||||
mViewInfo->h + mViewInfo->screen );
|
GetLeftOffset() + mViewInfo->GetScreenWidth());
|
||||||
if (onScreen)
|
if (onScreen)
|
||||||
{
|
{
|
||||||
x = mViewInfo->TimeToPosition(mLastIndicator, GetLeftOffset());
|
|
||||||
|
|
||||||
// LL: Keep from trying to blit outsize of the source DC. This results in a crash on
|
// LL: Keep from trying to blit outsize of the source DC. This results in a crash on
|
||||||
// OSX due to allocating memory using negative sizes and can be caused by resizing
|
// OSX due to allocating memory using negative sizes and can be caused by resizing
|
||||||
// the project window while recording or playing.
|
// the project window while recording or playing.
|
||||||
int w = dc.GetSize().GetWidth();
|
int w = dc.GetSize().GetWidth();
|
||||||
if (x >= w) {
|
if (mLastIndicatorX >= w) {
|
||||||
x = w - 1;
|
mLastIndicatorX = w - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.Blit( x, 0, 1, mBacking->GetHeight(), &mBackingDC, x, 0 );
|
dc.Blit(mLastIndicatorX, 0, 1, mBacking->GetHeight(), &mBackingDC, mLastIndicatorX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing's ever perfect...
|
// Nothing's ever perfect...
|
||||||
//
|
//
|
||||||
// Redraw the cursor since we may have just wiped it out
|
// Redraw the cursor since we may have just wiped it out
|
||||||
if( mLastCursor == mLastIndicator )
|
if (mLastCursorX == mLastIndicatorX)
|
||||||
{
|
{
|
||||||
DoDrawCursor( dc );
|
DoDrawCursor( dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastIndicator = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = indicator;
|
pos = indicator;
|
||||||
@ -1350,19 +1345,16 @@ void TrackPanel::DoDrawIndicator
|
|||||||
|
|
||||||
mIndicatorShowing = ( onScreen && audioActive );
|
mIndicatorShowing = ( onScreen && audioActive );
|
||||||
|
|
||||||
// Remember it
|
// Calculate the horizontal position of the indicator
|
||||||
mLastIndicator = pos;
|
mLastIndicatorX = mViewInfo->TimeToPosition(pos, GetLeftOffset());
|
||||||
} else {
|
|
||||||
pos = mLastIndicator;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
pos = mViewInfo->PositionToTime(mLastIndicatorX, GetLeftOffset());
|
||||||
|
|
||||||
// Set play/record color
|
// Set play/record color
|
||||||
bool rec = (gAudioIO->GetNumCaptureChannels() > 0);
|
bool rec = (gAudioIO->GetNumCaptureChannels() > 0);
|
||||||
AColor::IndicatorColor( &dc, !rec);
|
AColor::IndicatorColor( &dc, !rec);
|
||||||
|
|
||||||
// Calculate the horizontal position of the indicator
|
|
||||||
x = mViewInfo->TimeToPosition(pos, GetLeftOffset());
|
|
||||||
|
|
||||||
mRuler->DrawIndicator( pos, rec );
|
mRuler->DrawIndicator( pos, rec );
|
||||||
|
|
||||||
// Ensure that we don't draw through the TrackInfo or vertical ruler.
|
// Ensure that we don't draw through the TrackInfo or vertical ruler.
|
||||||
@ -1370,7 +1362,7 @@ void TrackPanel::DoDrawIndicator
|
|||||||
int leftCutoff = clip.x + GetLabelWidth();
|
int leftCutoff = clip.x + GetLabelWidth();
|
||||||
int rightInset = kLeftInset + 2; // See the call to SetInset
|
int rightInset = kLeftInset + 2; // See the call to SetInset
|
||||||
int rightCutoff = clip.x + clip.width - rightInset;
|
int rightCutoff = clip.x + clip.width - rightInset;
|
||||||
if (!between_inclusive(leftCutoff, x, rightCutoff))
|
if (!between_inclusive(leftCutoff, mLastIndicatorX, rightCutoff))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1390,9 +1382,9 @@ void TrackPanel::DoDrawIndicator
|
|||||||
|
|
||||||
// Draw the new indicator in its new location
|
// Draw the new indicator in its new location
|
||||||
AColor::Line(dc,
|
AColor::Line(dc,
|
||||||
x,
|
mLastIndicatorX,
|
||||||
y + kTopInset + 1,
|
y + kTopInset + 1,
|
||||||
x,
|
mLastIndicatorX,
|
||||||
y + t->GetHeight() - 3 );
|
y + t->GetHeight() - 3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1411,38 +1403,28 @@ void TrackPanel::DrawCursor()
|
|||||||
void TrackPanel::DoDrawCursor(wxDC & dc)
|
void TrackPanel::DoDrawCursor(wxDC & dc)
|
||||||
{
|
{
|
||||||
bool onScreen;
|
bool onScreen;
|
||||||
int x;
|
|
||||||
|
|
||||||
if( mLastCursor != -1 )
|
if( mLastCursorX != -1 )
|
||||||
{
|
{
|
||||||
onScreen = between_inclusive( mViewInfo->h,
|
onScreen = between_inclusive(GetLeftOffset(),
|
||||||
mLastCursor,
|
mLastCursorX,
|
||||||
mViewInfo->h + mViewInfo->screen );
|
GetLeftOffset() + mViewInfo->GetScreenWidth());
|
||||||
if( onScreen )
|
if( onScreen )
|
||||||
{
|
dc.Blit(mLastCursorX, 0, 1, mBacking->GetHeight(), &mBackingDC, mLastCursorX, 0);
|
||||||
x = mViewInfo->TimeToPosition(mLastCursor, GetLeftOffset());
|
|
||||||
|
|
||||||
dc.Blit( x, 0, 1, mBacking->GetHeight(), &mBackingDC, x, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastCursor = -1;
|
const double time = mViewInfo->selectedRegion.t0();
|
||||||
}
|
mLastCursorX = mViewInfo->TimeToPosition(time, GetLeftOffset());
|
||||||
|
|
||||||
mLastCursor = mViewInfo->selectedRegion.t0();
|
|
||||||
|
|
||||||
onScreen = between_inclusive( mViewInfo->h,
|
onScreen = between_inclusive( mViewInfo->h,
|
||||||
mLastCursor,
|
time,
|
||||||
mViewInfo->h + mViewInfo->screen );
|
mViewInfo->h + mViewInfo->screen );
|
||||||
|
|
||||||
if( !onScreen )
|
if( !onScreen )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
AColor::CursorColor( &dc );
|
AColor::CursorColor( &dc );
|
||||||
|
|
||||||
x = mViewInfo->TimeToPosition(mLastCursor, GetLeftOffset());
|
|
||||||
|
|
||||||
// Draw cursor in all selected tracks
|
// Draw cursor in all selected tracks
|
||||||
VisibleTrackIterator iter( GetProject() );
|
VisibleTrackIterator iter( GetProject() );
|
||||||
for( Track *t = iter.First(); t; t = iter.Next() )
|
for( Track *t = iter.First(); t; t = iter.Next() )
|
||||||
@ -1454,14 +1436,14 @@ void TrackPanel::DoDrawCursor(wxDC & dc)
|
|||||||
wxCoord bottom = y + t->GetHeight() - kTopInset;
|
wxCoord bottom = y + t->GetHeight() - kTopInset;
|
||||||
|
|
||||||
// MB: warp() is not needed here as far as I know, in fact it creates a bug. Removing it fixes that.
|
// MB: warp() is not needed here as far as I know, in fact it creates a bug. Removing it fixes that.
|
||||||
AColor::Line( dc, x, top, x, bottom ); // <-- The whole point of this routine.
|
AColor::Line(dc, mLastCursorX, top, mLastCursorX, bottom); // <-- The whole point of this routine.
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
if(MONO_WAVE_PAN(t)){
|
if(MONO_WAVE_PAN(t)){
|
||||||
y = t->GetY(true) - mViewInfo->vpos + 1;
|
y = t->GetY(true) - mViewInfo->vpos + 1;
|
||||||
top = y + kTopInset;
|
top = y + kTopInset;
|
||||||
bottom = y + t->GetHeight(true) - kTopInset;
|
bottom = y + t->GetHeight(true) - kTopInset;
|
||||||
AColor::Line( dc, x, top, x, bottom );
|
AColor::Line( dc, mLastCursorX, top, mLastCursorX, bottom );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1469,7 +1451,7 @@ void TrackPanel::DoDrawCursor(wxDC & dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AS: Ah, no, this is where we draw the blinky thing in the ruler.
|
// AS: Ah, no, this is where we draw the blinky thing in the ruler.
|
||||||
mRuler->DrawCursor( mLastCursor );
|
mRuler->DrawCursor( time );
|
||||||
|
|
||||||
DisplaySelection();
|
DisplaySelection();
|
||||||
}
|
}
|
||||||
|
@ -587,8 +587,8 @@ protected:
|
|||||||
|
|
||||||
// This stores the parts of the screen that get overwritten by the indicator
|
// This stores the parts of the screen that get overwritten by the indicator
|
||||||
// and cursor
|
// and cursor
|
||||||
double mLastIndicator;
|
int mLastIndicatorX;
|
||||||
double mLastCursor;
|
int mLastCursorX;
|
||||||
|
|
||||||
// Quick-Play indicator postion
|
// Quick-Play indicator postion
|
||||||
double mOldQPIndicatorPos;
|
double mOldQPIndicatorPos;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user