Audacity 3.2.0
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CellularPanel Class Referenceabstract

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>

Inheritance diagram for CellularPanel:
[legend]
Collaboration diagram for CellularPanel:
[legend]

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 AudacityProjectGetProject () const =0
 
virtual std::shared_ptr< TrackPanelNodeRoot ()=0
 
virtual std::shared_ptr< TrackPanelCellGetFocusedCell ()=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< TrackPanelCellLastCell () 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
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Protected Member Functions

bool HasEscape ()
 
bool CancelDragging (bool escaping)
 
void DoContextMenu (std::shared_ptr< TrackPanelCell > pCell)
 
void ClearTargets ()
 

Protected Attributes

ViewInfomViewInfo
 
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< StatemState
 

Detailed Description

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.

Member Typedef Documentation

◆ SimpleCellVisitor

using CellularPanel::SimpleCellVisitor = std::function< void( const wxRect &rect, TrackPanelCell &cell ) >

Definition at line 74 of file CellularPanel.h.

◆ SimpleNodeVisitor

using CellularPanel::SimpleNodeVisitor = std::function< void( const wxRect &rect, TrackPanelNode &node ) >

Definition at line 79 of file CellularPanel.h.

Constructor & Destructor Documentation

◆ CellularPanel()

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.

135: OverlayPanel(parent, id, pos, size, style)
136, mViewInfo( viewInfo )
137, mState{ std::make_unique<State>() }
138{
139 // Create the global event filter instance for CellularPanels only when the
140 // first CellularPanel is created, not sooner, so that the filter will be
141 // invoked before that for the application.
143}
std::unique_ptr< State > mState
ViewInfo * mViewInfo
OverlayPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style=wxTAB_TRAVERSAL|wxNO_BORDER)

◆ ~CellularPanel()

CellularPanel::~CellularPanel ( )
overridedefault

Member Function Documentation

◆ CancelDragging()

bool CellularPanel::CancelDragging ( bool  escaping)
protected

Definition at line 180 of file CellularPanel.cpp.

181{
182 auto &state = *mState;
183 if (state.mUIHandle) {
184 // copy shared_ptr for safety, as in HandleClick
185 auto handle = state.mUIHandle;
186 // UIHANDLE CANCEL
187 UIHandle::Result refreshResult = handle->Cancel(GetProject());
188 auto pClickedCell = state.mpClickedCell.lock();
189 if (pClickedCell)
191 pClickedCell.get(), {},
192 refreshResult | state.mMouseOverUpdateFlags );
193 state.mpClickedCell.reset();
194 state.mUIHandle.reset(), handle.reset(), ClearTargets();
195 Uncapture( escaping );
196 return true;
197 }
198 return false;
199}
virtual AudacityProject * GetProject() const =0
void Uncapture(bool escaping, wxMouseState *pState=nullptr)
virtual void ProcessUIHandleResult(TrackPanelCell *pClickedCell, TrackPanelCell *pLatestCell, unsigned refreshResult)=0
unsigned Result
Definition: UIHandle.h:40

References ClearTargets(), GetProject(), mState, ProcessUIHandleResult(), and Uncapture().

Referenced by HandleEscapeKey(), AdornedRulerPanel::OnAudioStartStop(), and OnMouseEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChangeTarget()

bool CellularPanel::ChangeTarget ( bool  forward,
bool  cycle 
)
private

Definition at line 459 of file CellularPanel.cpp.

460{
461 auto &state = *mState;
462 auto size = state.mTargets.size();
463
464 auto target = Target();
465 if (target && target->HasRotation()) {
466 if(target->Rotate(forward))
467 return true;
468 else if (cycle && (size == 1 || IsMouseCaptured())) {
469 // Rotate through the states of this target only.
470 target->Enter(forward, GetProject());
471 return true;
472 }
473 }
474
475 if (!cycle &&
476 ((forward && state.mTarget + 1 == size) ||
477 (!forward && state.mTarget == 0)))
478 return false;
479
480 if (size > 1) {
481 if (forward)
482 ++state.mTarget;
483 else
484 state.mTarget += size - 1;
485 state.mTarget %= size;
486 if (Target())
487 Target()->Enter(forward, GetProject());
488 return true;
489 }
490
491 return false;
492}
bool IsMouseCaptured()
Determines if a modal tool is active.
UIHandlePtr Target()

References forward, GetProject(), IsMouseCaptured(), mState, size, and Target().

Referenced by HandleEscapeKey(), and OnKeyDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClearTargets()

void CellularPanel::ClearTargets ( )
protected

Definition at line 1219 of file CellularPanel.cpp.

1220{
1221 auto &state = *mState;
1222 // Forget the rotation of hit test candidates when the mouse moves from
1223 // cell to cell or outside of the panel entirely.
1224 state.mLastCell.reset();
1225 state.mTargets.clear();
1226 state.mTarget = 0;
1227 state.mMouseOverUpdateFlags = 0;
1228}

References mState.

Referenced by CancelDragging(), HandleClick(), HandleMotion(), AdornedRulerPanel::OnAudioStartStop(), and OnMouseEvent().

Here is the caller graph for this function:

◆ DoContextMenu()

void CellularPanel::DoContextMenu ( std::shared_ptr< TrackPanelCell pCell)
protected

Definition at line 969 of file CellularPanel.cpp.

970{
971 if( !pCell ) {
972 pCell = GetFocusedCell();
973 if( !pCell )
974 return;
975 }
976
977 std::weak_ptr<TrackPanelCell> wCell = pCell;
978
979 const auto delegate = pCell->ContextMenuDelegate();
980 if (!delegate)
981 return;
982
983 auto rect = FindRect( *delegate );
984 const UIHandle::Result refreshResult =
985 delegate->DoContextMenu(rect, this, nullptr, GetProject());
986 pCell.reset();
987
988 ProcessUIHandleResult(wCell.lock().get(), wCell.lock().get(), refreshResult);
989}
virtual std::shared_ptr< TrackPanelCell > GetFocusedCell()=0
wxRect FindRect(const TrackPanelCell &cell)

