Revert "sizers"

This reverts commit 84c0a0b666.
This commit is contained in:
Paul Licameli 2016-02-18 14:50:52 -05:00
parent 84c0a0b666
commit 4d78e353c3
25 changed files with 1091 additions and 1191 deletions

View File

@ -52,6 +52,7 @@ class AboutDialog:public wxDialog {
void OnOK(wxCommandEvent & event); void OnOK(wxCommandEvent & event);
wxBoxSizer *topsizer;
wxStaticBitmap *icon; wxStaticBitmap *icon;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -105,42 +105,38 @@ LabelDialog::LabelDialog(wxWindow *parent,
{ {
SetName(GetTitle()); SetName(GetTitle());
{ // Create the main sizer
// Create the main sizer wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
// A little instruction // A little instruction
wxStaticText *instruct = wxStaticText *instruct =
safenew wxStaticText(this, safenew wxStaticText(this,
wxID_ANY, wxID_ANY,
_("Press F2 or double click to edit cell contents.")); _("Press F2 or double click to edit cell contents."));
instruct->SetName(instruct->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) instruct->SetName(instruct->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
vs->Add(instruct, vs->Add(instruct,
0, 0,
wxALIGN_LEFT | wxALL, wxALIGN_LEFT | wxALL,
5); 5);
// Create the main sizer // Create the main sizer
mGrid = new Grid(this, wxID_ANY); mGrid = new Grid(this, wxID_ANY);
vs->Add(mGrid, 1, wxEXPAND | wxALL, 5); vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);
// Create the action buttons // Create the action buttons
{ wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL); hs->Add(safenew wxButton(this, ID_INSERTA, _("Insert &After")), 1, wxCENTER | wxALL, 5);
hs->Add(safenew wxButton(this, ID_INSERTA, _("Insert &After")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_INSERTB, _("Insert &Before")), 1, wxCENTER | wxALL, 5);
hs->Add(safenew wxButton(this, ID_INSERTB, _("Insert &Before")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_REMOVE, _("&Remove")), 1, wxCENTER | wxALL, 5);
hs->Add(safenew wxButton(this, ID_REMOVE, _("&Remove")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_IMPORT, _("&Import...")), 1, wxCENTER | wxALL, 5);
hs->Add(safenew wxButton(this, ID_IMPORT, _("&Import...")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_EXPORT, _("&Export...")), 1, wxCENTER | wxALL, 5);
hs->Add(safenew wxButton(this, ID_EXPORT, _("&Export...")), 1, wxCENTER | wxALL, 5); vs->Add(hs, 0, wxEXPAND | wxCENTER | wxALL, 5);
vs->Add(hs.release(), 0, wxEXPAND | wxCENTER | wxALL, 5);
}
// Create the exit buttons // Create the exit buttons
vs->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND); vs->Add(CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND);
// Make it so // Make it so
SetSizer(vs.release()); SetSizer(vs);
}
// Build the initial (empty) grid // Build the initial (empty) grid
mGrid->CreateGrid(0, Col_Max); mGrid->CreateGrid(0, Col_Max);

View File

@ -1002,7 +1002,7 @@ MixerBoard::MixerBoard(AudacityProject* pProject,
mScrolledWindow->SetVirtualSize(size); mScrolledWindow->SetVirtualSize(size);
/* This doesn't work to make the mScrolledWindow automatically resize, so do it explicitly in OnSize. /* This doesn't work to make the mScrolledWindow automatically resize, so do it explicitly in OnSize.
auto pBoxSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); wxBoxSizer* pBoxSizer = new wxBoxSizer(wxVERTICAL);
pBoxSizer->Add(mScrolledWindow, 0, wxExpand, 0); pBoxSizer->Add(mScrolledWindow, 0, wxExpand, 0);
this->SetAutoLayout(true); this->SetAutoLayout(true);
this->SetSizer(pBoxSizer); this->SetSizer(pBoxSizer);

View File

@ -927,7 +927,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
wxNO_BORDER); wxNO_BORDER);
mMainPanel->SetSizer( safenew wxBoxSizer(wxVERTICAL) ); mMainPanel->SetSizer( new wxBoxSizer(wxVERTICAL) );
pPage = mMainPanel; pPage = mMainPanel;
// Set the colour here to the track panel background to avoid // Set the colour here to the track panel background to avoid
// flicker when Audacity starts up. // flicker when Audacity starts up.
@ -937,17 +937,13 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
//pPage->SetBackgroundColour( theTheme.Colour( clrDark )); //pPage->SetBackgroundColour( theTheme.Colour( clrDark ));
#endif #endif
wxBoxSizer *bs; wxBoxSizer *bs = new wxBoxSizer( wxVERTICAL );
{ bs->Add( mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP );
auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL); bs->Add( mRuler, 0, wxEXPAND );
bs = ubs.get(); bs->Add( pPage, 1, wxEXPAND );
bs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP); bs->Add( mToolManager->GetBotDock(), 0, wxEXPAND );
bs->Add(mRuler, 0, wxEXPAND); SetAutoLayout( true );
bs->Add(pPage, 1, wxEXPAND); SetSizer( bs );
bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND);
SetAutoLayout(true);
SetSizer(ubs.release());
}
bs->Layout(); bs->Layout();
// The right hand side translates to NEW TrackPanel(... in normal // The right hand side translates to NEW TrackPanel(... in normal
@ -976,37 +972,33 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
// keyboard focus problems. // keyboard focus problems.
pPage->MoveBeforeInTabOrder(mToolManager->GetTopDock()); pPage->MoveBeforeInTabOrder(mToolManager->GetTopDock());
bs = (wxBoxSizer *)pPage->GetSizer(); bs = (wxBoxSizer *) pPage->GetSizer();
{ wxBoxSizer *hs;
// Top horizontal grouping wxBoxSizer *vs;
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
// Track panel // Top horizontal grouping
hs->Add(mTrackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP); hs = new wxBoxSizer( wxHORIZONTAL );
{ // Track panel
// Vertical grouping hs->Add( mTrackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP );
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
// Vertical scroll bar // Vertical grouping
vs->Add(mVsbar, 1, wxEXPAND | wxALIGN_TOP); vs = new wxBoxSizer( wxVERTICAL );
hs->Add(vs.release(), 0, wxEXPAND | wxALIGN_TOP);
}
bs->Add(hs.release(), 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP); // Vertical scroll bar
} vs->Add( mVsbar, 1, wxEXPAND | wxALIGN_TOP );
hs->Add( vs, 0, wxEXPAND | wxALIGN_TOP );
bs->Add( hs, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP );
{ // Bottom horizontal grouping
// Bottom horizontal grouping hs = new wxBoxSizer( wxHORIZONTAL );
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
// Bottom scrollbar // Bottom scrollbar
hs->Add(mTrackPanel->GetLeftOffset() - 1, 0); hs->Add( mTrackPanel->GetLeftOffset() - 1, 0 );
hs->Add(mHsbar, 1, wxALIGN_BOTTOM); hs->Add( mHsbar, 1, wxALIGN_BOTTOM );
hs->Add(mVsbar->GetSize().GetWidth(), 0); hs->Add( mVsbar->GetSize().GetWidth(), 0 );
bs->Add(hs.release(), 0, wxEXPAND | wxALIGN_LEFT); bs->Add( hs, 0, wxEXPAND | wxALIGN_LEFT );
}
// Lay it out // Lay it out
pPage->SetAutoLayout(true); pPage->SetAutoLayout(true);

View File

@ -707,7 +707,7 @@ wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
Str ); Str );
pBox->SetLabel( Str ); pBox->SetLabel( Str );
pBox->SetName(wxStripMenuCodes(Str)); pBox->SetName(wxStripMenuCodes(Str));
mpSubSizer = std::make_unique<wxStaticBoxSizer>( mpSubSizer = new wxStaticBoxSizer(
pBox, pBox,
wxVERTICAL ); wxVERTICAL );
miSizerProp = iProp; miSizerProp = iProp;
@ -973,7 +973,7 @@ void ShuttleGuiBase::StartHorizontalLay( int PositionFlags, int iProp)
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
miSizerProp=iProp; miSizerProp=iProp;
mpSubSizer = std::make_unique<wxBoxSizer>( wxHORIZONTAL ); mpSubSizer = new wxBoxSizer( wxHORIZONTAL );
UpdateSizersCore( false, PositionFlags | wxALL ); UpdateSizersCore( false, PositionFlags | wxALL );
} }
@ -989,7 +989,7 @@ void ShuttleGuiBase::StartVerticalLay(int iProp)
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
miSizerProp=iProp; miSizerProp=iProp;
mpSubSizer = std::make_unique<wxBoxSizer>( wxVERTICAL ); mpSubSizer = new wxBoxSizer( wxVERTICAL );
UpdateSizers(); UpdateSizers();
} }
@ -1004,7 +1004,7 @@ void ShuttleGuiBase::StartMultiColumn(int nCols, int PositionFlags)
{ {
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
mpSubSizer = std::make_unique<wxFlexGridSizer>( nCols ); mpSubSizer = new wxFlexGridSizer( nCols );
UpdateSizersCore( false, PositionFlags | wxALL ); UpdateSizersCore( false, PositionFlags | wxALL );
} }
@ -1935,16 +1935,16 @@ void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags)
{ {
// When adding sizers into sizers, don't add a border. // When adding sizers into sizers, don't add a border.
// unless it's a static box sizer. // unless it's a static box sizer.
wxSizer *const pSubSizer = mpSubSizer.get(); if( wxDynamicCast( mpSubSizer, wxStaticBoxSizer ))
if (wxDynamicCast(pSubSizer, wxStaticBoxSizer))
{ {
mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags , miBorder); mpSizer->Add( mpSubSizer,miSizerProp, Flags , miBorder);
} }
else else
{ {
mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags ,0);//miBorder); mpSizer->Add( mpSubSizer,miSizerProp, Flags ,0);//miBorder);
} }
mpSizer = pSubSizer; mpSizer = mpSubSizer;
mpSubSizer = NULL;
PushSizer(); PushSizer();
} }
mpLastWind = mpWind; mpLastWind = mpWind;
@ -2116,7 +2116,7 @@ AttachableScrollBar * ShuttleGui::AddAttachableScrollBar( long style )
return pAttachableScrollBar; return pAttachableScrollBar;
} }
std::unique_ptr<wxSizer> CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra) wxSizer *CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
{ {
wxASSERT(parent != NULL); // To justify safenew wxASSERT(parent != NULL); // To justify safenew
@ -2136,7 +2136,7 @@ std::unique_ptr<wxSizer> CreateStdButtonSizer(wxWindow *parent, long buttons, wx
} }
wxButton *b = NULL; wxButton *b = NULL;
auto bs = std::make_unique<wxStdDialogButtonSizer>(); wxStdDialogButtonSizer *bs = new wxStdDialogButtonSizer();
if( buttons & eOkButton ) if( buttons & eOkButton )
{ {
@ -2226,8 +2226,9 @@ std::unique_ptr<wxSizer> CreateStdButtonSizer(wxWindow *parent, long buttons, wx
bs->Insert( lastLastSpacer + 1, b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin ); bs->Insert( lastLastSpacer + 1, b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
} }
std::unique_ptr<wxSizer> s = std::make_unique<wxBoxSizer>( wxVERTICAL ); wxSizer * s;
s->Add( bs.release(), 1, wxEXPAND | wxALL, 7 ); s = new wxBoxSizer( wxVERTICAL );
s->Add( bs, 1, wxEXPAND | wxALL, 7 );
s->Add( 0, 3 ); // a little extra space s->Add( 0, 3 ); // a little extra space
return s; return s;

View File

@ -313,7 +313,7 @@ protected:
// Proportion set by user rather than default. // Proportion set by user rather than default.
int miPropSetByUser; int miPropSetByUser;
std::unique_ptr<wxSizer> mpSubSizer; wxSizer * mpSubSizer;
wxSizer * mpSizer; wxSizer * mpSizer;
wxWindow * mpParent; wxWindow * mpParent;
wxWindow * mpWind; wxWindow * mpWind;
@ -358,7 +358,7 @@ enum
eCloseID = wxID_CANCEL eCloseID = wxID_CANCEL
}; };
AUDACITY_DLL_API std::unique_ptr<wxSizer> CreateStdButtonSizer( wxWindow *parent, AUDACITY_DLL_API wxSizer *CreateStdButtonSizer( wxWindow *parent,
long buttons = eOkButton | eCancelButton, long buttons = eOkButton | eCancelButton,
wxWindow *extra = NULL ); wxWindow *extra = NULL );

View File

@ -2887,179 +2887,175 @@ int EffectUIHost::ShowModal()
bool EffectUIHost::Initialize() bool EffectUIHost::Initialize()
{ {
wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
EffectPanel *w = safenew EffectPanel(this); EffectPanel *w = safenew EffectPanel(this);
// Try to give the window a sensible default/minimum size
w->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3),
mParent->GetSize().GetHeight() / 2));
mDisableTransport = !gAudioIO->IsAvailable(mProject);
mPlaying = gAudioIO->IsStreamActive(); // not exactly right, but will suffice
mCapturing = gAudioIO->IsStreamActive() && gAudioIO->GetNumCaptureChannels() > 0;
if (!mClient->PopulateUI(w))
{ {
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL); return false;
{ }
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
// Try to give the window a sensible default/minimum size hs->Add(w, 1, wxEXPAND);
w->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3), vs->Add(hs, 1, wxEXPAND);
mParent->GetSize().GetHeight() / 2));
mDisableTransport = !gAudioIO->IsAvailable(mProject); wxPanel *buttonPanel = safenew wxPanel(this, wxID_ANY);
mPlaying = gAudioIO->IsStreamActive(); // not exactly right, but will suffice wxPanel *const bar = safenew wxPanel(buttonPanel, wxID_ANY);
mCapturing = gAudioIO->IsStreamActive() && gAudioIO->GetNumCaptureChannels() > 0;
if (!mClient->PopulateUI(w)) // This fools NVDA into not saying "Panel" when the dialog gets focus
{ bar->SetName(wxT("\a"));
return false; bar->SetLabel(wxT("\a"));
}
hs->Add(w, 1, wxEXPAND); wxBoxSizer *bs = new wxBoxSizer(wxHORIZONTAL);
vs->Add(hs.release(), 1, wxEXPAND);
}
wxPanel *buttonPanel = safenew wxPanel(this, wxID_ANY); mSupportsRealtime = mEffect->SupportsRealtime();
wxPanel *const bar = safenew wxPanel(buttonPanel, wxID_ANY); mIsGUI = mClient->IsGraphicalUI();
mIsBatch = mEffect->IsBatchProcessing();
// This fools NVDA into not saying "Panel" when the dialog gets focus wxBitmapButton *bb;
bar->SetName(wxT("\a"));
bar->SetLabel(wxT("\a"));
wxBoxSizer *bs = new wxBoxSizer(wxHORIZONTAL); int margin = 0;
mSupportsRealtime = mEffect->SupportsRealtime();
mIsGUI = mClient->IsGraphicalUI();
mIsBatch = mEffect->IsBatchProcessing();
wxBitmapButton *bb;
int margin = 0;
#if defined(__WXMAC__) #if defined(__WXMAC__)
margin = 3; // I'm sure it's needed because of the order things are created... margin = 3; // I'm sure it's needed because of the order things are created...
#endif #endif
if (!mIsGUI)
{
wxASSERT(bar); // To justify safenew
mMenuBtn = safenew wxButton(bar, kMenuID, _("&Manage"));
bs->Add(mMenuBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
}
else
{
wxASSERT(bar); // To justify safenew
mMenuBtn = safenew wxBitmapButton(bar, kMenuID, CreateBitmap(effect_menu_xpm, true, false));
#if defined(__WXMAC__)
mMenuBtn->SetName(_("&Manage"));
#else
mMenuBtn->SetLabel(_("&Manage"));
#endif
bs->Add(mMenuBtn);
}
mMenuBtn->SetToolTip(_("Manage presets and options"));
bs->Add(5, 5);
if (!mIsBatch)
{
if (!mIsGUI) if (!mIsGUI)
{ {
wxASSERT(bar); // To justify safenew if (mSupportsRealtime)
mMenuBtn = safenew wxButton(bar, kMenuID, _("&Manage")); {
bs->Add(mMenuBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin); wxASSERT(bar); // To justify safenew
mPlayToggleBtn = safenew wxButton(bar, kPlayID, _("Start &Playback"));
mPlayToggleBtn->SetToolTip(_("Start and stop playback"));
bs->Add(mPlayToggleBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
}
else if (mEffect->GetType() != EffectTypeAnalyze)
{
wxASSERT(bar); // To justify safenew
mPlayToggleBtn = safenew wxButton(bar, kPlayID, _("&Preview"));
mPlayToggleBtn->SetToolTip(_("Preview effect"));
bs->Add(mPlayToggleBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
}
} }
else else
{ {
mPlayBM = CreateBitmap(effect_play_xpm, true, false);
mPlayDisabledBM = CreateBitmap(effect_play_disabled_xpm, true, false);
mStopBM = CreateBitmap(effect_stop_xpm, true, false);
mStopDisabledBM = CreateBitmap(effect_stop_disabled_xpm, true, false);
wxASSERT(bar); // To justify safenew wxASSERT(bar); // To justify safenew
mMenuBtn = safenew wxBitmapButton(bar, kMenuID, CreateBitmap(effect_menu_xpm, true, false)); bb = safenew wxBitmapButton(bar, kPlayID, mPlayBM);
bb->SetBitmapDisabled(mPlayDisabledBM);
mPlayBtn = bb;
bs->Add(mPlayBtn);
if (!mSupportsRealtime)
{
mPlayBtn->SetToolTip(_("Preview effect"));
#if defined(__WXMAC__) #if defined(__WXMAC__)
mMenuBtn->SetName(_("&Manage")); mPlayBtn->SetName(_("Preview effect"));
#else #else
mMenuBtn->SetLabel(_("&Manage")); mPlayBtn->SetLabel(_("&Preview effect"));
#endif #endif
bs->Add(mMenuBtn); }
} }
mMenuBtn->SetToolTip(_("Manage presets and options"));
bs->Add(5, 5); if (mSupportsRealtime)
if (!mIsBatch)
{ {
if (!mIsGUI) if (!mIsGUI)
{ {
if (mSupportsRealtime) wxASSERT(bar); // To justify safenew
{ mRewindBtn = safenew wxButton(bar, kRewindID, _("Skip &Backward"));
wxASSERT(bar); // To justify safenew bs->Add(mRewindBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
mPlayToggleBtn = safenew wxButton(bar, kPlayID, _("Start &Playback"));
mPlayToggleBtn->SetToolTip(_("Start and stop playback"));
bs->Add(mPlayToggleBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
}
else if (mEffect->GetType() != EffectTypeAnalyze)
{
wxASSERT(bar); // To justify safenew
mPlayToggleBtn = safenew wxButton(bar, kPlayID, _("&Preview"));
mPlayToggleBtn->SetToolTip(_("Preview effect"));
bs->Add(mPlayToggleBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
}
} }
else else
{ {
mPlayBM = CreateBitmap(effect_play_xpm, true, false);
mPlayDisabledBM = CreateBitmap(effect_play_disabled_xpm, true, false);
mStopBM = CreateBitmap(effect_stop_xpm, true, false);
mStopDisabledBM = CreateBitmap(effect_stop_disabled_xpm, true, false);
wxASSERT(bar); // To justify safenew wxASSERT(bar); // To justify safenew
bb = safenew wxBitmapButton(bar, kPlayID, mPlayBM); bb = safenew wxBitmapButton(bar, kRewindID, CreateBitmap(effect_rewind_xpm, true, true));
bb->SetBitmapDisabled(mPlayDisabledBM); bb->SetBitmapDisabled(CreateBitmap(effect_rewind_disabled_xpm, true, true));
mPlayBtn = bb; mRewindBtn = bb;
bs->Add(mPlayBtn);
if (!mSupportsRealtime)
{
mPlayBtn->SetToolTip(_("Preview effect"));
#if defined(__WXMAC__) #if defined(__WXMAC__)
mPlayBtn->SetName(_("Preview effect")); mRewindBtn->SetName(_("Skip &Backward"));
#else #else
mPlayBtn->SetLabel(_("&Preview effect")); mRewindBtn->SetLabel(_("Skip &Backward"));
#endif #endif
} bs->Add(mRewindBtn);
} }
mRewindBtn->SetToolTip(_("Skip backward"));
if (mSupportsRealtime) if (!mIsGUI)
{ {
if (!mIsGUI) wxASSERT(bar); // To justify safenew
{ mFFwdBtn = safenew wxButton(bar, kFFwdID, _("Skip &Forward"));
wxASSERT(bar); // To justify safenew bs->Add(mFFwdBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
mRewindBtn = safenew wxButton(bar, kRewindID, _("Skip &Backward"));
bs->Add(mRewindBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
}
else
{
wxASSERT(bar); // To justify safenew
bb = safenew wxBitmapButton(bar, kRewindID, CreateBitmap(effect_rewind_xpm, true, true));
bb->SetBitmapDisabled(CreateBitmap(effect_rewind_disabled_xpm, true, true));
mRewindBtn = bb;
#if defined(__WXMAC__)
mRewindBtn->SetName(_("Skip &Backward"));
#else
mRewindBtn->SetLabel(_("Skip &Backward"));
#endif
bs->Add(mRewindBtn);
}
mRewindBtn->SetToolTip(_("Skip backward"));
if (!mIsGUI)
{
wxASSERT(bar); // To justify safenew
mFFwdBtn = safenew wxButton(bar, kFFwdID, _("Skip &Forward"));
bs->Add(mFFwdBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
}
else
{
wxASSERT(bar); // To justify safenew
bb = safenew wxBitmapButton(bar, kFFwdID, CreateBitmap(effect_ffwd_xpm, true, true));
bb->SetBitmapDisabled(CreateBitmap(effect_ffwd_disabled_xpm, true, true));
mFFwdBtn = bb;
#if defined(__WXMAC__)
mFFwdBtn->SetName(_("Skip &Foreward"));
#else
mFFwdBtn->SetLabel(_("Skip &Foreward"));
#endif
bs->Add(mFFwdBtn);
}
mFFwdBtn->SetToolTip(_("Skip forward"));
bs->Add(5, 5);
mEnableCb = safenew wxCheckBox(bar, kEnableID, _("&Enable"));
mEnableCb->SetValue(mEnabled);
mEnableCb->SetName(_("Enable"));
bs->Add(mEnableCb, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
} }
else
{
wxASSERT(bar); // To justify safenew
bb = safenew wxBitmapButton(bar, kFFwdID, CreateBitmap(effect_ffwd_xpm, true, true));
bb->SetBitmapDisabled(CreateBitmap(effect_ffwd_disabled_xpm, true, true));
mFFwdBtn = bb;
#if defined(__WXMAC__)
mFFwdBtn->SetName(_("Skip &Foreward"));
#else
mFFwdBtn->SetLabel(_("Skip &Foreward"));
#endif
bs->Add(mFFwdBtn);
}
mFFwdBtn->SetToolTip(_("Skip forward"));
bs->Add(5, 5);
mEnableCb = safenew wxCheckBox(bar, kEnableID, _("&Enable"));
mEnableCb->SetValue(mEnabled);
mEnableCb->SetName(_("Enable"));
bs->Add(mEnableCb, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
} }
bar->SetSizerAndFit(bs);
long buttons = eApplyButton + eCloseButton;
if (mEffect->mUIDebug)
{
buttons += eDebugButton;
}
buttonPanel->SetSizer(CreateStdButtonSizer(buttonPanel, buttons, bar).release());
vs->Add(buttonPanel, 0, wxEXPAND);
SetSizer(vs.release());
} }
bar->SetSizerAndFit(bs);
long buttons = eApplyButton + eCloseButton;
if (mEffect->mUIDebug)
{
buttons += eDebugButton;
}
buttonPanel->SetSizer(CreateStdButtonSizer(buttonPanel, buttons, bar));
vs->Add(buttonPanel, 0, wxEXPAND);
SetSizer(vs);
Layout(); Layout();
Fit(); Fit();
Center(); Center();

View File

@ -104,12 +104,10 @@ EffectRack::EffectRack()
mRemovePushed = CreateBitmap(remove_16x16_xpm, false, true); mRemovePushed = CreateBitmap(remove_16x16_xpm, false, true);
mRemoveRaised = CreateBitmap(remove_16x16_xpm, true, true); mRemoveRaised = CreateBitmap(remove_16x16_xpm, true, true);
{ wxBoxSizer *bs = new wxBoxSizer(wxVERTICAL);
auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL); mPanel = safenew wxPanel(this, wxID_ANY);
mPanel = safenew wxPanel(this, wxID_ANY); bs->Add(mPanel, 1, wxEXPAND);
bs->Add(mPanel, 1, wxEXPAND); SetSizer(bs);
SetSizer(bs.release());
}
wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
wxASSERT(mPanel); // To justify safenew wxASSERT(mPanel); // To justify safenew
@ -120,19 +118,17 @@ EffectRack::EffectRack()
hs->AddStretchSpacer(); hs->AddStretchSpacer();
hs->Add(safenew wxToggleButton(mPanel, wxID_CLEAR, _("&Bypass")), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); hs->Add(safenew wxToggleButton(mPanel, wxID_CLEAR, _("&Bypass")), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
{ bs = new wxBoxSizer(wxVERTICAL);
auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL); bs->Add(hs, 0, wxEXPAND);
bs->Add(hs, 0, wxEXPAND); bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND);
bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND);
mMainSizer = new wxFlexGridSizer(7); mMainSizer = new wxFlexGridSizer(7);
mMainSizer->AddGrowableCol(6); mMainSizer->AddGrowableCol(6);
mMainSizer->SetHGap(0); mMainSizer->SetHGap(0);
mMainSizer->SetVGap(0); mMainSizer->SetVGap(0);
bs->Add(mMainSizer, 1, wxEXPAND); bs->Add(mMainSizer, 1, wxEXPAND);
mPanel->SetSizer(bs.release()); mPanel->SetSizer(bs);
}
wxString oldPath = gPrefs->GetPath(); wxString oldPath = gPrefs->GetPath();
gPrefs->SetPath(wxT("/EffectsRack")); gPrefs->SetPath(wxT("/EffectsRack"));

View File

@ -2825,14 +2825,12 @@ void VSTEffect::BuildFancy()
return; return;
} }
{ wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
mainSizer->Add(mControl, 0, wxALIGN_CENTER); mainSizer->Add(mControl, 0, wxALIGN_CENTER);
mParent->SetMinSize(wxDefaultSize); mParent->SetMinSize(wxDefaultSize);
mParent->SetSizer(mainSizer.release()); mParent->SetSizer(mainSizer);
}
NeedEditIdle(true); NeedEditIdle(true);
@ -2843,126 +2841,119 @@ void VSTEffect::BuildFancy()
void VSTEffect::BuildPlain() void VSTEffect::BuildPlain()
{ {
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
wxASSERT(mParent); // To justify safenew wxASSERT(mParent); // To justify safenew
wxScrolledWindow *const scroller = safenew wxScrolledWindow(mParent, wxScrolledWindow *const scroller = safenew wxScrolledWindow(mParent,
wxID_ANY, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
wxVSCROLL | wxTAB_TRAVERSAL); wxVSCROLL | wxTAB_TRAVERSAL);
{ // Try to give the window a sensible default/minimum size
auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); scroller->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3),
mParent->GetSize().GetHeight() / 2));
scroller->SetScrollRate(0, 20);
// Try to give the window a sensible default/minimum size // This fools NVDA into not saying "Panel" when the dialog gets focus
scroller->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3), scroller->SetName(wxT("\a"));
mParent->GetSize().GetHeight() / 2)); scroller->SetLabel(wxT("\a"));
scroller->SetScrollRate(0, 20);
// This fools NVDA into not saying "Panel" when the dialog gets focus mainSizer->Add(scroller, 1, wxEXPAND | wxALL, 5);
scroller->SetName(wxT("\a")); mParent->SetSizer(mainSizer);
scroller->SetLabel(wxT("\a"));
mainSizer->Add(scroller, 1, wxEXPAND | wxALL, 5);
mParent->SetSizer(mainSizer.release());
}
mNames = new wxStaticText *[mAEffect->numParams]; mNames = new wxStaticText *[mAEffect->numParams];
mSliders = new wxSlider *[mAEffect->numParams]; mSliders = new wxSlider *[mAEffect->numParams];
mDisplays = new wxStaticText *[mAEffect->numParams]; mDisplays = new wxStaticText *[mAEffect->numParams];
mLabels = new wxStaticText *[mAEffect->numParams]; mLabels = new wxStaticText *[mAEffect->numParams];
wxSizer *paramSizer = new wxStaticBoxSizer(wxVERTICAL, scroller, _("Effect Settings"));
wxFlexGridSizer *gridSizer = new wxFlexGridSizer(4, 0, 0);
gridSizer->AddGrowableCol(1);
// Add the duration control for generators
if (GetType() == EffectTypeGenerate)
{ {
auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, scroller, _("Effect Settings")); wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
{ mDuration = safenew
auto gridSizer = std::make_unique<wxFlexGridSizer>(4, 0, 0); NumericTextCtrl(NumericConverter::TIME,
gridSizer->AddGrowableCol(1); scroller,
ID_Duration,
// Add the duration control for generators mHost->GetDurationFormat(),
if (GetType() == EffectTypeGenerate) mHost->GetDuration(),
{ mSampleRate,
wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:")); wxDefaultPosition,
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); wxDefaultSize,
mDuration = safenew true);
NumericTextCtrl(NumericConverter::TIME, mDuration->SetName(_("Duration"));
scroller, mDuration->EnableMenu();
ID_Duration, gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
mHost->GetDurationFormat(), gridSizer->Add(1, 1, 0);
mHost->GetDuration(), gridSizer->Add(1, 1, 0);
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
}
// Find the longest parameter name.
int namew = 0;
int w;
int h;
for (int i = 0; i < mAEffect->numParams; i++)
{
wxString text = GetString(effGetParamName, i);
if (text.Right(1) != wxT(':'))
{
text += wxT(':');
}
scroller->GetTextExtent(text, &w, &h);
if (w > namew)
{
namew = w;
}
}
scroller->GetTextExtent(wxT("HHHHHHHH"), &w, &h);
for (int i = 0; i < mAEffect->numParams; i++)
{
mNames[i] = safenew wxStaticText(scroller,
wxID_ANY,
wxEmptyString,
wxDefaultPosition,
wxSize(namew, -1),
wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
gridSizer->Add(mNames[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mSliders[i] = safenew wxSlider(scroller,
ID_Sliders + i,
0,
0,
1000,
wxDefaultPosition,
wxSize(200, -1));
gridSizer->Add(mSliders[i], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
mDisplays[i] = safenew wxStaticText(scroller,
wxID_ANY,
wxEmptyString,
wxDefaultPosition,
wxSize(w, -1),
wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
gridSizer->Add(mDisplays[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mLabels[i] = safenew wxStaticText(scroller,
wxID_ANY,
wxEmptyString,
wxDefaultPosition,
wxSize(w, -1),
wxALIGN_LEFT | wxST_NO_AUTORESIZE);
gridSizer->Add(mLabels[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
}
paramSizer->Add(gridSizer.release(), 1, wxEXPAND | wxALL, 5);
}
scroller->SetSizer(paramSizer.release());
} }
// Find the longest parameter name.
int namew = 0;
int w;
int h;
for (int i = 0; i < mAEffect->numParams; i++)
{
wxString text = GetString(effGetParamName, i);
if (text.Right(1) != wxT(':'))
{
text += wxT(':');
}
scroller->GetTextExtent(text, &w, &h);
if (w > namew)
{
namew = w;
}
}
scroller->GetTextExtent(wxT("HHHHHHHH"), &w, &h);
for (int i = 0; i < mAEffect->numParams; i++)
{
mNames[i] = safenew wxStaticText(scroller,
wxID_ANY,
wxEmptyString,
wxDefaultPosition,
wxSize(namew, -1),
wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
gridSizer->Add(mNames[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mSliders[i] = safenew wxSlider(scroller,
ID_Sliders + i,
0,
0,
1000,
wxDefaultPosition,
wxSize(200, -1));
gridSizer->Add(mSliders[i], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
mDisplays[i] = safenew wxStaticText(scroller,
wxID_ANY,
wxEmptyString,
wxDefaultPosition,
wxSize(w, -1),
wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
gridSizer->Add(mDisplays[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mLabels[i] = safenew wxStaticText(scroller,
wxID_ANY,
wxEmptyString,
wxDefaultPosition,
wxSize(w, -1),
wxALIGN_LEFT | wxST_NO_AUTORESIZE);
gridSizer->Add(mLabels[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
}
paramSizer->Add(gridSizer, 1, wxEXPAND | wxALL, 5);
scroller->SetSizer(paramSizer);
RefreshParameters(); RefreshParameters();
mSliders[0]->SetFocus(); mSliders[0]->SetFocus();

View File

@ -1164,293 +1164,285 @@ bool LadspaEffect::PopulateUI(wxWindow *parent)
memset(mFields, 0, mData->PortCount * sizeof(wxTextCtrl *)); memset(mFields, 0, mData->PortCount * sizeof(wxTextCtrl *));
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
wxASSERT(mParent); // To justify safenew
wxScrolledWindow *const w = safenew wxScrolledWindow(mParent, wxScrolledWindow *const w = safenew wxScrolledWindow(mParent,
wxID_ANY, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
wxVSCROLL | wxTAB_TRAVERSAL); wxVSCROLL | wxTAB_TRAVERSAL);
w->SetScrollRate(0, 20);
// This fools NVDA into not saying "Panel" when the dialog gets focus
w->SetName(wxT("\a"));
w->SetLabel(wxT("\a"));
mainSizer->Add(w, 1, wxEXPAND);
mParent->SetSizer(mainSizer);
wxSizer *marginSizer = new wxBoxSizer(wxVERTICAL);
if (mNumInputControls)
{ {
auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); wxStaticBoxSizer *paramSizer = new wxStaticBoxSizer(wxVERTICAL, w, _("Effect Settings"));
wxASSERT(mParent); // To justify safenew
w->SetScrollRate(0, 20);
// This fools NVDA into not saying "Panel" when the dialog gets focus wxFlexGridSizer *gridSizer = new wxFlexGridSizer(5, 0, 0);
w->SetName(wxT("\a")); gridSizer->AddGrowableCol(3);
w->SetLabel(wxT("\a"));
mainSizer->Add(w, 1, wxEXPAND); wxControl *item;
mParent->SetSizer(mainSizer.release());
}
wxSizer *marginSizer; // Add the duration control for generators
{ if (GetType() == EffectTypeGenerate)
auto uMarginSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
marginSizer = uMarginSizer.get();
if (mNumInputControls)
{ {
auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Settings")); item = safenew wxStaticText(w, 0, _("Duration:"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mDuration = safenew
NumericTextCtrl(NumericConverter::TIME,
w,
ID_Duration,
mHost->GetDurationFormat(),
mHost->GetDuration(),
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
}
auto gridSizer = std::make_unique<wxFlexGridSizer>(5, 0, 0); for (unsigned long p = 0; p < mData->PortCount; p++)
gridSizer->AddGrowableCol(3); {
LADSPA_PortDescriptor d = mData->PortDescriptors[p];
wxControl *item; if (LADSPA_IS_PORT_AUDIO(d) || LADSPA_IS_PORT_OUTPUT(d))
// Add the duration control for generators
if (GetType() == EffectTypeGenerate)
{ {
item = safenew wxStaticText(w, 0, _("Duration:")); continue;
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
mDuration = safenew
NumericTextCtrl(NumericConverter::TIME,
w,
ID_Duration,
mHost->GetDurationFormat(),
mHost->GetDuration(),
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
} }
for (unsigned long p = 0; p < mData->PortCount; p++) wxString labelText = LAT1CTOWX(mData->PortNames[p]);
item = safenew wxStaticText(w, 0, labelText + wxT(":"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
wxString fieldText;
LADSPA_PortRangeHint hint = mData->PortRangeHints[p];
if (LADSPA_IS_HINT_TOGGLED(hint.HintDescriptor))
{ {
LADSPA_PortDescriptor d = mData->PortDescriptors[p]; mToggles[p] = safenew wxCheckBox(w, ID_Toggles + p, wxT(""));
if (LADSPA_IS_PORT_AUDIO(d) || LADSPA_IS_PORT_OUTPUT(d)) mToggles[p]->SetName(labelText);
{ mToggles[p]->SetValue(mInputControls[p] > 0);
continue; gridSizer->Add(mToggles[p], 0, wxALL, 5);
}
wxString labelText = LAT1CTOWX(mData->PortNames[p]); gridSizer->Add(1, 1, 0);
item = safenew wxStaticText(w, 0, labelText + wxT(":")); gridSizer->Add(1, 1, 0);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); gridSizer->Add(1, 1, 0);
continue;
}
wxString fieldText; wxString bound;
LADSPA_PortRangeHint hint = mData->PortRangeHints[p]; float lower = -FLT_MAX;
float upper = FLT_MAX;
bool haslo = false;
bool hashi = false;
bool forceint = false;
if (LADSPA_IS_HINT_TOGGLED(hint.HintDescriptor)) if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
{ {
mToggles[p] = safenew wxCheckBox(w, ID_Toggles + p, wxT("")); lower = hint.LowerBound;
mToggles[p]->SetName(labelText); haslo = true;
mToggles[p]->SetValue(mInputControls[p] > 0); }
gridSizer->Add(mToggles[p], 0, wxALL, 5);
gridSizer->Add(1, 1, 0); if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
gridSizer->Add(1, 1, 0); {
gridSizer->Add(1, 1, 0); upper = hint.UpperBound;
continue; hashi = true;
} }
wxString bound; if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor))
float lower = -FLT_MAX; {
float upper = FLT_MAX; lower *= mSampleRate;
bool haslo = false; upper *= mSampleRate;
bool hashi = false; forceint = true;
bool forceint = false; }
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) // Limit to the UI precision
{ lower = ceilf(lower * 1000000.0) / 1000000.0;
lower = hint.LowerBound; upper = floorf(upper * 1000000.0) / 1000000.0;
haslo = true; mInputControls[p] = roundf(mInputControls[p] * 1000000.0) / 1000000.0;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) if (haslo && mInputControls[p] < lower)
{ {
upper = hint.UpperBound; mInputControls[p] = lower;
hashi = true; }
}
if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor)) if (hashi && mInputControls[p] > upper)
{ {
lower *= mSampleRate; mInputControls[p] = lower;
upper *= mSampleRate; }
forceint = true;
}
// Limit to the UI precision // Don't specify a value at creation time. This prevents unwanted events
lower = ceilf(lower * 1000000.0) / 1000000.0; // being sent to the OnTextCtrl() handler before the associated slider
upper = floorf(upper * 1000000.0) / 1000000.0; // has been created.
mInputControls[p] = roundf(mInputControls[p] * 1000000.0) / 1000000.0; mFields[p] = safenew wxTextCtrl(w, ID_Texts + p);
mFields[p]->SetName(labelText);
if (haslo && mInputControls[p] < lower) gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
{
mInputControls[p] = lower;
}
if (hashi && mInputControls[p] > upper)
{
mInputControls[p] = lower;
}
// Don't specify a value at creation time. This prevents unwanted events
// being sent to the OnTextCtrl() handler before the associated slider
// has been created.
mFields[p] = safenew wxTextCtrl(w, ID_Texts + p);
mFields[p]->SetName(labelText);
gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
wxString str;
if (haslo)
{
if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
{
str.Printf(wxT("%d"), (int)(lower + 0.5));
}
else
{
str = Internat::ToDisplayString(lower);
}
item = safenew wxStaticText(w, 0, str);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
}
else
{
gridSizer->Add(1, 1, 0);
}
mSliders[p] = safenew wxSlider(w, ID_Sliders + p,
0, 0, 1000,
wxDefaultPosition,
wxSize(200, -1));
mSliders[p]->SetName(labelText);
gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
if (hashi)
{
if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
{
str.Printf(wxT("%d"), (int)(upper + 0.5));
}
else
{
str = Internat::ToDisplayString(upper);
}
item = safenew wxStaticText(w, 0, str);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
}
else
{
gridSizer->Add(1, 1, 0);
}
wxString str;
if (haslo)
{
if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint) if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
{ {
fieldText.Printf(wxT("%d"), (int)(mInputControls[p] + 0.5)); str.Printf(wxT("%d"), (int)(lower + 0.5));
IntegerValidator<float> vld(&mInputControls[p]);
vld.SetRange(haslo ? lower : INT_MIN,
hashi ? upper : INT_MAX);
mFields[p]->SetValidator(vld);
} }
else else
{ {
fieldText = Internat::ToDisplayString(mInputControls[p]); str = Internat::ToDisplayString(lower);
// > 12 decimal places can cause rounding errors in display.
FloatingPointValidator<float> vld(6, &mInputControls[p]);
vld.SetRange(lower, upper);
// Set number of decimal places
if (upper - lower < 10.0)
{
vld.SetStyle(NUM_VAL_THREE_TRAILING_ZEROES);
}
else if (upper - lower < 100.0)
{
vld.SetStyle(NUM_VAL_TWO_TRAILING_ZEROES);
}
else
{
vld.SetStyle(NUM_VAL_ONE_TRAILING_ZERO);
}
mFields[p]->SetValidator(vld);
} }
item = safenew wxStaticText(w, 0, str);
// Set the textctrl value. This will trigger an event so OnTextCtrl()
// can update the slider.
mFields[p]->SetValue(fieldText);
}
paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
}
if (mNumOutputControls > 0)
{
auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Output"));
auto gridSizer = std::make_unique<wxFlexGridSizer>(2, 0, 0);
gridSizer->AddGrowableCol(1);
wxControl *item;
for (unsigned long p = 0; p < mData->PortCount; p++)
{
LADSPA_PortDescriptor d = mData->PortDescriptors[p];
if (LADSPA_IS_PORT_AUDIO(d) || LADSPA_IS_PORT_INPUT(d))
{
continue;
}
wxString labelText = LAT1CTOWX(mData->PortNames[p]);
item = safenew wxStaticText(w, 0, labelText + wxT(":"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
}
LADSPA_PortRangeHint hint = mData->PortRangeHints[p]; else
{
wxString bound; gridSizer->Add(1, 1, 0);
float lower = 0.0;
float upper = 1.0;
bool haslo = false;
bool hashi = false;
bool forceint = false;
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
{
lower = hint.LowerBound;
haslo = true;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
{
upper = hint.UpperBound;
hashi = true;
}
if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor))
{
lower *= mSampleRate;
upper *= mSampleRate;
forceint = true;
}
// Limit to the UI precision
lower = ceilf(lower * 1000000.0) / 1000000.0;
upper = floorf(upper * 1000000.0) / 1000000.0;
mInputControls[p] = roundf(mInputControls[p] * 1000000.0) / 1000000.0;
mMeters[p] = safenew LadspaEffectMeter(w, mOutputControls[p], lower, upper);
mMeters[p]->SetName(labelText);
gridSizer->Add(mMeters[p], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5);
} }
paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5); mSliders[p] = safenew wxSlider(w, ID_Sliders + p,
marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5); 0, 0, 1000,
wxDefaultPosition,
wxSize(200, -1));
mSliders[p]->SetName(labelText);
gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
if (hashi)
{
if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
{
str.Printf(wxT("%d"), (int)(upper + 0.5));
}
else
{
str = Internat::ToDisplayString(upper);
}
item = safenew wxStaticText(w, 0, str);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
}
else
{
gridSizer->Add(1, 1, 0);
}
RefreshControls(true); if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
{
fieldText.Printf(wxT("%d"), (int)(mInputControls[p] + 0.5));
IntegerValidator<float> vld(&mInputControls[p]);
vld.SetRange(haslo ? lower : INT_MIN,
hashi ? upper : INT_MAX);
mFields[p]->SetValidator(vld);
}
else
{
fieldText = Internat::ToDisplayString(mInputControls[p]);
// > 12 decimal places can cause rounding errors in display.
FloatingPointValidator<float> vld(6, &mInputControls[p]);
vld.SetRange(lower, upper);
// Set number of decimal places
if (upper - lower < 10.0)
{
vld.SetStyle(NUM_VAL_THREE_TRAILING_ZEROES);
}
else if (upper - lower < 100.0)
{
vld.SetStyle(NUM_VAL_TWO_TRAILING_ZEROES);
}
else
{
vld.SetStyle(NUM_VAL_ONE_TRAILING_ZERO);
}
mFields[p]->SetValidator(vld);
}
// Set the textctrl value. This will trigger an event so OnTextCtrl()
// can update the slider.
mFields[p]->SetValue(fieldText);
} }
w->SetSizer(uMarginSizer.release()); paramSizer->Add(gridSizer, 0, wxEXPAND | wxALL, 5);
marginSizer->Add(paramSizer, 0, wxEXPAND | wxALL, 5);
} }
if (mNumOutputControls > 0 )
{
wxSizer *paramSizer = new wxStaticBoxSizer(wxVERTICAL, w, _("Effect Output"));
wxFlexGridSizer *gridSizer = new wxFlexGridSizer(2, 0, 0);
gridSizer->AddGrowableCol(1);
wxControl *item;
for (unsigned long p = 0; p < mData->PortCount; p++)
{
LADSPA_PortDescriptor d = mData->PortDescriptors[p];
if (LADSPA_IS_PORT_AUDIO(d) || LADSPA_IS_PORT_INPUT(d))
{
continue;
}
wxString labelText = LAT1CTOWX(mData->PortNames[p]);
item = safenew wxStaticText(w, 0, labelText + wxT(":"));
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
LADSPA_PortRangeHint hint = mData->PortRangeHints[p];
wxString bound;
float lower = 0.0;
float upper = 1.0;
bool haslo = false;
bool hashi = false;
bool forceint = false;
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
{
lower = hint.LowerBound;
haslo = true;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
{
upper = hint.UpperBound;
hashi = true;
}
if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor))
{
lower *= mSampleRate;
upper *= mSampleRate;
forceint = true;
}
// Limit to the UI precision
lower = ceilf(lower * 1000000.0) / 1000000.0;
upper = floorf(upper * 1000000.0) / 1000000.0;
mInputControls[p] = roundf(mInputControls[p] * 1000000.0) / 1000000.0;
mMeters[p] = safenew LadspaEffectMeter(w, mOutputControls[p], lower, upper);
mMeters[p]->SetName(labelText);
gridSizer->Add(mMeters[p], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5);
}
paramSizer->Add(gridSizer, 0, wxEXPAND | wxALL, 5);
marginSizer->Add(paramSizer, 0, wxEXPAND | wxALL, 5);
RefreshControls(true);
}
w->SetSizer(marginSizer);
w->Layout(); w->Layout();
// Try to give the window a sensible default/minimum size // Try to give the window a sensible default/minimum size

View File

@ -1465,11 +1465,11 @@ bool LV2Effect::BuildFancy()
wxSizerItem *si = NULL; wxSizerItem *si = NULL;
if (vs) if (vs)
{ {
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL); wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
if (hs) if (hs)
{ {
si = hs->Add(mContainer, 1, wxCENTER | wxEXPAND); si = hs->Add(mContainer, 1, wxCENTER | wxEXPAND);
vs->Add(hs.release(), 0, wxCENTER); vs->Add(hs, 0, wxCENTER);
} }
} }
@ -1578,291 +1578,282 @@ bool LV2Effect::BuildPlain()
mSliders = new wxSlider *[ctrlcnt]; mSliders = new wxSlider *[ctrlcnt];
mFields = new wxTextCtrl *[ctrlcnt]; mFields = new wxTextCtrl *[ctrlcnt];
wxSizer *innerSizer; wxSizer *outerSizer = new wxBoxSizer(wxVERTICAL);
wxASSERT(mParent); // To justify safenew wxASSERT(mParent); // To justify safenew
wxScrolledWindow *const w = safenew wxScrolledWindow(mParent, wxScrolledWindow *const w = safenew wxScrolledWindow(mParent,
wxID_ANY, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
wxVSCROLL | wxTAB_TRAVERSAL); wxVSCROLL | wxTAB_TRAVERSAL);
w->SetScrollRate(0, 20);
// This fools NVDA into not saying "Panel" when the dialog gets focus
w->SetName(wxT("\a"));
w->SetLabel(wxT("\a"));
outerSizer->Add(w, 1, wxEXPAND);
wxSizer *innerSizer = new wxBoxSizer(wxVERTICAL);
if (GetType() == EffectTypeGenerate)
{ {
auto outerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); // Add the length control
w->SetScrollRate(0, 20); wxSizer *groupSizer = new wxStaticBoxSizer(wxVERTICAL, w, _("Generator"));
// This fools NVDA into not saying "Panel" when the dialog gets focus wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
w->SetName(wxT("\a"));
w->SetLabel(wxT("\a")); wxWindow *item = safenew wxStaticText(w, 0, _("&Duration:"));
sizer->Add(item, 0, wxALIGN_CENTER | wxALL, 5);
mDuration = safenew
NumericTextCtrl(NumericConverter::TIME,
w,
ID_Duration,
mHost->GetDurationFormat(),
mHost->GetDuration(),
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
sizer->Add(mDuration, 0, wxALIGN_CENTER | wxALL, 5);
outerSizer->Add(w, 1, wxEXPAND); groupSizer->Add(sizer, 0, wxALIGN_CENTER | wxALL, 5);
innerSizer->Add(groupSizer, 0, wxEXPAND | wxALL, 5);
}
mGroups.Sort();
for (size_t i = 0, cnt = mGroups.GetCount(); i < cnt; i++)
{
wxString label = mGroups[i];
if (label.IsEmpty())
{ {
auto uInnerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); label = _("Effect Settings");
innerSizer = uInnerSizer.get(); }
wxSizer *groupSizer = new wxStaticBoxSizer(wxVERTICAL, w, label);
if (GetType() == EffectTypeGenerate) wxFlexGridSizer *gridSizer = new wxFlexGridSizer(numCols, 5, 5);
gridSizer->AddGrowableCol(3);
const wxArrayInt & params = mGroupMap[mGroups[i]];
for (size_t pi = 0, cnt = params.GetCount(); pi < cnt; pi++)
{
int p = params[pi];
LV2Port & ctrl = mControls[p];
wxString labelText = ctrl.mName;
if (!ctrl.mUnits.IsEmpty())
{ {
// Add the length control labelText += wxT(" (") + ctrl.mUnits + wxT(")");
auto groupSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Generator"));
auto sizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
wxWindow *item = safenew wxStaticText(w, 0, _("&Duration:"));
sizer->Add(item, 0, wxALIGN_CENTER | wxALL, 5);
mDuration = safenew
NumericTextCtrl(NumericConverter::TIME,
w,
ID_Duration,
mHost->GetDurationFormat(),
mHost->GetDuration(),
mSampleRate,
wxDefaultPosition,
wxDefaultSize,
true);
mDuration->SetName(_("Duration"));
mDuration->EnableMenu();
sizer->Add(mDuration, 0, wxALIGN_CENTER | wxALL, 5);
groupSizer->Add(sizer.release(), 0, wxALIGN_CENTER | wxALL, 5);
innerSizer->Add(groupSizer.release(), 0, wxEXPAND | wxALL, 5);
} }
mGroups.Sort(); if (ctrl.mTrigger)
for (size_t i = 0, cnt = mGroups.GetCount(); i < cnt; i++)
{ {
wxString label = mGroups[i]; gridSizer->Add(1, 1, 0);
if (label.IsEmpty())
wxASSERT(w); // To justify safenew
wxButton *b = safenew wxButton(w, ID_Triggers + p, labelText);
gridSizer->Add(b, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
continue;
}
wxWindow *item = safenew wxStaticText(w, wxID_ANY, labelText + wxT(":"),
wxDefaultPosition, wxDefaultSize,
wxALIGN_RIGHT);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
if (ctrl.mToggle)
{
wxCheckBox *c = safenew wxCheckBox(w, ID_Toggles + p, wxT(""));
c->SetName(labelText);
c->SetValue(ctrl.mVal > 0);
gridSizer->Add(c, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
}
else if (ctrl.mEnumeration) // Check before integer
{
int s;
for (s = (int) ctrl.mScaleValues.GetCount() - 1; s >= 0; s--)
{ {
label = _("Effect Settings"); if (ctrl.mVal >= ctrl.mScaleValues[s])
{
break;
}
} }
auto groupSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, label);
auto gridSizer = std::make_unique<wxFlexGridSizer>(numCols, 5, 5); if (s < 0)
gridSizer->AddGrowableCol(3);
const wxArrayInt & params = mGroupMap[mGroups[i]];
for (size_t pi = 0, cnt = params.GetCount(); pi < cnt; pi++)
{ {
int p = params[pi]; s = 0;
LV2Port & ctrl = mControls[p]; }
wxString labelText = ctrl.mName;
if (!ctrl.mUnits.IsEmpty()) wxChoice *c = safenew wxChoice(w, ID_Choices + p);
c->SetName(labelText);
c->Append(ctrl.mScaleLabels);
c->SetSelection(s);
gridSizer->Add(c, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
}
else if (!ctrl.mInput)
{
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
LV2EffectMeter *m = safenew LV2EffectMeter(w, ctrl);
gridSizer->Add(m, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND);
gridSizer->Add(1, 1, 0);
}
else
{
mFields[p] = safenew wxTextCtrl(w, ID_Texts + p, wxT(""));
mFields[p]->SetName(labelText);
gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
float rate = ctrl.mSampleRate ? mSampleRate : 1.0;
ctrl.mVal = ctrl.mDef;
ctrl.mLo = ctrl.mMin * rate;
ctrl.mHi = ctrl.mMax * rate;
ctrl.mTmp = ctrl.mDef * rate;
if (ctrl.mInteger)
{
IntegerValidator<float> vld(&ctrl.mTmp);
vld.SetRange(ctrl.mLo, ctrl.mHi);
mFields[p]->SetValidator(vld);
}
else
{
FloatingPointValidator<float> vld(6, &ctrl.mTmp);
vld.SetRange(ctrl.mLo, ctrl.mHi);
// Set number of decimal places
float range = ctrl.mHi - ctrl.mLo;
int style = range < 10 ? NUM_VAL_THREE_TRAILING_ZEROES :
range < 100 ? NUM_VAL_TWO_TRAILING_ZEROES :
NUM_VAL_ONE_TRAILING_ZERO;
vld.SetStyle(style);
mFields[p]->SetValidator(vld);
}
if (ctrl.mHasLo)
{
wxString str;
if (ctrl.mInteger || ctrl.mSampleRate)
{ {
labelText += wxT(" (") + ctrl.mUnits + wxT(")"); str.Printf(wxT("%d"), lrintf(ctrl.mLo));
} }
else
if (ctrl.mTrigger)
{ {
gridSizer->Add(1, 1, 0); str = Internat::ToDisplayString(ctrl.mLo);
wxASSERT(w); // To justify safenew
wxButton *b = safenew wxButton(w, ID_Triggers + p, labelText);
gridSizer->Add(b, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
continue;
} }
item = safenew wxStaticText(w, wxID_ANY, str);
wxWindow *item = safenew wxStaticText(w, wxID_ANY, labelText + wxT(":"),
wxDefaultPosition, wxDefaultSize,
wxALIGN_RIGHT);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT); gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
}
else
{
gridSizer->Add(1, 1, 0);
}
if (ctrl.mToggle) mSliders[p] = safenew wxSlider(w, ID_Sliders + p,
0, 0, 1000,
wxDefaultPosition,
wxSize(150, -1));
mSliders[p]->SetName(labelText);
gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND);
if (ctrl.mHasHi)
{
wxString str;
if (ctrl.mInteger || ctrl.mSampleRate)
{ {
wxCheckBox *c = safenew wxCheckBox(w, ID_Toggles + p, wxT("")); str.Printf(wxT("%d"), lrintf(ctrl.mHi));
c->SetName(labelText);
c->SetValue(ctrl.mVal > 0);
gridSizer->Add(c, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
}
else if (ctrl.mEnumeration) // Check before integer
{
int s;
for (s = (int)ctrl.mScaleValues.GetCount() - 1; s >= 0; s--)
{
if (ctrl.mVal >= ctrl.mScaleValues[s])
{
break;
}
}
if (s < 0)
{
s = 0;
}
wxChoice *c = safenew wxChoice(w, ID_Choices + p);
c->SetName(labelText);
c->Append(ctrl.mScaleLabels);
c->SetSelection(s);
gridSizer->Add(c, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
}
else if (!ctrl.mInput)
{
gridSizer->Add(1, 1, 0);
gridSizer->Add(1, 1, 0);
LV2EffectMeter *m = safenew LV2EffectMeter(w, ctrl);
gridSizer->Add(m, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND);
gridSizer->Add(1, 1, 0);
} }
else else
{ {
mFields[p] = safenew wxTextCtrl(w, ID_Texts + p, wxT("")); str = Internat::ToDisplayString(ctrl.mHi);
mFields[p]->SetName(labelText);
gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
float rate = ctrl.mSampleRate ? mSampleRate : 1.0;
ctrl.mVal = ctrl.mDef;
ctrl.mLo = ctrl.mMin * rate;
ctrl.mHi = ctrl.mMax * rate;
ctrl.mTmp = ctrl.mDef * rate;
if (ctrl.mInteger)
{
IntegerValidator<float> vld(&ctrl.mTmp);
vld.SetRange(ctrl.mLo, ctrl.mHi);
mFields[p]->SetValidator(vld);
}
else
{
FloatingPointValidator<float> vld(6, &ctrl.mTmp);
vld.SetRange(ctrl.mLo, ctrl.mHi);
// Set number of decimal places
float range = ctrl.mHi - ctrl.mLo;
int style = range < 10 ? NUM_VAL_THREE_TRAILING_ZEROES :
range < 100 ? NUM_VAL_TWO_TRAILING_ZEROES :
NUM_VAL_ONE_TRAILING_ZERO;
vld.SetStyle(style);
mFields[p]->SetValidator(vld);
}
if (ctrl.mHasLo)
{
wxString str;
if (ctrl.mInteger || ctrl.mSampleRate)
{
str.Printf(wxT("%d"), lrintf(ctrl.mLo));
}
else
{
str = Internat::ToDisplayString(ctrl.mLo);
}
item = safenew wxStaticText(w, wxID_ANY, str);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
}
else
{
gridSizer->Add(1, 1, 0);
}
mSliders[p] = safenew wxSlider(w, ID_Sliders + p,
0, 0, 1000,
wxDefaultPosition,
wxSize(150, -1));
mSliders[p]->SetName(labelText);
gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND);
if (ctrl.mHasHi)
{
wxString str;
if (ctrl.mInteger || ctrl.mSampleRate)
{
str.Printf(wxT("%d"), lrintf(ctrl.mHi));
}
else
{
str = Internat::ToDisplayString(ctrl.mHi);
}
item = safenew wxStaticText(w, wxID_ANY, str);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
}
else
{
gridSizer->Add(1, 1, 0);
}
} }
item = safenew wxStaticText(w, wxID_ANY, str);
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
} }
else
groupSizer->Add(gridSizer.release(), 1, wxEXPAND | wxALL, 5);
innerSizer->Add(groupSizer.release(), 0, wxEXPAND | wxALL, 5);
}
innerSizer->Layout();
// Calculate the maximum width of all columns (bypass Generator sizer)
wxArrayInt widths;
widths.Add(0, numCols);
size_t cnt = innerSizer->GetChildren().GetCount();
for (size_t i = (GetType() == EffectTypeGenerate); i < cnt; i++)
{
wxSizer *groupSizer = innerSizer->GetItem(i)->GetSizer();
wxFlexGridSizer *gridSizer = (wxFlexGridSizer *)groupSizer->GetItem((size_t)0)->GetSizer();
size_t items = gridSizer->GetChildren().GetCount();
int cols = gridSizer->GetCols();
for (size_t j = 0; j < items; j++)
{ {
wxSizerItem *item = gridSizer->GetItem(j); gridSizer->Add(1, 1, 0);
widths[j % cols] = wxMax(widths[j % cols], item->GetSize().GetWidth());
} }
} }
// Set each column in all of the groups to the same width.
for (size_t i = (GetType() == EffectTypeGenerate); i < cnt; i++)
{
wxSizer *groupSizer = innerSizer->GetItem(i)->GetSizer();
wxFlexGridSizer *gridSizer = (wxFlexGridSizer *)groupSizer->GetItem((size_t)0)->GetSizer();
size_t items = gridSizer->GetChildren().GetCount();
int cols = gridSizer->GetCols();
for (size_t j = 0; j < items; j++)
{
wxSizerItem *item = gridSizer->GetItem(j);
int flags = item->GetFlag();
if (flags & wxEXPAND)
{
continue;
}
if (flags & wxALIGN_RIGHT)
{
flags = (flags & ~wxALL) | wxLEFT;
}
else
{
flags = (flags & ~wxALL) | wxRIGHT;
}
item->SetFlag(flags);
item->SetBorder(widths[j % cols] - item->GetMinSize().GetWidth());
}
}
w->SetSizer(uInnerSizer.release());
} }
mParent->SetSizer(outerSizer.release()); groupSizer->Add(gridSizer, 1, wxEXPAND | wxALL, 5);
innerSizer->Add(groupSizer, 0, wxEXPAND | wxALL, 5);
} }
innerSizer->Layout();
// Calculate the maximum width of all columns (bypass Generator sizer)
wxArrayInt widths;
widths.Add(0, numCols);
size_t cnt = innerSizer->GetChildren().GetCount();
for (size_t i = (GetType() == EffectTypeGenerate); i < cnt; i++)
{
wxSizer *groupSizer = innerSizer->GetItem(i)->GetSizer();
wxFlexGridSizer *gridSizer = (wxFlexGridSizer *)groupSizer->GetItem((size_t) 0)->GetSizer();
size_t items = gridSizer->GetChildren().GetCount();
int cols = gridSizer->GetCols();
for (size_t j = 0; j < items; j++)
{
wxSizerItem *item = gridSizer->GetItem(j);
widths[j % cols] = wxMax(widths[j % cols], item->GetSize().GetWidth());
}
}
// Set each column in all of the groups to the same width.
for (size_t i = (GetType() == EffectTypeGenerate); i < cnt; i++)
{
wxSizer *groupSizer = innerSizer->GetItem(i)->GetSizer();
wxFlexGridSizer *gridSizer = (wxFlexGridSizer *)groupSizer->GetItem((size_t) 0)->GetSizer();
size_t items = gridSizer->GetChildren().GetCount();
int cols = gridSizer->GetCols();
for (size_t j = 0; j < items; j++)
{
wxSizerItem *item = gridSizer->GetItem(j);
int flags = item->GetFlag();
if (flags & wxEXPAND)
{
continue;
}
if (flags & wxALIGN_RIGHT)
{
flags = (flags & ~wxALL) | wxLEFT;
}
else
{
flags = (flags & ~wxALL) | wxRIGHT;
}
item->SetFlag(flags);
item->SetBorder(widths[j % cols] - item->GetMinSize().GetWidth());
}
}
w->SetSizer(innerSizer);
mParent->SetSizer(outerSizer);
// Try to give the window a sensible default/minimum size // Try to give the window a sensible default/minimum size
wxSize sz1 = innerSizer->GetMinSize(); wxSize sz1 = innerSizer->GetMinSize();
wxSize sz2 = mParent->GetMinSize(); wxSize sz2 = mParent->GetMinSize();

View File

@ -2242,39 +2242,33 @@ NyquistOutputDialog::NyquistOutputDialog(wxWindow * parent, wxWindowID id,
{ {
SetName(GetTitle()); SetName(GetTitle());
wxBoxSizer *mainSizer; wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
{ wxBoxSizer *hSizer;
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); wxButton *button;
mainSizer = uMainSizer.get(); wxControl *item;
wxButton *button;
wxControl *item;
item = safenew wxStaticText(this, -1, prompt); item = safenew wxStaticText(this, -1, prompt);
item->SetName(prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) item->SetName(prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
mainSizer->Add(item, 0, wxALIGN_LEFT | wxLEFT | wxTOP | wxRIGHT, 10); mainSizer->Add(item, 0, wxALIGN_LEFT | wxLEFT | wxTOP | wxRIGHT, 10);
// TODO use ShowInfoDialog() instead. // TODO use ShowInfoDialog() instead.
// Beware this dialog MUST work with screen readers. // Beware this dialog MUST work with screen readers.
item = safenew wxTextCtrl(this, -1, message, item = safenew wxTextCtrl(this, -1, message,
wxDefaultPosition, wxSize(400, 200), wxDefaultPosition, wxSize(400, 200),
wxTE_MULTILINE | wxTE_READONLY); wxTE_MULTILINE | wxTE_READONLY);
mainSizer->Add(item, 0, wxALIGN_LEFT | wxALL, 10); mainSizer->Add(item, 0, wxALIGN_LEFT | wxALL, 10);
{ hSizer = new wxBoxSizer(wxHORIZONTAL);
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
/* i18n-hint: In most languages OK is to be translated as OK. It appears on a button.*/ /* i18n-hint: In most languages OK is to be translated as OK. It appears on a button.*/
button = safenew wxButton(this, wxID_OK, _("OK")); button = safenew wxButton(this, wxID_OK, _("OK"));
button->SetDefault(); button->SetDefault();
hSizer->Add(button, 0, wxALIGN_CENTRE | wxALL, 5); hSizer->Add(button, 0, wxALIGN_CENTRE | wxALL, 5);
mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTRE | wxLEFT | wxBOTTOM | wxRIGHT, 5); mainSizer->Add(hSizer, 0, wxALIGN_CENTRE | wxLEFT | wxBOTTOM | wxRIGHT, 5);
}
SetAutoLayout(true);
SetSizer(uMainSizer.release());
}
SetAutoLayout(true);
SetSizer(mainSizer);
mainSizer->Fit(this); mainSizer->Fit(this);
mainSizer->SetSizeHints(this); mainSizer->SetSizeHints(this);
} }

