mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-15 07:50:22 +02:00
Ruler is in the ctrl+f6 cycle instead of reachable by arrows; experimental...
... flag for turning off navigability of the ruler.
This commit is contained in:
parent
7d7865c1a6
commit
80e19f2130
@ -96,8 +96,6 @@ enum CommandFlag : unsigned long long
|
|||||||
= 0x80000000ULL, // prl
|
= 0x80000000ULL, // prl
|
||||||
RulerHasFocus
|
RulerHasFocus
|
||||||
= 0x100000000ULL, // prl
|
= 0x100000000ULL, // prl
|
||||||
TrackPanelOrRulerHasFocus
|
|
||||||
= 0x200000000ULL, // prl
|
|
||||||
|
|
||||||
NoFlagsSpecifed = ~0ULL
|
NoFlagsSpecifed = ~0ULL
|
||||||
};
|
};
|
||||||
|
@ -200,5 +200,9 @@
|
|||||||
// interpolating in frequency domain.
|
// interpolating in frequency domain.
|
||||||
#define EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
|
#define EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
|
||||||
|
|
||||||
|
// Paul Licameli (PRL) 10 May 2016
|
||||||
|
// Time ruler accepts focus, buttons can be reached with TAB
|
||||||
|
#define EXPERIMENTAL_TIME_RULER_NAVIGATION
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1139,8 +1139,8 @@ void AudacityProject::CreateMenusAndCommands()
|
|||||||
c->AddCommand(wxT("SeekLeftLong"), _("Long seek left during playback"), FN(OnSeekLeftLong), wxT("Shift+Left\tallowDup"));
|
c->AddCommand(wxT("SeekLeftLong"), _("Long seek left during playback"), FN(OnSeekLeftLong), wxT("Shift+Left\tallowDup"));
|
||||||
c->AddCommand(wxT("SeekRightLong"), _("Long Seek right during playback"), FN(OnSeekRightLong), wxT("Shift+Right\tallowDup"));
|
c->AddCommand(wxT("SeekRightLong"), _("Long Seek right during playback"), FN(OnSeekRightLong), wxT("Shift+Right\tallowDup"));
|
||||||
|
|
||||||
c->SetDefaultFlags(TrackPanelOrRulerHasFocus,
|
c->SetDefaultFlags(TracksExistFlag | TrackPanelHasFocus,
|
||||||
TrackPanelOrRulerHasFocus);
|
TracksExistFlag | TrackPanelHasFocus);
|
||||||
|
|
||||||
c->AddCommand(wxT("PrevTrack"), _("Move Focus to Previous Track"), FN(OnCursorUp), wxT("Up"));
|
c->AddCommand(wxT("PrevTrack"), _("Move Focus to Previous Track"), FN(OnCursorUp), wxT("Up"));
|
||||||
c->AddCommand(wxT("NextTrack"), _("Move Focus to Next Track"), FN(OnCursorDown), wxT("Down"));
|
c->AddCommand(wxT("NextTrack"), _("Move Focus to Next Track"), FN(OnCursorDown), wxT("Down"));
|
||||||
@ -1152,9 +1152,6 @@ void AudacityProject::CreateMenusAndCommands()
|
|||||||
c->AddCommand(wxT("ShiftDown"), _("Move Focus to Next and Select"), FN(OnShiftDown), wxT("Shift+Down"));
|
c->AddCommand(wxT("ShiftDown"), _("Move Focus to Next and Select"), FN(OnShiftDown), wxT("Shift+Down"));
|
||||||
|
|
||||||
|
|
||||||
c->SetDefaultFlags(TracksExistFlag | TrackPanelHasFocus,
|
|
||||||
TracksExistFlag | TrackPanelHasFocus);
|
|
||||||
|
|
||||||
c->AddCommand(wxT("Toggle"), _("Toggle Focused Track"), FN(OnToggle), wxT("Return"));
|
c->AddCommand(wxT("Toggle"), _("Toggle Focused Track"), FN(OnToggle), wxT("Return"));
|
||||||
c->AddCommand(wxT("ToggleAlt"), _("Toggle Focused Track"), FN(OnToggle), wxT("NUMPAD_ENTER"));
|
c->AddCommand(wxT("ToggleAlt"), _("Toggle Focused Track"), FN(OnToggle), wxT("NUMPAD_ENTER"));
|
||||||
|
|
||||||
@ -1745,8 +1742,6 @@ CommandFlag AudacityProject::GetUpdateFlags()
|
|||||||
flags |= TextClipFlag;
|
flags |= TextClipFlag;
|
||||||
|
|
||||||
flags |= GetFocusedFrame();
|
flags |= GetFocusedFrame();
|
||||||
if (flags & (TrackPanelHasFocus | RulerHasFocus))
|
|
||||||
flags |= TrackPanelOrRulerHasFocus;
|
|
||||||
|
|
||||||
double start, end;
|
double start, end;
|
||||||
GetPlayRegion(&start, &end);
|
GetPlayRegion(&start, &end);
|
||||||
@ -2745,13 +2740,17 @@ void AudacityProject::NextFrame()
|
|||||||
switch( GetFocusedFrame() )
|
switch( GetFocusedFrame() )
|
||||||
{
|
{
|
||||||
case TopDockHasFocus:
|
case TopDockHasFocus:
|
||||||
if(mTrackPanel->GetFocusedTrack())
|
|
||||||
mTrackPanel->SetFocus();
|
#ifdef EXPERIMENTAL_TIME_RULER_NAVIGATION
|
||||||
else
|
mRuler->SetFocus();
|
||||||
mRuler->SetFocus();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RulerHasFocus:
|
case RulerHasFocus:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mTrackPanel->SetFocus();
|
||||||
|
break;
|
||||||
|
|
||||||
case TrackPanelHasFocus:
|
case TrackPanelHasFocus:
|
||||||
mToolManager->GetBotDock()->SetFocus();
|
mToolManager->GetBotDock()->SetFocus();
|
||||||
break;
|
break;
|
||||||
@ -2769,20 +2768,24 @@ void AudacityProject::PrevFrame()
|
|||||||
{
|
{
|
||||||
switch( GetFocusedFrame() )
|
switch( GetFocusedFrame() )
|
||||||
{
|
{
|
||||||
case TopDockHasFocus:
|
case BotDockHasFocus:
|
||||||
mToolManager->GetBotDock()->SetFocus();
|
mTrackPanel->SetFocus();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TrackPanelHasFocus:
|
||||||
|
|
||||||
|
#ifdef EXPERIMENTAL_TIME_RULER_NAVIGATION
|
||||||
|
mRuler->SetFocus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TrackPanelHasFocus:
|
|
||||||
case RulerHasFocus:
|
case RulerHasFocus:
|
||||||
|
#endif
|
||||||
|
|
||||||
mToolManager->GetTopDock()->SetFocus();
|
mToolManager->GetTopDock()->SetFocus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BotDockHasFocus:
|
case TopDockHasFocus:
|
||||||
if(mTrackPanel->GetFocusedTrack())
|
mToolManager->GetBotDock()->SetFocus();
|
||||||
mTrackPanel->SetFocus();
|
|
||||||
else
|
|
||||||
mRuler->SetFocus();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -7113,49 +7113,46 @@ void TrackPanel::UpdateVRulerSize()
|
|||||||
/// TrackPanel::OnNextTrack.
|
/// TrackPanel::OnNextTrack.
|
||||||
void TrackPanel::OnPrevTrack( bool shift )
|
void TrackPanel::OnPrevTrack( bool shift )
|
||||||
{
|
{
|
||||||
bool rulerFocus = mRuler->HasFocus();
|
TrackListIterator iter( mTracks );
|
||||||
bool stealFocus = (mCircularTrackNavigation && rulerFocus);
|
Track* t = GetFocusedTrack();
|
||||||
if(stealFocus) // if there isn't one, focus on last
|
if( t == NULL ) // if there isn't one, focus on last
|
||||||
{
|
{
|
||||||
if(rulerFocus) {
|
t = iter.Last();
|
||||||
this->SetFocus();
|
|
||||||
mRuler->Refresh();
|
|
||||||
}
|
|
||||||
TrackListIterator iter( mTracks );
|
|
||||||
auto t = iter.Last();
|
|
||||||
SetFocusedTrack( t );
|
SetFocusedTrack( t );
|
||||||
EnsureVisible( t );
|
EnsureVisible( t );
|
||||||
MakeParentModifyState(false);
|
MakeParentModifyState(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (rulerFocus) {
|
|
||||||
// JKC: wxBell() is probably for accessibility, so a blind
|
|
||||||
// user knows they were at the top track.
|
|
||||||
wxBell();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track* t = GetFocusedTrack();
|
|
||||||
Track* p = mTracks->GetPrev( t, true ); // Get previous track
|
|
||||||
if (!p) {
|
|
||||||
SetFocusedTrack(nullptr);
|
|
||||||
mRuler->SetFocus();
|
|
||||||
Refresh(false);
|
|
||||||
mRuler->Refresh();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Track* p = NULL;
|
||||||
bool tSelected = false;
|
bool tSelected = false;
|
||||||
bool pSelected = false;
|
bool pSelected = false;
|
||||||
if( shift )
|
if( shift )
|
||||||
{
|
{
|
||||||
|
p = mTracks->GetPrev( t, true ); // Get previous track
|
||||||
|
if( p == NULL ) // On first track
|
||||||
|
{
|
||||||
|
// JKC: wxBell() is probably for accessibility, so a blind
|
||||||
|
// user knows they were at the top track.
|
||||||
|
wxBell();
|
||||||
|
if( mCircularTrackNavigation )
|
||||||
|
{
|
||||||
|
TrackListIterator iter( mTracks );
|
||||||
|
p = iter.Last();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnsureVisible( t );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
tSelected = t->GetSelected();
|
tSelected = t->GetSelected();
|
||||||
if (p)
|
if (p)
|
||||||
pSelected = p->GetSelected();
|
pSelected = p->GetSelected();
|
||||||
if( tSelected && pSelected )
|
if( tSelected && pSelected )
|
||||||
{
|
{
|
||||||
mTracks->Select( t, false );
|
mTracks->Select( t, false );
|
||||||
SetFocusedTrack( p ); // move focus to next track up
|
SetFocusedTrack( p ); // move focus to next track down
|
||||||
EnsureVisible( p );
|
EnsureVisible( p );
|
||||||
MakeParentModifyState(false);
|
MakeParentModifyState(false);
|
||||||
return;
|
return;
|
||||||
@ -7163,7 +7160,7 @@ void TrackPanel::OnPrevTrack( bool shift )
|
|||||||
if( tSelected && !pSelected )
|
if( tSelected && !pSelected )
|
||||||
{
|
{
|
||||||
mTracks->Select( p, true );
|
mTracks->Select( p, true );
|
||||||
SetFocusedTrack( p ); // move focus to next track up
|
SetFocusedTrack( p ); // move focus to next track down
|
||||||
EnsureVisible( p );
|
EnsureVisible( p );
|
||||||
MakeParentModifyState(false);
|
MakeParentModifyState(false);
|
||||||
return;
|
return;
|
||||||
@ -7171,7 +7168,7 @@ void TrackPanel::OnPrevTrack( bool shift )
|
|||||||
if( !tSelected && pSelected )
|
if( !tSelected && pSelected )
|
||||||
{
|
{
|
||||||
mTracks->Select( p, false );
|
mTracks->Select( p, false );
|
||||||
SetFocusedTrack( p ); // move focus to next track up
|
SetFocusedTrack( p ); // move focus to next track down
|
||||||
EnsureVisible( p );
|
EnsureVisible( p );
|
||||||
MakeParentModifyState(false);
|
MakeParentModifyState(false);
|
||||||
return;
|
return;
|
||||||
@ -7179,7 +7176,7 @@ void TrackPanel::OnPrevTrack( bool shift )
|
|||||||
if( !tSelected && !pSelected )
|
if( !tSelected && !pSelected )
|
||||||
{
|
{
|
||||||
mTracks->Select( t, true );
|
mTracks->Select( t, true );
|
||||||
SetFocusedTrack( p ); // move focus to next track up
|
SetFocusedTrack( p ); // move focus to next track down
|
||||||
EnsureVisible( p );
|
EnsureVisible( p );
|
||||||
MakeParentModifyState(false);
|
MakeParentModifyState(false);
|
||||||
return;
|
return;
|
||||||
@ -7187,10 +7184,35 @@ void TrackPanel::OnPrevTrack( bool shift )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetFocusedTrack( p ); // move focus to next track up
|
p = mTracks->GetPrev( t, true ); // Get next track
|
||||||
EnsureVisible( p );
|
if( p == NULL ) // On last track so stay there?
|
||||||
MakeParentModifyState(false);
|
{
|
||||||
return;
|
wxBell();
|
||||||
|
if( mCircularTrackNavigation )
|
||||||
|
{
|
||||||
|
TrackListIterator iter( mTracks );
|
||||||
|
for( Track *d = iter.First(); d; d = iter.Next( true ) )
|
||||||
|
{
|
||||||
|
p = d;
|
||||||
|
}
|
||||||
|
SetFocusedTrack( p ); // Wrap to the first track
|
||||||
|
EnsureVisible( p );
|
||||||
|
MakeParentModifyState(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnsureVisible( t );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetFocusedTrack( p ); // move focus to next track down
|
||||||
|
EnsureVisible( p );
|
||||||
|
MakeParentModifyState(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7199,46 +7221,37 @@ void TrackPanel::OnPrevTrack( bool shift )
|
|||||||
/// block or not.
|
/// block or not.
|
||||||
void TrackPanel::OnNextTrack( bool shift )
|
void TrackPanel::OnNextTrack( bool shift )
|
||||||
{
|
{
|
||||||
if(mRuler->HasFocus()) {
|
|
||||||
TrackListIterator iter(mTracks);
|
|
||||||
auto first = iter.First();
|
|
||||||
if(first != nullptr) {
|
|
||||||
// Steal focus
|
|
||||||
this->SetFocus();
|
|
||||||
SetFocusedTrack(first);
|
|
||||||
EnsureVisible(first);
|
|
||||||
MakeParentModifyState(false);
|
|
||||||
mRuler->Refresh();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track *t;
|
Track *t;
|
||||||
Track *n = nullptr;
|
Track *n;
|
||||||
bool tSelected, nSelected;
|
TrackListIterator iter( mTracks );
|
||||||
|
bool tSelected,nSelected;
|
||||||
|
|
||||||
t = GetFocusedTrack(); // Get currently focused track
|
t = GetFocusedTrack(); // Get currently focused track
|
||||||
bool surrenderFocus =
|
if( t == NULL ) // if there isn't one, focus on first
|
||||||
t == nullptr ||
|
|
||||||
((n = mTracks->GetNext( t, true )) == nullptr &&
|
|
||||||
mCircularTrackNavigation);
|
|
||||||
|
|
||||||
if( surrenderFocus ) // if there is no next, give focus to the ruler
|
|
||||||
{
|
{
|
||||||
SetFocusedTrack(nullptr);
|
t = iter.First();
|
||||||
mRuler->SetFocus();
|
SetFocusedTrack( t );
|
||||||
mRuler->Refresh();
|
EnsureVisible( t );
|
||||||
Refresh(false);
|
MakeParentModifyState(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( shift )
|
if( shift )
|
||||||
{
|
{
|
||||||
|
n = mTracks->GetNext( t, true ); // Get next track
|
||||||
if( n == NULL ) // On last track so stay there
|
if( n == NULL ) // On last track so stay there
|
||||||
{
|
{
|
||||||
wxBell();
|
wxBell();
|
||||||
EnsureVisible( t );
|
if( mCircularTrackNavigation )
|
||||||
return;
|
{
|
||||||
|
TrackListIterator iter( mTracks );
|
||||||
|
n = iter.First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnsureVisible( t );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tSelected = t->GetSelected();
|
tSelected = t->GetSelected();
|
||||||
nSelected = n->GetSelected();
|
nSelected = n->GetSelected();
|
||||||
@ -7277,11 +7290,24 @@ void TrackPanel::OnNextTrack( bool shift )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
n = mTracks->GetNext( t, true ); // Get next track
|
||||||
if( n == NULL ) // On last track so stay there
|
if( n == NULL ) // On last track so stay there
|
||||||
{
|
{
|
||||||
wxBell();
|
wxBell();
|
||||||
EnsureVisible( t );
|
if( mCircularTrackNavigation )
|
||||||
return;
|
{
|
||||||
|
TrackListIterator iter( mTracks );
|
||||||
|
n = iter.First();
|
||||||
|
SetFocusedTrack( n ); // Wrap to the first track
|
||||||
|
EnsureVisible( n );
|
||||||
|
MakeParentModifyState(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnsureVisible( t );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -7295,25 +7321,26 @@ void TrackPanel::OnNextTrack( bool shift )
|
|||||||
|
|
||||||
void TrackPanel::OnFirstTrack()
|
void TrackPanel::OnFirstTrack()
|
||||||
{
|
{
|
||||||
SetFocusedTrack(nullptr);
|
Track *t = GetFocusedTrack();
|
||||||
if (!mRuler->HasFocus()) {
|
if (!t)
|
||||||
mRuler->SetFocus();
|
return;
|
||||||
mRuler->Refresh();
|
|
||||||
|
TrackListIterator iter(mTracks);
|
||||||
|
Track *f = iter.First();
|
||||||
|
if (t != f)
|
||||||
|
{
|
||||||
|
SetFocusedTrack(f);
|
||||||
|
MakeParentModifyState(false);
|
||||||
}
|
}
|
||||||
|
EnsureVisible(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackPanel::OnLastTrack()
|
void TrackPanel::OnLastTrack()
|
||||||
{
|
{
|
||||||
if (mTracks->empty()) {
|
|
||||||
OnFirstTrack();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(mRuler->HasFocus()) {
|
|
||||||
this->SetFocus();
|
|
||||||
mRuler->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
Track *t = GetFocusedTrack();
|
Track *t = GetFocusedTrack();
|
||||||
|
if (!t)
|
||||||
|
return;
|
||||||
|
|
||||||
TrackListIterator iter(mTracks);
|
TrackListIterator iter(mTracks);
|
||||||
Track *l = iter.Last();
|
Track *l = iter.Last();
|
||||||
if (t != l)
|
if (t != l)
|
||||||
|
@ -2923,7 +2923,6 @@ void AdornedRulerPanel::OnKeyDown(wxKeyEvent &event)
|
|||||||
void AdornedRulerPanel::OnSetFocus(wxFocusEvent & WXUNUSED(event))
|
void AdornedRulerPanel::OnSetFocus(wxFocusEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
AudacityProject::CaptureKeyboard(this);
|
AudacityProject::CaptureKeyboard(this);
|
||||||
mProject->GetTrackPanel()->SetFocusedTrack(nullptr);
|
|
||||||
mTabState = TabState{};
|
mTabState = TabState{};
|
||||||
Refresh( false );
|
Refresh( false );
|
||||||
}
|
}
|
||||||
|
@ -293,6 +293,10 @@ public:
|
|||||||
|
|
||||||
~AdornedRulerPanel();
|
~AdornedRulerPanel();
|
||||||
|
|
||||||
|
#ifndef EXPERIMENTAL_TIME_RULER_NAVIGATION
|
||||||
|
bool AcceptsFocus() const override { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int GetRulerHeight();
|
static int GetRulerHeight();
|
||||||
static int GetRulerHeight(bool showScrubBar);
|
static int GetRulerHeight(bool showScrubBar);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user