References FindRect(), GetFocusedCell(), GetProject(), and ProcessUIHandleResult().

Referenced by OnContextMenu(), and TrackPanel::OnTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoKillFocus()

void CellularPanel::DoKillFocus ( )
private

Definition at line 997 of file CellularPanel.cpp.

998{
999 if (auto pCell = GetFocusedCell()) {
1000 auto refreshResult = pCell->LoseFocus(GetProject());
1001 auto &state = *mState;
1002 auto pClickedCell = state.mpClickedCell.lock();
1003 if (pClickedCell)
1004 ProcessUIHandleResult( pClickedCell.get(), {}, refreshResult );
1005 }
1006 Refresh( false);
1007}

References GetFocusedCell(), GetProject(), mState, and ProcessUIHandleResult().

Referenced by OnKillFocus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Draw()

void CellularPanel::Draw ( TrackPanelDrawingContext context,
unsigned  nPasses 
)

Definition at line 1236 of file CellularPanel.cpp.

1237{
1238 const auto panelRect = GetClientRect();
1239 auto lastCell = LastCell();
1240 for ( unsigned iPass = 0; iPass < nPasses; ++iPass ) {
1241
1242 VisitPostorder( [&]( const wxRect &rect, TrackPanelNode &node ) {
1243
1244 // Draw the node
1245 const auto newRect = node.DrawingArea(
1246 context, rect, panelRect, iPass );
1247 if ( newRect.Intersects( panelRect ) )
1248 node.Draw( context, newRect, iPass );
1249
1250 // Draw the current handle if it is associated with the node
1251 if ( &node == lastCell.get() ) {
1252 auto target = Target();
1253 if ( target ) {
1254 const auto targetRect =
1255 target->DrawingArea( context, rect, panelRect, iPass );
1256 if ( targetRect.Intersects( panelRect ) )
1257 target->Draw( context, targetRect, iPass );
1258 }
1259 }
1260
1261 } ); // nodes
1262
1263 } // passes
1264}
std::shared_ptr< TrackPanelCell > LastCell() const
void VisitPostorder(const SimpleNodeVisitor &visitor)
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
virtual wxRect DrawingArea(TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
The TrackPanel is built up of nodes, subtrees of the CellularPanel's area Common base class for Track...

References TrackPanelDrawable::Draw(), TrackPanelDrawable::DrawingArea(), LastCell(), and VisitPostorder().

Referenced by TrackPanel::DrawTracks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindCell()

auto CellularPanel::FindCell ( int  mouseX,
int  mouseY 
)

Definition at line 1136 of file CellularPanel.cpp.

1137{
1138 auto rect = this->GetClientRect();
1139 auto node = Root();
1140 while (node) {
1141 if ( auto pCell = std::dynamic_pointer_cast< TrackPanelCell >( node ) )
1142 // Found the bottom of the hierarchy
1143 return { pCell, rect };
1144 else if ( auto pGroup = dynamic_cast< TrackPanelGroup* >( node.get() ) ) {
1145 // Ask node for its subdivision
1146 const auto results = pGroup->Children( rect );
1147 const bool divideX = results.first == TrackPanelGroup::Axis::X;
1148 const auto &children = results.second;
1149
1150 // Find the correct child
1151 const auto begin = children.begin(), end = children.end();
1152 auto iter = std::upper_bound( begin, end,
1153 (divideX ? mouseX : mouseY),
1154 [&]( wxCoord coord, const TrackPanelGroup::Child &child ) {
1155 return coord < child.first;
1156 }
1157 );
1158 if (iter == begin)
1159 break;
1160 --iter;
1161
1162 // Descend the hierarchy of nodes
1163 rect = Subdivide(rect, divideX, children, iter);
1164 node = iter->second;
1165 }
1166 else
1167 // Nulls in the array of children are allowed, to define a void with
1168 // no cell
1169 break;
1170 }
1171
1172 return { {}, {} };
1173}
virtual std::shared_ptr< TrackPanelNode > Root()=0
std::pair< wxCoord, std::shared_ptr< TrackPanelNode > > Child
wxRect Subdivide(const wxRect &rect, bool divideX, const TrackPanelGroup::Refinement &children, const TrackPanelGroup::Refinement::const_iterator iter)
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References details::begin(), details::end(), Root(), anonymous_namespace{CellularPanel.cpp}::Subdivide(), and TrackPanelGroup::X.

Referenced by HandleMotion(), OnMouseEvent(), and TrackPanel::OnMouseEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindRect() [1/2]

wxRect CellularPanel::FindRect ( const std::function< bool(TrackPanelNode &) > &  pred)

Definition at line 1189 of file CellularPanel.cpp.

1191{
1192 wxRect result;
1193
1194 struct Stop{};
1195 try { VisitPreorder( [&]( const wxRect &rect, TrackPanelNode &visited ) {
1196 if ( pred( visited ) )
1197 result = rect, throw Stop{};
1198 } ); }
1199 catch ( const Stop& ) {}
1200
1201 return result;
1202}
void VisitPreorder(const SimpleNodeVisitor &visitor)

References VisitPreorder().

Here is the call graph for this function:

◆ FindRect() [2/2]

wxRect CellularPanel::FindRect ( const TrackPanelCell cell)

Definition at line 1175 of file CellularPanel.cpp.

1176{
1177 wxRect result;
1178
1179 struct Stop{};
1180 try { VisitCells( [&]( const wxRect &rect, TrackPanelCell &visited ) {
1181 if ( &visited == &cell )
1182 result = rect, throw Stop{};
1183 } ); }
1184 catch ( const Stop& ) {}
1185
1186 return result;
1187}
void VisitCells(const SimpleCellVisitor &visitor)

References VisitCells().

Referenced by DoContextMenu(), TrackPanel::FindTrackRect(), WaveTrackControls::PanSlider(), and WaveTrackControls::VolumeSlider().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFocusedCell()

virtual std::shared_ptr< TrackPanelCell > CellularPanel::GetFocusedCell ( )
pure virtual

Implemented in AdornedRulerPanel, and TrackPanel.

Referenced by DoContextMenu(), DoKillFocus(), OnCaptureKey(), OnChar(), OnKeyDown(), and OnKeyUp().

Here is the caller graph for this function:

◆ GetProject()

virtual AudacityProject * CellularPanel::GetProject ( ) const
pure virtual

Implemented in AdornedRulerPanel, and TrackPanel.

Referenced by CancelDragging(), ChangeTarget(), DoContextMenu(), DoKillFocus(), HandleClick(), HandleEscapeKey(), HandleMotion(), HandleWheelRotation(), HasEscape(), OnCaptureKey(), OnChar(), OnKeyDown(), OnKeyUp(), and OnMouseEvent().

Here is the caller graph for this function:

◆ HandleClick()

void CellularPanel::HandleClick ( const TrackPanelMouseEvent tpmEvent)
private

Definition at line 910 of file CellularPanel.cpp.

911{
912 auto pCell = tpmEvent.pCell;
913 // Do hit test once more, in case the button really pressed was not the
914 // one "anticipated."
915 {
916 TrackPanelMouseState tpmState{
917 tpmEvent.event,
918 tpmEvent.rect,
919 tpmEvent.pCell
920 };
921 HandleMotion( tpmState );
922 }
923
924 auto &state = *mState;
925 state.mUIHandle = Target();
926 if (tpmEvent.event.RightDown() &&
927 !(state.mUIHandle && state.mUIHandle->HandlesRightClick())) {
928 if (auto pCell = state.mLastCell.lock())
929 state.mUIHandle = std::make_shared<DefaultRightButtonHandler>(pCell);
930 }
931
932 if (state.mUIHandle) {
933 // UIHANDLE CLICK
934 // Make another shared pointer to the handle, in case recursive
935 // event dispatching otherwise tries to delete the handle.
936 auto handle = state.mUIHandle;
937 UIHandle::Result refreshResult =
938 handle->Click( tpmEvent, GetProject() );
939 if (refreshResult & RefreshCode::Cancelled)
940 state.mUIHandle.reset(), handle.reset(), ClearTargets();
941 else {
943
944#if wxUSE_TOOLTIPS
945 // Remove any outstanding tooltip
946 UnsetToolTip();
947#endif
948
949 if( !HasFocus() && AcceptsFocus() )
950 SetFocusIgnoringChildren();
951
952 state.mpClickedCell = pCell;
953
954 // Perhaps the clicked handle wants to update cursor and state message
955 // after a click.
956 TrackPanelMouseState tpmState{
957 tpmEvent.event,
958 tpmEvent.rect,
959 tpmEvent.pCell
960 };
961 HandleMotion( tpmState );
962 }
964 pCell.get(), pCell.get(), refreshResult);
965 state.mMouseOverUpdateFlags |= refreshResult;
966 }
967}
void HandleMotion(wxMouseState &state, bool doHit=true)
static wxWeakRef< CellularPanel > spClickedPanel
std::shared_ptr< TrackPanelCell > pCell

