Audacity  3.0.3
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 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 (TrackPanelCell *pCell=nullptr)
 
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 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 108 of file CellularPanel.cpp.

113 : OverlayPanel(parent, id, pos, size, style)
114 , mViewInfo( viewInfo )
115 , mState{ std::make_unique<State>() }
116 {
117  // Create the global event filter instance for CellularPanels only when the
118  // first CellularPanel is created, not sooner, so that the filter will be
119  // invoked before that for the application.
120  Filter::Create();
121 }

◆ ~CellularPanel()

CellularPanel::~CellularPanel ( )
overridedefault

Member Function Documentation

◆ CancelDragging()

bool CellularPanel::CancelDragging ( bool  escaping)
protected

Definition at line 158 of file CellularPanel.cpp.

159 {
160  auto &state = *mState;
161  if (state.mUIHandle) {
162  // copy shared_ptr for safety, as in HandleClick
163  auto handle = state.mUIHandle;
164  // UIHANDLE CANCEL
165  UIHandle::Result refreshResult = handle->Cancel(GetProject());
166  auto pClickedCell = state.mpClickedCell.lock();
167  if (pClickedCell)
169  pClickedCell.get(), {},
170  refreshResult | state.mMouseOverUpdateFlags );
171  state.mpClickedCell.reset();
172  state.mUIHandle.reset(), handle.reset(), ClearTargets();
173  Uncapture( escaping );
174  return true;
175  }
176  return false;
177 }

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 436 of file CellularPanel.cpp.

437 {
438  auto &state = *mState;
439  auto size = state.mTargets.size();
440 
441  auto target = Target();
442  if (target && target->HasRotation()) {
443  if(target->Rotate(forward))
444  return true;
445  else if (cycle && (size == 1 || IsMouseCaptured())) {
446  // Rotate through the states of this target only.
447  target->Enter(forward, GetProject());
448  return true;
449  }
450  }
451 
452  if (!cycle &&
453  ((forward && state.mTarget + 1 == size) ||
454  (!forward && state.mTarget == 0)))
455  return false;
456 
457  if (size > 1) {
458  if (forward)
459  ++state.mTarget;
460  else
461  state.mTarget += size - 1;
462  state.mTarget %= size;
463  if (Target())
464  Target()->Enter(forward, GetProject());
465  return true;
466  }
467 
468  return false;
469 }

References 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 1185 of file CellularPanel.cpp.

1186 {
1187  auto &state = *mState;
1188  // Forget the rotation of hit test candidates when the mouse moves from
1189  // cell to cell or outside of the panel entirely.
1190  state.mLastCell.reset();
1191  state.mTargets.clear();
1192  state.mTarget = 0;
1193  state.mMouseOverUpdateFlags = 0;
1194 }

References mState.

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

Here is the caller graph for this function:

◆ DoContextMenu()

void CellularPanel::DoContextMenu ( TrackPanelCell pCell = nullptr)
protected

Definition at line 942 of file CellularPanel.cpp.

943 {
944  if( !pCell ) {
945  pCell = GetFocusedCell();
946  if( !pCell )
947  return;
948  }
949 
950  const auto delegate = pCell->ContextMenuDelegate();
951  if (!delegate)
952  return;
953 
954  auto rect = FindRect( *delegate );
955  const UIHandle::Result refreshResult =
956  delegate->DoContextMenu(rect, this, nullptr, GetProject());
957 
958  // To do: use safer shared_ptr to pCell
959  ProcessUIHandleResult(pCell, pCell, refreshResult);
960 }

References TrackPanelCell::ContextMenuDelegate(), 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:

◆ Draw()

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

Definition at line 1202 of file CellularPanel.cpp.

