1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 23:02:42 +02:00

GetVRulerWidth, GetLabelWidth, GetLeftOffset out of TrackPanel.h...

... And some things demoted from ViewInfo to ZoomInfo, related to x coordinates
only
This commit is contained in:
Paul Licameli 2019-06-21 11:26:13 -04:00
parent baf31dd72e
commit f87dfd43c1
11 changed files with 62 additions and 60 deletions

View File

@ -536,18 +536,20 @@ namespace
wxCoord GetPlayHeadX( const AudacityProject *pProject ) wxCoord GetPlayHeadX( const AudacityProject *pProject )
{ {
const auto &tp = TrackPanel::Get( *pProject ); const auto &tp = TrackPanel::Get( *pProject );
const auto &viewInfo = ViewInfo::Get( *pProject );
int width; int width;
tp.GetTracksUsableArea(&width, NULL); tp.GetTracksUsableArea(&width, NULL);
return tp.GetLeftOffset() return viewInfo.GetLeftOffset()
+ width * TracksPrefs::GetPinnedHeadPositionPreference(); + width * TracksPrefs::GetPinnedHeadPositionPreference();
} }
double GetPlayHeadFraction( const AudacityProject *pProject, wxCoord xx ) double GetPlayHeadFraction( const AudacityProject *pProject, wxCoord xx )
{ {
const auto &tp = TrackPanel::Get( *pProject ); const auto &tp = TrackPanel::Get( *pProject );
const auto &viewInfo = ViewInfo::Get( *pProject );
int width; int width;
tp.GetTracksUsableArea(&width, NULL); tp.GetTracksUsableArea(&width, NULL);
auto fraction = (xx - tp.GetLeftOffset()) / double(width); auto fraction = (xx - viewInfo.GetLeftOffset()) / double(width);
return std::max(0.0, std::min(1.0, fraction)); return std::max(0.0, std::min(1.0, fraction));
} }
@ -1710,10 +1712,11 @@ void AdornedRulerPanel::UpdateQuickPlayPos(wxCoord &mousePosX, bool shiftDown)
{ {
// Keep Quick-Play within usable track area. // Keep Quick-Play within usable track area.
const auto &tp = TrackPanel::Get( *mProject ); const auto &tp = TrackPanel::Get( *mProject );
const auto &viewInfo = ViewInfo::Get( *mProject );
int width; int width;
tp.GetTracksUsableArea(&width, NULL); tp.GetTracksUsableArea(&width, NULL);
mousePosX = std::max(mousePosX, tp.GetLeftOffset()); mousePosX = std::max(mousePosX, viewInfo.GetLeftOffset());
mousePosX = std::min(mousePosX, tp.GetLeftOffset() + width - 1); mousePosX = std::min(mousePosX, viewInfo.GetLeftOffset() + width - 1);
mQuickPlayPosUnsnapped = mQuickPlayPos = Pos2Time(mousePosX); mQuickPlayPosUnsnapped = mQuickPlayPos = Pos2Time(mousePosX);

View File

@ -414,7 +414,7 @@ unsigned operator()
// We're converting pixel positions to times, // We're converting pixel positions to times,
// counting pixels from the left edge of the track. // counting pixels from the left edge of the track.
auto &trackPanel = TrackPanel::Get( *pProject ); auto &trackPanel = TrackPanel::Get( *pProject );
int trackLeftEdge = trackPanel.GetLeftOffset(); int trackLeftEdge = viewInfo.GetLeftOffset();
// Time corresponding to mouse position // Time corresponding to mouse position
wxCoord xx; wxCoord xx;
@ -769,7 +769,7 @@ void ProjectWindow::Init()
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL); auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
// Bottom scrollbar // Bottom scrollbar
hs->Add(trackPanel.GetLeftOffset() - 1, 0); hs->Add(viewInfo.GetLeftOffset() - 1, 0);
hs->Add(mHsbar, 1, wxALIGN_BOTTOM); hs->Add(mHsbar, 1, wxALIGN_BOTTOM);
hs->Add(mVsbar->GetSize().GetWidth(), 0); hs->Add(mVsbar->GetSize().GetWidth(), 0);
bs->Add(hs.release(), 0, wxEXPAND | wxALIGN_LEFT); bs->Add(hs.release(), 0, wxEXPAND | wxALIGN_LEFT);
@ -791,7 +791,7 @@ void ProjectWindow::Init()
trackPanel.SetFocus(); trackPanel.SetFocus();
FixScrollbars(); FixScrollbars();
ruler.SetLeftOffset(trackPanel.GetLeftOffset()); // bevel on AdornedRuler ruler.SetLeftOffset(viewInfo.GetLeftOffset()); // bevel on AdornedRuler
// //
// Set the Icon // Set the Icon

View File

@ -349,7 +349,8 @@ wxSize TrackPanel::GetTracksUsableArea() const
{ {
auto size = GetSize(); auto size = GetSize();
return { return {
std::max( 0, size.GetWidth() - ( GetLeftOffset() + kRightMargin ) ), std::max( 0,
size.GetWidth() - ( mViewInfo->GetLeftOffset() + kRightMargin ) ),
size.GetHeight() size.GetHeight()
}; };
} }
@ -839,7 +840,8 @@ void TrackPanel::OnMouseEvent(wxMouseEvent & event)
double TrackPanel::GetMostRecentXPos() double TrackPanel::GetMostRecentXPos()
{ {
return mViewInfo->PositionToTime(MostRecentXCoord(), GetLabelWidth()); return mViewInfo->PositionToTime(
MostRecentXCoord(), mViewInfo->GetLabelWidth());
} }
void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking) void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking)
@ -934,7 +936,7 @@ void TrackPanel::DrawTracks(wxDC * dc)
return (pt && pt->GetSolo()); return (pt && pt->GetSolo());
} ); } );
mTrackArtist->leftOffset = GetLeftOffset(); mTrackArtist->leftOffset = mViewInfo->GetLeftOffset();
mTrackArtist->drawEnvelope = envelopeFlag; mTrackArtist->drawEnvelope = envelopeFlag;
mTrackArtist->bigPoints = bigPointsFlag; mTrackArtist->bigPoints = bigPointsFlag;
mTrackArtist->drawSliders = sliderFlag; mTrackArtist->drawSliders = sliderFlag;
@ -1008,11 +1010,11 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
trackRect.y = view.GetY() - mViewInfo->vpos + kTopMargin; trackRect.y = view.GetY() - mViewInfo->vpos + kTopMargin;
trackRect.height = view.GetHeight(); trackRect.height = view.GetHeight();
if (region.Contains( if (region.Contains(
0, trackRect.y, GetLeftOffset(), trackRect.height)) { 0, trackRect.y, mViewInfo->GetLeftOffset(), trackRect.height)) {
wxRect rect{ wxRect rect{
mViewInfo->GetVRulerOffset(), mViewInfo->GetVRulerOffset(),
trackRect.y, trackRect.y,
GetVRulerWidth() + 1, mViewInfo->GetVRulerWidth() + 1,
trackRect.height - kSeparatorThickness trackRect.height - kSeparatorThickness
}; };
TrackArt::DrawVRuler(context, channel, rect, bSelected); TrackArt::DrawVRuler(context, channel, rect, bSelected);
@ -1067,7 +1069,7 @@ void TrackPanel::DrawOutside
// Now exclude the resizer below // Now exclude the resizer below
rect.height -= kSeparatorThickness; rect.height -= kSeparatorThickness;
int labelw = GetLabelWidth(); int labelw = mViewInfo->GetLabelWidth();
int vrul = mViewInfo->GetVRulerOffset(); int vrul = mViewInfo->GetVRulerOffset();
TrackInfo::DrawBackground( dc, rect, t->GetSelected(), vrul ); TrackInfo::DrawBackground( dc, rect, t->GetSelected(), vrul );
@ -1077,7 +1079,7 @@ void TrackPanel::DrawOutside
//if (t->IsSyncLockSelected()) { //if (t->IsSyncLockSelected()) {
// wxRect tileFill = rect; // wxRect tileFill = rect;
// tileFill.x = mViewInfo->GetVRulerOffset(); // tileFill.x = mViewInfo->GetVRulerOffset();
// tileFill.width = GetVRulerWidth(); // tileFill.width = mViewInfo->GetVRulerWidth();
// TrackArt::DrawSyncLockTiles(dc, tileFill); // TrackArt::DrawSyncLockTiles(dc, tileFill);
//} //}
@ -1268,7 +1270,7 @@ void TrackPanel::UpdateTrackVRuler(const Track *t)
wxRect rect(mViewInfo->GetVRulerOffset(), wxRect rect(mViewInfo->GetVRulerOffset(),
kTopMargin, kTopMargin,
GetVRulerWidth(), mViewInfo->GetVRulerWidth(),
0); 0);
@ -1289,7 +1291,8 @@ void TrackPanel::UpdateVRulerSize()
if (mViewInfo->GetVRulerWidth() != s.GetWidth()) { if (mViewInfo->GetVRulerWidth() != s.GetWidth()) {
mViewInfo->SetVRulerWidth( s.GetWidth() ); mViewInfo->SetVRulerWidth( s.GetWidth() );
mRuler->SetLeftOffset(GetLeftOffset()); // bevel on AdornedRuler mRuler->SetLeftOffset(
mViewInfo->GetLeftOffset()); // bevel on AdornedRuler
mRuler->Refresh(); mRuler->Refresh();
} }
} }
@ -1313,7 +1316,7 @@ void TrackPanel::ScrollIntoView(double pos)
void TrackPanel::ScrollIntoView(int x) void TrackPanel::ScrollIntoView(int x)
{ {
ScrollIntoView(mViewInfo->PositionToTime(x, GetLeftOffset())); ScrollIntoView(mViewInfo->PositionToTime(x, mViewInfo->GetLeftOffset()));
} }
void TrackPanel::OnTrackMenu(Track *t) void TrackPanel::OnTrackMenu(Track *t)
@ -1569,7 +1572,8 @@ struct Subgroup final : TrackPanelGroup {
explicit Subgroup( TrackPanel &panel ) : mPanel{ panel } {} explicit Subgroup( TrackPanel &panel ) : mPanel{ panel } {}
Subdivision Children( const wxRect &rect ) override Subdivision Children( const wxRect &rect ) override
{ {
wxCoord yy = -mPanel.GetViewInfo()->vpos; const auto &viewInfo = *mPanel.GetViewInfo();
wxCoord yy = -viewInfo.vpos;
Refinement refinement; Refinement refinement;
auto &tracks = *mPanel.GetTracks(); auto &tracks = *mPanel.GetTracks();
@ -1585,7 +1589,7 @@ struct Subgroup final : TrackPanelGroup {
} }
refinement.emplace_back( yy, refinement.emplace_back( yy,
std::make_shared< ResizingChannelGroup >( std::make_shared< ResizingChannelGroup >(
leader->SharedPointer(), mPanel.GetLeftOffset() ) leader->SharedPointer(), viewInfo.GetLeftOffset() )
); );
yy += height; yy += height;
} }
@ -1637,16 +1641,6 @@ wxRect TrackPanel::FindTrackRect( const Track * target )
} ); } );
} }
int TrackPanel::GetVRulerWidth() const
{
return mViewInfo->GetVRulerWidth();
}
int TrackPanel::GetLabelWidth() const
{
return mViewInfo->GetVRulerOffset() + GetVRulerWidth();
}
/// Displays the bounds of the selection in the status bar. /// Displays the bounds of the selection in the status bar.
void TrackPanel::DisplaySelection() void TrackPanel::DisplaySelection()
{ {

View File

@ -103,8 +103,6 @@ class AUDACITY_DLL_API TrackPanel final
void OnProjectSettingsChange(wxCommandEvent &event); void OnProjectSettingsChange(wxCommandEvent &event);
void OnTrackFocusChange( wxCommandEvent &event ); void OnTrackFocusChange( wxCommandEvent &event );
int GetLeftOffset() const { return GetLabelWidth() + 1;}
wxSize GetTracksUsableArea() const; wxSize GetTracksUsableArea() const;
// Width and height, relative to upper left corner at (GetLeftOffset(), 0) // Width and height, relative to upper left corner at (GetLeftOffset(), 0)
@ -173,11 +171,7 @@ protected:
// area into cells // area into cells
std::shared_ptr<TrackPanelNode> Root() override; std::shared_ptr<TrackPanelNode> Root() override;
int GetVRulerWidth() const;
public: public:
int GetLabelWidth() const;
// JKC Nov-2011: These four functions only used from within a dll such as mod-track-panel // JKC Nov-2011: These four functions only used from within a dll such as mod-track-panel
// They work around some messy problems with constructors. // They work around some messy problems with constructors.
const TrackList * GetTracks() const { return mTracks.get(); } const TrackList * GetTracks() const { return mTracks.get(); }

View File

@ -21,20 +21,14 @@
// See big pictorial comment in TrackPanel.cpp for explanation of these numbers // See big pictorial comment in TrackPanel.cpp for explanation of these numbers
enum : int { enum : int {
kLeftInset = 4, // constants related to y coordinates in the track panel
kRightInset = kLeftInset,
kTopInset = 4, kTopInset = 4,
kShadowThickness = 1,
kBorderThickness = 1,
kTopMargin = kTopInset + kBorderThickness, kTopMargin = kTopInset + kBorderThickness,
kBottomMargin = kShadowThickness + kBorderThickness, kBottomMargin = kShadowThickness + kBorderThickness,
kLeftMargin = kLeftInset + kBorderThickness,
kRightMargin = kRightInset + kShadowThickness + kBorderThickness,
kSeparatorThickness = kBottomMargin + kTopMargin, kSeparatorThickness = kBottomMargin + kTopMargin,
}; };
enum : int { enum : int {
kTrackInfoWidth = 100 - kLeftMargin,
kTrackInfoBtnSize = 18, // widely used dimension, usually height kTrackInfoBtnSize = 18, // widely used dimension, usually height
kTrackInfoSliderHeight = 25, kTrackInfoSliderHeight = 25,
kTrackInfoSliderWidth = 84, kTrackInfoSliderWidth = 84,
@ -106,8 +100,6 @@ public:
int GetHeight() const { return mHeight; } int GetHeight() const { return mHeight; }
void SetHeight( int height ) { mHeight = height; } void SetHeight( int height ) { mHeight = height; }
int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; }
static int UpdateScrollPrefsID(); static int UpdateScrollPrefsID();
void UpdatePrefs() override; void UpdatePrefs() override;
void UpdateSelectedPrefs( int id ) override; void UpdateSelectedPrefs( int id ) override;

View File

@ -22,6 +22,20 @@
class AudacityProject; class AudacityProject;
// See big pictorial comment in TrackPanel.cpp for explanation of these numbers
enum : int {
// Constants related to x coordinates in the track panel
kBorderThickness = 1,
kShadowThickness = 1,
kLeftInset = 4,
kRightInset = kLeftInset,
kLeftMargin = kLeftInset + kBorderThickness,
kRightMargin = kRightInset + kShadowThickness + kBorderThickness,
kTrackInfoWidth = 100 - kLeftMargin,
};
// The subset of ViewInfo information (other than selection) // The subset of ViewInfo information (other than selection)
// that is sufficient for purposes of TrackArtist, // that is sufficient for purposes of TrackArtist,
// and for computing conversions between track times and pixel positions. // and for computing conversions between track times and pixel positions.
@ -83,6 +97,9 @@ 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 GetLabelWidth() const { return GetVRulerOffset() + GetVRulerWidth(); }
int GetLeftOffset() const { return GetLabelWidth() + 1;}
bool ZoomInAvailable() const; bool ZoomInAvailable() const;
bool ZoomOutAvailable() const; bool ZoomOutAvailable() const;

View File

@ -761,7 +761,7 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
R.width -= kLeftInset * 2; R.width -= kLeftInset * 2;
R.height -= kTopInset; R.height -= kTopInset;
int labelw = pTP->GetLabelWidth(); int labelw = viewInfo.GetLabelWidth();
//int vrul = viewInfo.GetVRulerOffset(); //int vrul = viewInfo.GetVRulerOffset();
bool bIsWave = true; bool bIsWave = true;
//mTrackInfo.DrawBackground(dc, R, t->GetSelected(), bIsWave, labelw, vrul); //mTrackInfo.DrawBackground(dc, R, t->GetSelected(), bIsWave, labelw, vrul);
@ -780,7 +780,7 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
wxRect R = trackRect; wxRect R = trackRect;
R.x += viewInfo.GetVRulerOffset(); R.x += viewInfo.GetVRulerOffset();
R.y += kTopMargin; R.y += kTopMargin;
R.width = tp.GetVRulerWidth(); R.width = viewInfo.GetVRulerWidth();
R.height -= (kTopMargin + kBottomMargin); R.height -= (kTopMargin + kBottomMargin);
R.SetPosition( R.GetPosition() + P ); R.SetPosition( R.GetPosition() + P );

View File

@ -2045,7 +2045,7 @@ int LabelTrackView::DialogForLabelName(
wxPoint position = trackPanel.FindTrackRect(trackPanel.GetFocusedTrack()).GetBottomLeft(); wxPoint position = trackPanel.FindTrackRect(trackPanel.GetFocusedTrack()).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 += trackPanel.GetLabelWidth() position.x += viewInfo.GetLabelWidth()
+ std::max(0, static_cast<int>(viewInfo.TimeToPosition(region.t0()))) + std::max(0, static_cast<int>(viewInfo.TimeToPosition(region.t0())))
-40; -40;
position.y += 2; // just below the bottom of the track position.y += 2; // just below the bottom of the track

View File

@ -54,15 +54,16 @@ unsigned EditCursorOverlay::SequenceNumber() const
std::pair<wxRect, bool> EditCursorOverlay::DoGetRectangle(wxSize size) std::pair<wxRect, bool> EditCursorOverlay::DoGetRectangle(wxSize size)
{ {
const auto &selection = ViewInfo::Get( *mProject ).selectedRegion; const auto &viewInfo = ViewInfo::Get( *mProject );
const auto &selection = viewInfo.selectedRegion;
if (!selection.isPoint()) { if (!selection.isPoint()) {
mCursorTime = -1.0; mCursorTime = -1.0;
mNewCursorX = -1; mNewCursorX = -1;
} }
else { else {
mCursorTime = selection.t0(); mCursorTime = selection.t0();
mNewCursorX = ViewInfo::Get( *mProject ).TimeToPosition( mNewCursorX = viewInfo.TimeToPosition(
mCursorTime, TrackPanel::Get( *mProject ).GetLeftOffset()); mCursorTime, viewInfo.GetLeftOffset());
} }
// Excessive height in case of the ruler, but it matters little. // Excessive height in case of the ruler, but it matters little.

View File

@ -149,6 +149,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
} }
auto &trackPanel = TrackPanel::Get( *mProject ); auto &trackPanel = TrackPanel::Get( *mProject );
const auto &viewInfo = ViewInfo::Get( *mProject );
int width; int width;
trackPanel.GetTracksUsableArea(&width, nullptr); trackPanel.GetTracksUsableArea(&width, nullptr);
@ -158,15 +159,13 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
const auto &scrubber = Scrubber::Get( *mProject ); const auto &scrubber = Scrubber::Get( *mProject );
if (scrubber.HasMark()) { if (scrubber.HasMark()) {
auto position = scrubber.GetScrubStartPosition(); auto position = scrubber.GetScrubStartPosition();
const auto offset = trackPanel.GetLeftOffset(); const auto offset = viewInfo.GetLeftOffset();
if(position >= trackPanel.GetLeftOffset() && if(position >= viewInfo.GetLeftOffset() &&
position < offset + width) position < offset + width)
mNewIndicatorX = position; mNewIndicatorX = position;
} }
} }
else { else {
const auto &viewInfo = ViewInfo::Get( *mProject );
// Calculate the horizontal position of the indicator // Calculate the horizontal position of the indicator
const double playPos = viewInfo.mRecentStreamTime; const double playPos = viewInfo.mRecentStreamTime;
@ -225,7 +224,8 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
window.TP_RedrawScrollbars(); window.TP_RedrawScrollbars();
if (onScreen) if (onScreen)
mNewIndicatorX = viewInfo.TimeToPosition(playPos, trackPanel.GetLeftOffset()); mNewIndicatorX =
viewInfo.TimeToPosition(playPos, viewInfo.GetLeftOffset());
else else
mNewIndicatorX = -1; mNewIndicatorX = -1;

View File

@ -353,10 +353,9 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
wxCoord position = xx; wxCoord position = xx;
if (abs(mScrubStartPosition - position) >= SCRUBBING_PIXEL_TOLERANCE) { if (abs(mScrubStartPosition - position) >= SCRUBBING_PIXEL_TOLERANCE) {
auto &viewInfo = ViewInfo::Get( *mProject ); auto &viewInfo = ViewInfo::Get( *mProject );
auto &trackPanel = TrackPanel::Get( *mProject );
auto &ctb = ControlToolBar::Get( *mProject ); auto &ctb = ControlToolBar::Get( *mProject );
double maxTime = TrackList::Get( *mProject ).GetEndTime(); double maxTime = TrackList::Get( *mProject ).GetEndTime();
const int leftOffset = trackPanel.GetLeftOffset(); const int leftOffset = viewInfo.GetLeftOffset();
double time0 = std::min(maxTime, double time0 = std::min(maxTime,
viewInfo.PositionToTime(mScrubStartPosition, leftOffset) viewInfo.PositionToTime(mScrubStartPosition, leftOffset)
); );
@ -605,7 +604,7 @@ void Scrubber::ContinueScrubbingPoll()
else else
#endif #endif
{ {
const auto origin = trackPanel.GetLeftOffset(); const auto origin = viewInfo.GetLeftOffset();
auto xx = position.x; auto xx = position.x;
if (!seek && !mSmoothScrollingScrub) { if (!seek && !mSmoothScrollingScrub) {
// If mouse is out-of-bounds, so that we scrub at maximum speed // If mouse is out-of-bounds, so that we scrub at maximum speed
@ -1007,6 +1006,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
} }
else { else {
TrackPanel &trackPanel = TrackPanel::Get( *mProject ); TrackPanel &trackPanel = TrackPanel::Get( *mProject );
auto &viewInfo = ViewInfo::Get( *mProject );
int panelWidth, panelHeight; int panelWidth, panelHeight;
trackPanel.GetSize(&panelWidth, &panelHeight); trackPanel.GetSize(&panelWidth, &panelHeight);
@ -1021,7 +1021,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
scrubber.IsScrollScrubbing() scrubber.IsScrollScrubbing()
? scrubber.FindScrubSpeed( seeking, ? scrubber.FindScrubSpeed( seeking,
ViewInfo::Get( *mProject ) ViewInfo::Get( *mProject )
.PositionToTime(position.x, trackPanel.GetLeftOffset())) .PositionToTime(position.x, viewInfo.GetLeftOffset()))
: maxScrubSpeed; : maxScrubSpeed;
const wxChar *format = const wxChar *format =
@ -1073,12 +1073,13 @@ void Scrubber::DoScrub(bool seek)
const bool scroll = ShouldScrubPinned(); const bool scroll = ShouldScrubPinned();
if (!wasScrubbing) { if (!wasScrubbing) {
auto &tp = TrackPanel::Get( *mProject ); auto &tp = TrackPanel::Get( *mProject );
const auto &viewInfo = ViewInfo::Get( *mProject );
wxCoord xx = tp.ScreenToClient(::wxGetMouseState().GetPosition()).x; wxCoord xx = tp.ScreenToClient(::wxGetMouseState().GetPosition()).x;
// Limit x // Limit x
int width; int width;
tp.GetTracksUsableArea(&width, nullptr); tp.GetTracksUsableArea(&width, nullptr);
const auto offset = tp.GetLeftOffset(); const auto offset = viewInfo.GetLeftOffset();
xx = (std::max(offset, std::min(offset + width - 1, xx))); xx = (std::max(offset, std::min(offset + width - 1, xx)));
MarkScrubStart(xx, scroll, seek); MarkScrubStart(xx, scroll, seek);