Audacity 3.2.0
|
Formerly part of TrackPanel, this abstract base class has no special knowledge of Track objects and is intended for reuse with other windows. More...
#include <CellularPanel.h>
Classes | |
struct | Filter |
struct | FoundCell |
struct | State |
struct | Visitor |
Public Types | |
using | SimpleCellVisitor = std::function< void(const wxRect &rect, TrackPanelCell &cell) > |
using | SimpleNodeVisitor = std::function< void(const wxRect &rect, TrackPanelNode &node) > |
Public Member Functions | |
CellularPanel (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ViewInfo *viewInfo, long style=wxTAB_TRAVERSAL|wxNO_BORDER) | |
~CellularPanel () override | |
virtual AudacityProject * | GetProject () const =0 |
virtual std::shared_ptr< TrackPanelNode > | Root ()=0 |
virtual std::shared_ptr< TrackPanelCell > | GetFocusedCell ()=0 |
virtual void | SetFocusedCell ()=0 |
virtual void | ProcessUIHandleResult (TrackPanelCell *pClickedCell, TrackPanelCell *pLatestCell, unsigned refreshResult)=0 |
virtual void | UpdateStatusMessage (const TranslatableString &)=0 |
void | Visit (Visitor &visitor) |
void | VisitCells (const SimpleCellVisitor &visitor) |
void | VisitPreorder (const SimpleNodeVisitor &visitor) |
void | VisitPostorder (const SimpleNodeVisitor &visitor) |
FoundCell | FindCell (int mouseX, int mouseY) |
wxRect | FindRect (const TrackPanelCell &cell) |
wxRect | FindRect (const std::function< bool(TrackPanelNode &) > &pred) |
UIHandlePtr | Target () |
std::shared_ptr< TrackPanelCell > | LastCell () const |
bool | IsMouseCaptured () |
Determines if a modal tool is active. More... | |
wxCoord | MostRecentXCoord () const |
void | HandleCursorForPresentMouseState (bool doHit=true) |
void | Draw (TrackPanelDrawingContext &context, unsigned nPasses) |
Public Member Functions inherited from OverlayPanel | |
OverlayPanel (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style=wxTAB_TRAVERSAL|wxNO_BORDER) | |
void | AddOverlay (const std::weak_ptr< Overlay > &pOverlay) |
void | ClearOverlays () |
void | DrawOverlays (bool repaint_all, wxDC *pDC=nullptr) |
Public Member Functions inherited from BackedPanel | |
BackedPanel (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) | |
~BackedPanel () | |
wxDC & | GetBackingDC () |
wxDC & | GetBackingDCForRepaint () |
void | ResizeBacking () |
void | RepairBitmap (wxDC &dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
void | DisplayBitmap (wxDC &dc) |
void | OnSize (wxSizeEvent &event) |
Public Member Functions inherited from wxPanelWrapper | |
wxPanelWrapper () | |
wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel")) | |
bool | Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel")) |
void | SetLabel (const TranslatableString &label) |
void | SetName (const TranslatableString &name) |
void | SetToolTip (const TranslatableString &toolTip) |
void | SetName () |
Public Member Functions inherited from wxTabTraversalWrapper< wxPanel > | |
wxTabTraversalWrapper (Args &&... args) | |
wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete | |
wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete | |
wxTabTraversalWrapper & | operator= (const wxTabTraversalWrapper &)=delete |
wxTabTraversalWrapper & | operator= (wxTabTraversalWrapper &&)=delete |
Protected Member Functions | |
bool | HasEscape () |
bool | CancelDragging (bool escaping) |
void | DoContextMenu (std::shared_ptr< TrackPanelCell > pCell) |
void | ClearTargets () |
Protected Attributes | |
ViewInfo * | mViewInfo |
wxMouseState | mLastMouseState |
Private Member Functions | |
void | Visit (const wxRect &rect, const std::shared_ptr< TrackPanelNode > &node, Visitor &visitor) |
bool | HasRotation () |
bool | ChangeTarget (bool forward, bool cycle) |
void | OnMouseEvent (wxMouseEvent &event) |
void | OnCaptureLost (wxMouseCaptureLostEvent &event) |
Should handle the case when the mouse capture is lost. (MSW only) More... | |
void | OnCaptureKey (wxCommandEvent &event) |
void | OnKeyDown (wxKeyEvent &event) |
void | OnChar (wxKeyEvent &event) |
void | OnKeyUp (wxKeyEvent &event) |
void | OnSetFocus (wxFocusEvent &event) |
void | OnKillFocus (wxFocusEvent &event) |
void | DoKillFocus () |
void | OnContextMenu (wxContextMenuEvent &event) |
void | HandleInterruptedDrag () |
void | Uncapture (bool escaping, wxMouseState *pState=nullptr) |
bool | HandleEscapeKey (bool down) |
void | UpdateMouseState (const wxMouseState &state) |
void | HandleModifierKey () |
void | HandleClick (const TrackPanelMouseEvent &tpmEvent) |
void | HandleWheelRotation (TrackPanelMouseEvent &tpmEvent) |
Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling) More... | |
void | HandleMotion (wxMouseState &state, bool doHit=true) |
void | HandleMotion (const TrackPanelMouseState &tpmState, bool doHit=true) |
void | Leave () |
Private Attributes | |
std::unique_ptr< State > | mState |
Formerly part of TrackPanel, this abstract base class has no special knowledge of Track objects and is intended for reuse with other windows.
Manages a division of a panel's area into disjoint rectangles, each with an associated Cell object. Details of that partition and association, and the choice of the cell with keyboard focus, are subclass responsibilities.
Handling of keyboard events is delegated to the focused cell. The cell under the mouse position is queried for hit-test candidate objects, which handle click-drag-release (and ESC key abort) sequences.
Definition at line 34 of file CellularPanel.h.
using CellularPanel::SimpleCellVisitor = std::function< void( const wxRect &rect, TrackPanelCell &cell ) > |
Definition at line 74 of file CellularPanel.h.
using CellularPanel::SimpleNodeVisitor = std::function< void( const wxRect &rect, TrackPanelNode &node ) > |
Definition at line 79 of file CellularPanel.h.
CellularPanel::CellularPanel | ( | wxWindow * | parent, |
wxWindowID | id, | ||
const wxPoint & | pos, | ||
const wxSize & | size, | ||
ViewInfo * | viewInfo, | ||
long | style = wxTAB_TRAVERSAL | wxNO_BORDER |
||
) |
Definition at line 130 of file CellularPanel.cpp.
|
overridedefault |
|
protected |
Definition at line 180 of file CellularPanel.cpp.
References ClearTargets(), GetProject(), mState, ProcessUIHandleResult(), and Uncapture().
Referenced by HandleEscapeKey(), AdornedRulerPanel::OnAudioStartStop(), and OnMouseEvent().
|
private |
Definition at line 459 of file CellularPanel.cpp.
References forward, GetProject(), IsMouseCaptured(), mState, size, and Target().
Referenced by HandleEscapeKey(), and OnKeyDown().
|
protected |
Definition at line 1219 of file CellularPanel.cpp.
References mState.
Referenced by CancelDragging(), HandleClick(), HandleMotion(), AdornedRulerPanel::OnAudioStartStop(), and OnMouseEvent().
|
protected |
Definition at line 969 of file CellularPanel.cpp.
References FindRect(), GetFocusedCell(), GetProject(), and ProcessUIHandleResult().
Referenced by OnContextMenu(), and TrackPanel::OnTrackMenu().
|
private |
Definition at line 997 of file CellularPanel.cpp.
References GetFocusedCell(), GetProject(), mState, and ProcessUIHandleResult().
Referenced by OnKillFocus().
void CellularPanel::Draw | ( | TrackPanelDrawingContext & | context, |
unsigned | nPasses | ||
) |
Definition at line 1236 of file CellularPanel.cpp.
References TrackPanelDrawable::Draw(), TrackPanelDrawable::DrawingArea(), LastCell(), and VisitPostorder().
Referenced by TrackPanel::DrawTracks().
auto CellularPanel::FindCell | ( | int | mouseX, |
int | mouseY | ||
) |
Definition at line 1136 of file CellularPanel.cpp.
References details::begin(), details::end(), Root(), anonymous_namespace{CellularPanel.cpp}::Subdivide(), and TrackPanelGroup::X.
Referenced by HandleMotion(), OnMouseEvent(), and TrackPanel::OnMouseEvent().
wxRect CellularPanel::FindRect | ( | const std::function< bool(TrackPanelNode &) > & | pred | ) |
Definition at line 1189 of file CellularPanel.cpp.
References VisitPreorder().
wxRect CellularPanel::FindRect | ( | const TrackPanelCell & | cell | ) |
Definition at line 1175 of file CellularPanel.cpp.
References VisitCells().
Referenced by DoContextMenu(), TrackPanel::FindTrackRect(), WaveTrackControls::PanSlider(), and WaveTrackControls::VolumeSlider().
|
pure virtual |
Implemented in AdornedRulerPanel, and TrackPanel.
Referenced by DoContextMenu(), DoKillFocus(), OnCaptureKey(), OnChar(), OnKeyDown(), and OnKeyUp().
|
pure virtual |
Implemented in AdornedRulerPanel, and TrackPanel.
Referenced by CancelDragging(), ChangeTarget(), DoContextMenu(), DoKillFocus(), HandleClick(), HandleEscapeKey(), HandleMotion(), HandleWheelRotation(), HasEscape(), OnCaptureKey(), OnChar(), OnKeyDown(), OnKeyUp(), and OnMouseEvent().
|
private |
Definition at line 910 of file CellularPanel.cpp.
References RefreshCode::Cancelled, ClearTargets(), TrackPanelMouseEvent::event, GetProject(), HandleMotion(), mState, TrackPanelMouseEvent::pCell, ProcessUIHandleResult(), TrackPanelMouseEvent::rect, CellularPanel::Filter::spClickedPanel, and Target().
Referenced by OnMouseEvent().
void CellularPanel::HandleCursorForPresentMouseState | ( | bool | doHit = true | ) |
Definition at line 254 of file CellularPanel.cpp.
References HandleMotion().
Referenced by HandleEscapeKey(), HandleModifierKey(), TrackPanel::OnAudioIO(), OnKeyDown(), AdornedRulerPanel::Refresh(), and TrackPanel::Refresh().
|
private |
Definition at line 201 of file CellularPanel.cpp.
References CancelDragging(), ChangeTarget(), GetProject(), HandleCursorForPresentMouseState(), mState, and Target().
Referenced by OnKeyDown(), and OnKeyUp().
|
private |
Definition at line 147 of file CellularPanel.cpp.
References mState.
Referenced by OnCaptureKey().
|
private |
Definition at line 249 of file CellularPanel.cpp.
References HandleCursorForPresentMouseState().
Referenced by OnKeyDown(), and OnKeyUp().
|
private |
Definition at line 287 of file CellularPanel.cpp.
References details::begin(), ClearTargets(), TranslatableString::empty(), details::end(), GetProject(), mState, TrackPanelMouseState::pCell, ProcessUIHandleResult(), RefreshCode::RefreshNone, wxPanelWrapper::SetToolTip(), Target(), TranslatableString::Translation(), and UpdateStatusMessage().
|
private |
CellularPanel::HandleMotion( ) sets the cursor drawn at the mouse location, and updates the status bar message. We treat certain other changes of mouse button and key state as "motions" too, and also starting and stopping of playback or recording, all of which may cause the appropriate cursor and message to change. As this procedure checks which region the mouse is over, it is appropriate to establish the message in the status bar.
Definition at line 276 of file CellularPanel.cpp.
References FindCell(), HandleMotion(), mLastMouseState, and UpdateMouseState().
Referenced by HandleClick(), HandleCursorForPresentMouseState(), HandleMotion(), Leave(), OnMouseEvent(), and Uncapture().
|
private |
Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling)
Definition at line 507 of file CellularPanel.cpp.
References TrackPanelMouseEvent::event, GetProject(), TrackPanelMouseEvent::pCell, ProcessUIHandleResult(), and TrackPanelMouseEvent::steps.
Referenced by OnMouseEvent().
|
protected |
Definition at line 445 of file CellularPanel.cpp.
References GetProject(), HasEscape(), IsMouseCaptured(), mState, and Target().
Referenced by HasEscape(), and TrackPanel::UpdateStatusMessage().
|
private |
Definition at line 435 of file CellularPanel.cpp.
References mState, and Target().
Referenced by OnCaptureKey(), and OnKeyDown().
bool CellularPanel::IsMouseCaptured | ( | ) |
Determines if a modal tool is active.
Definition at line 495 of file CellularPanel.cpp.
References mState.
Referenced by ChangeTarget(), HasEscape(), and OnMouseEvent().
std::shared_ptr< TrackPanelCell > CellularPanel::LastCell | ( | ) | const |
Definition at line 1230 of file CellularPanel.cpp.
References mState.
Referenced by Draw().
|
private |
Definition at line 425 of file CellularPanel.cpp.
References HandleMotion().
Referenced by OnCaptureLost(), and OnMouseEvent().
wxCoord CellularPanel::MostRecentXCoord | ( | ) | const |
Definition at line 1213 of file CellularPanel.cpp.
References mState.
Referenced by TrackPanel::GetMostRecentXPos().
|
private |
Definition at line 553 of file CellularPanel.cpp.
References GetFocusedCell(), GetProject(), HandleInterruptedDrag(), HasRotation(), mState, mViewInfo, and ProcessUIHandleResult().
|
private |
Should handle the case when the mouse capture is lost. (MSW only)
Definition at line 687 of file CellularPanel.cpp.
References kCaptureLostEventId, Leave(), mState, and OnMouseEvent().
|
private |
Definition at line 630 of file CellularPanel.cpp.
References GetFocusedCell(), GetProject(), mViewInfo, and ProcessUIHandleResult().
|
private |
Definition at line 501 of file CellularPanel.cpp.
References DoContextMenu().
|
private |
Definition at line 586 of file CellularPanel.cpp.
References ChangeTarget(), GetFocusedCell(), GetProject(), HandleCursorForPresentMouseState(), HandleEscapeKey(), HandleModifierKey(), HasRotation(), mViewInfo, and ProcessUIHandleResult().
|
private |
Definition at line 653 of file CellularPanel.cpp.
References GetFocusedCell(), GetProject(), HandleEscapeKey(), HandleModifierKey(), mViewInfo, and ProcessUIHandleResult().
|
private |
Definition at line 1009 of file CellularPanel.cpp.
References DoKillFocus(), KeyboardCapture::IsHandler(), and KeyboardCapture::Release().
|
private |
This handles just generic mouse events. Then, based on our current state, we forward the mouse events to various interested parties.
Definition at line 706 of file CellularPanel.cpp.
References CancelDragging(), RefreshCode::Cancelled, ClearTargets(), FindCell(), GetProject(), HandleClick(), HandleMotion(), HandleWheelRotation(), IsMouseCaptured(), Leave(), mLastMouseState, mState, ProcessUIHandleResult(), size, CellularPanel::Filter::spEnteredPanel, Uncapture(), and UpdateMouseState().
Referenced by OnCaptureLost().
|
private |
Definition at line 991 of file CellularPanel.cpp.
References SetFocusedCell().
|
pure virtual |
Implemented in AdornedRulerPanel, and TrackPanel.
Referenced by CancelDragging(), DoContextMenu(), DoKillFocus(), HandleClick(), HandleMotion(), HandleWheelRotation(), OnCaptureKey(), OnChar(), OnKeyDown(), OnKeyUp(), and OnMouseEvent().
|
pure virtual |
Implemented in AdornedRulerPanel, and TrackPanel.
Referenced by FindCell(), and Visit().
|
pure virtual |
Implemented in AdornedRulerPanel, and TrackPanel.
Referenced by OnSetFocus().
UIHandlePtr CellularPanel::Target | ( | ) |
Definition at line 1204 of file CellularPanel.cpp.
References mState.
Referenced by ChangeTarget(), TrackPanel::DrawTracks(), anonymous_namespace{LabelTrackView.cpp}::findHit(), HandleClick(), HandleEscapeKey(), HandleMotion(), HasEscape(), HasRotation(), and TrackPanel::OnTrackListDeletion().
|
private |
Definition at line 163 of file CellularPanel.cpp.
References HandleMotion(), and CellularPanel::Filter::spClickedPanel.
Referenced by CancelDragging(), and OnMouseEvent().
|
private |
Definition at line 229 of file CellularPanel.cpp.
References mLastMouseState.
Referenced by HandleMotion(), and OnMouseEvent().
|
pure virtual |
Implemented in AdornedRulerPanel, and TrackPanel.
Referenced by HandleMotion().
|
private |
Definition at line 1112 of file CellularPanel.cpp.
References details::begin(), CellularPanel::Visitor::BeginGroup(), details::end(), CellularPanel::Visitor::EndGroup(), anonymous_namespace{CellularPanel.cpp}::Subdivide(), Visit(), CellularPanel::Visitor::VisitCell(), and TrackPanelGroup::X.
void CellularPanel::Visit | ( | Visitor & | visitor | ) |
Definition at line 1028 of file CellularPanel.cpp.
References Root(), and Visit().
Referenced by Visit(), VisitCells(), VisitPostorder(), and VisitPreorder().
void CellularPanel::VisitCells | ( | const SimpleCellVisitor & | visitor | ) |
Definition at line 1065 of file CellularPanel.cpp.
References Visit().
Referenced by FindRect(), and TrackPanel::FindRulerRects().
void CellularPanel::VisitPostorder | ( | const SimpleNodeVisitor & | visitor | ) |
Definition at line 1077 of file CellularPanel.cpp.
References Visit().
Referenced by Draw().
void CellularPanel::VisitPreorder | ( | const SimpleNodeVisitor & | visitor | ) |
Definition at line 1071 of file CellularPanel.cpp.
References Visit().
Referenced by FindRect().
|
protected |
Definition at line 165 of file CellularPanel.h.
Referenced by TrackPanel::DrawTracks(), HandleMotion(), OnMouseEvent(), and UpdateMouseState().
|
private |
Definition at line 169 of file CellularPanel.h.
Referenced by CancelDragging(), ChangeTarget(), ClearTargets(), DoKillFocus(), HandleClick(), HandleEscapeKey(), HandleInterruptedDrag(), HandleMotion(), HasEscape(), HasRotation(), IsMouseCaptured(), LastCell(), MostRecentXCoord(), OnCaptureKey(), OnCaptureLost(), OnMouseEvent(), and Target().
|
protected |
Definition at line 162 of file CellularPanel.h.
Referenced by AdornedRulerPanel::AdornedRulerPanel(), TrackPanel::DrawTracks(), TrackPanel::GetMostRecentXPos(), TrackPanel::GetViewInfo(), TrackPanel::HandlePageDownKey(), TrackPanel::HandlePageUpKey(), AdornedRulerPanel::HandleSnapping(), AdornedRulerPanel::OnAudioStartStop(), AdornedRulerPanel::OnAutoScroll(), OnCaptureKey(), OnChar(), OnKeyDown(), OnKeyUp(), TrackPanel::OnPaint(), AdornedRulerPanel::OnSelectionChange(), TrackPanel::OnSize(), TrackPanel::OnTimer(), AdornedRulerPanel::Pos2Time(), TrackPanel::RefreshTrack(), AdornedRulerPanel::SetLeftOffset(), AdornedRulerPanel::ShowMenu(), AdornedRulerPanel::Time2Pos(), TrackPanel::UpdateTrackVRuler(), TrackPanel::UpdateViewIfNoTracks(), and TrackPanel::UpdateVRulerSize().