1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

In ViewInfo, remove GetLabelWidth() and add comments

(cherry picked from audacity commit cef8e228f9)

Signed-off-by: akleja <storspov@gmail.com>
This commit is contained in:
Paul Licameli
2021-08-06 17:03:30 -04:00
committed by akleja
parent 5f2e0fa213
commit 6c98a5a2aa
4 changed files with 12 additions and 9 deletions

View File

@@ -26,7 +26,7 @@
TrackInfo class to draw the controls area on the left of a track, TrackInfo class to draw the controls area on the left of a track,
and the TrackArtist class to draw the actual waveforms. and the TrackArtist class to draw the actual waveforms.
Note that in some of the older code here, e.g., GetLabelWidth(), Note that in some of the older code here,
"Label" means the TrackInfo plus the vertical ruler. "Label" means the TrackInfo plus the vertical ruler.
Confusing relative to LabelTrack labels. Confusing relative to LabelTrack labels.
@@ -118,8 +118,8 @@ controls, and is a constant.
GetVRulerWidth() is variable -- all tracks have the same ruler width at any GetVRulerWidth() is variable -- all tracks have the same ruler width at any
time, but that width may be adjusted when tracks change their vertical scales. time, but that width may be adjusted when tracks change their vertical scales.
GetLabelWidth() counts columns up to and including the VRuler. GetLeftOffset() counts columns up to and including the VRuler and one more,
GetLeftOffset() is yet one more -- it counts the "one pixel" column. the "one pixel" column.
Cell for label has a rectangle that OMITS left, top, and bottom Cell for label has a rectangle that OMITS left, top, and bottom
margins margins

View File

@@ -74,7 +74,7 @@ void TrackPanelResizerCell::Draw(
// Paint the left part of the background // Paint the left part of the background
const auto artist = TrackArtist::Get( context ); const auto artist = TrackArtist::Get( context );
auto labelw = artist->pZoomInfo->GetLabelWidth(); auto labelw = artist->pZoomInfo->GetLeftOffset() - 1;
AColor::MediumTrackInfo( dc, pTrack->GetSelected() ); AColor::MediumTrackInfo( dc, pTrack->GetSelected() );
dc->DrawRectangle( dc->DrawRectangle(
rect.GetX(), rect.GetY(), labelw, rect.GetHeight() ); rect.GetX(), rect.GetY(), labelw, rect.GetHeight() );

View File

@@ -98,9 +98,11 @@ public:
int GetVRulerWidth() const { return mVRulerWidth; } int GetVRulerWidth() const { return mVRulerWidth; }
void SetVRulerWidth( int width ) { mVRulerWidth = width; } void SetVRulerWidth( int width ) { mVRulerWidth = width; }
int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; } int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; }
int GetLabelWidth() const { return GetVRulerOffset() + GetVRulerWidth(); }
int GetLeftOffset() const { return GetLabelWidth() + 1;}
// The x-coordinate of the start of the displayed track data
int GetLeftOffset() const
{ return GetVRulerOffset() + GetVRulerWidth() + 1; }
// The number of pixel columns for display of track data
int GetTracksUsableWidth() const int GetTracksUsableWidth() const
{ {
return return

View File

@@ -2253,9 +2253,10 @@ int LabelTrackView::DialogForLabelName(
trackPanel.FindTrackRect( trackFocus.Get() ).GetBottomLeft(); trackPanel.FindTrackRect( trackFocus.Get() ).GetBottomLeft();
// The start of the text in the text box will be roughly in line with the label's position // The start of the text in the text box will be roughly in line with the label's position
// if it's a point label, or the start of its region if it's a region label. // if it's a point label, or the start of its region if it's a region label.
position.x += viewInfo.GetLabelWidth() position.x +=
+ std::max(0, static_cast<int>(viewInfo.TimeToPosition(region.t0()))) + std::max(0, static_cast<int>(viewInfo.TimeToPosition(
-40; viewInfo.GetLeftOffset(), region.t0())))
- 39;
position.y += 2; // just below the bottom of the track position.y += 2; // just below the bottom of the track
position = trackPanel.ClientToScreen(position); position = trackPanel.ClientToScreen(position);
auto &window = GetProjectFrame( project ); auto &window = GetProjectFrame( project );