1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 08:59:28 +02:00

Rewrite ImportPCM dialog with ShuttleGui

This commit is contained in:
Paul Licameli 2017-10-20 09:53:30 -04:00
parent 63b1803a6e
commit 3a14393f5e

View File

@ -37,6 +37,8 @@
#include "sndfile.h" #include "sndfile.h"
#include "../WaveClip.h" #include "../WaveClip.h"
#include "../ShuttleGui.h"
#include "../ondemand/ODManager.h" #include "../ondemand/ODManager.h"
#include "../ondemand/ODComputeSummaryTask.h" #include "../ondemand/ODComputeSummaryTask.h"
#include "../blockfile/ODPCMAliasBlockFile.h" #include "../blockfile/ODPCMAliasBlockFile.h"
@ -318,9 +320,6 @@ static wxString AskCopyOrEdit()
wxDialogWrapper dialog( nullptr, -1, XO("Warning") ); wxDialogWrapper dialog( nullptr, -1, XO("Warning") );
dialog.SetName(); dialog.SetName();
wxBoxSizer *vbox;
dialog.SetSizer(vbox = safenew wxBoxSizer(wxVERTICAL));
wxString clause1 = _( wxString clause1 = _(
"When importing uncompressed audio files you can either copy them into the project," "When importing uncompressed audio files you can either copy them into the project,"
" or read them directly from their current location (without copying).\n\n" " or read them directly from their current location (without copying).\n\n"
@ -340,36 +339,31 @@ static wxString AskCopyOrEdit()
"How do you want to import the current file(s)?" "How do you want to import the current file(s)?"
); );
wxStaticText *message = ShuttleGui S{ &dialog, eIsCreating };
safenew wxStaticText(&dialog, -1, clause1 + clause2 + clause3); S.SetBorder(10);
S
message->Wrap(500); .Position( wxALL | wxEXPAND )
message->SetName(message->GetLabel()); .AddUnits( clause1 + clause2 + clause3, 500);
vbox->Add(message, 1, wxALL | wxEXPAND, 10);
wxStaticBox *box = safenew wxStaticBoxWrapper(&dialog, -1, _("Choose an import method"));
box->SetName(box->GetLabel());
wxRadioButton *aliasRadio; wxRadioButton *aliasRadio;
wxRadioButton *copyRadio; wxRadioButton *copyRadio;
wxCheckBox *dontAskNextTimeBox; wxCheckBox *dontAskNextTimeBox;
S.StartStatic(_("Choose an import method"));
{ {
auto boxsizer = std::make_unique<wxStaticBoxSizer>(box, wxVERTICAL); S.SetBorder(0);
copyRadio = safenew wxRadioButton(&dialog, -1, _("Make a &copy of the files before editing (safer)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); copyRadio = S.AddRadioButton(
boxsizer->Add(copyRadio, 0, wxALL); _("Make a &copy of the files before editing (safer)") );
copyRadio->SetName(wxStripMenuCodes(copyRadio->GetLabel()));
aliasRadio = safenew wxRadioButton(&dialog, -1, _("Read the files &directly from the original (faster)")); aliasRadio = S.AddRadioButtonToGroup(
boxsizer->Add(aliasRadio, 0, wxALL); _("Read the files &directly from the original (faster)") );
aliasRadio->SetName(wxStripMenuCodes(aliasRadio->GetLabel()));
dontAskNextTimeBox = safenew wxCheckBox(&dialog, -1, _("Don't &warn again and always use my choice above")); dontAskNextTimeBox = S.AddCheckBox(
boxsizer->Add(dontAskNextTimeBox, 0, wxALL); _("Don't &warn again and always use my choice above"),
vbox->Add(boxsizer.release(), 0, wxALL, 10); wxT("false"));
} }
S.EndStatic();
dontAskNextTimeBox->SetName(wxStripMenuCodes(dontAskNextTimeBox->GetLabel())); dontAskNextTimeBox->SetName(wxStripMenuCodes(dontAskNextTimeBox->GetLabel()));
@ -377,8 +371,8 @@ static wxString AskCopyOrEdit()
wxRadioButton *prefsRadio = oldCopyPref == wxT("copy") ? copyRadio : aliasRadio; wxRadioButton *prefsRadio = oldCopyPref == wxT("copy") ? copyRadio : aliasRadio;
prefsRadio->SetValue(true); prefsRadio->SetValue(true);
wxSizer *buttonSizer = dialog.CreateButtonSizer(wxOK | wxCANCEL); S.SetBorder( 10 );
vbox->Add(buttonSizer, 0, wxALL | wxEXPAND, 10); S.AddStandardButtons( eOkButton | eCancelButton );
dialog.SetSize(dialog.GetBestSize()); dialog.SetSize(dialog.GetBestSize());
dialog.Layout(); dialog.Layout();