mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-07 15:49:42 +02:00
TrackPanel copies its size, stores VRuler width in ViewInfo
This commit is contained in:
parent
5cd77187ef
commit
baf31dd72e
@ -170,6 +170,8 @@ BEGIN_EVENT_TABLE(TrackPanel, CellularPanel)
|
||||
|
||||
EVT_TIMER(wxID_ANY, TrackPanel::OnTimer)
|
||||
|
||||
EVT_SIZE(TrackPanel::OnSize)
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/// Makes a cursor from an XPM, uses CursorId as a fallback.
|
||||
@ -252,8 +254,7 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
||||
mTracks(tracks),
|
||||
mRuler(ruler),
|
||||
mTrackArtist(nullptr),
|
||||
mRefreshBacking(false),
|
||||
vrulerSize(36,0)
|
||||
mRefreshBacking(false)
|
||||
#ifndef __WXGTK__ //Get rid if this pragma for gtk
|
||||
#pragma warning( default: 4355 )
|
||||
#endif
|
||||
@ -384,6 +385,14 @@ AudacityProject * TrackPanel::GetProject() const
|
||||
return &static_cast<ProjectWindow*>( pWind )->GetProject();
|
||||
}
|
||||
|
||||
void TrackPanel::OnSize( wxSizeEvent &evt )
|
||||
{
|
||||
evt.Skip();
|
||||
const auto &size = evt.GetSize();
|
||||
mViewInfo->SetWidth( size.GetWidth() );
|
||||
mViewInfo->SetHeight( size.GetHeight() );
|
||||
}
|
||||
|
||||
void TrackPanel::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
@ -1278,8 +1287,8 @@ void TrackPanel::UpdateVRulerSize()
|
||||
for (auto t : trackRange)
|
||||
s.IncTo(t->vrulerSize);
|
||||
|
||||
if (vrulerSize != s) {
|
||||
vrulerSize = s;
|
||||
if (mViewInfo->GetVRulerWidth() != s.GetWidth()) {
|
||||
mViewInfo->SetVRulerWidth( s.GetWidth() );
|
||||
mRuler->SetLeftOffset(GetLeftOffset()); // bevel on AdornedRuler
|
||||
mRuler->Refresh();
|
||||
}
|
||||
@ -1630,7 +1639,7 @@ wxRect TrackPanel::FindTrackRect( const Track * target )
|
||||
|
||||
int TrackPanel::GetVRulerWidth() const
|
||||
{
|
||||
return vrulerSize.x;
|
||||
return mViewInfo->GetVRulerWidth();
|
||||
}
|
||||
|
||||
int TrackPanel::GetLabelWidth() const
|
||||
|
@ -96,6 +96,7 @@ class AUDACITY_DLL_API TrackPanel final
|
||||
|
||||
double GetMostRecentXPos();
|
||||
|
||||
void OnSize( wxSizeEvent & );
|
||||
void OnIdle(wxIdleEvent & event);
|
||||
void OnTimer(wxTimerEvent& event);
|
||||
void OnODTask(wxCommandEvent &event);
|
||||
@ -271,9 +272,6 @@ protected:
|
||||
|
||||
SelectedRegion mLastDrawnSelectedRegion {};
|
||||
|
||||
public:
|
||||
wxSize vrulerSize;
|
||||
|
||||
protected:
|
||||
|
||||
std::shared_ptr<TrackPanelCell> mpBackground;
|
||||
|
@ -103,6 +103,9 @@ public:
|
||||
|
||||
ViewInfo(double start, double screenDuration, double pixelsPerSecond);
|
||||
|
||||
int GetHeight() const { return mHeight; }
|
||||
void SetHeight( int height ) { mHeight = height; }
|
||||
|
||||
int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; }
|
||||
|
||||
static int UpdateScrollPrefsID();
|
||||
@ -157,6 +160,9 @@ public:
|
||||
|
||||
// Receive track panel timer notifications
|
||||
void OnTimer(wxCommandEvent &event);
|
||||
|
||||
private:
|
||||
int mHeight{ 0 };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -78,6 +78,12 @@ public:
|
||||
return PositionToTime(offset + TimeToPosition(time, ignoreFisheye), ignoreFisheye);
|
||||
}
|
||||
|
||||
int GetWidth() const { return mWidth; }
|
||||
void SetWidth( int width ) { mWidth = width; }
|
||||
|
||||
int GetVRulerWidth() const { return mVRulerWidth; }
|
||||
void SetVRulerWidth( int width ) { mVRulerWidth = width; }
|
||||
|
||||
bool ZoomInAvailable() const;
|
||||
bool ZoomOutAvailable() const;
|
||||
|
||||
@ -137,6 +143,9 @@ public:
|
||||
// Exclusive:
|
||||
wxInt64 GetFisheyeRightBoundary(wxInt64 WXUNUSED(origin = 0)) const
|
||||
{return 0;} // stub
|
||||
|
||||
int mWidth{ 0 };
|
||||
int mVRulerWidth{ 36 };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user