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