1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-07 15:49:42 +02:00

Allow tabbing to the button on the time ruler...

... by making the ruler and the upper tool dock part of one panel
This commit is contained in:
Paul Licameli 2016-06-25 02:42:22 -04:00
parent 57788c8d7a
commit ae14cb0dbc
7 changed files with 35 additions and 14 deletions

View File

@ -2770,7 +2770,7 @@ void AudacityProject::NextOrPrevFrame(bool forward)
; ;
wxWindow *const begin [rotationSize] = { wxWindow *const begin [rotationSize] = {
mToolManager->GetTopDock(), GetTopPanel(),
#ifdef EXPERIMENTAL_TIME_RULER_NAVIGATION #ifdef EXPERIMENTAL_TIME_RULER_NAVIGATION
GetRulerPanel(), GetRulerPanel(),
#endif #endif

View File

@ -875,10 +875,21 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
// Near as I can tell, this is only a problem under Windows. // Near as I can tell, this is only a problem under Windows.
// //
// PRL: this panel groups the top tool dock and the ruler into one
// tab cycle.
// Must create it with non-default width equal to the main window width,
// or else the device toolbar doesn't make initial widths of the choice
// controls correct.
mTopPanel = safenew wxPanel {
this, wxID_ANY, wxDefaultPosition, { this->GetSize().GetWidth(), -1 }
};
mTopPanel->SetAutoLayout(true);
// //
// Create the ToolDock // Create the ToolDock
// //
mToolManager = std::make_unique<ToolManager>( this ); mToolManager = std::make_unique<ToolManager>( this, mTopPanel );
GetSelectionBar()->SetListener(this); GetSelectionBar()->SetListener(this);
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
GetSpectralSelectionBar()->SetListener(this); GetSpectralSelectionBar()->SetListener(this);
@ -888,7 +899,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
// //
// Create the horizontal ruler // Create the horizontal ruler
// //
mRuler = safenew AdornedRulerPanel( this, mRuler = safenew AdornedRulerPanel( this, mTopPanel,
wxID_ANY, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxSize( -1, AdornedRulerPanel::GetRulerHeight(false) ), wxSize( -1, AdornedRulerPanel::GetRulerHeight(false) ),
@ -928,12 +939,18 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
//pPage->SetBackgroundColour( theTheme.Colour( clrDark )); //pPage->SetBackgroundColour( theTheme.Colour( clrDark ));
#endif #endif
{
auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL);
ubs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP);
ubs->Add(mRuler, 0, wxEXPAND);
mTopPanel->SetSizer(ubs.release());
}
wxBoxSizer *bs; wxBoxSizer *bs;
{ {
auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL); auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL);
bs = ubs.get(); bs = ubs.get();
bs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP); bs->Add(mTopPanel, 0, wxEXPAND | wxALIGN_TOP);
bs->Add(mRuler, 0, wxEXPAND);
bs->Add(pPage, 1, wxEXPAND); bs->Add(pPage, 1, wxEXPAND);
bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND); bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND);
SetAutoLayout(true); SetAutoLayout(true);
@ -999,7 +1016,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
// will be given the focus even if we try to SetFocus(). By // will be given the focus even if we try to SetFocus(). By
// making the TrackPanel that first window, we resolve several // making the TrackPanel that first window, we resolve several
// keyboard focus problems. // keyboard focus problems.
pPage->MoveBeforeInTabOrder(mToolManager->GetTopDock()); pPage->MoveBeforeInTabOrder(mTopPanel);
bs = (wxBoxSizer *)pPage->GetSizer(); bs = (wxBoxSizer *)pPage->GetSizer();

View File

@ -258,7 +258,8 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
bool GetDirty() { return mDirty; } bool GetDirty() { return mDirty; }
void SetProjectTitle(); void SetProjectTitle();
TrackPanel * GetTrackPanel(){return mTrackPanel;} wxPanel *GetTopPanel() { return mTopPanel; }
TrackPanel * GetTrackPanel() {return mTrackPanel;}
bool GetIsEmpty(); bool GetIsEmpty();
@ -594,6 +595,7 @@ public:
wxStatusBar *mStatusBar; wxStatusBar *mStatusBar;
AdornedRulerPanel *mRuler{}; AdornedRulerPanel *mRuler{};
wxPanel *mTopPanel{};
TrackPanel *mTrackPanel{}; TrackPanel *mTrackPanel{};
TrackFactory *mTrackFactory{}; TrackFactory *mTrackFactory{};
wxPanel * mMainPanel; wxPanel * mMainPanel;

View File

@ -350,7 +350,7 @@ END_EVENT_TABLE()
// //
// Constructor // Constructor
// //
ToolManager::ToolManager( AudacityProject *parent ) ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
: wxEvtHandler() : wxEvtHandler()
{ {
wxPoint pt[ 3 ]; wxPoint pt[ 3 ];
@ -433,7 +433,7 @@ ToolManager::ToolManager( AudacityProject *parent )
this ); this );
// Create the top and bottom docks // Create the top and bottom docks
mTopDock = safenew ToolDock( this, mParent, TopDockID ); mTopDock = safenew ToolDock( this, topDockParent, TopDockID );
mBotDock = safenew ToolDock( this, mParent, BotDockID ); mBotDock = safenew ToolDock( this, mParent, BotDockID );
// Create all of the toolbars // Create all of the toolbars

View File

@ -45,7 +45,7 @@ class ToolManager final : public wxEvtHandler
public: public:
ToolManager( AudacityProject *parent ); ToolManager( AudacityProject *parent, wxWindow *topDockParent );
~ToolManager(); ~ToolManager();
void LayoutToolBars(); void LayoutToolBars();

View File

@ -1953,13 +1953,14 @@ BEGIN_EVENT_TABLE(AdornedRulerPanel, OverlayPanel)
END_EVENT_TABLE() END_EVENT_TABLE()
AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent, AdornedRulerPanel::AdornedRulerPanel(AudacityProject* project,
wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
ViewInfo *viewinfo) ViewInfo *viewinfo)
: OverlayPanel(parent, id, pos, size) : OverlayPanel(parent, id, pos, size)
, mProject(parent) , mProject(project)
, mViewInfo(viewinfo) , mViewInfo(viewinfo)
{ {
for (auto &button : mButtons) for (auto &button : mButtons)
@ -1991,7 +1992,7 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
mRuler.SetLabelEdges( false ); mRuler.SetLabelEdges( false );
mRuler.SetFormat( Ruler::TimeFormat ); mRuler.SetFormat( Ruler::TimeFormat );
mTracks = parent->GetTracks(); mTracks = project->GetTracks();
mSnapManager = NULL; mSnapManager = NULL;
mIsSnapped = false; mIsSnapped = false;

View File

@ -285,7 +285,8 @@ class QuickPlayRulerOverlay;
class AUDACITY_DLL_API AdornedRulerPanel final : public OverlayPanel class AUDACITY_DLL_API AdornedRulerPanel final : public OverlayPanel
{ {
public: public:
AdornedRulerPanel(AudacityProject* parent, AdornedRulerPanel(AudacityProject *project,
wxWindow* parent,
wxWindowID id, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,