1203 {
1204  const auto panelRect = GetClientRect();
1205  auto lastCell = LastCell();
1206  for ( unsigned iPass = 0; iPass < nPasses; ++iPass ) {
1207 
1208  VisitPostorder( [&]( const wxRect &rect, TrackPanelNode &node ) {
1209 
1210  // Draw the node
1211  const auto newRect = node.DrawingArea(
1212  context, rect, panelRect, iPass );
1213  if ( newRect.Intersects( panelRect ) )
1214  node.Draw( context, newRect, iPass );
1215 
1216  // Draw the current handle if it is associated with the node
1217  if ( &node == lastCell.get() ) {
1218  auto target = Target();
1219  if ( target ) {
1220  const auto targetRect =
1221  target->DrawingArea( context, rect, panelRect, iPass );
1222  if ( targetRect.Intersects( panelRect ) )
1223  target->Draw( context, targetRect, iPass );
1224  }
1225  }
1226 
1227  } ); // nodes
1228 
1229  } // passes
1230 }

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 1102 of file CellularPanel.cpp.

1103 {
1104  auto rect = this->GetClientRect();
1105  auto node = Root();
1106  while (node) {
1107  if ( auto pCell = std::dynamic_pointer_cast< TrackPanelCell >( node ) )
1108  // Found the bottom of the hierarchy
1109  return { pCell, rect };
1110  else if ( auto pGroup = dynamic_cast< TrackPanelGroup* >( node.get() ) ) {
1111  // Ask node for its subdivision
1112  const auto results = pGroup->Children( rect );
1113  const bool divideX = results.first == TrackPanelGroup::Axis::X;
1114  const auto &children = results.second;
1115 
1116  // Find the correct child
1117  const auto begin = children.begin(), end = children.end();
1118  auto iter = std::upper_bound( begin, end,
1119  (divideX ? mouseX : mouseY),
1120  [&]( wxCoord coord, const TrackPanelGroup::Child &child ) {
1121  return coord < child.first;
1122  }
1123  );
1124  if (iter == begin)
1125  break;
1126  --iter;
1127 
1128  // Descend the hierarchy of nodes
1129  rect = Subdivide(rect, divideX, children, iter);
1130  node = iter->second;
1131  }
1132  else
1133  // Nulls in the array of children are allowed, to define a void with
1134  // no cell
1135  break;
1136  }
1137 
1138  return { {}, {} };
1139 }

References 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 1155 of file CellularPanel.cpp.

1157 {
1158  wxRect result;
1159 
1160  struct Stop{};
1161  try { VisitPreorder( [&]( const wxRect &rect, TrackPanelNode &visited ) {
1162  if ( pred( visited ) )
1163  result = rect, throw Stop{};
1164  } ); }
1165  catch ( const Stop& ) {}
1166 
1167  return result;
1168 }

References VisitPreorder().

Here is the call graph for this function:

◆ FindRect() [2/2]

wxRect CellularPanel::FindRect ( const TrackPanelCell cell)

Definition at line 1141 of file CellularPanel.cpp.

1142 {
1143  wxRect result;
1144 
1145  struct Stop{};
1146  try { VisitCells( [&]( const wxRect &rect, TrackPanelCell &visited ) {
1147  if ( &visited == &cell )
1148  result = rect, throw Stop{};
1149  } ); }
1150  catch ( const Stop& ) {}
1151 
1152  return result;
1153 }

References VisitCells().

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

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

◆ GetFocusedCell()

virtual TrackPanelCell* CellularPanel::GetFocusedCell ( )
pure virtual

Implemented in TrackPanel, and AdornedRulerPanel.

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

Here is the caller graph for this function:

◆ GetProject()

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

Implemented in TrackPanel, and AdornedRulerPanel.

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

Here is the caller graph for this function:

◆ HandleClick()

void CellularPanel::HandleClick ( const TrackPanelMouseEvent tpmEvent)
private

Definition at line 883 of file CellularPanel.cpp.

884 {
885  auto pCell = tpmEvent.pCell;
886  // Do hit test once more, in case the button really pressed was not the
887  // one "anticipated."
888  {
889  TrackPanelMouseState tpmState{
890  tpmEvent.event,
891  tpmEvent.rect,
892  tpmEvent.pCell
893  };
894  HandleMotion( tpmState );
895  }
896 
897  auto &state = *mState;
898  state.mUIHandle = Target();
899  if (tpmEvent.event.RightDown() &&
900  !(state.mUIHandle && state.mUIHandle->HandlesRightClick())) {
901  if (auto pCell = state.mLastCell.lock())
902  state.mUIHandle = std::make_shared<DefaultRightButtonHandler>(pCell);
903  }
904 
905  if (state.mUIHandle) {
906  // UIHANDLE CLICK
907  // Make another shared pointer to the handle, in case recursive
908  // event dispatching otherwise tries to delete the handle.
909  auto handle = state.mUIHandle;
910  UIHandle::Result refreshResult =
911  handle->Click( tpmEvent, GetProject() );
912  if (refreshResult & RefreshCode::Cancelled)
913  state.mUIHandle.reset(), handle.reset(), ClearTargets();
914  else {
915  Filter::spActivePanel = this;
916 
917 #if wxUSE_TOOLTIPS
918  // Remove any outstanding tooltip
919  UnsetToolTip();
920 #endif
921 
922  if( !HasFocus() && AcceptsFocus() )
923  SetFocusIgnoringChildren();
924 
925  state.mpClickedCell = pCell;
926 
927  // Perhaps the clicked handle wants to update cursor and state message
928  // after a click.
929  TrackPanelMouseState tpmState{
930  tpmEvent.event,
931  tpmEvent.rect,
932  tpmEvent.pCell
933  };
934  HandleMotion( tpmState );
935  }
937  pCell.get(), pCell.get(), refreshResult);
938  state.mMouseOverUpdateFlags |= refreshResult;
939  }
940 }

References RefreshCode::Cancelled, ClearTargets(), TrackPanelMouseEvent::event, GetProject(), HandleMotion(), mState, TrackPanelMouseEvent::pCell, ProcessUIHandleResult(), TrackPanelMouseEvent::rect, CellularPanel::Filter::spActivePanel, 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 231 of file CellularPanel.cpp.

232 {
233  // Come here on modifier key or mouse button transitions,
234  // or on starting or stopping of play or record,
235  // or change of toolbar button,
236  // and change the cursor appropriately.
237 
238  // Get the button and key states
239  auto state = ::wxGetMouseState();
240  // Remap the position
241  state.SetPosition(this->ScreenToClient(state.GetPosition()));
242 
243  HandleMotion( state, doHit );
244 }

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 179 of file CellularPanel.cpp.

180 {
181  if (!down)
182  return false;
183 
184  {
185  auto target = Target();
186  if (target && target->HasEscape() && target->Escape(GetProject())) {
188  return true;
189  }
190  }
191 
192  auto &state = *mState;
193  if (state.mUIHandle) {
194  CancelDragging( true );
195  return true;
196  }
197 
198  if (ChangeTarget(true, false)) {
200  return true;
201  }
202 
203  return false;
204 }

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 125 of file CellularPanel.cpp.

126 {
127  auto &state = *mState;
128  if (state.mUIHandle &&
129  state.mUIHandle->StopsOnKeystroke() ) {
130  // The bogus id isn't used anywhere, but may help with debugging.
131  // as this is sending a bogus mouse up. The mouse button is still actually down
132  // and may go up again.
133  const int idBogusUp = 2;
134  wxMouseEvent evt { wxEVT_LEFT_UP };
135  evt.SetId( idBogusUp );
136  evt.SetPosition(this->ScreenToClient(::wxGetMousePosition()));
137  this->ProcessEvent(evt);
138  }
139 }

References mState.

Referenced by OnCaptureKey().

Here is the caller graph for this function:

◆ HandleModifierKey()

void CellularPanel::HandleModifierKey ( )
private

Definition at line 226 of file CellularPanel.cpp.

227 {
229 }

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 264 of file CellularPanel.cpp.

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

References ClearTargets(), TranslatableString::empty(), 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 253 of file CellularPanel.cpp.

254 {
255  UpdateMouseState( inState );
256 
257  const auto foundCell = FindCell( inState.m_x, inState.m_y );
258  auto &rect = foundCell.rect;
259  auto &pCell = foundCell.pCell;
260  const TrackPanelMouseState tpmState{ mLastMouseState, rect, pCell };
261  HandleMotion( tpmState, doHit );
262 }

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

