mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +02:00
Sizers are owned by wxWindow objects when added, so use safenew, or...
... use unique_ptr in the interim between building them and adding. This checks eliminates some naked news, which were not paired with deletes.
This commit is contained in:
parent
c7d3ff7299
commit
1c07741d57
@ -52,7 +52,6 @@ class AboutDialog:public wxDialog {
|
||||
|
||||
void OnOK(wxCommandEvent & event);
|
||||
|
||||
wxBoxSizer *topsizer;
|
||||
wxStaticBitmap *icon;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
@ -105,38 +105,42 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||
{
|
||||
SetName(GetTitle());
|
||||
|
||||
// Create the main sizer
|
||||
wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
|
||||
{
|
||||
// Create the main sizer
|
||||
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
|
||||
// A little instruction
|
||||
wxStaticText *instruct =
|
||||
safenew wxStaticText(this,
|
||||
wxID_ANY,
|
||||
_("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)
|
||||
vs->Add(instruct,
|
||||
0,
|
||||
wxALIGN_LEFT | wxALL,
|
||||
5);
|
||||
// A little instruction
|
||||
wxStaticText *instruct =
|
||||
safenew wxStaticText(this,
|
||||
wxID_ANY,
|
||||
_("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)
|
||||
vs->Add(instruct,
|
||||
0,
|
||||
wxALIGN_LEFT | wxALL,
|
||||
5);
|
||||
|
||||
// Create the main sizer
|
||||
mGrid = new Grid(this, wxID_ANY);
|
||||
vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);
|
||||
// Create the main sizer
|
||||
mGrid = new Grid(this, wxID_ANY);
|
||||
vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);
|
||||
|
||||
// Create the action buttons
|
||||
wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
|
||||
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_REMOVE, _("&Remove")), 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);
|
||||
vs->Add(hs, 0, wxEXPAND | wxCENTER | wxALL, 5);
|
||||
// Create the action buttons
|
||||
{
|
||||
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_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_IMPORT, _("&Import...")), 1, wxCENTER | wxALL, 5);
|
||||
hs->Add(safenew wxButton(this, ID_EXPORT, _("&Export...")), 1, wxCENTER | wxALL, 5);
|
||||
vs->Add(hs.release(), 0, wxEXPAND | wxCENTER | wxALL, 5);
|
||||
}
|
||||
|
||||
// Create the exit buttons
|
||||
vs->Add(CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND);
|
||||
// Create the exit buttons
|
||||
vs->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND);
|
||||
|
||||
// Make it so
|
||||
SetSizer(vs);
|
||||
// Make it so
|
||||
SetSizer(vs.release());
|
||||
}
|
||||
|
||||
// Build the initial (empty) grid
|
||||
mGrid->CreateGrid(0, Col_Max);
|
||||
|
@ -1002,7 +1002,7 @@ MixerBoard::MixerBoard(AudacityProject* pProject,
|
||||
mScrolledWindow->SetVirtualSize(size);
|
||||
|
||||
/* This doesn't work to make the mScrolledWindow automatically resize, so do it explicitly in OnSize.
|
||||
wxBoxSizer* pBoxSizer = new wxBoxSizer(wxVERTICAL);
|
||||
auto pBoxSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
pBoxSizer->Add(mScrolledWindow, 0, wxExpand, 0);
|
||||
this->SetAutoLayout(true);
|
||||
this->SetSizer(pBoxSizer);
|
||||
|
@ -927,7 +927,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxNO_BORDER);
|
||||
mMainPanel->SetSizer( new wxBoxSizer(wxVERTICAL) );
|
||||
mMainPanel->SetSizer( safenew wxBoxSizer(wxVERTICAL) );
|
||||
pPage = mMainPanel;
|
||||
// Set the colour here to the track panel background to avoid
|
||||
// flicker when Audacity starts up.
|
||||
@ -937,13 +937,17 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
//pPage->SetBackgroundColour( theTheme.Colour( clrDark ));
|
||||
#endif
|
||||
|
||||
wxBoxSizer *bs = new wxBoxSizer( wxVERTICAL );
|
||||
bs->Add( mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP );
|
||||
bs->Add( mRuler, 0, wxEXPAND );
|
||||
bs->Add( pPage, 1, wxEXPAND );
|
||||
bs->Add( mToolManager->GetBotDock(), 0, wxEXPAND );
|
||||
SetAutoLayout( true );
|
||||
SetSizer( bs );
|
||||
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(pPage, 1, wxEXPAND);
|
||||
bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND);
|
||||
SetAutoLayout(true);
|
||||
SetSizer(ubs.release());
|
||||
}
|
||||
bs->Layout();
|
||||
|
||||
// The right hand side translates to NEW TrackPanel(... in normal
|
||||
@ -972,33 +976,37 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
// keyboard focus problems.
|
||||
pPage->MoveBeforeInTabOrder(mToolManager->GetTopDock());
|
||||
|
||||
bs = (wxBoxSizer *) pPage->GetSizer();
|
||||
bs = (wxBoxSizer *)pPage->GetSizer();
|
||||
|
||||
wxBoxSizer *hs;
|
||||
wxBoxSizer *vs;
|
||||
{
|
||||
// Top horizontal grouping
|
||||
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
// Top horizontal grouping
|
||||
hs = new wxBoxSizer( wxHORIZONTAL );
|
||||
// Track panel
|
||||
hs->Add(mTrackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
|
||||
|
||||
// Track panel
|
||||
hs->Add( mTrackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP );
|
||||
{
|
||||
// Vertical grouping
|
||||
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
|
||||
// Vertical grouping
|
||||
vs = new wxBoxSizer( wxVERTICAL );
|
||||
// Vertical scroll bar
|
||||
vs->Add(mVsbar, 1, wxEXPAND | wxALIGN_TOP);
|
||||
hs->Add(vs.release(), 0, wxEXPAND | 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 );
|
||||
bs->Add(hs.release(), 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
|
||||
}
|
||||
|
||||
// Bottom horizontal grouping
|
||||
hs = new wxBoxSizer( wxHORIZONTAL );
|
||||
{
|
||||
// Bottom horizontal grouping
|
||||
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
// Bottom scrollbar
|
||||
hs->Add( mTrackPanel->GetLeftOffset() - 1, 0 );
|
||||
hs->Add( mHsbar, 1, wxALIGN_BOTTOM );
|
||||
hs->Add( mVsbar->GetSize().GetWidth(), 0 );
|
||||
bs->Add( hs, 0, wxEXPAND | wxALIGN_LEFT );
|
||||
// Bottom scrollbar
|
||||
hs->Add(mTrackPanel->GetLeftOffset() - 1, 0);
|
||||
hs->Add(mHsbar, 1, wxALIGN_BOTTOM);
|
||||
hs->Add(mVsbar->GetSize().GetWidth(), 0);
|
||||
bs->Add(hs.release(), 0, wxEXPAND | wxALIGN_LEFT);
|
||||
}
|
||||
|
||||
// Lay it out
|
||||
pPage->SetAutoLayout(true);
|
||||
|
@ -163,8 +163,7 @@ void ShuttleGuiBase::Init()
|
||||
|
||||
if( !mpSizer )
|
||||
{
|
||||
mpSizer = new wxBoxSizer( wxVERTICAL );
|
||||
mpParent->SetSizer( mpSizer );
|
||||
mpParent->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
|
||||
}
|
||||
PushSizer();
|
||||
mpSizer->SetMinSize(250,100);
|
||||
@ -707,7 +706,7 @@ wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
|
||||
Str );
|
||||
pBox->SetLabel( Str );
|
||||
pBox->SetName(wxStripMenuCodes(Str));
|
||||
mpSubSizer = new wxStaticBoxSizer(
|
||||
mpSubSizer = std::make_unique<wxStaticBoxSizer>(
|
||||
pBox,
|
||||
wxVERTICAL );
|
||||
miSizerProp = iProp;
|
||||
@ -762,8 +761,7 @@ wxScrolledWindow * ShuttleGuiBase::StartScroller(int iStyle)
|
||||
|
||||
// create a sizer within the window...
|
||||
mpParent = pScroller;
|
||||
mpSizer = new wxBoxSizer( wxVERTICAL );
|
||||
pScroller->SetSizer( mpSizer );
|
||||
pScroller->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
|
||||
PushSizer();
|
||||
return pScroller;
|
||||
}
|
||||
@ -810,8 +808,7 @@ wxPanel * ShuttleGuiBase::StartPanel(int iStyle)
|
||||
|
||||
// create a sizer within the window...
|
||||
mpParent = pPanel;
|
||||
mpSizer = new wxBoxSizer( wxVERTICAL );
|
||||
pPanel->SetSizer( mpSizer );
|
||||
pPanel->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
|
||||
PushSizer();
|
||||
return pPanel;
|
||||
}
|
||||
@ -861,10 +858,9 @@ wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString & Name )
|
||||
|
||||
SetProportions( 1 );
|
||||
mpParent = pPage;
|
||||
mpSizer = new wxBoxSizer( wxVERTICAL );
|
||||
mpSizer->SetMinSize(250,500);
|
||||
pPage->SetSizer( mpSizer );
|
||||
// UpdateSizers();
|
||||
pPage->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
|
||||
mpSizer->SetMinSize(250, 500);
|
||||
// UpdateSizers();
|
||||
return pPage;
|
||||
}
|
||||
|
||||
@ -885,10 +881,9 @@ void ShuttleGuiBase::StartNotebookPage( const wxString & Name, wxNotebookPage *
|
||||
|
||||
SetProportions( 1 );
|
||||
mpParent = pPage;
|
||||
mpSizer = new wxBoxSizer( wxVERTICAL );
|
||||
mpSizer->SetMinSize(250,500);
|
||||
pPage->SetSizer( mpSizer );
|
||||
// UpdateSizers();
|
||||
pPage->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
|
||||
mpSizer->SetMinSize(250, 500);
|
||||
// UpdateSizers();
|
||||
}
|
||||
|
||||
void ShuttleGuiBase::EndNotebookPage()
|
||||
@ -950,8 +945,7 @@ wxPanel * ShuttleGuiBase::StartInvisiblePanel()
|
||||
|
||||
// create a sizer within the window...
|
||||
mpParent = pPanel;
|
||||
mpSizer = new wxBoxSizer( wxVERTICAL );
|
||||
pPanel->SetSizer( mpSizer );
|
||||
pPanel->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
|
||||
PushSizer();
|
||||
return pPanel;
|
||||
}
|
||||
@ -973,7 +967,7 @@ void ShuttleGuiBase::StartHorizontalLay( int PositionFlags, int iProp)
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
miSizerProp=iProp;
|
||||
mpSubSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
mpSubSizer = std::make_unique<wxBoxSizer>( wxHORIZONTAL );
|
||||
UpdateSizersCore( false, PositionFlags | wxALL );
|
||||
}
|
||||
|
||||
@ -989,7 +983,7 @@ void ShuttleGuiBase::StartVerticalLay(int iProp)
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
miSizerProp=iProp;
|
||||
mpSubSizer = new wxBoxSizer( wxVERTICAL );
|
||||
mpSubSizer = std::make_unique<wxBoxSizer>( wxVERTICAL );
|
||||
UpdateSizers();
|
||||
}
|
||||
|
||||
@ -1004,7 +998,7 @@ void ShuttleGuiBase::StartMultiColumn(int nCols, int PositionFlags)
|
||||
{
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
mpSubSizer = new wxFlexGridSizer( nCols );
|
||||
mpSubSizer = std::make_unique<wxFlexGridSizer>( nCols );
|
||||
UpdateSizersCore( false, PositionFlags | wxALL );
|
||||
}
|
||||
|
||||
@ -1935,16 +1929,16 @@ void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags)
|
||||
{
|
||||
// When adding sizers into sizers, don't add a border.
|
||||
// unless it's a static box sizer.
|
||||
if( wxDynamicCast( mpSubSizer, wxStaticBoxSizer ))
|
||||
wxSizer *const pSubSizer = mpSubSizer.get();
|
||||
if (wxDynamicCast(pSubSizer, wxStaticBoxSizer))
|
||||
{
|
||||
mpSizer->Add( mpSubSizer,miSizerProp, Flags , miBorder);
|
||||
mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags , miBorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpSizer->Add( mpSubSizer,miSizerProp, Flags ,0);//miBorder);
|
||||
mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags ,0);//miBorder);
|
||||
}
|
||||
mpSizer = mpSubSizer;
|
||||
mpSubSizer = NULL;
|
||||
mpSizer = pSubSizer;
|
||||
PushSizer();
|
||||
}
|
||||
mpLastWind = mpWind;
|
||||
@ -2116,7 +2110,7 @@ AttachableScrollBar * ShuttleGui::AddAttachableScrollBar( long style )
|
||||
return pAttachableScrollBar;
|
||||
}
|
||||
|
||||
wxSizer *CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
|
||||
std::unique_ptr<wxSizer> CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
|
||||
{
|
||||
wxASSERT(parent != NULL); // To justify safenew
|
||||
|
||||
@ -2136,7 +2130,7 @@ wxSizer *CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
|
||||
}
|
||||
|
||||
wxButton *b = NULL;
|
||||
wxStdDialogButtonSizer *bs = new wxStdDialogButtonSizer();
|
||||
auto bs = std::make_unique<wxStdDialogButtonSizer>();
|
||||
|
||||
if( buttons & eOkButton )
|
||||
{
|
||||
@ -2226,12 +2220,11 @@ wxSizer *CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
|
||||
bs->Insert( lastLastSpacer + 1, b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
|
||||
}
|
||||
|
||||
wxSizer * s;
|
||||
s = new wxBoxSizer( wxVERTICAL );
|
||||
s->Add( bs, 1, wxEXPAND | wxALL, 7 );
|
||||
auto s = std::make_unique<wxBoxSizer>( wxVERTICAL );
|
||||
s->Add( bs.release(), 1, wxEXPAND | wxALL, 7 );
|
||||
s->Add( 0, 3 ); // a little extra space
|
||||
|
||||
return s;
|
||||
return std::unique_ptr<wxSizer>{ s.release() };
|
||||
}
|
||||
|
||||
void ShuttleGui::AddStandardButtons(long buttons, wxButton *extra)
|
||||
|
@ -267,7 +267,7 @@ public:
|
||||
int GetId() {return miIdNext;};
|
||||
void UseUpId();
|
||||
|
||||
wxSizer * GetSizer() {return mpSizer;};
|
||||
wxSizer * GetSizer() {return mpSizer;}
|
||||
|
||||
protected:
|
||||
void SetProportions( int Default );
|
||||
@ -313,7 +313,7 @@ protected:
|
||||
// Proportion set by user rather than default.
|
||||
int miPropSetByUser;
|
||||
|
||||
wxSizer * mpSubSizer;
|
||||
std::unique_ptr<wxSizer> mpSubSizer;
|
||||
wxSizer * mpSizer;
|
||||
wxWindow * mpParent;
|
||||
wxWindow * mpWind;
|
||||
@ -358,7 +358,7 @@ enum
|
||||
eCloseID = wxID_CANCEL
|
||||
};
|
||||
|
||||
AUDACITY_DLL_API wxSizer *CreateStdButtonSizer( wxWindow *parent,
|
||||
AUDACITY_DLL_API std::unique_ptr<wxSizer> CreateStdButtonSizer( wxWindow *parent,
|
||||
long buttons = eOkButton | eCancelButton,
|
||||
wxWindow *extra = NULL );
|
||||
|
||||
|
@ -2887,175 +2887,181 @@ int EffectUIHost::ShowModal()
|
||||
|
||||
bool EffectUIHost::Initialize()
|
||||
{
|
||||
wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
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))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
{
|
||||
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
hs->Add(w, 1, wxEXPAND);
|
||||
vs->Add(hs, 1, wxEXPAND);
|
||||
// Try to give the window a sensible default/minimum size
|
||||
w->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3),
|
||||
mParent->GetSize().GetHeight() / 2));
|
||||
|
||||
wxPanel *buttonPanel = safenew wxPanel(this, wxID_ANY);
|
||||
wxPanel *const bar = safenew wxPanel(buttonPanel, wxID_ANY);
|
||||
mDisableTransport = !gAudioIO->IsAvailable(mProject);
|
||||
mPlaying = gAudioIO->IsStreamActive(); // not exactly right, but will suffice
|
||||
mCapturing = gAudioIO->IsStreamActive() && gAudioIO->GetNumCaptureChannels() > 0;
|
||||
|
||||
// This fools NVDA into not saying "Panel" when the dialog gets focus
|
||||
bar->SetName(wxT("\a"));
|
||||
bar->SetLabel(wxT("\a"));
|
||||
if (!mClient->PopulateUI(w))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wxBoxSizer *bs = new wxBoxSizer(wxHORIZONTAL);
|
||||
hs->Add(w, 1, wxEXPAND);
|
||||
vs->Add(hs.release(), 1, wxEXPAND);
|
||||
}
|
||||
|
||||
mSupportsRealtime = mEffect->SupportsRealtime();
|
||||
mIsGUI = mClient->IsGraphicalUI();
|
||||
mIsBatch = mEffect->IsBatchProcessing();
|
||||
wxPanel *buttonPanel = safenew wxPanel(this, wxID_ANY);
|
||||
wxPanel *const bar = safenew wxPanel(buttonPanel, wxID_ANY);
|
||||
|
||||
wxBitmapButton *bb;
|
||||
// This fools NVDA into not saying "Panel" when the dialog gets focus
|
||||
bar->SetName(wxT("\a"));
|
||||
bar->SetLabel(wxT("\a"));
|
||||
|
||||
int margin = 0;
|
||||
{
|
||||
auto bs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
mSupportsRealtime = mEffect->SupportsRealtime();
|
||||
mIsGUI = mClient->IsGraphicalUI();
|
||||
mIsBatch = mEffect->IsBatchProcessing();
|
||||
|
||||
wxBitmapButton *bb;
|
||||
|
||||
int margin = 0;
|
||||
|
||||
#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
|
||||
|
||||
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 (mSupportsRealtime)
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
bb = safenew wxBitmapButton(bar, kPlayID, mPlayBM);
|
||||
bb->SetBitmapDisabled(mPlayDisabledBM);
|
||||
mPlayBtn = bb;
|
||||
bs->Add(mPlayBtn);
|
||||
if (!mSupportsRealtime)
|
||||
{
|
||||
mPlayBtn->SetToolTip(_("Preview effect"));
|
||||
#if defined(__WXMAC__)
|
||||
mPlayBtn->SetName(_("Preview effect"));
|
||||
#else
|
||||
mPlayBtn->SetLabel(_("&Preview effect"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (mSupportsRealtime)
|
||||
{
|
||||
if (!mIsGUI)
|
||||
{
|
||||
wxASSERT(bar); // To justify safenew
|
||||
mRewindBtn = safenew wxButton(bar, kRewindID, _("Skip &Backward"));
|
||||
bs->Add(mRewindBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin);
|
||||
mMenuBtn = safenew wxButton(bar, kMenuID, _("&Manage"));
|
||||
bs->Add(mMenuBtn, 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;
|
||||
mMenuBtn = safenew wxBitmapButton(bar, kMenuID, CreateBitmap(effect_menu_xpm, true, false));
|
||||
#if defined(__WXMAC__)
|
||||
mRewindBtn->SetName(_("Skip &Backward"));
|
||||
mMenuBtn->SetName(_("&Manage"));
|
||||
#else
|
||||
mRewindBtn->SetLabel(_("Skip &Backward"));
|
||||
mMenuBtn->SetLabel(_("&Manage"));
|
||||
#endif
|
||||
bs->Add(mRewindBtn);
|
||||
bs->Add(mMenuBtn);
|
||||
}
|
||||
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"));
|
||||
mMenuBtn->SetToolTip(_("Manage presets and options"));
|
||||
|
||||
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);
|
||||
if (!mIsBatch)
|
||||
{
|
||||
if (!mIsGUI)
|
||||
{
|
||||
if (mSupportsRealtime)
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
bb = safenew wxBitmapButton(bar, kPlayID, mPlayBM);
|
||||
bb->SetBitmapDisabled(mPlayDisabledBM);
|
||||
mPlayBtn = bb;
|
||||
bs->Add(mPlayBtn);
|
||||
if (!mSupportsRealtime)
|
||||
{
|
||||
mPlayBtn->SetToolTip(_("Preview effect"));
|
||||
#if defined(__WXMAC__)
|
||||
mPlayBtn->SetName(_("Preview effect"));
|
||||
#else
|
||||
mPlayBtn->SetLabel(_("&Preview effect"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (mSupportsRealtime)
|
||||
{
|
||||
if (!mIsGUI)
|
||||
{
|
||||
wxASSERT(bar); // To justify safenew
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
bar->SetSizerAndFit(bs.release());
|
||||
}
|
||||
|
||||
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();
|
||||
Fit();
|
||||
Center();
|
||||
|
@ -104,31 +104,38 @@ EffectRack::EffectRack()
|
||||
mRemovePushed = CreateBitmap(remove_16x16_xpm, false, true);
|
||||
mRemoveRaised = CreateBitmap(remove_16x16_xpm, true, true);
|
||||
|
||||
wxBoxSizer *bs = new wxBoxSizer(wxVERTICAL);
|
||||
mPanel = safenew wxPanel(this, wxID_ANY);
|
||||
bs->Add(mPanel, 1, wxEXPAND);
|
||||
SetSizer(bs);
|
||||
{
|
||||
auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
mPanel = safenew wxPanel(this, wxID_ANY);
|
||||
bs->Add(mPanel, 1, wxEXPAND);
|
||||
SetSizer(bs.release());
|
||||
}
|
||||
|
||||
wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxASSERT(mPanel); // To justify safenew
|
||||
hs->Add(safenew wxButton(mPanel, wxID_APPLY, _("&Apply")), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
hs->AddStretchSpacer();
|
||||
mLatency = safenew wxStaticText(mPanel, wxID_ANY, _("Latency: 0"));
|
||||
hs->Add(mLatency, 0, wxALIGN_CENTER);
|
||||
hs->AddStretchSpacer();
|
||||
hs->Add(safenew wxToggleButton(mPanel, wxID_CLEAR, _("&Bypass")), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
|
||||
{
|
||||
auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
{
|
||||
auto hs = std::make_uniqie<wxBoxSizer>(wxHORIZONTAL);
|
||||
wxASSERT(mPanel); // To justify safenew
|
||||
hs->Add(safenew wxButton(mPanel, wxID_APPLY, _("&Apply")), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
hs->AddStretchSpacer();
|
||||
mLatency = safenew wxStaticText(mPanel, wxID_ANY, _("Latency: 0"));
|
||||
hs->Add(mLatency, 0, wxALIGN_CENTER);
|
||||
hs->AddStretchSpacer();
|
||||
hs->Add(safenew wxToggleButton(mPanel, wxID_CLEAR, _("&Bypass")), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
|
||||
bs->Add(hs.release(), 0, wxEXPAND);
|
||||
}
|
||||
bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND);
|
||||
|
||||
bs = new wxBoxSizer(wxVERTICAL);
|
||||
bs->Add(hs, 0, wxEXPAND);
|
||||
bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND);
|
||||
{
|
||||
auto uMainSizer = make_uniqie<wxFlexGridSizer>(7);
|
||||
uMainSizer->AddGrowableCol(6);
|
||||
uMainSizer->SetHGap(0);
|
||||
uMainSizer->SetVGap(0);
|
||||
bs->Add((mMainSizer = uMainSizer.release()), 1, wxEXPAND);
|
||||
}
|
||||
|
||||
mMainSizer = new wxFlexGridSizer(7);
|
||||
mMainSizer->AddGrowableCol(6);
|
||||
mMainSizer->SetHGap(0);
|
||||
mMainSizer->SetVGap(0);
|
||||
bs->Add(mMainSizer, 1, wxEXPAND);
|
||||
|
||||
mPanel->SetSizer(bs);
|
||||
mPanel->SetSizer(bs.release());
|
||||
}
|
||||
|
||||
wxString oldPath = gPrefs->GetPath();
|
||||
gPrefs->SetPath(wxT("/EffectsRack"));
|
||||
|
@ -2825,12 +2825,14 @@ void VSTEffect::BuildFancy()
|
||||
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->SetSizer(mainSizer);
|
||||
mParent->SetMinSize(wxDefaultSize);
|
||||
mParent->SetSizer(mainSizer.release());
|
||||
}
|
||||
|
||||
NeedEditIdle(true);
|
||||
|
||||
@ -2841,119 +2843,126 @@ void VSTEffect::BuildFancy()
|
||||
|
||||
void VSTEffect::BuildPlain()
|
||||
{
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxASSERT(mParent); // To justify safenew
|
||||
wxScrolledWindow *const scroller = safenew wxScrolledWindow(mParent,
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxVSCROLL | wxTAB_TRAVERSAL);
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxVSCROLL | wxTAB_TRAVERSAL);
|
||||
|
||||
// Try to give the window a sensible default/minimum size
|
||||
scroller->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3),
|
||||
mParent->GetSize().GetHeight() / 2));
|
||||
scroller->SetScrollRate(0, 20);
|
||||
{
|
||||
auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
|
||||
// This fools NVDA into not saying "Panel" when the dialog gets focus
|
||||
scroller->SetName(wxT("\a"));
|
||||
scroller->SetLabel(wxT("\a"));
|
||||
// Try to give the window a sensible default/minimum size
|
||||
scroller->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3),
|
||||
mParent->GetSize().GetHeight() / 2));
|
||||
scroller->SetScrollRate(0, 20);
|
||||
|
||||
mainSizer->Add(scroller, 1, wxEXPAND | wxALL, 5);
|
||||
mParent->SetSizer(mainSizer);
|
||||
// This fools NVDA into not saying "Panel" when the dialog gets focus
|
||||
scroller->SetName(wxT("\a"));
|
||||
scroller->SetLabel(wxT("\a"));
|
||||
|
||||
mainSizer->Add(scroller, 1, wxEXPAND | wxALL, 5);
|
||||
mParent->SetSizer(mainSizer.release());
|
||||
}
|
||||
|
||||
mNames = new wxStaticText *[mAEffect->numParams];
|
||||
mSliders = new wxSlider *[mAEffect->numParams];
|
||||
mDisplays = 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)
|
||||
{
|
||||
wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:"));
|
||||
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
|
||||
mDuration = safenew
|
||||
NumericTextCtrl(NumericConverter::TIME,
|
||||
scroller,
|
||||
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);
|
||||
}
|
||||
auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, scroller, _("Effect Settings"));
|
||||
|
||||
// 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;
|
||||
auto gridSizer = std::make_unique<wxFlexGridSizer>(4, 0, 0);
|
||||
gridSizer->AddGrowableCol(1);
|
||||
|
||||
// Add the duration control for generators
|
||||
if (GetType() == EffectTypeGenerate)
|
||||
{
|
||||
wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:"));
|
||||
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
|
||||
mDuration = safenew
|
||||
NumericTextCtrl(NumericConverter::TIME,
|
||||
scroller,
|
||||
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);
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
mSliders[0]->SetFocus();
|
||||
|
@ -1752,13 +1752,16 @@ bool AudioUnitEffect::PopulateUI(wxWindow *parent)
|
||||
mDialog = (wxDialog *) wxGetTopLevelParent(parent);
|
||||
mParent = parent;
|
||||
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxPanel *container;
|
||||
{
|
||||
auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
|
||||
wxASSERT(mParent); // To justify safenew
|
||||
wxPanel *container = safenew wxPanel(mParent, wxID_ANY);
|
||||
mainSizer->Add(container, 1, wxEXPAND);
|
||||
wxASSERT(mParent); // To justify safenew
|
||||
container = safenew wxPanel(mParent, wxID_ANY);
|
||||
mainSizer->Add(container, 1, wxEXPAND);
|
||||
|
||||
mParent->SetSizer(mainSizer);
|
||||
mParent->SetSizer(mainSizer.release());
|
||||
}
|
||||
|
||||
if (mUIType == wxT("Plain"))
|
||||
{
|
||||
@ -1780,10 +1783,12 @@ bool AudioUnitEffect::PopulateUI(wxWindow *parent)
|
||||
return false;
|
||||
}
|
||||
|
||||
wxBoxSizer *innerSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
innerSizer->Add(mControl, 1, wxEXPAND);
|
||||
container->SetSizer(innerSizer);
|
||||
{
|
||||
auto innerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
|
||||
innerSizer->Add(mControl, 1, wxEXPAND);
|
||||
container->SetSizer(innerSizer.release());
|
||||
}
|
||||
|
||||
mParent->SetMinSize(wxDefaultSize);
|
||||
}
|
||||
|
@ -1164,285 +1164,293 @@ bool LadspaEffect::PopulateUI(wxWindow *parent)
|
||||
|
||||
memset(mFields, 0, mData->PortCount * sizeof(wxTextCtrl *));
|
||||
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxASSERT(mParent); // To justify safenew
|
||||
wxScrolledWindow *const w = safenew wxScrolledWindow(mParent,
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxVSCROLL | wxTAB_TRAVERSAL);
|
||||
w->SetScrollRate(0, 20);
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxVSCROLL | wxTAB_TRAVERSAL);
|
||||
|
||||
// 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)
|
||||
{
|
||||
wxStaticBoxSizer *paramSizer = new wxStaticBoxSizer(wxVERTICAL, w, _("Effect Settings"));
|
||||
auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
w->SetScrollRate(0, 20);
|
||||
|
||||
wxFlexGridSizer *gridSizer = new wxFlexGridSizer(5, 0, 0);
|
||||
gridSizer->AddGrowableCol(3);
|
||||
// This fools NVDA into not saying "Panel" when the dialog gets focus
|
||||
w->SetName(wxT("\a"));
|
||||
w->SetLabel(wxT("\a"));
|
||||
|
||||
wxControl *item;
|
||||
mainSizer->Add(w, 1, wxEXPAND);
|
||||
mParent->SetSizer(mainSizer.release());
|
||||
}
|
||||
|
||||
// Add the duration control for generators
|
||||
if (GetType() == EffectTypeGenerate)
|
||||
wxSizer *marginSizer;
|
||||
{
|
||||
auto uMarginSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
marginSizer = uMarginSizer.get();
|
||||
|
||||
if (mNumInputControls)
|
||||
{
|
||||
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 paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Settings"));
|
||||
|
||||
for (unsigned long p = 0; p < mData->PortCount; p++)
|
||||
{
|
||||
LADSPA_PortDescriptor d = mData->PortDescriptors[p];
|
||||
if (LADSPA_IS_PORT_AUDIO(d) || LADSPA_IS_PORT_OUTPUT(d))
|
||||
auto gridSizer = std::make_unique<wxFlexGridSizer>(5, 0, 0);
|
||||
gridSizer->AddGrowableCol(3);
|
||||
|
||||
wxControl *item;
|
||||
|
||||
// Add the duration control for generators
|
||||
if (GetType() == EffectTypeGenerate)
|
||||
{
|
||||
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);
|
||||
|
||||
wxString fieldText;
|
||||
LADSPA_PortRangeHint hint = mData->PortRangeHints[p];
|
||||
|
||||
if (LADSPA_IS_HINT_TOGGLED(hint.HintDescriptor))
|
||||
{
|
||||
mToggles[p] = safenew wxCheckBox(w, ID_Toggles + p, wxT(""));
|
||||
mToggles[p]->SetName(labelText);
|
||||
mToggles[p]->SetValue(mInputControls[p] > 0);
|
||||
gridSizer->Add(mToggles[p], 0, wxALL, 5);
|
||||
|
||||
gridSizer->Add(1, 1, 0);
|
||||
gridSizer->Add(1, 1, 0);
|
||||
gridSizer->Add(1, 1, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
wxString bound;
|
||||
float lower = -FLT_MAX;
|
||||
float upper = FLT_MAX;
|
||||
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;
|
||||
|
||||
if (haslo && mInputControls[p] < lower)
|
||||
{
|
||||
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);
|
||||
item = safenew wxStaticText(w, 0, _("Duration:"));
|
||||
gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
for (unsigned long p = 0; p < mData->PortCount; p++)
|
||||
{
|
||||
LADSPA_PortDescriptor d = mData->PortDescriptors[p];
|
||||
if (LADSPA_IS_PORT_AUDIO(d) || LADSPA_IS_PORT_OUTPUT(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);
|
||||
|
||||
wxString fieldText;
|
||||
LADSPA_PortRangeHint hint = mData->PortRangeHints[p];
|
||||
|
||||
if (LADSPA_IS_HINT_TOGGLED(hint.HintDescriptor))
|
||||
{
|
||||
mToggles[p] = safenew wxCheckBox(w, ID_Toggles + p, wxT(""));
|
||||
mToggles[p]->SetName(labelText);
|
||||
mToggles[p]->SetValue(mInputControls[p] > 0);
|
||||
gridSizer->Add(mToggles[p], 0, wxALL, 5);
|
||||
|
||||
gridSizer->Add(1, 1, 0);
|
||||
gridSizer->Add(1, 1, 0);
|
||||
gridSizer->Add(1, 1, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
wxString bound;
|
||||
float lower = -FLT_MAX;
|
||||
float upper = FLT_MAX;
|
||||
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;
|
||||
|
||||
if (haslo && mInputControls[p] < lower)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
|
||||
{
|
||||
str.Printf(wxT("%d"), (int)(upper + 0.5));
|
||||
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
|
||||
{
|
||||
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);
|
||||
}
|
||||
fieldText = Internat::ToDisplayString(mInputControls[p]);
|
||||
|
||||
if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
|
||||
{
|
||||
fieldText.Printf(wxT("%d"), (int)(mInputControls[p] + 0.5));
|
||||
// > 12 decimal places can cause rounding errors in display.
|
||||
FloatingPointValidator<float> vld(6, &mInputControls[p]);
|
||||
vld.SetRange(lower, upper);
|
||||
|
||||
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]);
|
||||
// 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);
|
||||
}
|
||||
|
||||
// > 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);
|
||||
}
|
||||
|
||||
mFields[p]->SetValidator(vld);
|
||||
// Set the textctrl value. This will trigger an event so OnTextCtrl()
|
||||
// can update the slider.
|
||||
mFields[p]->SetValue(fieldText);
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
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++)
|
||||
if (mNumOutputControls > 0)
|
||||
{
|
||||
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);
|
||||
auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Effect Output"));
|
||||
|
||||
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;
|
||||
auto gridSizer = std::make_unique<wxFlexGridSizer>(2, 0, 0);
|
||||
gridSizer->AddGrowableCol(1);
|
||||
|
||||
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
|
||||
wxControl *item;
|
||||
|
||||
for (unsigned long p = 0; p < mData->PortCount; p++)
|
||||
{
|
||||
lower = hint.LowerBound;
|
||||
haslo = true;
|
||||
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);
|
||||
}
|
||||
|
||||
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
|
||||
{
|
||||
upper = hint.UpperBound;
|
||||
hashi = true;
|
||||
}
|
||||
paramSizer->Add(gridSizer.release(), 0, wxEXPAND | wxALL, 5);
|
||||
marginSizer->Add(paramSizer.release(), 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
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);
|
||||
RefreshControls(true);
|
||||
}
|
||||
|
||||
paramSizer->Add(gridSizer, 0, wxEXPAND | wxALL, 5);
|
||||
marginSizer->Add(paramSizer, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
RefreshControls(true);
|
||||
w->SetSizer(uMarginSizer.release());
|
||||
}
|
||||
|
||||
w->SetSizer(marginSizer);
|
||||
w->Layout();
|
||||
|
||||
// Try to give the window a sensible default/minimum size
|
||||
|
@ -1461,105 +1461,104 @@ bool LV2Effect::BuildFancy()
|
||||
return false;
|
||||
}
|
||||
|
||||
wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizerItem *si = NULL;
|
||||
if (vs)
|
||||
{
|
||||
wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
|
||||
if (hs)
|
||||
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
wxSizerItem *si = NULL;
|
||||
if (vs)
|
||||
{
|
||||
si = hs->Add(mContainer, 1, wxCENTER | wxEXPAND);
|
||||
vs->Add(hs, 0, wxCENTER);
|
||||
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
if (hs)
|
||||
{
|
||||
si = hs->Add(mContainer, 1, wxCENTER | wxEXPAND);
|
||||
vs->Add(hs.release(), 0, wxCENTER);
|
||||
}
|
||||
}
|
||||
|
||||
if (!si)
|
||||
{
|
||||
delete mContainer;
|
||||
lilv_uis_free(uis);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!si)
|
||||
{
|
||||
delete vs;
|
||||
delete mContainer;
|
||||
lilv_uis_free(uis);
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
// Make sure the parent has a window
|
||||
if (!gtk_widget_get_window(GTK_WIDGET(mContainer->m_wxwindow)))
|
||||
{
|
||||
gtk_widget_realize(GTK_WIDGET(mContainer->m_wxwindow));
|
||||
}
|
||||
// Make sure the parent has a window
|
||||
if (!gtk_widget_get_window(GTK_WIDGET(mContainer->m_wxwindow)))
|
||||
{
|
||||
gtk_widget_realize(GTK_WIDGET(mContainer->m_wxwindow));
|
||||
}
|
||||
|
||||
mParentFeature->data = GTK_WIDGET(mContainer->GetHandle());
|
||||
mParentFeature->data = GTK_WIDGET(mContainer->GetHandle());
|
||||
#elif defined(__WXMSW__)
|
||||
mParentFeature->data = mContainer->GetHandle();
|
||||
mParentFeature->data = mContainer->GetHandle();
|
||||
#elif defined(__WXMAC__)
|
||||
mParentFeature->data = mContainer->GetHandle();
|
||||
mParentFeature->data = mContainer->GetHandle();
|
||||
#endif
|
||||
|
||||
mInstanceAccessFeature->data = lilv_instance_get_handle(mMaster);
|
||||
mExtDataFeature.data_access = lilv_instance_get_descriptor(mMaster)->extension_data;
|
||||
mInstanceAccessFeature->data = lilv_instance_get_handle(mMaster);
|
||||
mExtDataFeature.data_access = lilv_instance_get_descriptor(mMaster)->extension_data;
|
||||
|
||||
// Create the suil host
|
||||
mSuilHost = suil_host_new(LV2Effect::suil_write_func, NULL, NULL, NULL);
|
||||
if (!mSuilHost)
|
||||
{
|
||||
delete mContainer;
|
||||
lilv_uis_free(uis);
|
||||
return false;
|
||||
}
|
||||
|
||||
mSuilInstance = suil_instance_new(mSuilHost,
|
||||
this,
|
||||
nativeType,
|
||||
lilv_node_as_uri(lilv_plugin_get_uri(mPlug)),
|
||||
lilv_node_as_uri(lilv_ui_get_uri(ui)),
|
||||
lilv_node_as_uri(uiType),
|
||||
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))),
|
||||
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))),
|
||||
mFeatures);
|
||||
|
||||
// Create the suil host
|
||||
mSuilHost = suil_host_new(LV2Effect::suil_write_func, NULL, NULL, NULL);
|
||||
if (!mSuilHost)
|
||||
{
|
||||
delete vs;
|
||||
delete mContainer;
|
||||
lilv_uis_free(uis);
|
||||
return false;
|
||||
}
|
||||
|
||||
mSuilInstance = suil_instance_new(mSuilHost,
|
||||
this,
|
||||
nativeType,
|
||||
lilv_node_as_uri(lilv_plugin_get_uri(mPlug)),
|
||||
lilv_node_as_uri(lilv_ui_get_uri(ui)),
|
||||
lilv_node_as_uri(uiType),
|
||||
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))),
|
||||
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))),
|
||||
mFeatures);
|
||||
// Bail if the instance (no compatible UI) couldn't be created
|
||||
if (!mSuilInstance)
|
||||
{
|
||||
suil_host_free(mSuilHost);
|
||||
mSuilHost = NULL;
|
||||
|
||||
lilv_uis_free(uis);
|
||||
|
||||
// Bail if the instance (no compatible UI) couldn't be created
|
||||
if (!mSuilInstance)
|
||||
{
|
||||
suil_host_free(mSuilHost);
|
||||
mSuilHost = NULL;
|
||||
|
||||
delete vs;
|
||||
delete mContainer;
|
||||
return false;
|
||||
}
|
||||
delete mContainer;
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
GtkWidget* widget = GTK_WIDGET(suil_instance_get_widget(mSuilInstance));
|
||||
gtk_widget_show_all(widget);
|
||||
GtkWidget* widget = GTK_WIDGET(suil_instance_get_widget(mSuilInstance));
|
||||
gtk_widget_show_all(widget);
|
||||
|
||||
GtkRequisition sz;
|
||||
gtk_widget_size_request(widget, &sz);
|
||||
gtk_widget_set_size_request(widget, 1, 1);
|
||||
gtk_widget_set_size_request(widget, sz.width, sz.height);
|
||||
GtkRequisition sz;
|
||||
gtk_widget_size_request(widget, &sz);
|
||||
gtk_widget_set_size_request(widget, 1, 1);
|
||||
gtk_widget_set_size_request(widget, sz.width, sz.height);
|
||||
|
||||
wxPizza *pizza = WX_PIZZA(mContainer->m_wxwindow);
|
||||
pizza->put(widget,
|
||||
0, //gtk_pizza_get_xoffset(pizza),
|
||||
0, //gtk_pizza_get_yoffset(pizza),
|
||||
sz.width,
|
||||
sz.height);
|
||||
gtk_widget_show_all(GTK_WIDGET(pizza));
|
||||
si->SetMinSize(wxSize(sz.width, sz.height));
|
||||
wxPizza *pizza = WX_PIZZA(mContainer->m_wxwindow);
|
||||
pizza->put(widget,
|
||||
0, //gtk_pizza_get_xoffset(pizza),
|
||||
0, //gtk_pizza_get_yoffset(pizza),
|
||||
sz.width,
|
||||
sz.height);
|
||||
gtk_widget_show_all(GTK_WIDGET(pizza));
|
||||
si->SetMinSize(wxSize(sz.width, sz.height));
|
||||
#elif defined(__WXMSW__)
|
||||
HWND widget = (HWND) suil_instance_get_widget(mSuilInstance);
|
||||
RECT rect;
|
||||
GetWindowRect(widget, &rect);
|
||||
si->SetMinSize(wxSize(rect.right - rect.left, rect.bottom - rect.top));
|
||||
HWND widget = (HWND)suil_instance_get_widget(mSuilInstance);
|
||||
RECT rect;
|
||||
GetWindowRect(widget, &rect);
|
||||
si->SetMinSize(wxSize(rect.right - rect.left, rect.bottom - rect.top));
|
||||
#elif defined(__WXMAC__)
|
||||
NSView *view = (NSView *) suil_instance_get_widget(mSuilInstance);
|
||||
NSSize sz = [view frame].size;
|
||||
si->SetMinSize(sz.width, sz.height);
|
||||
NSView *view = (NSView *) suil_instance_get_widget(mSuilInstance);
|
||||
NSSize sz = [view frame].size;
|
||||
si->SetMinSize(sz.width, sz.height);
|
||||
#endif
|
||||
|
||||
mParent->SetSizerAndFit(vs);
|
||||
mParent->SetSizerAndFit(vs.release());
|
||||
}
|
||||
|
||||
mIdleFeature = (const LV2UI_Idle_Interface *)
|
||||
suil_instance_extension_data(mSuilInstance, LV2_UI__idleInterface);
|
||||
@ -1578,281 +1577,290 @@ bool LV2Effect::BuildPlain()
|
||||
mSliders = new wxSlider *[ctrlcnt];
|
||||
mFields = new wxTextCtrl *[ctrlcnt];
|
||||
|
||||
wxSizer *outerSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer *innerSizer;
|
||||
|
||||
wxASSERT(mParent); // To justify safenew
|
||||
wxScrolledWindow *const w = safenew wxScrolledWindow(mParent,
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxVSCROLL | wxTAB_TRAVERSAL);
|
||||
w->SetScrollRate(0, 20);
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxVSCROLL | wxTAB_TRAVERSAL);
|
||||
|
||||
// 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)
|
||||
{
|
||||
// Add the length control
|
||||
wxSizer *groupSizer = new wxStaticBoxSizer(wxVERTICAL, w, _("Generator"));
|
||||
auto outerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
w->SetScrollRate(0, 20);
|
||||
|
||||
wxBoxSizer *sizer = new 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);
|
||||
// This fools NVDA into not saying "Panel" when the dialog gets focus
|
||||
w->SetName(wxT("\a"));
|
||||
w->SetLabel(wxT("\a"));
|
||||
|
||||
groupSizer->Add(sizer, 0, wxALIGN_CENTER | wxALL, 5);
|
||||
innerSizer->Add(groupSizer, 0, wxEXPAND | wxALL, 5);
|
||||
}
|
||||
outerSizer->Add(w, 1, wxEXPAND);
|
||||
|
||||
mGroups.Sort();
|
||||
|
||||
for (size_t i = 0, cnt = mGroups.GetCount(); i < cnt; i++)
|
||||
{
|
||||
wxString label = mGroups[i];
|
||||
if (label.IsEmpty())
|
||||
{
|
||||
label = _("Effect Settings");
|
||||
}
|
||||
wxSizer *groupSizer = new wxStaticBoxSizer(wxVERTICAL, w, label);
|
||||
auto uInnerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
innerSizer = uInnerSizer.get();
|
||||
|
||||
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())
|
||||
if (GetType() == EffectTypeGenerate)
|
||||
{
|
||||
labelText += wxT(" (") + ctrl.mUnits + wxT(")");
|
||||
// Add the length control
|
||||
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);
|
||||
}
|
||||
|
||||
if (ctrl.mTrigger)
|
||||
mGroups.Sort();
|
||||
|
||||
for (size_t i = 0, cnt = mGroups.GetCount(); i < cnt; i++)
|
||||
{
|
||||
gridSizer->Add(1, 1, 0);
|
||||
|
||||
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--)
|
||||
wxString label = mGroups[i];
|
||||
if (label.IsEmpty())
|
||||
{
|
||||
if (ctrl.mVal >= ctrl.mScaleValues[s])
|
||||
label = _("Effect Settings");
|
||||
}
|
||||
auto groupSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, label);
|
||||
|
||||
auto gridSizer = std::make_unique<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())
|
||||
{
|
||||
break;
|
||||
labelText += wxT(" (") + ctrl.mUnits + wxT(")");
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
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)
|
||||
if (ctrl.mTrigger)
|
||||
{
|
||||
str.Printf(wxT("%d"), lrintf(ctrl.mLo));
|
||||
gridSizer->Add(1, 1, 0);
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = Internat::ToDisplayString(ctrl.mLo);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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)
|
||||
if (ctrl.mToggle)
|
||||
{
|
||||
str.Printf(wxT("%d"), lrintf(ctrl.mHi));
|
||||
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--)
|
||||
{
|
||||
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
|
||||
{
|
||||
str = Internat::ToDisplayString(ctrl.mHi);
|
||||
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)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
gridSizer->Add(1, 1, 0);
|
||||
wxSizerItem *item = gridSizer->GetItem(j);
|
||||
widths[j % cols] = wxMax(widths[j % cols], item->GetSize().GetWidth());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
// Set each column in all of the groups to the same width.
|
||||
for (size_t i = (GetType() == EffectTypeGenerate); i < cnt; i++)
|
||||
{
|
||||
continue;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
w->SetSizer(innerSizer);
|
||||
mParent->SetSizer(outerSizer);
|
||||
|
||||
// Try to give the window a sensible default/minimum size
|
||||
wxSize sz1 = innerSizer->GetMinSize();
|
||||
|
@ -2242,33 +2242,39 @@ NyquistOutputDialog::NyquistOutputDialog(wxWindow * parent, wxWindowID id,
|
||||
{
|
||||
SetName(GetTitle());
|
||||
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *hSizer;
|
||||
wxButton *button;
|
||||
wxControl *item;
|
||||
wxBoxSizer *mainSizer;
|
||||
{
|
||||
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
mainSizer = uMainSizer.get();
|
||||
wxButton *button;
|
||||
wxControl *item;
|
||||
|
||||
item = safenew wxStaticText(this, -1, prompt);
|
||||
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);
|
||||
item = safenew wxStaticText(this, -1, prompt);
|
||||
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);
|
||||
|
||||
// TODO use ShowInfoDialog() instead.
|
||||
// Beware this dialog MUST work with screen readers.
|
||||
item = safenew wxTextCtrl(this, -1, message,
|
||||
wxDefaultPosition, wxSize(400, 200),
|
||||
wxTE_MULTILINE | wxTE_READONLY);
|
||||
mainSizer->Add(item, 0, wxALIGN_LEFT | wxALL, 10);
|
||||
// TODO use ShowInfoDialog() instead.
|
||||
// Beware this dialog MUST work with screen readers.
|
||||
item = safenew wxTextCtrl(this, -1, message,
|
||||
wxDefaultPosition, wxSize(400, 200),
|
||||
wxTE_MULTILINE | wxTE_READONLY);
|
||||
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.*/
|
||||
button = safenew wxButton(this, wxID_OK, _("OK"));
|
||||
button->SetDefault();
|
||||
hSizer->Add(button, 0, wxALIGN_CENTRE | wxALL, 5);
|
||||
/* 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->SetDefault();
|
||||
hSizer->Add(button, 0, wxALIGN_CENTRE | wxALL, 5);
|
||||
|
||||
mainSizer->Add(hSizer, 0, wxALIGN_CENTRE | wxLEFT | wxBOTTOM | wxRIGHT, 5);
|
||||
mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTRE | wxLEFT | wxBOTTOM | wxRIGHT, 5);
|
||||
}
|
||||
|
||||
SetAutoLayout(true);
|
||||
SetSizer(uMainSizer.release());
|
||||
}
|
||||
|
||||
SetAutoLayout(true);
|
||||
SetSizer(mainSizer);
|
||||
mainSizer->Fit(this);
|
||||
mainSizer->SetSizeHints(this);
|
||||
}
|
||||
|
@ -1212,34 +1212,41 @@ ExportMixerDialog::ExportMixerDialog( TrackList *tracks, bool selectedOnly,
|
||||
if (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();
|
||||
|
||||
wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL );
|
||||
wxWindow *mixerPanel = safenew ExportMixerPanel(mMixerSpec, mTrackNames, this,
|
||||
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,
|
||||
ID_MIXERPANEL, wxDefaultPosition, wxSize( 400, -1 ) );
|
||||
mixerPanel->SetName(_("Mixer Panel"));
|
||||
vertSizer->Add( mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5 );
|
||||
{
|
||||
auto horSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
wxBoxSizer *horSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxString label;
|
||||
label.Printf(_("Output Channels: %2d"), mMixerSpec->GetNumChannels());
|
||||
mChannelsText = safenew wxStaticText(this, -1, label);
|
||||
horSizer->Add(mChannelsText, 0, wxALIGN_LEFT | wxALL, 5);
|
||||
|
||||
wxString label;
|
||||
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,
|
||||
mMixerSpec->GetNumChannels(), 1, mMixerSpec->GetMaxNumChannels(),
|
||||
wxDefaultPosition, wxSize(300, -1));
|
||||
channels->SetName(label);
|
||||
horSizer->Add(channels, 0, wxEXPAND | 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(horSizer.release(), 0, wxALIGN_CENTRE | wxALL, 5);
|
||||
}
|
||||
|
||||
vertSizer->Add( horSizer, 0, wxALIGN_CENTRE | wxALL, 5 );
|
||||
vertSizer->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND);
|
||||
|
||||
vertSizer->Add( CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND );
|
||||
SetAutoLayout(true);
|
||||
SetSizer(uVertSizer.release());
|
||||
}
|
||||
|
||||
SetAutoLayout( true );
|
||||
SetSizer( vertSizer );
|
||||
vertSizer->Fit( this );
|
||||
vertSizer->SetSizeHints( this );
|
||||
|
||||
|
@ -751,19 +751,24 @@ wxDialog( parent, id, title, position, size, style | wxRESIZE_BORDER )
|
||||
mFile = _mFile;
|
||||
scount = mFile->GetStreamCount();
|
||||
for (wxInt32 i = 0; i < scount; i++)
|
||||
mFile->SetStreamUsage(i,FALSE);
|
||||
mFile->SetStreamUsage(i, FALSE);
|
||||
|
||||
wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL );
|
||||
wxArrayString *choices = mFile->GetStreamInfo();
|
||||
StreamList = safenew wxListBox(this, -1, wxDefaultPosition, wxDefaultSize, *choices , wxLB_EXTENDED | wxLB_ALWAYS_SB);
|
||||
wxBoxSizer *vertSizer;
|
||||
{
|
||||
auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
vertSizer = uVertSizer.get();
|
||||
|
||||
vertSizer->Add( StreamList, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 5 );
|
||||
wxArrayString *choices = mFile->GetStreamInfo();
|
||||
StreamList = safenew wxListBox(this, -1, wxDefaultPosition, wxDefaultSize, *choices, wxLB_EXTENDED | wxLB_ALWAYS_SB);
|
||||
|
||||
vertSizer->Add( CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND );
|
||||
vertSizer->Add(StreamList, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 5);
|
||||
|
||||
SetAutoLayout( true );
|
||||
vertSizer->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND);
|
||||
|
||||
SetSizer( vertSizer );
|
||||
SetAutoLayout(true);
|
||||
|
||||
SetSizer(uVertSizer.release());
|
||||
}
|
||||
|
||||
vertSizer->Fit( this );
|
||||
|
||||
|
@ -240,8 +240,8 @@ static wxString AskCopyOrEdit()
|
||||
wxDialog dialog(NULL, -1, wxString(_("Warning")));
|
||||
dialog.SetName(dialog.GetTitle());
|
||||
|
||||
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
||||
dialog.SetSizer(vbox);
|
||||
wxBoxSizer *vbox;
|
||||
dialog.SetSizer(vbox = safenew wxBoxSizer(wxVERTICAL));
|
||||
|
||||
wxStaticText *message = safenew wxStaticText(&dialog, -1, wxString::Format(_("\
|
||||
When importing uncompressed audio files you can either copy them \
|
||||
@ -261,19 +261,27 @@ How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _
|
||||
|
||||
wxStaticBox *box = safenew wxStaticBox(&dialog, -1, _("Choose an import method"));
|
||||
box->SetName(box->GetLabel());
|
||||
wxStaticBoxSizer *boxsizer = new wxStaticBoxSizer(box, wxVERTICAL);
|
||||
|
||||
wxRadioButton *copyRadio = safenew wxRadioButton(&dialog, -1, _("Make a © of the files before editing (safer)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
|
||||
boxsizer->Add(copyRadio, 0, wxALL);
|
||||
copyRadio->SetName(wxStripMenuCodes(copyRadio->GetLabel()));
|
||||
wxRadioButton *aliasRadio;
|
||||
wxRadioButton *copyRadio;
|
||||
wxCheckBox *dontAskNextTimeBox;
|
||||
|
||||
wxRadioButton *aliasRadio = safenew wxRadioButton(&dialog, -1, _("Read the files &directly from the original (faster)"));
|
||||
boxsizer->Add(aliasRadio, 0, wxALL);
|
||||
aliasRadio->SetName(wxStripMenuCodes(aliasRadio->GetLabel()));
|
||||
{
|
||||
auto boxsizer = std::make_unique<wxStaticBoxSizer>(box, wxVERTICAL);
|
||||
|
||||
copyRadio = safenew wxRadioButton(&dialog, -1, _("Make a © 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()));
|
||||
|
||||
|
||||
|
@ -282,8 +282,8 @@ void ControlToolBar::ArrangeButtons()
|
||||
Detach( mSizer );
|
||||
delete mSizer;
|
||||
}
|
||||
mSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
Add( mSizer, 1, wxEXPAND );
|
||||
|
||||
Add((mSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
|
||||
|
||||
// Start with a little extra space
|
||||
mSizer->Add( 5, 55 );
|
||||
|
@ -113,8 +113,7 @@ void MeterToolBar::ReCreateButtons()
|
||||
|
||||
void MeterToolBar::Populate()
|
||||
{
|
||||
mSizer = new wxGridBagSizer();
|
||||
Add( mSizer, 1, wxEXPAND );
|
||||
Add((mSizer = safenew wxGridBagSizer()), 1, wxEXPAND);
|
||||
|
||||
if( mWhichMeters & kWithRecordMeter ){
|
||||
//JKC: Record on left, playback on right. Left to right flow
|
||||
|
@ -114,7 +114,6 @@ void SelectionBar::Populate()
|
||||
SetFont(wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||
|
||||
wxFlexGridSizer *mainSizer;
|
||||
wxBoxSizer *hSizer;
|
||||
|
||||
/* 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
|
||||
@ -122,8 +121,7 @@ void SelectionBar::Populate()
|
||||
* runtime */
|
||||
wxString formatName = mListener ? mListener->AS_GetSelectionFormat() : wxString(wxEmptyString);
|
||||
|
||||
mainSizer = new wxFlexGridSizer(7, 1, 1);
|
||||
Add(mainSizer, 0, wxALIGN_CENTER_VERTICAL);
|
||||
Add((mainSizer = safenew wxFlexGridSizer(7, 1, 1)), 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
//
|
||||
// Top row (mostly labels)
|
||||
@ -150,19 +148,20 @@ void SelectionBar::Populate()
|
||||
bool showSelectionLength = false;
|
||||
gPrefs->Read(wxT("/ShowSelectionLength"), &showSelectionLength);
|
||||
|
||||
hSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, _("End"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRB_GROUP);
|
||||
mRightEndButton->SetName(_("End"));
|
||||
mRightEndButton->SetValue(!showSelectionLength);
|
||||
hSizer->Add(mRightEndButton,
|
||||
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
|
||||
mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, _("Length"));
|
||||
mRightLengthButton->SetName(_("Length"));
|
||||
mRightLengthButton->SetValue(showSelectionLength);
|
||||
hSizer->Add(mRightLengthButton,
|
||||
0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
{
|
||||
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, _("End"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRB_GROUP);
|
||||
mRightEndButton->SetName(_("End"));
|
||||
mRightEndButton->SetValue(!showSelectionLength);
|
||||
hSizer->Add(mRightEndButton,
|
||||
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
|
||||
mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, _("Length"));
|
||||
mRightLengthButton->SetName(_("Length"));
|
||||
mRightLengthButton->SetValue(showSelectionLength);
|
||||
hSizer->Add(mRightLengthButton,
|
||||
0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
#if defined(__WXMSW__)
|
||||
// Refer to Microsoft KB article 261192 for an explanation as
|
||||
// to why this is needed. We've only experienced it under Win2k
|
||||
@ -170,12 +169,13 @@ void SelectionBar::Populate()
|
||||
// in for all versions.
|
||||
wxRadioButton* dummyButton =
|
||||
safenew wxRadioButton(this, wxID_ANY, _("hidden"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRB_GROUP);
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRB_GROUP);
|
||||
dummyButton->Disable();
|
||||
dummyButton->Hide();
|
||||
#endif
|
||||
mainSizer->Add(hSizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
}
|
||||
|
||||
mainSizer->Add(5, 1);
|
||||
|
||||
|
@ -123,8 +123,8 @@ void SpectralSelectionBar::Populate()
|
||||
? mListener->SSBL_GetBandwidthSelectionFormatName()
|
||||
: wxString(wxEmptyString);
|
||||
|
||||
wxFlexGridSizer *mainSizer = new wxFlexGridSizer(1, 1, 1);
|
||||
Add(mainSizer, 0, wxALIGN_CENTER_VERTICAL);
|
||||
wxFlexGridSizer *mainSizer;
|
||||
Add((mainSizer = safenew wxFlexGridSizer(1, 1, 1)), 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
//
|
||||
// Top row, choice box
|
||||
@ -144,42 +144,44 @@ void SpectralSelectionBar::Populate()
|
||||
// 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(
|
||||
NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0);
|
||||
mCenterCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||
mCenterCtrl->SetName(_("Center Frequency:"));
|
||||
mCenterCtrl->EnableMenu();
|
||||
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
mCenterCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0);
|
||||
mCenterCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||
mCenterCtrl->SetName(_("Center Frequency:"));
|
||||
mCenterCtrl->EnableMenu();
|
||||
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
|
||||
mWidthCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0);
|
||||
mWidthCtrl->SetInvalidValue(-1.0);
|
||||
mWidthCtrl->SetName(wxString(_("Bandwidth:")));
|
||||
mWidthCtrl->EnableMenu();
|
||||
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
mWidthCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0);
|
||||
mWidthCtrl->SetInvalidValue(-1.0);
|
||||
mWidthCtrl->SetName(wxString(_("Bandwidth:")));
|
||||
mWidthCtrl->EnableMenu();
|
||||
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
|
||||
mLowCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0);
|
||||
mLowCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||
mLowCtrl->SetName(_("Low Frequency:"));
|
||||
mLowCtrl->EnableMenu();
|
||||
subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
mLowCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0);
|
||||
mLowCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||
mLowCtrl->SetName(_("Low Frequency:"));
|
||||
mLowCtrl->EnableMenu();
|
||||
subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
|
||||
mHighCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::FREQUENCY, this, OnHighID, frequencyFormatName, 0.0);
|
||||
mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||
mHighCtrl->SetName(wxString(_("High Frequency:")));
|
||||
mHighCtrl->EnableMenu();
|
||||
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
mHighCtrl = safenew NumericTextCtrl(
|
||||
NumericConverter::FREQUENCY, this, OnHighID, frequencyFormatName, 0.0);
|
||||
mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||
mHighCtrl->SetName(wxString(_("High Frequency:")));
|
||||
mHighCtrl->EnableMenu();
|
||||
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
|
||||
mCenterCtrl->Show(mbCenterAndWidth);
|
||||
mWidthCtrl->Show(mbCenterAndWidth);
|
||||
mLowCtrl->Show(!mbCenterAndWidth);
|
||||
mHighCtrl->Show(!mbCenterAndWidth);
|
||||
mCenterCtrl->Show(mbCenterAndWidth);
|
||||
mWidthCtrl->Show(mbCenterAndWidth);
|
||||
mLowCtrl->Show(!mbCenterAndWidth);
|
||||
mHighCtrl->Show(!mbCenterAndWidth);
|
||||
|
||||
mainSizer->Add(subSizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
mainSizer->Add(subSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
}
|
||||
|
||||
mainSizer->Layout();
|
||||
|
||||
|
@ -422,34 +422,35 @@ void ToolBar::ReCreateButtons()
|
||||
mGrabber = NULL;
|
||||
mResizer = NULL;
|
||||
|
||||
// Create the main sizer
|
||||
wxBoxSizer *ms = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
// Create the grabber and add it to the main sizer
|
||||
mGrabber = safenew Grabber( this, mType );
|
||||
ms->Add( mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1 );
|
||||
|
||||
// Use a box sizer for laying out controls
|
||||
mHSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
ms->Add( mHSizer, 1, wxEXPAND );
|
||||
|
||||
// (Re)Establish dock state
|
||||
SetDocked( GetDock(), false );
|
||||
|
||||
// Go add all the rest of the gadgets
|
||||
Populate();
|
||||
|
||||
// Add some space for the resize border
|
||||
if( IsResizable() )
|
||||
{
|
||||
// Create the resizer and add it to the main sizer
|
||||
mResizer = safenew ToolBarResizer( this );
|
||||
ms->Add( mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1 );
|
||||
mResizer->SetToolTip( _("Click and drag to resize toolbar") );
|
||||
}
|
||||
// Create the main sizer
|
||||
auto ms = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
// Set the sizer
|
||||
SetSizerAndFit( ms );
|
||||
// Create the grabber and add it to the main sizer
|
||||
mGrabber = safenew Grabber(this, mType);
|
||||
ms->Add(mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1);
|
||||
|
||||
// Use a box sizer for laying out controls
|
||||
ms->Add((mHSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
|
||||
|
||||
// (Re)Establish dock state
|
||||
SetDocked(GetDock(), false);
|
||||
|
||||
// Go add all the rest of the gadgets
|
||||
Populate();
|
||||
|
||||
// Add some space for the resize border
|
||||
if (IsResizable())
|
||||
{
|
||||
// Create the resizer and add it to the main sizer
|
||||
mResizer = safenew ToolBarResizer(this);
|
||||
ms->Add(mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1);
|
||||
mResizer->SetToolTip(_("Click and drag to resize toolbar"));
|
||||
}
|
||||
|
||||
// Set the sizer
|
||||
SetSizerAndFit(ms.release());
|
||||
}
|
||||
|
||||
// Recalculate the height to be a multiple of toolbarSingle
|
||||
const int tbs = toolbarSingle + toolbarGap;
|
||||
|
@ -118,25 +118,28 @@ class ToolFrame:public wxFrame
|
||||
mBar = bar;
|
||||
|
||||
// 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() )
|
||||
{
|
||||
s->Add( sizerW, 1 );
|
||||
width += sizerW;
|
||||
// We use a sizer to maintain proper spacing
|
||||
auto s = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
// 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();
|
||||
|
||||
// Inform toolbar of change
|
||||
|
@ -186,8 +186,7 @@ AButton * ToolsToolBar::MakeTool( teBmps eTool,
|
||||
void ToolsToolBar::Populate()
|
||||
{
|
||||
MakeButtonBackgroundsSmall();
|
||||
mToolSizer = new wxGridSizer( 2, 3, 1, 1 );
|
||||
Add( mToolSizer );
|
||||
Add(mToolSizer = safenew wxGridSizer(2, 3, 1, 1));
|
||||
|
||||
/* Tools */
|
||||
mTool[ selectTool ] = MakeTool( bmpIBeam, selectTool, _("Selection Tool") );
|
||||
|
@ -109,28 +109,33 @@ ErrorDialog::ErrorDialog(
|
||||
#if 0
|
||||
// Original non ShuttleGui based code.
|
||||
// Layout did not look good on Windows.
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer mainSizer;
|
||||
{
|
||||
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
mainSizer = uMainSizer.get();
|
||||
auto vSizer = make_unique<xBoxSizer>(wxVERTICAL);
|
||||
|
||||
wxBoxSizer *hSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto hSizer = make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
wxStaticText *statText = safenew wxStaticText(this, -1, message);
|
||||
mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
wxStaticText *statText = safenew wxStaticText(this, -1, message);
|
||||
mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
wxButton *help = safenew wxButton(this, wxID_HELP, _("Help"));
|
||||
hSizer->Add(help, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
wxButton *help = safenew wxButton(this, wxID_HELP, _("Help"));
|
||||
hSizer->Add(help, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
|
||||
ok->SetDefault();
|
||||
ok->SetFocus();
|
||||
hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5);
|
||||
wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
|
||||
ok->SetDefault();
|
||||
ok->SetFocus();
|
||||
hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5);
|
||||
|
||||
vSizer->Add(hSizer, 0, wxALIGN_CENTER|wxALL, 5);
|
||||
vSizer->Add(hSizer.release(), 0, wxALIGN_CENTER|wxALL, 5);
|
||||
|
||||
mainSizer->Add(vSizer, 0, wxALL, 15 );
|
||||
mainSizer->Add(vSizer.release(), 0, wxALL, 15 );
|
||||
|
||||
SetAutoLayout(true);
|
||||
SetSizer(uMainSizer.release());
|
||||
}
|
||||
|
||||
SetAutoLayout(true);
|
||||
SetSizer(mainSizer);
|
||||
mainSizer->Fit(this);
|
||||
mainSizer->SetSizeHints(this);
|
||||
#endif
|
||||
|
@ -68,65 +68,78 @@ MultiDialog::MultiDialog(wxWindow * pParent,
|
||||
{
|
||||
SetName(GetTitle());
|
||||
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *iconAndTextSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
|
||||
wxART_MESSAGE_BOX);
|
||||
wxStaticBitmap *icon = safenew wxStaticBitmap(this, -1, bitmap);
|
||||
iconAndTextSizer->Add( icon, 0, wxCENTER );
|
||||
|
||||
wxStaticText *statText = safenew wxStaticText(this, -1, message);
|
||||
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, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
|
||||
int count=0;
|
||||
while(buttons[count])count++;
|
||||
wxString *buttonLabels = new wxString[count];
|
||||
|
||||
count=0;
|
||||
while(buttons[count]){
|
||||
buttonLabels[count] = buttons[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);
|
||||
|
||||
|
||||
wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxButton* pButton;
|
||||
if(log)
|
||||
wxString *buttonLabels;
|
||||
wxBoxSizer *mainSizer;
|
||||
{
|
||||
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.
|
||||
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
mainSizer = uMainSizer.get();
|
||||
|
||||
buttonSizer->AddSpacer(40);
|
||||
{
|
||||
auto vSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
{
|
||||
auto iconAndTextSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
|
||||
wxART_MESSAGE_BOX);
|
||||
wxStaticBitmap *icon = safenew wxStaticBitmap(this, -1, bitmap);
|
||||
iconAndTextSizer->Add(icon, 0, wxCENTER);
|
||||
|
||||
wxStaticText *statText = safenew wxStaticText(this, -1, message);
|
||||
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;
|
||||
while (buttons[count])count++;
|
||||
buttonLabels = new wxString[count];
|
||||
|
||||
count = 0;
|
||||
while (buttons[count]){
|
||||
buttonLabels[count] = buttons[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());
|
||||
}
|
||||
|
||||
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->SetSizeHints(this);
|
||||
delete[] buttonLabels;
|
||||
|
@ -1087,101 +1087,111 @@ bool ProgressDialog::Create(const wxString & title,
|
||||
}
|
||||
SetName(GetTitle());
|
||||
|
||||
wxBoxSizer *v;
|
||||
wxWindow *w;
|
||||
wxSize ds;
|
||||
|
||||
SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT);
|
||||
|
||||
v = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
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))
|
||||
wxFlexGridSizer *g;
|
||||
wxBoxSizer *h;
|
||||
{
|
||||
w = safenew wxButton(this, wxID_OK, _("Stop"));
|
||||
h->Add(w, 0, wxRIGHT, 10);
|
||||
auto v = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
|
||||
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();
|
||||
|
||||
ds.x = wxMax(g->GetSize().x, h->GetSize().x) + 10;
|
||||
|
Loading…
x
Reference in New Issue
Block a user