References RefreshCode::Cancelled, ClearTargets(), TrackPanelMouseEvent::event, GetProject(), HandleMotion(), mState, TrackPanelMouseEvent::pCell, ProcessUIHandleResult(), TrackPanelMouseEvent::rect, CellularPanel::Filter::spClickedPanel, and Target().

Referenced by OnMouseEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleCursorForPresentMouseState()

void CellularPanel::HandleCursorForPresentMouseState ( bool  doHit = true)

Definition at line 254 of file CellularPanel.cpp.

255{
256 // Come here on modifier key or mouse button transitions,
257 // or on starting or stopping of play or record,
258 // or change of toolbar button,
259 // and change the cursor appropriately.
260
261 // Get the button and key states
262 auto state = ::wxGetMouseState();
263 // Remap the position
264 state.SetPosition(this->ScreenToClient(state.GetPosition()));
265
266 HandleMotion( state, doHit );
267}

References HandleMotion().

Referenced by HandleEscapeKey(), HandleModifierKey(), TrackPanel::OnAudioIO(), OnKeyDown(), AdornedRulerPanel::Refresh(), and TrackPanel::Refresh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleEscapeKey()

bool CellularPanel::HandleEscapeKey ( bool  down)
private

Definition at line 201 of file CellularPanel.cpp.

202{
203 if (!down)
204 return false;
205
206 {
207 auto target = Target();
208 const auto pProject = GetProject();
209 if (target && target->HasEscape(pProject) && target->Escape(pProject)) {
211 return true;
212 }
213 }
214
215 auto &state = *mState;
216 if (state.mUIHandle) {
217 CancelDragging( true );
218 return true;
219 }
220
221 if (ChangeTarget(true, false)) {
223 return true;
224 }
225
226 return false;
227}
bool CancelDragging(bool escaping)
bool ChangeTarget(bool forward, bool cycle)
void HandleCursorForPresentMouseState(bool doHit=true)

References CancelDragging(), ChangeTarget(), GetProject(), HandleCursorForPresentMouseState(), mState, and Target().

Referenced by OnKeyDown(), and OnKeyUp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleInterruptedDrag()

void CellularPanel::HandleInterruptedDrag ( )
private

Definition at line 147 of file CellularPanel.cpp.

148{
149 auto &state = *mState;
150 if (state.mUIHandle &&
151 state.mUIHandle->StopsOnKeystroke() ) {
152 // The bogus id isn't used anywhere, but may help with debugging.
153 // as this is sending a bogus mouse up. The mouse button is still actually down
154 // and may go up again.
155 const int idBogusUp = 2;
156 wxMouseEvent evt { wxEVT_LEFT_UP };
157 evt.SetId( idBogusUp );
158 evt.SetPosition(this->ScreenToClient(::wxGetMousePosition()));
159 this->ProcessEvent(evt);
160 }
161}