Referenced by HandleClick(), HandleCursorForPresentMouseState(), 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 484 of file CellularPanel.cpp.

485 {
486  auto pCell = tpmEvent.pCell;
487  if (!pCell)
488  return;
489 
490  auto &event = tpmEvent.event;
491  double steps {};
492 #if defined(__WXMAC__) && defined(EVT_MAGNIFY)
493  // PRL:
494  // Pinch and spread implemented in wxWidgets 3.1.0, or cherry-picked from
495  // the future in custom build of 3.0.2
496  if (event.Magnify()) {
497  event.SetControlDown(true);
498  steps = 2 * event.GetMagnification();
499  }
500  else
501 #endif
502  {
503  steps = event.m_wheelRotation /
504  (event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0);
505  }
506 
507  if(event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL) {
508  // Two-fingered horizontal swipe on mac is treated like shift-mousewheel
509  event.SetShiftDown(true);
510  // This makes the wave move in the same direction as the fingers, and the scrollbar
511  // thumb moves oppositely
512  steps *= -1;
513  }
514 
515  tpmEvent.steps = steps;
516 
517  if(!event.HasAnyModifiers()) {
518  // We will later un-skip if we do anything, but if we don't,
519  // propagate the event up for the sake of the scrubber
520  event.Skip();
521  event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
522  }
523 
524  unsigned result =
525  pCell->HandleWheelRotation( tpmEvent, GetProject() );
527  pCell.get(), pCell.get(), result);
528 }

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 422 of file CellularPanel.cpp.

423 {
424  if (IsMouseCaptured())
425  return true;
426 
427  auto &state = *mState;
428  if (state.mTarget + 1 == state.mTargets.size() &&
429  Target() &&
430  !Target()->HasEscape())
431  return false;
432 
433  return state.mTargets.size() > 0;
434 }

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

Referenced by 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 412 of file CellularPanel.cpp.

413 {
414  auto &state = *mState;
415  // Is there a nontrivial TAB key rotation?
416  if ( state.mTargets.size() > 1 )
417  return true;
418  auto target = Target();
419  return target && target->HasRotation();
420 }

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 472 of file CellularPanel.cpp.

473 {
474  auto &state = *mState;
475  return state.mUIHandle != NULL;
476 }

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 1196 of file CellularPanel.cpp.

1197 {
1198  auto &state = *mState;
1199  return state.mLastCell.lock();
1200 }

References mState.

Referenced by Draw(), and AdornedRulerPanel::UpdateQuickPlayPos().

Here is the caller graph for this function:

◆ Leave()

void CellularPanel::Leave ( )
private

Definition at line 402 of file CellularPanel.cpp.

403 {
404  // Make transition into an empty CellularPanel state
405  auto state = ::wxGetMouseState();
406  const wxRect rect;
407  std::shared_ptr<TrackPanelCell> pCell;
408  TrackPanelMouseState tpmState{ state, rect, pCell };
409  HandleMotion( tpmState );
410 }

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 1179 of file CellularPanel.cpp.

1180 {
1181  auto &state = *mState;
1182  return state.mMouseMostRecentX;
1183 }

References mState.

Referenced by TrackPanel::GetMostRecentXPos().

Here is the caller graph for this function:

◆ OnCaptureKey()

void CellularPanel::OnCaptureKey ( wxCommandEvent &  event)
private

Definition at line 530 of file CellularPanel.cpp.

531 {
532  auto &state = *mState;
533  state.mEnableTab = false;
534  wxKeyEvent *kevent = static_cast<wxKeyEvent *>(event.GetEventObject());
535  const auto code = kevent->GetKeyCode();
536  if ( WXK_ESCAPE != code )
538 
539  // Give focused cell precedence
540  const auto t = GetFocusedCell();
541  if (t) {
542  const unsigned refreshResult =
543  t->CaptureKey(*kevent, *mViewInfo, this, GetProject());
544  ProcessUIHandleResult(t, t, refreshResult);
545  event.Skip(kevent->GetSkipped());
546  }
547 
548 #if 0
549  // Special TAB key handling, but only if the cell didn't capture it
550  if ( !(t && !kevent->GetSkipped()) &&
551  WXK_TAB == code && HasRotation() ) {
552  // Override TAB navigation in wxWidgets, by not skipping
553  event.Skip(false);
554  mEnableTab = true;
555  return;
556  }
557  else
558 #endif
559  if (!t)
560  event.Skip();
561 }

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 665 of file CellularPanel.cpp.

666 {
667  auto &state = *mState;
668  state.mUIHandle.reset();
669  Leave();
670 
671  // This is bad. We are lying abou the event by saying it is a mouse up.
672  wxMouseEvent e(wxEVT_LEFT_UP);
673  e.SetId( kCaptureLostEventId );
674 
675  e.m_x = state.mMouseMostRecentX;
676  e.m_y = state.mMouseMostRecentY;
677 
678  OnMouseEvent(e);
679 }

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

Here is the call graph for this function:

◆ OnChar()

void CellularPanel::OnChar ( wxKeyEvent &  event)
private

Definition at line 608 of file CellularPanel.cpp.

609 {
610  switch (event.GetKeyCode())
611  {
612  case WXK_ESCAPE:
613  case WXK_ALT:
614  case WXK_SHIFT:
615  case WXK_CONTROL:
616  case WXK_PAGEUP:
617  case WXK_PAGEDOWN:
618  return;
619  }
620 
621  const auto t = GetFocusedCell();
622  if (t) {
623  const unsigned refreshResult =
624  t->Char(event, *mViewInfo, this, GetProject());
625  ProcessUIHandleResult(t, t, refreshResult);
626  }
627  else
628  event.Skip();
629 }

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

Here is the call graph for this function:

◆ OnContextMenu()

void CellularPanel::OnContextMenu ( wxContextMenuEvent &  event)
private

Definition at line 478 of file CellularPanel.cpp.

479 {
480  DoContextMenu();
481 }

References DoContextMenu().

Here is the call graph for this function:

◆ OnKeyDown()

void CellularPanel::OnKeyDown ( wxKeyEvent &  event)
private

Definition at line 563 of file CellularPanel.cpp.

564 {
565  switch (event.GetKeyCode())
566  {
567  case WXK_ESCAPE:
568  // This switch case is now redundant with the global filter
569  if(HandleEscapeKey(true))
570  // Don't skip the event, eat it so that
571  // AudacityApp does not also stop any playback.
572  return;
573  else
574  break;
575 
576  case WXK_ALT:
577  case WXK_SHIFT:
578  case WXK_CONTROL:
579 #ifdef __WXOSX__
580  case WXK_RAW_CONTROL:
581 #endif
583  break;
584 
585 #if 0
586  case WXK_TAB:
587  if ( mEnableTab && HasRotation() ) {
588  ChangeTarget( !event.ShiftDown(), true );
590  return;
591  }
592  else
593  break;
594 #endif
595  }
596 
597  const auto t = GetFocusedCell();
598 
599  if (t) {
600  const unsigned refreshResult =
601  t->KeyDown(event, *mViewInfo, this, GetProject());
602  ProcessUIHandleResult(t, t, refreshResult);
603  }
604  else
605  event.Skip();
606 }

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 631 of file CellularPanel.cpp.

632 {
633  bool didSomething = false;
634  switch (event.GetKeyCode())
635  {
636  case WXK_ESCAPE:
637  didSomething = HandleEscapeKey(false);
638  break;
639 
640  case WXK_ALT:
641  case WXK_SHIFT:
642  case WXK_CONTROL:
643 #ifdef __WXOSX__
644  case WXK_RAW_CONTROL:
645 #endif
647  break;
648  }
649 
650  if (didSomething)
651  return;
652 
653  const auto t = GetFocusedCell();
654  if (t) {
655  const unsigned refreshResult =
656  t->KeyUp(event, *mViewInfo, this, GetProject());
657  ProcessUIHandleResult(t, t, refreshResult);
658  return;
659  }
660 
661  event.Skip();
662 }

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 968 of file CellularPanel.cpp.

969 {
970  if (auto pCell = GetFocusedCell()) {
971  auto refreshResult = pCell->LoseFocus(GetProject());
972  auto &state = *mState;
973  auto pClickedCell = state.mpClickedCell.lock();
974  if (pClickedCell)
975  ProcessUIHandleResult( pClickedCell.get(), {}, refreshResult );
976  }
977  if (KeyboardCapture::IsHandler(this))
978  {
980  }
981  Refresh( false);
982 }

References GetFocusedCell(), GetProject(), KeyboardCapture::IsHandler(), mState, ProcessUIHandleResult(), 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 684 of file CellularPanel.cpp.

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

References CancelDragging(), RefreshCode::Cancelled, ClearTargets(), FindCell(), GetProject(), HandleClick(), HandleMotion(), HandleWheelRotation(), IsMouseCaptured(), Leave(), mLastMouseState, mState, ProcessUIHandleResult(), size, CellularPanel::Filter::spActivePanel, 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 962 of file CellularPanel.cpp.

963 {
964  SetFocusedCell();
965  Refresh( false);
966 }

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 TrackPanel, and AdornedRulerPanel.

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

Here is the caller graph for this function:

◆ Root()

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

Implemented in TrackPanel, and AdornedRulerPanel.

Referenced by FindCell(), and Visit().

Here is the caller graph for this function:

◆ SetFocusedCell()

virtual void CellularPanel::SetFocusedCell ( )
pure virtual

Implemented in TrackPanel, and AdornedRulerPanel.

Referenced by OnSetFocus().

Here is the caller graph for this function:

◆ Target()

UIHandlePtr CellularPanel::Target ( )

Definition at line 1170 of file CellularPanel.cpp.

1171 {
1172  auto &state = *mState;
1173  if (state.mTargets.size())
1174  return state.mTargets[state.mTarget];
1175  else
1176  return {};
1177 }

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 141 of file CellularPanel.cpp.

142 {
143  auto state = ::wxGetMouseState();
144  if (!pState) {
145  // Remap the position
146  state.SetPosition(this->ScreenToClient(state.GetPosition()));
147  pState = &state;
148  }
149 
150  if (HasCapture())
151  ReleaseMouse();
152  HandleMotion( *pState );
153 
154  if ( escaping || !AcceptsFocus() )
155  Filter::spActivePanel = nullptr;
156 }

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

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 206 of file CellularPanel.cpp.

207 {
208  mLastMouseState = state;
209 
210  // Simulate a down button if none, so hit test routines can anticipate
211  // which button will be clicked
212  if (!state.ButtonIsDown(wxMOUSE_BTN_ANY)) {
213 #ifdef __WXOSX__
214  if (state.RawControlDown())
215  // On Mac we can distinctly anticipate "right" click (as Control+click)
216  mLastMouseState.SetRightDown( true ),
217  mLastMouseState.SetLeftDown( false );
218  else
219 #endif
220  // Anticipate a left click by default
221  mLastMouseState.SetRightDown( false ),
222  mLastMouseState.SetLeftDown( true );
223  }
224 }

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 TrackPanel, and AdornedRulerPanel.

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 1078 of file CellularPanel.cpp.

1081 {
1082  if (auto pCell = dynamic_cast<TrackPanelCell*>(node.get()))
1083  visitor.VisitCell( rect, *pCell );
1084  else if (auto pGroup = dynamic_cast<TrackPanelGroup*>(node.get())) {
1085  visitor.BeginGroup( rect, *pGroup );
1086 
1087  // Recur on children
1088  const auto results = pGroup->Children( rect );
1089  const bool divideX = results.first == TrackPanelGroup::Axis::X;
1090  const auto &children = results.second;
1091  const auto begin = children.begin(), end = children.end();
1092  for (auto iter = begin; iter != end; ++iter)
1093  Visit(
1094  Subdivide(rect, divideX, children, iter), iter->second, visitor );
1095 
1096  visitor.EndGroup( rect, *pGroup );
1097  }
1098  else
1099  return;
1100 }

References CellularPanel::Visitor::BeginGroup(), 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 994 of file CellularPanel.cpp.

995 {
996  Visit( GetClientRect(), Root(), visitor );
997 }

References Root().

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 1031 of file CellularPanel.cpp.

1032 {
1033  Adaptor adaptor{ visitor };
1034  Visit( adaptor );
1035 }

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 1043 of file CellularPanel.cpp.

1044 {
1045  Adaptor adaptor{ visitor, false };
1046  Visit( adaptor );
1047 }

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 1037 of file CellularPanel.cpp.

1038 {
1039  Adaptor adaptor{ visitor, true };
1040  Visit( adaptor );
1041 }

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:
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
TrackPanelMouseEvent::pCell
std::shared_ptr< TrackPanelCell > pCell
Definition: TrackPanelMouseEvent.h:61
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
CellularPanel::Uncapture
void Uncapture(bool escaping, wxMouseState *pState=nullptr)
Definition: CellularPanel.cpp:141
CellularPanel::GetFocusedCell
virtual TrackPanelCell * GetFocusedCell()=0
TrackPanelMouseState::pCell
std::shared_ptr< TrackPanelCell > pCell
Definition: TrackPanelMouseEvent.h:40
TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
wxPanelWrapper::SetToolTip
void SetToolTip(const TranslatableString &toolTip)
Definition: wxPanelWrapper.cpp:56
CellularPanel::HandleCursorForPresentMouseState
void HandleCursorForPresentMouseState(bool doHit=true)
Definition: CellularPanel.cpp:231
CellularPanel::VisitPostorder
void VisitPostorder(const SimpleNodeVisitor &visitor)
Definition: CellularPanel.cpp:1043
CellularPanel::LastCell
std::shared_ptr< TrackPanelCell > LastCell() const
Definition: CellularPanel.cpp:1196
CellularPanel::Filter::spActivePanel
static wxWeakRef< CellularPanel > spActivePanel
Definition: CellularPanel.cpp:73
TrackPanelMouseEvent::rect
const wxRect & rect
Definition: TrackPanelMouseEvent.h:59
OverlayPanel::OverlayPanel
OverlayPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style=wxTAB_TRAVERSAL|wxNO_BORDER)
Definition: OverlayPanel.cpp:17
RefreshCode::RefreshNone
@ RefreshNone
Definition: RefreshCode.h:21
KeyboardCapture::Release
void Release(wxWindow *handler)
Definition: KeyboardCapture.cpp:75
KeyboardCapture::IsHandler
bool IsHandler(const wxWindow *handler)
Definition: KeyboardCapture.cpp:60
CellularPanel::mViewInfo
ViewInfo * mViewInfo
Definition: CellularPanel.h:161
CellularPanel::Filter::Create
static void Create()
Definition: CellularPanel.cpp:56
CellularPanel::Leave
void Leave()
Definition: CellularPanel.cpp:402
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
TrackPanelDrawable::DrawingArea
virtual wxRect DrawingArea(TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
Definition: TrackPanelDrawable.cpp:22
CellularPanel::ClearTargets
void ClearTargets()
Definition: CellularPanel.cpp:1185
CellularPanel::FindRect
wxRect FindRect(const TrackPanelCell &cell)
Definition: CellularPanel.cpp:1141
TrackPanelGroup::Child
std::pair< wxCoord, std::shared_ptr< TrackPanelNode > > Child
Definition: TrackPanelCell.h:63
CellularPanel::ProcessUIHandleResult
virtual void ProcessUIHandleResult(TrackPanelCell *pClickedCell, TrackPanelCell *pLatestCell, unsigned refreshResult)=0
CellularPanel::Root
virtual std::shared_ptr< TrackPanelNode > Root()=0
TrackPanelGroup::Axis::X
@ X
CellularPanel::VisitPreorder
void VisitPreorder(const SimpleNodeVisitor &visitor)
Definition: CellularPanel.cpp:1037
CellularPanel::CancelDragging
bool CancelDragging(bool escaping)
Definition: CellularPanel.cpp:158
TrackPanelNode
The TrackPanel is built up of nodes, subtrees of the CellularPanel's area Common base class for Track...
Definition: TrackPanelCell.h:39
CellularPanel::OnMouseEvent
void OnMouseEvent(wxMouseEvent &event)
Definition: CellularPanel.cpp:684
CellularPanel::HasEscape
bool HasEscape()
Definition: CellularPanel.cpp:422
CellularPanel::HandleEscapeKey
bool HandleEscapeKey(bool down)
Definition: CellularPanel.cpp:179
CellularPanel::Visit
void Visit(Visitor &visitor)
Definition: CellularPanel.cpp:994
CellularPanel::ChangeTarget
bool ChangeTarget(bool forward, bool cycle)
Definition: CellularPanel.cpp:436
CellularPanel::mState
std::unique_ptr< State > mState
Definition: CellularPanel.h:167
UIHandle::Result
unsigned Result
Definition: UIHandle.h:38
CellularPanel::HandleInterruptedDrag
void HandleInterruptedDrag()
Definition: CellularPanel.cpp:125
CellularPanel::UpdateMouseState
void UpdateMouseState(const wxMouseState &state)
Definition: CellularPanel.cpp:206
TrackPanelCell
Definition: TrackPanelCell.h:74
CellularPanel::IsMouseCaptured
bool IsMouseCaptured()
Determines if a modal tool is active.
Definition: CellularPanel.cpp:472
CellularPanel::Target
UIHandlePtr Target()
Definition: CellularPanel.cpp:1170
TrackPanelGroup
Definition: TrackPanelCell.h:47
TrackPanelCell::ContextMenuDelegate
virtual std::shared_ptr< TrackPanelCell > ContextMenuDelegate()
Definition: TrackPanelCell.h:104
CellularPanel::SetFocusedCell
virtual void SetFocusedCell()=0
CellularPanel::UpdateStatusMessage
virtual void UpdateStatusMessage(const TranslatableString &)=0
CellularPanel::HandleWheelRotation
void HandleWheelRotation(TrackPanelMouseEvent &tpmEvent)
Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling)
Definition: CellularPanel.cpp:484
TrackPanelMouseEvent
Definition: TrackPanelMouseEvent.h:46
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
CellularPanel::HasRotation
bool HasRotation()
Definition: CellularPanel.cpp:412
CellularPanel::mLastMouseState
wxMouseState mLastMouseState
Definition: CellularPanel.h:164
CellularPanel::VisitCells
void VisitCells(const SimpleCellVisitor &visitor)
Definition: CellularPanel.cpp:1031
CellularPanel::HandleClick
void HandleClick(const TrackPanelMouseEvent &tpmEvent)
Definition: CellularPanel.cpp:883
kCaptureLostEventId
const int kCaptureLostEventId
Definition: TrackPanelMouseEvent.h:23
CellularPanel::DoContextMenu
void DoContextMenu(TrackPanelCell *pCell=nullptr)
Definition: CellularPanel.cpp:942
CellularPanel::HandleMotion
void HandleMotion(wxMouseState &state, bool doHit=true)
Definition: CellularPanel.cpp:253
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
CellularPanel::HandleModifierKey
void HandleModifierKey()
Definition: CellularPanel.cpp:226
CellularPanel::FindCell
FoundCell FindCell(int mouseX, int mouseY)
Definition: CellularPanel.cpp:1102
anonymous_namespace{CellularPanel.cpp}::Subdivide
wxRect Subdivide(const wxRect &rect, bool divideX, const TrackPanelGroup::Refinement &children, const TrackPanelGroup::Refinement::const_iterator iter)
Definition: CellularPanel.cpp:1050
TrackPanelMouseEvent::event
wxMouseEvent & event
Definition: TrackPanelMouseEvent.h:58
TrackPanelMouseEvent::steps
double steps
Definition: TrackPanelMouseEvent.h:62
CellularPanel::GetProject
virtual AudacityProject * GetProject() const =0
TrackPanelDrawable::Draw
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
Definition: TrackPanelDrawable.cpp:17