mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-06 16:50:12 +01:00
Rewrite AdornedRulerPanel with one less friend
This commit is contained in:
@@ -1842,7 +1842,7 @@ std::pair<wxRect, bool> QuickPlayRulerOverlay::DoGetRectangle(wxSize /*size*/)
|
||||
return {
|
||||
{ xx, yy,
|
||||
indsize * 2 + 1,
|
||||
mPartner.mProject->GetRulerPanel()->GetSize().GetHeight() },
|
||||
GetRuler()->GetSize().GetHeight() },
|
||||
(x != mNewQPIndicatorPos)
|
||||
};
|
||||
}
|
||||
@@ -1856,10 +1856,7 @@ void QuickPlayRulerOverlay::Draw(OverlayPanel & /*panel*/, wxDC &dc)
|
||||
if (mOldQPIndicatorPos >= 0) {
|
||||
auto ruler = GetRuler();
|
||||
const auto &scrubber = mPartner.mProject->GetScrubber();
|
||||
auto scrub =
|
||||
ruler->mMouseEventState == AdornedRulerPanel::mesNone &&
|
||||
(ruler->mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
|
||||
(scrubber.HasStartedScrubbing()));
|
||||
auto scrub = ruler->ShowingScrubControl();
|
||||
auto seek = scrub && (scrubber.Seeks() || scrubber.TemporarilySeeks());
|
||||
auto width = scrub ? IndicatorBigWidth() : IndicatorSmallWidth;
|
||||
ruler->DoDrawIndicator(&dc, mOldQPIndicatorPos, true, width, scrub, seek);
|
||||
@@ -2919,6 +2916,15 @@ void AdornedRulerPanel::SetPanelSize()
|
||||
GetParent()->PostSizeEventToParent();
|
||||
}
|
||||
|
||||
bool AdornedRulerPanel::ShowingScrubControl() const
|
||||
{
|
||||
const auto &scrubber = mProject->GetScrubber();
|
||||
return
|
||||
mMouseEventState == AdornedRulerPanel::mesNone &&
|
||||
(mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
|
||||
(scrubber.HasStartedScrubbing()));
|
||||
}
|
||||
|
||||
void AdornedRulerPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event))
|
||||
{
|
||||
ShowContextMenu(MenuChoice::QuickPlay, nullptr);
|
||||
|
||||
@@ -367,6 +367,8 @@ public:
|
||||
void OnToggleScrubRulerFromMenu(wxCommandEvent& );
|
||||
void SetPanelSize();
|
||||
|
||||
bool ShowingScrubControl() const;
|
||||
|
||||
|
||||
private:
|
||||
void OnCapture(wxCommandEvent & evt);
|
||||
@@ -490,8 +492,6 @@ private:
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
friend QuickPlayRulerOverlay;
|
||||
|
||||
wxWindow *mButtons[3];
|
||||
bool mNeedButtonUpdate { true };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user