References mState.

Referenced by OnCaptureKey().

Here is the caller graph for this function:

◆ HandleModifierKey()

void CellularPanel::HandleModifierKey ( )
private

Definition at line 249 of file CellularPanel.cpp.

References HandleCursorForPresentMouseState().

Referenced by OnKeyDown(), and OnKeyUp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleMotion() [1/2]

void CellularPanel::HandleMotion ( const TrackPanelMouseState tpmState,
bool  doHit = true 
)
private

Definition at line 287 of file CellularPanel.cpp.

289{
290 auto &state = *mState;
291 auto handle = state.mUIHandle;
292
293 auto newCell = tpmState.pCell;
294 auto oldCell = state.mLastCell.lock();
295 auto oldHandle = Target();
296
297 TranslatableString status, tooltip;
298 wxCursor *pCursor{};
299 unsigned refreshCode = 0;
300 if ( ! doHit ) {
301 // Dragging or not
302 handle = Target();
303
304 // Assume cell does not change but target does
305 refreshCode = state.mMouseOverUpdateFlags;
306 state.mMouseOverUpdateFlags = 0;
307 }
308 else if ( !state.mUIHandle ) {
309 // Not yet dragging.
310
311 unsigned updateFlags = state.mMouseOverUpdateFlags;
312
313 // First check whether crossing cell to cell
314 if ( newCell == oldCell )
315 oldCell.reset();
316 else {
317 // Forget old targets
318 ClearTargets();
319 // Re-draw any highlighting
320 if (oldCell) {
322 oldCell.get(), oldCell.get(), updateFlags);
323 }
324 }
325
326 auto oldPosition = state.mTarget;
327
328 // Now do the
329 // UIHANDLE HIT TEST !
330 state.mTargets.clear();
331 if (newCell)
332 state.mTargets = newCell->HitTest(tpmState, GetProject());
333 state.mTarget = 0;
334
335 // Find the old target's NEW place if we can
336 if (oldHandle) {
337 auto begin = state.mTargets.begin(), end = state.mTargets.end(),
338 iter = std::find(begin, end, oldHandle);
339 if (iter != end) {
340 size_t newPosition = iter - begin;
341 if (newPosition <= oldPosition)
342 state.mTarget = newPosition;
343 // else, some NEW hit at this position takes priority
344 }
345 }
346
347 handle = Target();
348
349 state.mLastCell = newCell;
350
351 // These lines caused P2 Bug 2617, repeated refreshing using all CPU.
352 // Disabling them might be causing something to not refresh,
353 // but so far I have not found a downside to disabling them. JKC
354
355 // VS: https://github.com/audacity/audacity/issues/1363
356 // Extensive refresh request fixed by using std::move on
357 // new envelope handle instance
358 if (!oldCell && oldHandle != handle)
359 // Did not move cell to cell, but did change the target
360 refreshCode = updateFlags;
361
362
363 if (handle && handle != oldHandle)
364 handle->Enter(true, GetProject());
365
366 if (oldHandle == handle)
367 oldHandle.reset();
368 }
369
370 // UIHANDLE PREVIEW
371 // Update status message and cursor, whether dragging or not
372 if (handle) {
373 auto preview = handle->Preview( tpmState, GetProject() );
374 status = preview.message;
375 tooltip = preview.tooltip;
376 pCursor = preview.cursor;
377 auto code = handle->GetChangeHighlight();
378 handle->SetChangeHighlight(RefreshCode::RefreshNone);
379 refreshCode |= code;
380 state.mMouseOverUpdateFlags |= code;
381 }
382 if (newCell &&
383 (!pCursor || status.empty() || tooltip.empty())) {
384 // Defaulting of cursor, tooltip, and status if there is no handle,
385 // or if the handle does not specify them
386 const auto preview = newCell->DefaultPreview( tpmState, GetProject() );
387 if (!pCursor)
388 pCursor = preview.cursor;
389 if (status.empty())
390 status = preview.message;
391 if (tooltip.empty())
392 tooltip = preview.tooltip;
393 }
394 if (!pCursor) {
395 // Ultimate default cursor
396 static wxCursor defaultCursor{ wxCURSOR_DEFAULT };
397 pCursor = &defaultCursor;
398 }
399
400 // Update status, tooltip, and cursor only if we're dragging, or the mouse
401 // was in one of our cells and nobody else is dragging
402 if (handle || (newCell && !wxWindow::GetCapture())) {
403 UpdateStatusMessage(status);
404
405#if wxUSE_TOOLTIPS
406 if (tooltip.Translation() != GetToolTipText()) {
407 // Unset first, by analogy with AButton
408 UnsetToolTip();
409 if (handle != oldHandle)
410 SetToolTip(tooltip);
411 }
412#endif
413
414 if (pCursor)
415 SetCursor( *pCursor );
416 }
417 else if ( oldCell || oldHandle )
418 // Leaving a cell or hit test target with no replacement
420
421 if (newCell)
422 ProcessUIHandleResult(newCell.get(), newCell.get(), refreshCode);
423}
virtual void UpdateStatusMessage(const TranslatableString &)=0
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
void SetToolTip(const TranslatableString &toolTip)
std::shared_ptr< TrackPanelCell > pCell

References details::begin(), ClearTargets(), TranslatableString::empty(), details::end(), GetProject(), mState, TrackPanelMouseState::pCell, ProcessUIHandleResult(), RefreshCode::RefreshNone, wxPanelWrapper::SetToolTip(), Target(), TranslatableString::Translation(), and UpdateStatusMessage().

Here is the call graph for this function:

◆ HandleMotion() [2/2]

void CellularPanel::HandleMotion ( wxMouseState &  inState,
bool  doHit = true 
)
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.

