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] = {
mToolManager->GetTopDock(),
GetTopPanel(),
#ifdef EXPERIMENTAL_TIME_RULER_NAVIGATION
GetRulerPanel(),
#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.
//
// 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
//
mToolManager = std::make_unique<ToolManager>( this );
mToolManager = std::make_unique<ToolManager>( this, mTopPanel );
GetSelectionBar()->SetListener(this);
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
GetSpectralSelectionBar()->SetListener(this);
@ -888,7 +899,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
//
// Create the horizontal ruler
//
mRuler = safenew AdornedRulerPanel( this,
mRuler = safenew AdornedRulerPanel( this, mTopPanel,
wxID_ANY,
wxDefaultPosition,
wxSize( -1, AdornedRulerPanel::GetRulerHeight(false) ),
@ -928,12 +939,18 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
//pPage->SetBackgroundColour( theTheme.Colour( clrDark ));
#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;
{
auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL);
bs = ubs.get();
bs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP);
bs->Add(mRuler, 0, wxEXPAND);
bs->Add(mTopPanel, 0, wxEXPAND | wxALIGN_TOP);
bs->Add(pPage, 1, wxEXPAND);
bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND);
SetAutoLayout(true);
@ -999,7 +1016,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
// will be given the focus even if we try to SetFocus(). By
// making the TrackPanel that first window, we resolve several
// keyboard focus problems.
pPage->MoveBeforeInTabOrder(mToolManager->GetTopDock());
pPage->MoveBeforeInTabOrder(mTopPanel);
bs = (wxBoxSizer *)pPage->GetSizer();

View File

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

View File

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

View File

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

View File

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

View File

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