Bug 1533 - Selection in label track offset from selection in audio Track

The problem was actually more general, and involves misalignment between selections
in clips and selections in the background and in the ruler - so could be seen with just
audio tracks and no label tracks.
This commit is contained in:
James Crook 2018-03-17 13:36:37 +00:00
parent 21e330d0e7
commit a47df37ea4
2 changed files with 6 additions and 10 deletions

View File

@ -3417,10 +3417,6 @@ void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo)
{
//MM: Draw background. We should optimize that a bit more.
//AWD: "+ 1.5" and "+ 2.5" throughout match code in
//AdornedRulerPanel::DoDrawSelection() and make selection line up with ruler.
//I don't know if/why this is correct.
const double sel0 = selectedRegion.t0();
const double sel1 = selectedRegion.t1();
@ -3432,7 +3428,7 @@ void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
wxRect within = rect;
wxRect after = rect;
before.width = (int)(zoomInfo.TimeToPosition(sel0) + 2);
before.width = (int)(zoomInfo.TimeToPosition(sel0) );
if (before.GetRight() > rect.GetRight()) {
before.width = rect.width;
}
@ -3443,7 +3439,7 @@ void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
within.x = 1 + before.GetRight();
}
within.width = rect.x + (int)(zoomInfo.TimeToPosition(sel1) + 2) - within.x;
within.width = rect.x + (int)(zoomInfo.TimeToPosition(sel1) ) - within.x -1;
if (within.GetRight() > rect.GetRight()) {
within.width = 1 + rect.GetRight() - within.x;

View File

@ -3075,8 +3075,8 @@ void AdornedRulerPanel::DoDrawPlayRegion(wxDC * dc)
if (start >= 0)
{
const int x1 = Time2Pos(start) + 1;
const int x2 = Time2Pos(end);
const int x1 = Time2Pos(start);
const int x2 = Time2Pos(end)-2;
int y = mInner.y - TopMargin + mInner.height/2;
bool isLocked = mProject->IsPlayRegionLocked();
@ -3202,8 +3202,8 @@ void AdornedRulerPanel::DrawSelection()
void AdornedRulerPanel::DoDrawSelection(wxDC * dc)
{
// Draw selection
const int p0 = 1 + max(0, Time2Pos(mViewInfo->selectedRegion.t0()));
const int p1 = 2 + min(mInner.width, Time2Pos(mViewInfo->selectedRegion.t1()));
const int p0 = max(1, Time2Pos(mViewInfo->selectedRegion.t0()));
const int p1 = min(mInner.width, Time2Pos(mViewInfo->selectedRegion.t1()));
dc->SetBrush( wxBrush( theTheme.Colour( clrRulerBackground )) );
dc->SetPen( wxPen( theTheme.Colour( clrRulerBackground )) );