277{
278 UpdateMouseState( inState );
279
280 const auto foundCell = FindCell( inState.m_x, inState.m_y );
281 auto &rect = foundCell.rect;
282 auto &pCell = foundCell.pCell;
283 const TrackPanelMouseState tpmState{ mLastMouseState, rect, pCell };
284 HandleMotion( tpmState, doHit );
285}
void UpdateMouseState(const wxMouseState &state)
FoundCell FindCell(int mouseX, int mouseY)
wxMouseState mLastMouseState

References FindCell(), HandleMotion(), mLastMouseState, and UpdateMouseState().

Referenced by HandleClick(), HandleCursorForPresentMouseState(), HandleMotion(), Leave(), OnMouseEvent(), and Uncapture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleWheelRotation()

void CellularPanel::HandleWheelRotation ( TrackPanelMouseEvent tpmEvent)
private

Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling)

Definition at line 507 of file CellularPanel.cpp.

508{
509 auto pCell = tpmEvent.pCell;
510 if (!pCell)
511 return;
512
513 auto &event = tpmEvent.event;
514 double steps {};
515#if defined(__WXMAC__) && defined(EVT_MAGNIFY)
516 // PRL:
517 // Pinch and spread implemented in wxWidgets 3.1.0, or cherry-picked from
518 // the future in custom build of 3.0.2
519 if (event.Magnify()) {
520 event.SetControlDown(true);
521 steps = 2 * event.GetMagnification();
522 }
523 else
524#endif
525 {
526 steps = event.m_wheelRotation /
527 (event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0);
528 }
529
530 if(event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL) {
531 // Two-fingered horizontal swipe on mac is treated like shift-mousewheel
532 event.SetShiftDown(true);
533 // This makes the wave move in the same direction as the fingers, and the scrollbar
534 // thumb moves oppositely
535 steps *= -1;
536 }
537
538 tpmEvent.steps = steps;
539
540 if(!event.HasAnyModifiers()) {
541 // We will later un-skip if we do anything, but if we don't,
542 // propagate the event up for the sake of the scrubber
543 event.Skip();
544 event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
545 }
546
547 unsigned result =
548 pCell->HandleWheelRotation( tpmEvent, GetProject() );
550 pCell.get(), pCell.get(), result);
551}

References TrackPanelMouseEvent::event, GetProject(), TrackPanelMouseEvent::pCell, ProcessUIHandleResult(), and TrackPanelMouseEvent::steps.

Referenced by OnMouseEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasEscape()

bool CellularPanel::HasEscape ( )
protected

Definition at line 445 of file CellularPanel.cpp.

