1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 09:20:16 +01:00

TrackPanel copies its size, stores VRuler width in ViewInfo

This commit is contained in:
Paul Licameli
2019-06-07 20:50:31 -04:00
parent 5cd77187ef
commit baf31dd72e
4 changed files with 30 additions and 8 deletions

View File

@@ -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