View File

@ -1212,41 +1212,34 @@ ExportMixerDialog::ExportMixerDialog( TrackList *tracks, bool selectedOnly,
if (maxNumChannels > 32) if (maxNumChannels > 32)
maxNumChannels = 32; maxNumChannels = 32;
mMixerSpec = new MixerSpec(numTracks, maxNumChannels); mMixerSpec = new MixerSpec( numTracks, maxNumChannels );
wxBoxSizer *vertSizer;
{
auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
vertSizer = uVertSizer.get();
wxWindow *mixerPanel = safenew ExportMixerPanel(mMixerSpec, mTrackNames, this, wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL );
ID_MIXERPANEL, wxDefaultPosition, wxSize(400, -1));
mixerPanel->SetName(_("Mixer Panel"));
vertSizer->Add(mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5);
{ wxWindow *mixerPanel = safenew ExportMixerPanel( mMixerSpec, mTrackNames, this,
auto horSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); ID_MIXERPANEL, wxDefaultPosition, wxSize( 400, -1 ) );
mixerPanel->SetName(_("Mixer Panel"));
vertSizer->Add( mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5 );
wxString label; wxBoxSizer *horSizer = new wxBoxSizer( wxHORIZONTAL );
label.Printf(_("Output Channels: %2d"), mMixerSpec->GetNumChannels());
mChannelsText = safenew wxStaticText(this, -1, label);
horSizer->Add(mChannelsText, 0, wxALIGN_LEFT | wxALL, 5);
wxSlider *channels = safenew wxSlider(this, ID_SLIDER_CHANNEL, wxString label;
mMixerSpec->GetNumChannels(), 1, mMixerSpec->GetMaxNumChannels(), label.Printf( _( "Output Channels: %2d" ), mMixerSpec->GetNumChannels() );
wxDefaultPosition, wxSize(300, -1)); mChannelsText = safenew wxStaticText(this, -1, label);
channels->SetName(label); horSizer->Add( mChannelsText, 0, wxALIGN_LEFT | wxALL, 5 );
horSizer->Add(channels, 0, wxEXPAND | wxALL, 5);
vertSizer->Add(horSizer.release(), 0, wxALIGN_CENTRE | wxALL, 5); wxSlider *channels = safenew wxSlider( this, ID_SLIDER_CHANNEL,
} mMixerSpec->GetNumChannels(), 1, mMixerSpec->GetMaxNumChannels(),
wxDefaultPosition, wxSize( 300, -1 ) );
channels->SetName(label);
horSizer->Add( channels, 0, wxEXPAND | wxALL, 5 );
vertSizer->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND); vertSizer->Add( horSizer, 0, wxALIGN_CENTRE | wxALL, 5 );
SetAutoLayout(true); vertSizer->Add( CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND );
SetSizer(uVertSizer.release());
}
SetAutoLayout( true );
SetSizer( vertSizer );
vertSizer->Fit( this ); vertSizer->Fit( this );
vertSizer->SetSizeHints( this ); vertSizer->SetSizeHints( this );