446{
447 if (IsMouseCaptured())
448 return true;
449
450 auto &state = *mState;
451 if (state.mTarget + 1 == state.mTargets.size() &&
452 Target() &&
454 return false;
455
456 return state.mTargets.size() > 0;
457}

References GetProject(), HasEscape(), IsMouseCaptured(), mState, and Target().

Referenced by HasEscape(), and TrackPanel::UpdateStatusMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasRotation()

bool CellularPanel::HasRotation ( )
private

Definition at line 435 of file CellularPanel.cpp.

436{
437 auto &state = *mState;
438 // Is there a nontrivial TAB key rotation?
439 if ( state.mTargets.size() > 1 )
440 return true;
441 auto target = Target();
442 return target && target->HasRotation();
443}

References mState, and Target().

Referenced by OnCaptureKey(), and OnKeyDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsMouseCaptured()

bool CellularPanel::IsMouseCaptured ( )

Determines if a modal tool is active.

Definition at line 495 of file CellularPanel.cpp.

496{
497 auto &state = *mState;
498 return state.mUIHandle != NULL;
499}

References mState.

Referenced by ChangeTarget(), HasEscape(), and OnMouseEvent().

Here is the caller graph for this function:

◆ LastCell()

std::shared_ptr< TrackPanelCell > CellularPanel::LastCell ( ) const

Definition at line 1230 of file CellularPanel.cpp.

1231{
1232 auto &state = *mState;
1233 return state.mLastCell.lock();
1234}

References mState.

Referenced by Draw().

Here is the caller graph for this function:

◆ Leave()

void CellularPanel::Leave ( )
private

Definition at line 425 of file CellularPanel.cpp.

426{
427 // Make transition into an empty CellularPanel state
428 auto state = ::wxGetMouseState();
429 const wxRect rect;
430 std::shared_ptr<TrackPanelCell> pCell;
431 TrackPanelMouseState tpmState{ state, rect, pCell };
432 HandleMotion( tpmState );
433}

References HandleMotion().

Referenced by OnCaptureLost(), and OnMouseEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MostRecentXCoord()

wxCoord CellularPanel::MostRecentXCoord ( ) const

Definition at line 1213 of file CellularPanel.cpp.

1214{
1215 auto &state = *mState;
1216 return state.mMouseMostRecentX;
1217}

References mState.

Referenced by TrackPanel::GetMostRecentXPos().

Here is the caller graph for this function:

◆ OnCaptureKey()

void CellularPanel::OnCaptureKey ( wxCommandEvent &  event)
private

Definition at line 553 of file CellularPanel.cpp.

554{
555 auto &state = *mState;
556 state.mEnableTab = false;
557 wxKeyEvent *kevent = static_cast<wxKeyEvent *>(event.GetEventObject());
558 const auto code = kevent->GetKeyCode();
559 if ( WXK_ESCAPE != code )
561
562 // Give focused cell precedence
563 const auto t = GetFocusedCell();
564 if (t) {
565 const unsigned refreshResult =
566 t->CaptureKey(*kevent, *mViewInfo, this, GetProject());
567 ProcessUIHandleResult(t.get(), t.get(), refreshResult);
568 event.Skip(kevent->GetSkipped());
569 }
570
571#if 0
572 // Special TAB key handling, but only if the cell didn't capture it
573 if ( !(t && !kevent->GetSkipped()) &&
574 WXK_TAB == code && HasRotation() ) {
575 // Override TAB navigation in wxWidgets, by not skipping
576 event.Skip(false);
577 mEnableTab = true;
578 return;
579 }
580 else
581#endif
582 if (!t)
583 event.Skip();
584}
void HandleInterruptedDrag()

References GetFocusedCell(), GetProject(), HandleInterruptedDrag(), HasRotation(), mState, mViewInfo, and ProcessUIHandleResult().

Here is the call graph for this function:

◆ OnCaptureLost()

void CellularPanel::OnCaptureLost ( wxMouseCaptureLostEvent &  event)
private

Should handle the case when the mouse capture is lost. (MSW only)

Definition at line 687 of file CellularPanel.cpp.

688{
689 auto &state = *mState;
690 state.mUIHandle.reset();
691 Leave();
692
693 // This is bad. We are lying abou the event by saying it is a mouse up.
694 wxMouseEvent e(wxEVT_LEFT_UP);
695 e.SetId( kCaptureLostEventId );
696
697 e.m_x = state.mMouseMostRecentX;
698 e.m_y = state.mMouseMostRecentY;
699
700 OnMouseEvent(e);
701}
const int kCaptureLostEventId
void OnMouseEvent(wxMouseEvent &event)

References kCaptureLostEventId, Leave(), mState, and OnMouseEvent().

Here is the call graph for this function:

◆ OnChar()

void CellularPanel::OnChar ( wxKeyEvent &  event)
private

Definition at line 630 of file CellularPanel.cpp.

631{
632 switch (event.GetKeyCode())
633 {
634 case WXK_ESCAPE:
635 case WXK_ALT:
636 case WXK_SHIFT:
637 case WXK_CONTROL:
638 case WXK_PAGEUP:
639 case WXK_PAGEDOWN:
640 return;
641 }
642
643 const auto t = GetFocusedCell();
644 if (t) {
645 const unsigned refreshResult =
646 t->Char(event, *mViewInfo, this, GetProject());
647 ProcessUIHandleResult(t.get(), t.get(), refreshResult);
648 }
649 else
650 event.Skip();
651}

References GetFocusedCell(), GetProject(), mViewInfo, and ProcessUIHandleResult().

Here is the call graph for this function:

◆ OnContextMenu()

void CellularPanel::OnContextMenu ( wxContextMenuEvent &  event)
private

Definition at line 501 of file CellularPanel.cpp.

502{
503 DoContextMenu({});
504}
void DoContextMenu(std::shared_ptr< TrackPanelCell > pCell)

References DoContextMenu().

Here is the call graph for this function:

◆ OnKeyDown()

void CellularPanel::OnKeyDown ( wxKeyEvent &  event)
private

Definition at line 586 of file CellularPanel.cpp.

587{
588 switch (event.GetKeyCode())
589 {
590 case WXK_ESCAPE:
591 // This switch case is now redundant with the global filter
592 if(HandleEscapeKey(true))
593 // Don't skip the event, eat it so that
594 // AudacityApp does not also stop any playback.
595 return;
596 else
597 break;
598
599 case WXK_ALT:
600 case WXK_SHIFT:
601 case WXK_CONTROL:
602#ifdef __WXOSX__
603 case WXK_RAW_CONTROL:
604#endif
606 break;
607
608#if 0
609 case WXK_TAB:
610 if ( mEnableTab && HasRotation() ) {
611 ChangeTarget( !event.ShiftDown(), true );
613 return;
614 }
615 else
616 break;
617#endif
618 }
619
620 const auto t = GetFocusedCell();
621 if (t) {
622 const unsigned refreshResult =
623 t->KeyDown(event, *mViewInfo, this, GetProject());
624 ProcessUIHandleResult(t.get(), t.get(), refreshResult);
625 }
626 else
627 event.Skip();
628}
void HandleModifierKey()
bool HandleEscapeKey(bool down)

References ChangeTarget(), GetFocusedCell(), GetProject(), HandleCursorForPresentMouseState(), HandleEscapeKey(), HandleModifierKey(), HasRotation(), mViewInfo, and ProcessUIHandleResult().

Here is the call graph for this function:

◆ OnKeyUp()

void CellularPanel::OnKeyUp ( wxKeyEvent &  event)
private

Definition at line 653 of file CellularPanel.cpp.

654{
655 bool didSomething = false;
656 switch (event.GetKeyCode())
657 {
658 case WXK_ESCAPE:
659 didSomething = HandleEscapeKey(false);
660 break;
661
662 case WXK_ALT:
663 case WXK_SHIFT:
664 case WXK_CONTROL:
665#ifdef __WXOSX__
666 case WXK_RAW_CONTROL:
667#endif
669 break;
670 }
671
672 if (didSomething)
673 return;
674
675 const auto t = GetFocusedCell();
676 if (t) {
677 const unsigned refreshResult =
678 t->KeyUp(event, *mViewInfo, this, GetProject());
679 ProcessUIHandleResult(t.get(), t.get(), refreshResult);
680 return;
681 }
682
683 event.Skip();
684}

References GetFocusedCell(), GetProject(), HandleEscapeKey(), HandleModifierKey(), mViewInfo, and ProcessUIHandleResult().

Here is the call graph for this function:

◆ OnKillFocus()

void CellularPanel::OnKillFocus ( wxFocusEvent &  event)
private

Definition at line 1009 of file CellularPanel.cpp.

1010{
1011 DoKillFocus();
1013 {
1015 }
1016}
bool IsHandler(const wxWindow *handler)
void Release(wxWindow *handler)

References DoKillFocus(), KeyboardCapture::IsHandler(), and KeyboardCapture::Release().

Here is the call graph for this function:

◆ OnMouseEvent()

void CellularPanel::OnMouseEvent ( wxMouseEvent &  event)
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.

708{
709 const auto foundCell = FindCell( event.m_x, event.m_y );
710 auto &rect = foundCell.rect;
711 auto &pCell = foundCell.pCell;
712
713 const auto size = GetSize();
714 TrackPanelMouseEvent tpmEvent{ event, rect, size, pCell };
715
716#if defined(__WXMAC__) && defined(EVT_MAGNIFY)
717 // PRL:
718 // Pinch and spread implemented in wxWidgets 3.1.0, or cherry-picked from
719 // the future in custom build of 3.0.2
720 if (event.Magnify()) {
721 HandleWheelRotation( tpmEvent );
722 }
723#endif
724
725 // If a mouse event originates from a keyboard context menu event then
726 // event.GetPosition() == wxDefaultPosition. wxContextMenu events are handled in
727 // CellularPanel::OnContextMenu(), and therefore associated mouse events are ignored here.
728 // Not ignoring them was causing bug 613: the mouse events were interpreted as clicking
729 // outside the tracks.
730 if (event.GetPosition() == wxDefaultPosition && (event.RightDown() || event.RightUp())) {
731 event.Skip();
732 return;
733 }
734
735 if (event.m_wheelRotation != 0)
736 HandleWheelRotation( tpmEvent );
737
738 if (event.LeftDown() || event.LeftIsDown() || event.Moving()) {
739 // Skip, even if we do something, so that the left click or drag
740 // may have an additional effect in the scrubber.
741 event.Skip();
742 event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
743 }
744
745 auto &state = *mState;
746 state.mMouseMostRecentX = event.m_x;
747 state.mMouseMostRecentY = event.m_y;
748
749 if (event.LeftDown()) {
750 // The activate event is used to make the
751 // parent window 'come alive' if it didn't have focus.
752 wxActivateEvent e;
753 GetParent()->GetEventHandler()->ProcessEvent(e);
754 }
755
756 if (event.Entering())
757 {
759 }
760 else if (event.Leaving())
761 {
762 if (Filter::spEnteredPanel == this)
763 Filter::spEnteredPanel = nullptr;
764 Leave();
765
766 auto buttons =
767 // Bug 1325: button state in Leaving events is unreliable on Mac.
768 // Poll the global state instead.
769 // event.ButtonIsDown(wxMOUSE_BTN_ANY);
770 ::wxGetMouseState().ButtonIsDown(wxMOUSE_BTN_ANY);
771
772 if (!buttons) {
773 CancelDragging( false );
774
775#if defined(__WXMAC__)
776
777 // We must install the cursor ourselves since the window under
778 // the mouse is no longer this one and wx2.8.12 makes that check.
779 // Should re-evaluate with wx3.
780 wxSTANDARD_CURSOR->MacInstall();
781#endif
782 }
783 }
784
785 if (state.mUIHandle) {
786 auto pClickedCell = state.mpClickedCell.lock();
787 if (event.Dragging()) {
788 // UIHANDLE DRAG
789 // copy shared_ptr for safety, as in HandleClick
790 auto handle = state.mUIHandle;
791 const UIHandle::Result refreshResult =
792 handle->Drag( tpmEvent, GetProject() );
794 (pClickedCell.get(), pCell.get(), refreshResult);
795 state.mMouseOverUpdateFlags |= refreshResult;
796 if (refreshResult & RefreshCode::Cancelled) {
797 // Drag decided to abort itself
798 state.mUIHandle.reset(), handle.reset(), ClearTargets();
799 state.mpClickedCell.reset();
800 Uncapture( false, &event );
801 }
802 else {
803 UpdateMouseState(event);
804 TrackPanelMouseState tpmState{ mLastMouseState, rect, pCell };
805 HandleMotion( tpmState );
806 }
807 }
808 else if (event.ButtonUp()) {
809 // UIHANDLE RELEASE
810 // copy shared_ptr for safety, as in HandleClick
811 auto handle = state.mUIHandle;
812 unsigned moreFlags = state.mMouseOverUpdateFlags;
813 UIHandle::Result refreshResult =
814 handle->Release( tpmEvent, GetProject(), this );
816 (pClickedCell.get(), pCell.get(),
817 refreshResult | moreFlags);
818 state.mUIHandle.reset(), handle.reset(), ClearTargets();
819 state.mpClickedCell.reset();
820 // will also Uncapture() below
821 }
822 }
823 else if ( event.GetEventType() == wxEVT_MOTION )
824 // Update status message and cursor, not during drag
825 // consider it not a drag, even if button is down during motion, if
826 // mUIHandle is null, as it becomes during interrupted drag
827 // (e.g. by hitting space to play while dragging an envelope point)
828 HandleMotion( event );
829 else if ( event.ButtonDown() || event.ButtonDClick() )
830 HandleClick( tpmEvent );
831
832 if (event.ButtonDown() && IsMouseCaptured()) {
833 if (!HasCapture())
834 CaptureMouse();
835 }
836
837 if (event.ButtonUp())
838 Uncapture( false );
839}
840catch( ... )
841{
842 // Abort any dragging, as if by hitting Esc
843 if ( CancelDragging( true ) )
844 ;
845 else {
846 Uncapture( true );
847 Refresh(false);
848 }
849 throw;
850}
void HandleWheelRotation(TrackPanelMouseEvent &tpmEvent)
Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling)
void HandleClick(const TrackPanelMouseEvent &tpmEvent)
static wxWeakRef< CellularPanel > spEnteredPanel

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSetFocus()

