Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
ScrubForwarder Struct Reference
Inheritance diagram for ScrubForwarder:
[legend]
Collaboration diagram for ScrubForwarder:
[legend]

Public Member Functions

 ScrubForwarder (AudacityProject &project)
 
 ~ScrubForwarder ()
 
void OnMouse (wxMouseEvent &event)
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Public Attributes

AudacityProjectmProject
 
wxWindowPtr< wxWindow > mWindow
 
wxWeakRef< AdornedRulerPanelmRuler
 
std::weak_ptr< ScrubbermScrubber
 

Detailed Description

Definition at line 214 of file ScrubUI.cpp.

Constructor & Destructor Documentation

◆ ScrubForwarder()

ScrubForwarder::ScrubForwarder ( AudacityProject project)
inline

Definition at line 218 of file ScrubUI.cpp.

219 : mProject{ project }
220 {
222 if ( mWindow )
223 mWindow->PushEventHandler( this );
225 mScrubber = Scrubber::Get( project ).shared_from_this();
226 }
const auto project
static AdornedRulerPanel & Get(AudacityProject &project)
static ProjectWindow & Get(AudacityProject &project)
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:186
AudacityProject & mProject
Definition: ScrubUI.cpp:234
wxWindowPtr< wxWindow > mWindow
Definition: ScrubUI.cpp:235
wxWeakRef< AdornedRulerPanel > mRuler
Definition: ScrubUI.cpp:236
std::weak_ptr< Scrubber > mScrubber
Definition: ScrubUI.cpp:237

References AdornedRulerPanel::Get(), ProjectWindow::Get(), Scrubber::Get(), mRuler, mScrubber, mWindow, and project.

Here is the call graph for this function:

◆ ~ScrubForwarder()

ScrubForwarder::~ScrubForwarder ( )
inline

Definition at line 228 of file ScrubUI.cpp.

229 {
230 if ( mWindow )
231 mWindow->PopEventHandler();
232 }

References mWindow.

Member Function Documentation

◆ OnMouse()

void ScrubForwarder::OnMouse ( wxMouseEvent &  event)

Definition at line 243 of file ScrubUI.cpp.

244{
245 auto pScrubber = mScrubber.lock();
246 if ( !pScrubber || !mRuler ) {
247 event.Skip();
248 return;
249 }
250
251 auto &scrubber = *pScrubber;
252
253 auto &ruler = *mRuler;
254 const auto &state = ::wxGetMouseState();
255 const auto &position = state.GetPosition();
256 scrubber.SetMayDragToSeek(
257 ruler.GetScreenRect().Contains(position) );
258
259 /*
260 auto trackPanel = mProject->GetTrackPanel();
261 if (trackPanel &&
262 trackPanel->GetScreenRect().Contains(position))
263 return true;
264 */
265
266 //auto ruler = scrubber.mProject->GetRulerPanel();
267 auto isScrubbing = scrubber.IsScrubbing();
268 if (isScrubbing && !event.HasAnyModifiers()) {
269 if(event.LeftDown() && scrubber.MayDragToSeek()) {
270 // This event handler may catch mouse transitions that are missed
271 // by the polling of mouse state by the timer.
272 scrubber.SetSeekPress( true );
273 }
274 else if (event.m_wheelRotation) {
275 double steps = event.m_wheelRotation /
276 (event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0);
277 scrubber.HandleScrollWheel(steps);
278 }
279 else
280 event.Skip();
281 }
282 else
283 event.Skip();
284}

References mRuler, mScrubber, and anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler().

Here is the call graph for this function:

Member Data Documentation

◆ mProject

AudacityProject& ScrubForwarder::mProject

Definition at line 234 of file ScrubUI.cpp.

◆ mRuler

wxWeakRef<AdornedRulerPanel> ScrubForwarder::mRuler

Definition at line 236 of file ScrubUI.cpp.

Referenced by OnMouse(), and ScrubForwarder().

◆ mScrubber

std::weak_ptr<Scrubber> ScrubForwarder::mScrubber

Definition at line 237 of file ScrubUI.cpp.

Referenced by OnMouse(), and ScrubForwarder().

◆ mWindow

wxWindowPtr<wxWindow> ScrubForwarder::mWindow

Definition at line 235 of file ScrubUI.cpp.

Referenced by ScrubForwarder(), and ~ScrubForwarder().


The documentation for this struct was generated from the following file: