1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 16:48:44 +02:00

Merge: More for bug 1014: stop scrubbing when switching out of select tool...

This commit is contained in:
Paul Licameli 2015-06-08 09:56:28 -04:00
commit d556042e5b
4 changed files with 46 additions and 11 deletions

View File

@ -172,14 +172,14 @@
// Paul Licameli (PRL) 16 Apr 2015 // Paul Licameli (PRL) 16 Apr 2015
// Support for scrubbing in the AudioIO engine, without calls to it // Support for scrubbing in the AudioIO engine, without calls to it
#define EXPERIMENTAL_SCRUBBING_SUPPORT #define EXPERIMENTAL_SCRUBBING_SUPPORT
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
// The following enable parts of the scrubbing user interface. // The following enable parts of the scrubbing user interface.
// You must define EXPERIMENTAL_SCRUBBING_SUPPORT if you enable this: #define EXPERIMENTAL_SCRUBBING_BASIC
#define EXPERIMENTAL_SCRUBBING_BASIC #ifdef EXPERIMENTAL_SCRUBBING_BASIC
// You must define EXPERIMENTAL_SCRUBBING_BASIC if you enable this: #define EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
#define EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL #define EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
// You must define EXPERIMENTAL_SCRUBBING_BASIC if you enable this: #endif
#define EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL #endif
// Paul Licameli (PRL) 24 May 2015 // Paul Licameli (PRL) 24 May 2015
// Allow scrolling up to one half of a screenful beyond either end of the project, // Allow scrolling up to one half of a screenful beyond either end of the project,

View File

@ -1952,9 +1952,13 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
// choose boundaries only in snapping tolerance, // choose boundaries only in snapping tolerance,
// and may choose center. // and may choose center.
// But don't change the cursor when scrubbing. // But don't change the cursor when scrubbing.
SelectionBoundary boundary = IsScrubbing() SelectionBoundary boundary =
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
IsScrubbing()
? SBNone ? SBNone
: ChooseBoundary(event, t, r, !bShiftDown, !bShiftDown); :
#endif
ChooseBoundary(event, t, r, !bShiftDown, !bShiftDown);
#ifdef USE_MIDI #ifdef USE_MIDI
// The MIDI HitTest will only succeed if we are on a midi track, so // The MIDI HitTest will only succeed if we are on a midi track, so
@ -6852,6 +6856,7 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event)
return; return;
} }
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
if ((!pTrack || if ((!pTrack ||
pTrack->GetKind() == Track::Wave) && pTrack->GetKind() == Track::Wave) &&
IsScrubbing()) { IsScrubbing()) {
@ -6862,6 +6867,7 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event)
else if (event.LeftIsDown()) else if (event.LeftIsDown())
return; return;
} }
#endif
if (pTrack && (pTrack->GetKind() == Track::Wave) && if (pTrack && (pTrack->GetKind() == Track::Wave) &&
(mMouseCapture == IsUncaptured || mMouseCapture == IsOverCutLine || (mMouseCapture == IsUncaptured || mMouseCapture == IsOverCutLine ||

View File

@ -316,7 +316,9 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
); );
bool MaybeStartScrubbing(wxMouseEvent &event); bool MaybeStartScrubbing(wxMouseEvent &event);
bool ContinueScrubbing(wxCoord position, bool hasFocus, bool seek); bool ContinueScrubbing(wxCoord position, bool hasFocus, bool seek);
public:
bool StopScrubbing(); bool StopScrubbing();
protected:
#endif #endif
virtual void SelectionHandleClick(wxMouseEvent &event, virtual void SelectionHandleClick(wxMouseEvent &event,

View File

@ -33,6 +33,7 @@
#include "../Audacity.h" #include "../Audacity.h"
#include "ToolsToolBar.h"
// For compilers that support precompilation, includes "wx/wx.h". // For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h> #include <wx/wxprec.h>
@ -46,12 +47,14 @@
#include <wx/tooltip.h> #include <wx/tooltip.h>
#include "MeterToolBar.h" #include "MeterToolBar.h"
#include "ToolsToolBar.h"
#include "../Prefs.h" #include "../Prefs.h"
#include "../AllThemeResources.h" #include "../AllThemeResources.h"
#include "../ImageManipulation.h" #include "../ImageManipulation.h"
#include "../Project.h" #include "../Project.h"
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
#include "../TrackPanel.h"
#endif
#include "../Theme.h" #include "../Theme.h"
#include "../widgets/AButton.h" #include "../widgets/AButton.h"
@ -215,6 +218,18 @@ void ToolsToolBar::SetCurrentTool(int tool, bool show)
//In multi-mode the current tool is shown by the //In multi-mode the current tool is shown by the
//cursor icon. The buttons are not updated. //cursor icon. The buttons are not updated.
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
if (tool != selectTool) {
AudacityProject *p = GetActiveProject();
if (p) {
TrackPanel *tp = p->GetTrackPanel();
if (tp) {
tp->StopScrubbing();
}
}
}
#endif
bool leavingMulticlipMode = bool leavingMulticlipMode =
IsDown(multiTool) && show && tool != multiTool; IsDown(multiTool) && show && tool != multiTool;
@ -278,6 +293,18 @@ void ToolsToolBar::OnTool(wxCommandEvent & evt)
else else
mTool[i]->PopUp(); mTool[i]->PopUp();
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
if (0 != mCurrentTool) {
AudacityProject *p = GetActiveProject();
if (p) {
TrackPanel *tp = p->GetTrackPanel();
if (tp) {
tp->StopScrubbing();
}
}
}
#endif
RedrawAllProjects(); RedrawAllProjects();
gPrefs->Write(wxT("/GUI/ToolBars/Tools/MultiToolActive"), gPrefs->Write(wxT("/GUI/ToolBars/Tools/MultiToolActive"),