void CellularPanel::OnSetFocus ( wxFocusEvent &  event)
private

Definition at line 991 of file CellularPanel.cpp.

992{
994 Refresh( false);
995}
virtual void SetFocusedCell()=0

References SetFocusedCell().

Here is the call graph for this function:

◆ ProcessUIHandleResult()

virtual void CellularPanel::ProcessUIHandleResult ( TrackPanelCell pClickedCell,
TrackPanelCell pLatestCell,
unsigned  refreshResult 
)
pure virtual

Implemented in AdornedRulerPanel, and TrackPanel.

Referenced by CancelDragging(), DoContextMenu(), DoKillFocus(), HandleClick(), HandleMotion(), HandleWheelRotation(), OnCaptureKey(), OnChar(), OnKeyDown(), OnKeyUp(), and OnMouseEvent().

Here is the caller graph for this function:

◆ Root()

virtual std::shared_ptr< TrackPanelNode > CellularPanel::Root ( )
pure virtual

Implemented in AdornedRulerPanel, and TrackPanel.

Referenced by FindCell(), and Visit().

Here is the caller graph for this function:

◆ SetFocusedCell()

virtual void CellularPanel::SetFocusedCell ( )
pure virtual

Implemented in AdornedRulerPanel, and TrackPanel.

Referenced by OnSetFocus().