View File

@ -751,24 +751,19 @@ wxDialog( parent, id, title, position, size, style | wxRESIZE_BORDER )
mFile = _mFile; mFile = _mFile;
scount = mFile->GetStreamCount(); scount = mFile->GetStreamCount();
for (wxInt32 i = 0; i < scount; i++) for (wxInt32 i = 0; i < scount; i++)
mFile->SetStreamUsage(i, FALSE); mFile->SetStreamUsage(i,FALSE);
wxBoxSizer *vertSizer; wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL );
{ wxArrayString *choices = mFile->GetStreamInfo();
auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); StreamList = safenew wxListBox(this, -1, wxDefaultPosition, wxDefaultSize, *choices , wxLB_EXTENDED | wxLB_ALWAYS_SB);
vertSizer = uVertSizer.get();
wxArrayString *choices = mFile->GetStreamInfo(); vertSizer->Add( StreamList, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 5 );
StreamList = safenew wxListBox(this, -1, wxDefaultPosition, wxDefaultSize, *choices, wxLB_EXTENDED | wxLB_ALWAYS_SB);
vertSizer->Add(StreamList, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 5); vertSizer->Add( CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND );
vertSizer->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND); SetAutoLayout( true );
SetAutoLayout(true); SetSizer( vertSizer );
SetSizer(uVertSizer.release());
}
vertSizer->Fit( this ); vertSizer->Fit( this );

