MCPcopy Create free account
hub / github.com/audacity/audacity / OnMouse

Method OnMouse

src/toolbars/ToolManager.cpp:1101–1283  ·  view source on GitHub ↗

Handle toolbar dragging

Source from the content-addressed store, hash-verified

1099// Handle toolbar dragging
1100//
1101void ToolManager::OnMouse( wxMouseEvent & event )
1102{
1103 // Go ahead and set the event to propagate
1104 event.Skip();
1105
1106 // Can't do anything if we're not dragging. This also prevents
1107 // us from intercepting events that don't belong to us from the
1108 // parent since we're Connect()ed to a couple.
1109 if( !mClicked )
1110 {
1111 return;
1112 }
1113
1114#if defined(__WXMAC__)
1115 // Disable window animation
1116 wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
1117#endif
1118
1119 // Retrieve the event position
1120 wxPoint pos =
1121 ( (wxWindow *)event.GetEventObject() )->ClientToScreen( event.GetPosition() ) - mDragOffset;
1122
1123
1124 if( !event.LeftIsDown() )
1125 {
1126 // Button was released...finish the drag
1127 // Transition the bar to a dock
1128 if (!mDidDrag) {
1129 if (mPrevDock)
1130 mPrevDock->RestoreConfiguration(mPrevConfiguration);
1131 DoneDragging();
1132 return;
1133 }
1134 else if( mDragDock && !event.ShiftDown() )
1135 {
1136 // Trip over...everyone ashore that's going ashore...
1137 mDragDock->Dock( mDragBar, true, mDragBefore );
1138 Updated();
1139 mDragWindow->ClearBar();
1140
1141 // Done with the floater
1142 mDragWindow->Destroy();
1143 mDragWindow = nullptr;
1144 mDragBar->Refresh(false);
1145 }
1146 else
1147 {
1148 // Calling SetDocked() to force the grabber button to popup
1149 mDragBar->SetDocked( NULL, false );
1150 }
1151
1152 DoneDragging();
1153 }
1154 else if( event.Dragging() && pos != mLastPos )
1155 {
1156 if (!mDidDrag) {
1157 // Must set the bar afloat if it's currently docked
1158 mDidDrag = true;

Callers

nothing calls this directly

Calls 15

SkipMethod · 0.80
RestoreConfigurationMethod · 0.80
DockMethod · 0.80
ClearBarMethod · 0.80
MoveMethod · 0.80
SetPositionMethod · 0.80
IntersectsMethod · 0.80
PositionBarMethod · 0.80
GetHeightMethod · 0.80
GetBoxMethod · 0.80
wxPointClass · 0.70
DestroyMethod · 0.45

Tested by

no test coverage detected