mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-11 09:31:13 +02:00
Remove double-click and scrolling menu items for scrub/seek...
This commit is contained in:
commit
e295263958
@ -2372,8 +2372,8 @@ void AudacityProject::OnToggleSoundActivated()
|
|||||||
|
|
||||||
void AudacityProject::OnTogglePinnedHead()
|
void AudacityProject::OnTogglePinnedHead()
|
||||||
{
|
{
|
||||||
PlaybackPrefs::SetPinnedHeadPreference(
|
bool value = !PlaybackPrefs::GetPinnedHeadPreference();
|
||||||
!PlaybackPrefs::GetPinnedHeadPreference(), true);
|
PlaybackPrefs::SetPinnedHeadPreference(value, true);
|
||||||
ModifyAllProjectToolbarMenus();
|
ModifyAllProjectToolbarMenus();
|
||||||
|
|
||||||
// Change what happens in case transport is in progress right now
|
// Change what happens in case transport is in progress right now
|
||||||
@ -2384,7 +2384,12 @@ void AudacityProject::OnTogglePinnedHead()
|
|||||||
auto ruler = GetRulerPanel();
|
auto ruler = GetRulerPanel();
|
||||||
if (ruler)
|
if (ruler)
|
||||||
// Update button image
|
// Update button image
|
||||||
|
|
||||||
ruler->UpdateButtonStates();
|
ruler->UpdateButtonStates();
|
||||||
|
|
||||||
|
auto &scrubber = GetScrubber();
|
||||||
|
if (scrubber.HasStartedScrubbing())
|
||||||
|
scrubber.SetScrollScrubbing(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnTogglePlayRecording()
|
void AudacityProject::OnTogglePlayRecording()
|
||||||
|
@ -1258,6 +1258,16 @@ void ControlToolBar::StartScrollingIfPreferred()
|
|||||||
{
|
{
|
||||||
if (PlaybackPrefs::GetPinnedHeadPreference())
|
if (PlaybackPrefs::GetPinnedHeadPreference())
|
||||||
StartScrolling();
|
StartScrolling();
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
else if (::GetActiveProject()->GetScrubber().HasStartedScrubbing()) {
|
||||||
|
// PRL: cause many "unnecessary" refreshes. For reasons I don't understand,
|
||||||
|
// doing this causes wheel rotation events (mapped from the double finger vertical
|
||||||
|
// swipe) to be delivered more uniformly to the application, so that speed control
|
||||||
|
// works better.
|
||||||
|
::GetActiveProject()->GetPlaybackScroller().Activate
|
||||||
|
(AudacityProject::PlaybackScroller::Mode::Refresh);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
StopScrolling();
|
StopScrolling();
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../TrackPanelCell.h"
|
#include "../../TrackPanelCell.h"
|
||||||
#include "../../TrackPanelCellIterator.h"
|
#include "../../TrackPanelCellIterator.h"
|
||||||
#include "../../commands/CommandFunctors.h"
|
#include "../../commands/CommandFunctors.h"
|
||||||
|
#include "../../prefs/PlaybackPrefs.h"
|
||||||
#include "../../toolbars/ControlToolBar.h"
|
#include "../../toolbars/ControlToolBar.h"
|
||||||
|
|
||||||
#undef USE_TRANSCRIPTION_TOOLBAR
|
#undef USE_TRANSCRIPTION_TOOLBAR
|
||||||
@ -219,7 +220,6 @@ namespace {
|
|||||||
wxString label;
|
wxString label;
|
||||||
wxString status;
|
wxString status;
|
||||||
void (Scrubber::*memFn)(wxCommandEvent&);
|
void (Scrubber::*memFn)(wxCommandEvent&);
|
||||||
bool scroll;
|
|
||||||
bool seek;
|
bool seek;
|
||||||
|
|
||||||
const wxString &GetStatus() const { return status; }
|
const wxString &GetStatus() const { return status; }
|
||||||
@ -230,26 +230,20 @@ namespace {
|
|||||||
"Scrolling" keeps the playback position at a fixed place on screen while the waveform moves
|
"Scrolling" keeps the playback position at a fixed place on screen while the waveform moves
|
||||||
*/
|
*/
|
||||||
{ wxT("Scrub"), XO("&Scrub"), XO("Scrubbing"),
|
{ wxT("Scrub"), XO("&Scrub"), XO("Scrubbing"),
|
||||||
&Scrubber::OnScrub, false, false },
|
&Scrubber::OnScrub, false },
|
||||||
|
|
||||||
{ wxT("ScrollScrub"), XO("Sc&rolling Scrub"), XO("Scrolling Scrub"),
|
|
||||||
&Scrubber::OnScrollScrub, true, false },
|
|
||||||
|
|
||||||
{ wxT("Seek"), XO("See&k"), XO("Seeking"),
|
{ wxT("Seek"), XO("See&k"), XO("Seeking"),
|
||||||
&Scrubber::OnSeek, false, true },
|
&Scrubber::OnSeek, true },
|
||||||
|
|
||||||
{ wxT("ScrollSeek"), XO("Scro&lling Seek"), XO("Scrolling Seek"),
|
|
||||||
&Scrubber::OnScrollSeek, true, true }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { nMenuItems = sizeof(menuItems) / sizeof(*menuItems) };
|
enum { nMenuItems = sizeof(menuItems) / sizeof(*menuItems) };
|
||||||
|
|
||||||
inline const MenuItem &FindMenuItem(bool scroll, bool seek)
|
inline const MenuItem &FindMenuItem(bool seek)
|
||||||
{
|
{
|
||||||
return *std::find_if(menuItems, menuItems + nMenuItems,
|
return *std::find_if(menuItems, menuItems + nMenuItems,
|
||||||
[=](const MenuItem &item) {
|
[=](const MenuItem &item) {
|
||||||
return scroll == item.scroll &&
|
return seek == item.seek;
|
||||||
seek == item.seek;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -382,7 +376,6 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
|
|||||||
mOptions.startClockTimeMillis = ::wxGetLocalTimeMillis();
|
mOptions.startClockTimeMillis = ::wxGetLocalTimeMillis();
|
||||||
|
|
||||||
if (IsScrubbing()) {
|
if (IsScrubbing()) {
|
||||||
ActivateScroller();
|
|
||||||
mPaused = false;
|
mPaused = false;
|
||||||
mLastScrubPosition = xx;
|
mLastScrubPosition = xx;
|
||||||
|
|
||||||
@ -780,29 +773,11 @@ bool Scrubber::PollIsSeeking()
|
|||||||
return mDragging || (mAlwaysSeeking || ::wxGetMouseState().LeftIsDown());
|
return mDragging || (mAlwaysSeeking || ::wxGetMouseState().LeftIsDown());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::ActivateScroller()
|
void Scrubber::DoScrub(bool seek)
|
||||||
{
|
|
||||||
const auto ctb = mProject->GetControlToolBar();
|
|
||||||
if (mSmoothScrollingScrub)
|
|
||||||
ctb->StartScrolling();
|
|
||||||
else {
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
// PRL: cause many "unnecessary" refreshes. For reasons I don't understand,
|
|
||||||
// doing this causes wheel rotation events (mapped from the double finger vertical
|
|
||||||
// swipe) to be delivered more uniformly to the application, so that speed control
|
|
||||||
// works better.
|
|
||||||
mProject->GetPlaybackScroller().Activate
|
|
||||||
(AudacityProject::PlaybackScroller::Mode::Refresh);
|
|
||||||
#else
|
|
||||||
ctb->StopScrolling();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scrubber::DoScrub(bool scroll, bool seek)
|
|
||||||
{
|
{
|
||||||
const bool wasScrubbing = IsScrubbing();
|
const bool wasScrubbing = IsScrubbing();
|
||||||
const bool match = (scroll == mSmoothScrollingScrub && seek == mAlwaysSeeking);
|
const bool match = (seek == mAlwaysSeeking);
|
||||||
|
const bool scroll = PlaybackPrefs::GetPinnedHeadPreference();
|
||||||
if (!wasScrubbing) {
|
if (!wasScrubbing) {
|
||||||
auto tp = mProject->GetTrackPanel();
|
auto tp = mProject->GetTrackPanel();
|
||||||
wxCoord xx = tp->ScreenToClient(::wxGetMouseState().GetPosition()).x;
|
wxCoord xx = tp->ScreenToClient(::wxGetMouseState().GetPosition()).x;
|
||||||
@ -817,7 +792,6 @@ void Scrubber::DoScrub(bool scroll, bool seek)
|
|||||||
}
|
}
|
||||||
else if(!match) {
|
else if(!match) {
|
||||||
mSmoothScrollingScrub = scroll;
|
mSmoothScrollingScrub = scroll;
|
||||||
ActivateScroller();
|
|
||||||
mAlwaysSeeking = seek;
|
mAlwaysSeeking = seek;
|
||||||
UncheckAllMenuItems();
|
UncheckAllMenuItems();
|
||||||
CheckMenuItem();
|
CheckMenuItem();
|
||||||
@ -835,45 +809,33 @@ void Scrubber::DoScrub(bool scroll, bool seek)
|
|||||||
|
|
||||||
void Scrubber::OnScrub(wxCommandEvent&)
|
void Scrubber::OnScrub(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
DoScrub(false, false);
|
DoScrub(false);
|
||||||
}
|
|
||||||
|
|
||||||
void Scrubber::OnScrollScrub(wxCommandEvent&)
|
|
||||||
{
|
|
||||||
DoScrub(true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::OnSeek(wxCommandEvent&)
|
void Scrubber::OnSeek(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
DoScrub(false, true);
|
DoScrub(true);
|
||||||
}
|
|
||||||
|
|
||||||
void Scrubber::OnScrollSeek(wxCommandEvent&)
|
|
||||||
{
|
|
||||||
DoScrub(true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { CMD_ID = 8000 };
|
enum { CMD_ID = 8000 };
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(Scrubber, wxEvtHandler)
|
BEGIN_EVENT_TABLE(Scrubber, wxEvtHandler)
|
||||||
EVT_MENU(CMD_ID, Scrubber::OnScrub)
|
EVT_MENU(CMD_ID, Scrubber::OnScrub)
|
||||||
EVT_MENU(CMD_ID + 1, Scrubber::OnScrollScrub)
|
EVT_MENU(CMD_ID + 1, Scrubber::OnSeek)
|
||||||
EVT_MENU(CMD_ID + 2, Scrubber::OnSeek)
|
|
||||||
EVT_MENU(CMD_ID + 3, Scrubber::OnScrollSeek)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(Scrubber::Forwarder, wxEvtHandler)
|
BEGIN_EVENT_TABLE(Scrubber::Forwarder, wxEvtHandler)
|
||||||
EVT_MOUSE_EVENTS(Scrubber::Forwarder::OnMouse)
|
EVT_MOUSE_EVENTS(Scrubber::Forwarder::OnMouse)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
static_assert(nMenuItems == 4, "wrong number of items");
|
static_assert(nMenuItems == 2, "wrong number of items");
|
||||||
|
|
||||||
const wxString &Scrubber::GetUntranslatedStateString() const
|
const wxString &Scrubber::GetUntranslatedStateString() const
|
||||||
{
|
{
|
||||||
static wxString empty;
|
static wxString empty;
|
||||||
|
|
||||||
if (HasStartedScrubbing()) {
|
if (HasStartedScrubbing()) {
|
||||||
auto &item = FindMenuItem(mSmoothScrollingScrub, mAlwaysSeeking);
|
auto &item = FindMenuItem(mAlwaysSeeking);
|
||||||
return item.status;
|
return item.status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -923,7 +885,7 @@ void Scrubber::PopulateMenu(wxMenu &menu)
|
|||||||
auto cm = mProject->GetCommandManager();
|
auto cm = mProject->GetCommandManager();
|
||||||
const MenuItem *checkedItem =
|
const MenuItem *checkedItem =
|
||||||
HasStartedScrubbing()
|
HasStartedScrubbing()
|
||||||
? &FindMenuItem(mSmoothScrollingScrub, mAlwaysSeeking)
|
? &FindMenuItem(mAlwaysSeeking)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
for (const auto &item : menuItems) {
|
for (const auto &item : menuItems) {
|
||||||
if (cm->GetEnabled(item.name)) {
|
if (cm->GetEnabled(item.name)) {
|
||||||
@ -953,7 +915,7 @@ void Scrubber::CheckMenuItem()
|
|||||||
#ifdef CHECKABLE_SCRUB_MENU_ITEMS
|
#ifdef CHECKABLE_SCRUB_MENU_ITEMS
|
||||||
if(HasStartedScrubbing()) {
|
if(HasStartedScrubbing()) {
|
||||||
auto cm = mProject->GetCommandManager();
|
auto cm = mProject->GetCommandManager();
|
||||||
auto item = FindMenuItem(mSmoothScrollingScrub, mAlwaysSeeking);
|
auto item = FindMenuItem(mAlwaysSeeking);
|
||||||
cm->Check(item.name, true);
|
cm->Check(item.name, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -98,6 +98,8 @@ public:
|
|||||||
|
|
||||||
bool IsScrollScrubbing() const // If true, implies HasStartedScrubbing()
|
bool IsScrollScrubbing() const // If true, implies HasStartedScrubbing()
|
||||||
{ return mSmoothScrollingScrub; }
|
{ return mSmoothScrollingScrub; }
|
||||||
|
void SetScrollScrubbing(bool value)
|
||||||
|
{ mSmoothScrollingScrub = value; }
|
||||||
|
|
||||||
bool IsAlwaysSeeking() const
|
bool IsAlwaysSeeking() const
|
||||||
{ return mAlwaysSeeking; }
|
{ return mAlwaysSeeking; }
|
||||||
@ -119,9 +121,7 @@ public:
|
|||||||
void PopulateMenu(wxMenu &menu);
|
void PopulateMenu(wxMenu &menu);
|
||||||
|
|
||||||
void OnScrub(wxCommandEvent&);
|
void OnScrub(wxCommandEvent&);
|
||||||
void OnScrollScrub(wxCommandEvent&);
|
|
||||||
void OnSeek(wxCommandEvent&);
|
void OnSeek(wxCommandEvent&);
|
||||||
void OnScrollSeek(wxCommandEvent&);
|
|
||||||
|
|
||||||
// A string to put in the leftmost part of the status bar.
|
// A string to put in the leftmost part of the status bar.
|
||||||
const wxString &GetUntranslatedStateString() const;
|
const wxString &GetUntranslatedStateString() const;
|
||||||
@ -133,8 +133,7 @@ public:
|
|||||||
bool IsPaused() const;
|
bool IsPaused() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ActivateScroller();
|
void DoScrub(bool seek);
|
||||||
void DoScrub(bool scroll, bool seek);
|
|
||||||
void OnActivateOrDeactivateApp(wxActivateEvent & event);
|
void OnActivateOrDeactivateApp(wxActivateEvent & event);
|
||||||
void UncheckAllMenuItems();
|
void UncheckAllMenuItems();
|
||||||
void CheckMenuItem();
|
void CheckMenuItem();
|
||||||
|
@ -2360,9 +2360,6 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
|
|
||||||
if (scrubber.IsScrubbing())
|
if (scrubber.IsScrubbing())
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
else if (evt.LeftDClick())
|
|
||||||
// On the second button down, switch the pending scrub to scrolling
|
|
||||||
scrubber.MarkScrubStart(evt.m_x, true, false);
|
|
||||||
else
|
else
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
|
|
||||||
@ -2421,7 +2418,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
}
|
}
|
||||||
else if (!HasCapture() && inScrubZone) {
|
else if (!HasCapture() && inScrubZone) {
|
||||||
if (evt.LeftDown()) {
|
if (evt.LeftDown()) {
|
||||||
scrubber.MarkScrubStart(evt.m_x, false, false);
|
scrubber.MarkScrubStart(evt.m_x, PlaybackPrefs::GetPinnedHeadPreference(), false);
|
||||||
UpdateStatusBarAndTooltips(StatusChoice::EnteringScrubZone);
|
UpdateStatusBarAndTooltips(StatusChoice::EnteringScrubZone);
|
||||||
}
|
}
|
||||||
ShowQuickPlayIndicator();
|
ShowQuickPlayIndicator();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user