View File

@ -240,8 +240,8 @@ static wxString AskCopyOrEdit()
wxDialog dialog(NULL, -1, wxString(_("Warning"))); wxDialog dialog(NULL, -1, wxString(_("Warning")));
dialog.SetName(dialog.GetTitle()); dialog.SetName(dialog.GetTitle());
wxBoxSizer *vbox; wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
dialog.SetSizer(vbox = safenew wxBoxSizer(wxVERTICAL)); dialog.SetSizer(vbox);
wxStaticText *message = safenew wxStaticText(&dialog, -1, wxString::Format(_("\ wxStaticText *message = safenew wxStaticText(&dialog, -1, wxString::Format(_("\
When importing uncompressed audio files you can either copy them \ When importing uncompressed audio files you can either copy them \
@ -261,27 +261,19 @@ How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _
wxStaticBox *box = safenew wxStaticBox(&dialog, -1, _("Choose an import method")); wxStaticBox *box = safenew wxStaticBox(&dialog, -1, _("Choose an import method"));
box->SetName(box->GetLabel()); box->SetName(box->GetLabel());
wxStaticBoxSizer *boxsizer = new wxStaticBoxSizer(box, wxVERTICAL);
wxRadioButton *aliasRadio; wxRadioButton *copyRadio = safenew wxRadioButton(&dialog, -1, _("Make a &copy of the files before editing (safer)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
wxRadioButton *copyRadio; boxsizer->Add(copyRadio, 0, wxALL);
wxCheckBox *dontAskNextTimeBox; copyRadio->SetName(wxStripMenuCodes(copyRadio->GetLabel()));
{ wxRadioButton *aliasRadio = safenew wxRadioButton(&dialog, -1, _("Read the files &directly from the original (faster)"));
auto boxsizer = std::make_unique<wxStaticBoxSizer>(box, wxVERTICAL); boxsizer->Add(aliasRadio, 0, wxALL);
aliasRadio->SetName(wxStripMenuCodes(aliasRadio->GetLabel()));
copyRadio = safenew wxRadioButton(&dialog, -1, _("Make a &copy of the files before editing (safer)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
boxsizer->Add(copyRadio, 0, wxALL);
copyRadio->SetName(wxStripMenuCodes(copyRadio->GetLabel()));
aliasRadio = safenew wxRadioButton(&dialog, -1, _("Read the files &directly from the original (faster)"));
boxsizer->Add(aliasRadio, 0, wxALL);
aliasRadio->SetName(wxStripMenuCodes(aliasRadio->GetLabel()));
dontAskNextTimeBox = safenew wxCheckBox(&dialog, -1, _("Don't &warn again and always use my choice above"));
boxsizer->Add(dontAskNextTimeBox, 0, wxALL);
vbox->Add(boxsizer.release(), 0, wxALL, 10);
}
wxCheckBox *dontAskNextTimeBox = safenew wxCheckBox(&dialog, -1, _("Don't &warn again and always use my choice above"));
boxsizer->Add(dontAskNextTimeBox, 0, wxALL);
vbox->Add(boxsizer, 0, wxALL, 10);
dontAskNextTimeBox->SetName(wxStripMenuCodes(dontAskNextTimeBox->GetLabel())); dontAskNextTimeBox->SetName(wxStripMenuCodes(dontAskNextTimeBox->GetLabel()));

View File

@ -282,8 +282,8 @@ void ControlToolBar::ArrangeButtons()
Detach( mSizer ); Detach( mSizer );
delete mSizer; delete mSizer;
} }
mSizer = new wxBoxSizer( wxHORIZONTAL );
Add((mSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND); Add( mSizer, 1, wxEXPAND );
// Start with a little extra space // Start with a little extra space
mSizer->Add( 5, 55 ); mSizer->Add( 5, 55 );

View File

@ -113,7 +113,8 @@ void MeterToolBar::ReCreateButtons()
void MeterToolBar::Populate() void MeterToolBar::Populate()
{ {
Add((mSizer = safenew wxGridBagSizer()), 1, wxEXPAND); mSizer = new wxGridBagSizer();
Add( mSizer, 1, wxEXPAND );
if( mWhichMeters & kWithRecordMeter ){ if( mWhichMeters & kWithRecordMeter ){
//JKC: Record on left, playback on right. Left to right flow //JKC: Record on left, playback on right. Left to right flow

View File

@ -114,6 +114,7 @@ void SelectionBar::Populate()
SetFont(wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); SetFont(wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
wxFlexGridSizer *mainSizer; wxFlexGridSizer *mainSizer;
wxBoxSizer *hSizer;
/* we don't actually need a control yet, but we want to use it's methods /* we don't actually need a control yet, but we want to use it's methods
* to do some look-ups, so we'll have to create one. We can't make the * to do some look-ups, so we'll have to create one. We can't make the
@ -121,7 +122,8 @@ void SelectionBar::Populate()
* runtime */ * runtime */
wxString formatName = mListener ? mListener->AS_GetSelectionFormat() : wxString(wxEmptyString); wxString formatName = mListener ? mListener->AS_GetSelectionFormat() : wxString(wxEmptyString);
Add((mainSizer = safenew wxFlexGridSizer(7, 1, 1)), 0, wxALIGN_CENTER_VERTICAL); mainSizer = new wxFlexGridSizer(7, 1, 1);
Add(mainSizer, 0, wxALIGN_CENTER_VERTICAL);
// //
// Top row (mostly labels) // Top row (mostly labels)
@ -148,20 +150,19 @@ void SelectionBar::Populate()
bool showSelectionLength = false; bool showSelectionLength = false;
gPrefs->Read(wxT("/ShowSelectionLength"), &showSelectionLength); gPrefs->Read(wxT("/ShowSelectionLength"), &showSelectionLength);
{ hSizer = new wxBoxSizer(wxHORIZONTAL);
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, _("End"),
mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, _("End"), wxDefaultPosition, wxDefaultSize,
wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
wxRB_GROUP); mRightEndButton->SetName(_("End"));
mRightEndButton->SetName(_("End")); mRightEndButton->SetValue(!showSelectionLength);
mRightEndButton->SetValue(!showSelectionLength); hSizer->Add(mRightEndButton,
hSizer->Add(mRightEndButton, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5); mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, _("Length"));
mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, _("Length")); mRightLengthButton->SetName(_("Length"));
mRightLengthButton->SetName(_("Length")); mRightLengthButton->SetValue(showSelectionLength);
mRightLengthButton->SetValue(showSelectionLength); hSizer->Add(mRightLengthButton,
hSizer->Add(mRightLengthButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
#if defined(__WXMSW__) #if defined(__WXMSW__)
// Refer to Microsoft KB article 261192 for an explanation as // Refer to Microsoft KB article 261192 for an explanation as
// to why this is needed. We've only experienced it under Win2k // to why this is needed. We've only experienced it under Win2k
@ -169,13 +170,12 @@ void SelectionBar::Populate()
// in for all versions. // in for all versions.
wxRadioButton* dummyButton = wxRadioButton* dummyButton =
safenew wxRadioButton(this, wxID_ANY, _("hidden"), safenew wxRadioButton(this, wxID_ANY, _("hidden"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxRB_GROUP); wxRB_GROUP);
dummyButton->Disable(); dummyButton->Disable();
dummyButton->Hide(); dummyButton->Hide();
#endif #endif
mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); mainSizer->Add(hSizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
}
mainSizer->Add(5, 1); mainSizer->Add(5, 1);

View File

@ -123,8 +123,8 @@ void SpectralSelectionBar::Populate()
? mListener->SSBL_GetBandwidthSelectionFormatName() ? mListener->SSBL_GetBandwidthSelectionFormatName()
: wxString(wxEmptyString); : wxString(wxEmptyString);
wxFlexGridSizer *mainSizer; wxFlexGridSizer *mainSizer = new wxFlexGridSizer(1, 1, 1);
Add((mainSizer = safenew wxFlexGridSizer(1, 1, 1)), 0, wxALIGN_CENTER_VERTICAL); Add(mainSizer, 0, wxALIGN_CENTER_VERTICAL);
// //
// Top row, choice box // Top row, choice box
@ -144,44 +144,42 @@ void SpectralSelectionBar::Populate()
// Bottom row, split into two columns, each with one control // Bottom row, split into two columns, each with one control
// //
{ wxBoxSizer *subSizer = new wxBoxSizer(wxHORIZONTAL);
auto subSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
mCenterCtrl = safenew NumericTextCtrl( mCenterCtrl = safenew NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0); NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0);
mCenterCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); mCenterCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
mCenterCtrl->SetName(_("Center Frequency:")); mCenterCtrl->SetName(_("Center Frequency:"));
mCenterCtrl->EnableMenu(); mCenterCtrl->EnableMenu();
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mWidthCtrl = safenew NumericTextCtrl( mWidthCtrl = safenew NumericTextCtrl(
NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0); NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0);
mWidthCtrl->SetInvalidValue(-1.0); mWidthCtrl->SetInvalidValue(-1.0);
mWidthCtrl->SetName(wxString(_("Bandwidth:"))); mWidthCtrl->SetName(wxString(_("Bandwidth:")));
mWidthCtrl->EnableMenu(); mWidthCtrl->EnableMenu();
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
mLowCtrl = safenew NumericTextCtrl( mLowCtrl = safenew NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0); NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0);
mLowCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); mLowCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
mLowCtrl->SetName(_("Low Frequency:")); mLowCtrl->SetName(_("Low Frequency:"));
mLowCtrl->EnableMenu(); mLowCtrl->EnableMenu();
subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mHighCtrl = safenew NumericTextCtrl( mHighCtrl = safenew NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnHighID, frequencyFormatName, 0.0); NumericConverter::FREQUENCY, this, OnHighID, frequencyFormatName, 0.0);
mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
mHighCtrl->SetName(wxString(_("High Frequency:"))); mHighCtrl->SetName(wxString(_("High Frequency:")));
mHighCtrl->EnableMenu(); mHighCtrl->EnableMenu();
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
mCenterCtrl->Show(mbCenterAndWidth); mCenterCtrl->Show(mbCenterAndWidth);
mWidthCtrl->Show(mbCenterAndWidth); mWidthCtrl->Show(mbCenterAndWidth);
mLowCtrl->Show(!mbCenterAndWidth); mLowCtrl->Show(!mbCenterAndWidth);
mHighCtrl->Show(!mbCenterAndWidth); mHighCtrl->Show(!mbCenterAndWidth);
mainSizer->Add(subSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); mainSizer->Add(subSizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
}
mainSizer->Layout(); mainSizer->Layout();

View File

@ -430,7 +430,8 @@ void ToolBar::ReCreateButtons()
ms->Add( mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1 ); ms->Add( mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1 );
// Use a box sizer for laying out controls // Use a box sizer for laying out controls
ms->Add((mHSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND); mHSizer = new wxBoxSizer( wxHORIZONTAL );
ms->Add( mHSizer, 1, wxEXPAND );
// (Re)Establish dock state // (Re)Establish dock state
SetDocked( GetDock(), false ); SetDocked( GetDock(), false );

View File

@ -118,28 +118,25 @@ class ToolFrame:public wxFrame
mBar = bar; mBar = bar;
// Transfer the bar to the ferry // Transfer the bar to the ferry
bar->Reparent(this); bar->Reparent( this );
// We use a sizer to maintain proper spacing
wxBoxSizer *s = new wxBoxSizer( wxHORIZONTAL );
// Add the bar to the sizer
s->Add( bar, 1, wxEXPAND | wxALL, border );
// Add space for the resize grabber
if( bar->IsResizable() )
{ {
// We use a sizer to maintain proper spacing s->Add( sizerW, 1 );
auto s = std::make_unique<wxBoxSizer>(wxHORIZONTAL); width += sizerW;
// Add the bar to the sizer
s->Add(bar, 1, wxEXPAND | wxALL, border);
// Add space for the resize grabber
if (bar->IsResizable())
{
s->Add(sizerW, 1);
width += sizerW;
}
SetSize(width + 2, bar->GetDockedSize().y + 2);
// Attach the sizer and resize the window to fit
SetSizer(s.release());
} }
SetSize( width + 2, bar->GetDockedSize().y + 2 );
// Attach the sizer and resize the window to fit
SetSizer( s );
Layout(); Layout();
// Inform toolbar of change // Inform toolbar of change

View File

@ -186,7 +186,8 @@ AButton * ToolsToolBar::MakeTool( teBmps eTool,
void ToolsToolBar::Populate() void ToolsToolBar::Populate()
{ {
MakeButtonBackgroundsSmall(); MakeButtonBackgroundsSmall();
Add(mToolSizer = safenew wxGridSizer(2, 3, 1, 1)); mToolSizer = new wxGridSizer( 2, 3, 1, 1 );
Add( mToolSizer );
/* Tools */ /* Tools */
mTool[ selectTool ] = MakeTool( bmpIBeam, selectTool, _("Selection Tool") ); mTool[ selectTool ] = MakeTool( bmpIBeam, selectTool, _("Selection Tool") );

View File

@ -109,33 +109,28 @@ ErrorDialog::ErrorDialog(
#if 0 #if 0
// Original non ShuttleGui based code. // Original non ShuttleGui based code.
// Layout did not look good on Windows. // Layout did not look good on Windows.
wxBoxSizer mainSizer; wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
{ wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL);
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
mainSizer = uMainSizer.get();
wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *hSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *hSizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticText *statText = safenew wxStaticText(this, -1, message); wxStaticText *statText = safenew wxStaticText(this, -1, message);
mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5); mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5);
wxButton *help = safenew wxButton(this, wxID_HELP, _("Help")); wxButton *help = safenew wxButton(this, wxID_HELP, _("Help"));
hSizer->Add(help, 0, wxALIGN_LEFT|wxALL, 5); hSizer->Add(help, 0, wxALIGN_LEFT|wxALL, 5);
wxButton *ok = safenew wxButton(this, wxID_OK, _("OK")); wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
ok->SetDefault(); ok->SetDefault();
ok->SetFocus(); ok->SetFocus();
hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5); hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5);
vSizer->Add(hSizer, 0, wxALIGN_CENTER|wxALL, 5); vSizer->Add(hSizer, 0, wxALIGN_CENTER|wxALL, 5);
mainSizer->Add(vSizer, 0, wxALL, 15 ); mainSizer->Add(vSizer, 0, wxALL, 15 );
SetAutoLayout(true);
SetSizer(uMainSizer.release());
}
SetAutoLayout(true);
SetSizer(mainSizer);
mainSizer->Fit(this); mainSizer->Fit(this);
mainSizer->SetSizeHints(this); mainSizer->SetSizeHints(this);
#endif #endif

View File

@ -68,78 +68,65 @@ MultiDialog::MultiDialog(wxWindow * pParent,
{ {
SetName(GetTitle()); SetName(GetTitle());
wxString *buttonLabels; wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *mainSizer; wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL);
{ wxBoxSizer *iconAndTextSizer = new wxBoxSizer( wxHORIZONTAL );
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
mainSizer = uMainSizer.get();
{ wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
auto vSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); wxART_MESSAGE_BOX);
{ wxStaticBitmap *icon = safenew wxStaticBitmap(this, -1, bitmap);
auto iconAndTextSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); iconAndTextSizer->Add( icon, 0, wxCENTER );
wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxStaticText *statText = safenew wxStaticText(this, -1, message);
wxART_MESSAGE_BOX); statText->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
wxStaticBitmap *icon = safenew wxStaticBitmap(this, -1, bitmap); iconAndTextSizer->Add(statText, 1, wxCENTER|wxLEFT,15 );
iconAndTextSizer->Add(icon, 0, wxCENTER);
wxStaticText *statText = safenew wxStaticText(this, -1, message); vSizer->Add(iconAndTextSizer, 0, wxALIGN_LEFT|wxALL, 5);
statText->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
iconAndTextSizer->Add(statText, 1, wxCENTER | wxLEFT, 15);
vSizer->Add(iconAndTextSizer.release(), 0, wxALIGN_LEFT | wxALL, 5);
}
int count = 0; int count=0;
while (buttons[count])count++; while(buttons[count])count++;
buttonLabels = new wxString[count]; wxString *buttonLabels = new wxString[count];
count = 0; count=0;
while (buttons[count]){ while(buttons[count]){
buttonLabels[count] = buttons[count]; buttonLabels[count] = buttons[count];
count++; count++;
}
mRadioBox = safenew wxRadioBox(this, -1,
boxMsg,
wxDefaultPosition, wxDefaultSize,
count, buttonLabels,
1, wxRA_SPECIFY_COLS);
mRadioBox->SetName(boxMsg);
mRadioBox->SetSelection(0);
vSizer->Add(mRadioBox, 1, wxEXPAND | wxALIGN_CENTER | wxALL, 5);
{
auto buttonSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
wxButton* pButton;
if (log)
{
pButton = safenew wxButton(this, ID_SHOW_LOG_BUTTON, _("Show Log for Details"));
buttonSizer->Add(pButton, 0, wxALIGN_LEFT | wxALL, 5);
pButton->SetDefault(); // Encourage user to look at files.
buttonSizer->AddSpacer(40);
}
pButton = safenew wxButton(this, wxID_OK, _("OK"));
if (!log)
pButton->SetDefault();
buttonSizer->Add(pButton, 0, wxALIGN_RIGHT | wxALL, 5);
vSizer->Add(buttonSizer.release(), 0, wxALIGN_CENTER | wxALL, 5);
}
mainSizer->Add(vSizer.release(), 0, wxALL, 5);
}
SetAutoLayout(true);
SetSizer(uMainSizer.release());
} }
mRadioBox = safenew wxRadioBox(this,-1,
boxMsg,
wxDefaultPosition, wxDefaultSize,
count, buttonLabels,
1, wxRA_SPECIFY_COLS);
mRadioBox->SetName(boxMsg);
mRadioBox->SetSelection(0);
vSizer->Add(mRadioBox, 1, wxEXPAND | wxALIGN_CENTER | wxALL, 5);
wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
wxButton* pButton;
if(log)
{
pButton = safenew wxButton(this, ID_SHOW_LOG_BUTTON, _("Show Log for Details"));
buttonSizer->Add(pButton, 0, wxALIGN_LEFT | wxALL, 5);
pButton->SetDefault(); // Encourage user to look at files.
buttonSizer->AddSpacer(40);
}
pButton = safenew wxButton(this, wxID_OK, _("OK"));
if(!log)
pButton->SetDefault();
buttonSizer->Add(pButton, 0, wxALIGN_RIGHT | wxALL, 5);
vSizer->Add(buttonSizer, 0, wxALIGN_CENTER | wxALL, 5);
mainSizer->Add(vSizer, 0, wxALL, 5);
SetAutoLayout(true);
SetSizer(mainSizer);
mainSizer->Fit(this); mainSizer->Fit(this);
mainSizer->SetSizeHints(this); mainSizer->SetSizeHints(this);
delete[] buttonLabels; delete[] buttonLabels;

View File

@ -1087,111 +1087,101 @@ bool ProgressDialog::Create(const wxString & title,
} }
SetName(GetTitle()); SetName(GetTitle());
wxBoxSizer *v;
wxWindow *w; wxWindow *w;
wxSize ds; wxSize ds;
SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT); SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT);
wxFlexGridSizer *g; v = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *h;
mMessage = safenew wxStaticText(this,
wxID_ANY,
message,
wxDefaultPosition,
wxDefaultSize,
wxALIGN_LEFT);
mMessage->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
v->Add(mMessage, 1, wxEXPAND | wxALL, 10);
ds.y += mMessage->GetSize().y + 20;
//
//
//
mGauge = safenew wxGauge(this,
wxID_ANY,
1000,
wxDefaultPosition,
wxDefaultSize,
wxGA_HORIZONTAL);
v->Add(mGauge, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
ds.y += mGauge->GetSize().y + 10;
//
//
//
wxFlexGridSizer *g = new wxFlexGridSizer(2, 2, 10, 10);
w = safenew wxStaticText(this,
wxID_ANY,
_("Elapsed Time:"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_RIGHT);
w->SetName(w->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(w, 0, wxALIGN_RIGHT);
mElapsed = safenew wxStaticText(this,
wxID_ANY,
wxT("00:00:00"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_LEFT);
mElapsed->SetName(mElapsed->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(mElapsed, 0, wxALIGN_LEFT);
ds.y += mElapsed->GetSize().y + 10;
//
//
//
w = safenew wxStaticText(this,
wxID_ANY,
_("Remaining Time:"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_RIGHT);
w->SetName(w->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(w, 0, wxALIGN_RIGHT);
mRemaining = safenew wxStaticText(this,
wxID_ANY,
wxT("00:00:00"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_LEFT);
mRemaining->SetName(mRemaining->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(mRemaining, 0, wxALIGN_LEFT);
v->Add(g, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT | wxBOTTOM, 10);
ds.y += mRemaining->GetSize().y + 10;
wxBoxSizer *h = new wxBoxSizer(wxHORIZONTAL);
if (!(flags & pdlgHideStopButton))
{ {
auto v = std::make_unique<wxBoxSizer>(wxVERTICAL); w = safenew wxButton(this, wxID_OK, _("Stop"));
h->Add(w, 0, wxRIGHT, 10);
mMessage = safenew wxStaticText(this,
wxID_ANY,
message,
wxDefaultPosition,
wxDefaultSize,
wxALIGN_LEFT);
mMessage->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
v->Add(mMessage, 1, wxEXPAND | wxALL, 10);
ds.y += mMessage->GetSize().y + 20;
//
//
//
mGauge = safenew wxGauge(this,
wxID_ANY,
1000,
wxDefaultPosition,
wxDefaultSize,
wxGA_HORIZONTAL);
v->Add(mGauge, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
ds.y += mGauge->GetSize().y + 10;
//
//
//
{
auto ug = std::make_unique<wxFlexGridSizer>(2, 2, 10, 10);
g = ug.get();
w = safenew wxStaticText(this,
wxID_ANY,
_("Elapsed Time:"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_RIGHT);
w->SetName(w->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(w, 0, wxALIGN_RIGHT);
mElapsed = safenew wxStaticText(this,
wxID_ANY,
wxT("00:00:00"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_LEFT);
mElapsed->SetName(mElapsed->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(mElapsed, 0, wxALIGN_LEFT);
ds.y += mElapsed->GetSize().y + 10;
//
//
//
w = safenew wxStaticText(this,
wxID_ANY,
_("Remaining Time:"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_RIGHT);
w->SetName(w->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(w, 0, wxALIGN_RIGHT);
mRemaining = safenew wxStaticText(this,
wxID_ANY,
wxT("00:00:00"),
wxDefaultPosition,
wxDefaultSize,
wxALIGN_LEFT);
mRemaining->SetName(mRemaining->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
g->Add(mRemaining, 0, wxALIGN_LEFT);
v->Add(ug.release(), 0, wxALIGN_CENTER | wxLEFT | wxRIGHT | wxBOTTOM, 10);
}
ds.y += mRemaining->GetSize().y + 10;
{
auto uh = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
h = uh.get();
if (!(flags & pdlgHideStopButton))
{
w = safenew wxButton(this, wxID_OK, _("Stop"));
h->Add(w, 0, wxRIGHT, 10);
}
if (!(flags & pdlgHideCancelButton))
{
w = safenew wxButton(this, wxID_CANCEL, _("Cancel"));
h->Add(w, 0, wxRIGHT, 10);
}
v->Add(uh.release(), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
}
SetSizer(v.release());
} }
if (!(flags & pdlgHideCancelButton))
{
w = safenew wxButton(this, wxID_CANCEL, _("Cancel"));
h->Add(w, 0, wxRIGHT, 10);
}
v->Add(h, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
SetSizer(v);
Layout(); Layout();
ds.x = wxMax(g->GetSize().x, h->GetSize().x) + 10; ds.x = wxMax(g->GetSize().x, h->GetSize().x) + 10;