Here is the caller graph for this function:

◆ Target()

UIHandlePtr CellularPanel::Target ( )

Definition at line 1204 of file CellularPanel.cpp.

1205{
1206 auto &state = *mState;
1207 if (state.mTargets.size())
1208 return state.mTargets[state.mTarget];
1209 else
1210 return {};
1211}

References mState.

Referenced by ChangeTarget(), TrackPanel::DrawTracks(), anonymous_namespace{LabelTrackView.cpp}::findHit(), HandleClick(), HandleEscapeKey(), HandleMotion(), HasEscape(), HasRotation(), and TrackPanel::OnTrackListDeletion().

Here is the caller graph for this function:

◆ Uncapture()

void CellularPanel::Uncapture ( bool  escaping,
wxMouseState *  pState = nullptr 
)
private

Definition at line 163 of file CellularPanel.cpp.

164{
165 auto state = ::wxGetMouseState();
166 if (!pState) {
167 // Remap the position
168 state.SetPosition(this->ScreenToClient(state.GetPosition()));
169 pState = &state;
170 }
171
172 if (HasCapture())
173 ReleaseMouse();
174 HandleMotion( *pState );
175
176 if ( escaping || !AcceptsFocus() )
177 Filter::spClickedPanel = nullptr;
178}

References HandleMotion(), and CellularPanel::Filter::spClickedPanel.

Referenced by CancelDragging(), and OnMouseEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateMouseState()

void CellularPanel::UpdateMouseState ( const wxMouseState &  state)
private

Definition at line 229 of file CellularPanel.cpp.

230{
231 mLastMouseState = state;
232
233 // Simulate a down button if none, so hit test routines can anticipate
234 // which button will be clicked
235 if (!state.ButtonIsDown(wxMOUSE_BTN_ANY)) {
236#ifdef __WXOSX__
237 if (state.RawControlDown())
238 // On Mac we can distinctly anticipate "right" click (as Control+click)
239 mLastMouseState.SetRightDown( true ),
240 mLastMouseState.SetLeftDown( false );
241 else
242#endif
243 // Anticipate a left click by default
244 mLastMouseState.SetRightDown( false ),
245 mLastMouseState.SetLeftDown( true );
246 }
247}

References mLastMouseState.

Referenced by HandleMotion(), and OnMouseEvent().

Here is the caller graph for this function:

◆ UpdateStatusMessage()

virtual void CellularPanel::UpdateStatusMessage ( const TranslatableString )
pure virtual

Implemented in AdornedRulerPanel, and TrackPanel.

Referenced by HandleMotion().

Here is the caller graph for this function:

◆ Visit() [1/2]

void CellularPanel::Visit ( const wxRect &  rect,
const std::shared_ptr< TrackPanelNode > &  node,
Visitor visitor 
)
private

Definition at line 1112 of file CellularPanel.cpp.

1115{
1116 if (auto pCell = dynamic_cast<TrackPanelCell*>(node.get()))
1117 visitor.VisitCell( rect, *pCell );
1118 else if (auto pGroup = dynamic_cast<TrackPanelGroup*>(node.get())) {
1119 visitor.BeginGroup( rect, *pGroup );
1120
1121 // Recur on children
1122 const auto results = pGroup->Children( rect );
1123 const bool divideX = results.first == TrackPanelGroup::Axis::X;
1124 const auto &children = results.second;
1125 const auto begin = children.begin(), end = children.end();
1126 for (auto iter = begin; iter != end; ++iter)
1127 Visit(
1128 Subdivide(rect, divideX, children, iter), iter->second, visitor );
1129
1130 visitor.EndGroup( rect, *pGroup );
1131 }
1132 else
1133 return;
1134}
void Visit(Visitor &visitor)

References details::begin(), CellularPanel::Visitor::BeginGroup(), details::end(), CellularPanel::Visitor::EndGroup(), anonymous_namespace{CellularPanel.cpp}::Subdivide(), Visit(), CellularPanel::Visitor::VisitCell(), and TrackPanelGroup::X.

Here is the call graph for this function:

◆ Visit() [2/2]

void CellularPanel::Visit ( Visitor visitor)

Definition at line 1028 of file CellularPanel.cpp.

1029{
1030 Visit( GetClientRect(), Root(), visitor );
1031}

References Root(), and Visit().

Referenced by Visit(), VisitCells(), VisitPostorder(), and VisitPreorder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VisitCells()

void CellularPanel::VisitCells ( const SimpleCellVisitor visitor)

Definition at line 1065 of file CellularPanel.cpp.

1066{
1067 Adaptor adaptor{ visitor };
1068 Visit( adaptor );
1069}

References Visit().

Referenced by FindRect(), and TrackPanel::FindRulerRects().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VisitPostorder()

void CellularPanel::VisitPostorder ( const SimpleNodeVisitor visitor)

Definition at line 1077 of file CellularPanel.cpp.

1078{
1079 Adaptor adaptor{ visitor, false };
1080 Visit( adaptor );
1081}

References Visit().

Referenced by Draw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VisitPreorder()

void CellularPanel::VisitPreorder ( const SimpleNodeVisitor visitor)

Definition at line 1071 of file CellularPanel.cpp.

1072{
1073 Adaptor adaptor{ visitor, true };
1074 Visit( adaptor );
1075}

References Visit().

Referenced by FindRect().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mLastMouseState

wxMouseState CellularPanel::mLastMouseState
protected

◆ mState

std::unique_ptr<State> CellularPanel::mState
private

◆ mViewInfo

ViewInfo* CellularPanel::mViewInfo
protected

The documentation for this class was generated from the following files: