mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-14 17:14:07 +01: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:
@@ -2045,7 +2045,7 @@ int LabelTrackView::DialogForLabelName(
|
||||
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
|
||||
// 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())))
|
||||
-40;
|
||||
position.y += 2; // just below the bottom of the track
|
||||
|
||||
@@ -54,15 +54,16 @@ unsigned EditCursorOverlay::SequenceNumber() const
|
||||
|
||||
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()) {
|
||||
mCursorTime = -1.0;
|
||||
mNewCursorX = -1;
|
||||
}
|
||||
else {
|
||||
mCursorTime = selection.t0();
|
||||
mNewCursorX = ViewInfo::Get( *mProject ).TimeToPosition(
|
||||
mCursorTime, TrackPanel::Get( *mProject ).GetLeftOffset());
|
||||
mNewCursorX = viewInfo.TimeToPosition(
|
||||
mCursorTime, viewInfo.GetLeftOffset());
|
||||
}
|
||||
|
||||
// Excessive height in case of the ruler, but it matters little.
|
||||
|
||||
@@ -149,6 +149,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
||||
}
|
||||
|
||||
auto &trackPanel = TrackPanel::Get( *mProject );
|
||||
const auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
int width;
|
||||
trackPanel.GetTracksUsableArea(&width, nullptr);
|
||||
|
||||
@@ -158,15 +159,13 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
||||
const auto &scrubber = Scrubber::Get( *mProject );
|
||||
if (scrubber.HasMark()) {
|
||||
auto position = scrubber.GetScrubStartPosition();
|
||||
const auto offset = trackPanel.GetLeftOffset();
|
||||
if(position >= trackPanel.GetLeftOffset() &&
|
||||
const auto offset = viewInfo.GetLeftOffset();
|
||||
if(position >= viewInfo.GetLeftOffset() &&
|
||||
position < offset + width)
|
||||
mNewIndicatorX = position;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
|
||||
// Calculate the horizontal position of the indicator
|
||||
const double playPos = viewInfo.mRecentStreamTime;
|
||||
|
||||
@@ -225,7 +224,8 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
||||
window.TP_RedrawScrollbars();
|
||||
|
||||
if (onScreen)
|
||||
mNewIndicatorX = viewInfo.TimeToPosition(playPos, trackPanel.GetLeftOffset());
|
||||
mNewIndicatorX =
|
||||
viewInfo.TimeToPosition(playPos, viewInfo.GetLeftOffset());
|
||||
else
|
||||
mNewIndicatorX = -1;
|
||||
|
||||
|
||||
@@ -353,10 +353,9 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
|
||||
wxCoord position = xx;
|
||||
if (abs(mScrubStartPosition - position) >= SCRUBBING_PIXEL_TOLERANCE) {
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
auto &trackPanel = TrackPanel::Get( *mProject );
|
||||
auto &ctb = ControlToolBar::Get( *mProject );
|
||||
double maxTime = TrackList::Get( *mProject ).GetEndTime();
|
||||
const int leftOffset = trackPanel.GetLeftOffset();
|
||||
const int leftOffset = viewInfo.GetLeftOffset();
|
||||
double time0 = std::min(maxTime,
|
||||
viewInfo.PositionToTime(mScrubStartPosition, leftOffset)
|
||||
);
|
||||
@@ -605,7 +604,7 @@ void Scrubber::ContinueScrubbingPoll()
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const auto origin = trackPanel.GetLeftOffset();
|
||||
const auto origin = viewInfo.GetLeftOffset();
|
||||
auto xx = position.x;
|
||||
if (!seek && !mSmoothScrollingScrub) {
|
||||
// If mouse is out-of-bounds, so that we scrub at maximum speed
|
||||
@@ -1007,6 +1006,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
|
||||
}
|
||||
else {
|
||||
TrackPanel &trackPanel = TrackPanel::Get( *mProject );
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
int panelWidth, panelHeight;
|
||||
trackPanel.GetSize(&panelWidth, &panelHeight);
|
||||
|
||||
@@ -1021,7 +1021,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
|
||||
scrubber.IsScrollScrubbing()
|
||||
? scrubber.FindScrubSpeed( seeking,
|
||||
ViewInfo::Get( *mProject )
|
||||
.PositionToTime(position.x, trackPanel.GetLeftOffset()))
|
||||
.PositionToTime(position.x, viewInfo.GetLeftOffset()))
|
||||
: maxScrubSpeed;
|
||||
|
||||
const wxChar *format =
|
||||
@@ -1073,12 +1073,13 @@ void Scrubber::DoScrub(bool seek)
|
||||
const bool scroll = ShouldScrubPinned();
|
||||
if (!wasScrubbing) {
|
||||
auto &tp = TrackPanel::Get( *mProject );
|
||||
const auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
wxCoord xx = tp.ScreenToClient(::wxGetMouseState().GetPosition()).x;
|
||||
|
||||
// Limit x
|
||||
int width;
|
||||
tp.GetTracksUsableArea(&width, nullptr);
|
||||
const auto offset = tp.GetLeftOffset();
|
||||
const auto offset = viewInfo.GetLeftOffset();
|
||||
xx = (std::max(offset, std::min(offset + width - 1, xx)));
|
||||
|
||||
MarkScrubStart(xx, scroll, seek);
|
||||
|
||||
Reference in New Issue
Block a user