1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 23:59:41 +02:00

Add GetInfo Preferences.

This commit is contained in:
James Crook 2018-02-24 19:39:58 +00:00
parent 11fa48d66f
commit ea4968e094
37 changed files with 364 additions and 53 deletions

View File

@ -94,6 +94,8 @@ for registering for changes.
#include "Audacity.h"
#include "Experimental.h"
#include "Shuttle.h"
#include "ShuttleGui.h"
#include "MemoryX.h"
@ -105,8 +107,6 @@ for registering for changes.
#include <wx/spinctrl.h>
#include <wx/bmpbuttn.h>
#include "Internat.h"
#include "Experimental.h"
#include "Shuttle.h"
#include "WrappedType.h"
#include "widgets/wxPanelWrapper.h"
#include "AllThemeResources.h"
@ -142,9 +142,7 @@ void ShuttleGuiBase::Init()
miSizerProp=0;
mSizerDepth=-1;
miIdSetByUser = -1;
miId = -1;
miIdNext = 3000;
ResetId();
miNoMatchSelector = 0;
@ -172,6 +170,13 @@ void ShuttleGuiBase::Init()
mpSizer->SetMinSize(250,100);
}
void ShuttleGuiBase::ResetId()
{
miIdSetByUser = -1;
miId = -1;
miIdNext = 3000;
}
void ShuttleGuiBase::EnableCtrl( bool bEnable )
{
if( mShuttleMode != eIsCreating )
@ -1038,6 +1043,8 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, WrappedType & W
switch( mShuttleMode )
{
// IF setting internal storage from the controls.
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxASSERT( pCheckBox );
@ -1077,6 +1084,8 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, WrappedT
switch( mShuttleMode )
{
// IF setting internal storage from the controls.
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxASSERT( pCheckBox );
@ -1117,6 +1126,8 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, WrappedType &
switch( mShuttleMode )
{
// IF setting internal storage from the controls.
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxASSERT( pSpinCtrl );
@ -1157,6 +1168,8 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, WrappedType & W
switch( mShuttleMode )
{
// IF setting internal storage from the controls.
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxASSERT( pTextBox );
@ -1197,6 +1210,8 @@ wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, WrappedT
switch( mShuttleMode )
{
// IF setting internal storage from the controls.
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxASSERT( pTextBox );
@ -1236,6 +1251,8 @@ wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, WrappedType & Wrap
}
break;
// IF setting internal storage from the controls.
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
@ -1293,6 +1310,8 @@ wxChoice * ShuttleGuiBase::TieChoice(
}
break;
// IF setting internal storage from the controls.
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
@ -1347,6 +1366,8 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy
UpdateSizers();
}
break;
case eIsGettingMetadata:
break;
case eIsGettingFromDialog:
{
wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
@ -1617,6 +1638,8 @@ bool ShuttleGuiBase::DoStep( int iStep )
{
return (iStep==2) || (iStep==3);
}
if( mShuttleMode == eIsGettingMetadata )
return iStep ==2;
wxASSERT( false );
return false;
}
@ -2295,3 +2318,172 @@ void ShuttleGui::SetSizeHints( int minX, int minY )
{
ShuttleGuiBase::SetSizeHints( minX, minY );
}
/********************************* GetDefinition ******************************/
ShuttleGuiGetDefinition::ShuttleGuiGetDefinition(
wxWindow * pParent,CommandMessageTarget & target )
: CommandMessageTargetDecorator( target ),
ShuttleGui( pParent, eIsGettingMetadata )
{
}
ShuttleGuiGetDefinition::~ShuttleGuiGetDefinition(void)
{
}
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBox(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "bool", "type" );
AddBool( bDefault, "default" );
EndStruct();
return ShuttleGui::TieCheckBox( Prompt, SettingName, bDefault );
}
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBoxOnRight(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "bool", "type" );
AddBool( bDefault, "default" );
EndStruct();
return ShuttleGui::TieCheckBoxOnRight( Prompt, SettingName, bDefault );
}
wxChoice * ShuttleGuiGetDefinition::TieChoice(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const wxArrayString &Choices,
const wxArrayString & TranslatedChoices )
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "enum", "type" );
AddItem( Default, "default" );
StartField( "enum" );
StartArray();
for( size_t i=0;i<Choices.Count(); i++ )
AddItem( Choices[i] );
EndArray();
EndField();
EndStruct();
return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, TranslatedChoices );
}
wxChoice * ShuttleGuiGetDefinition::TieChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const wxArrayString & Choices,
const std::vector<int> & TranslatedChoices)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "enum", "type" );
AddItem( Default, "default" );
StartField( "enum" );
StartArray();
for( size_t i=0;i<Choices.Count(); i++ )
AddItem( Choices[i] );
EndArray();
EndField();
EndStruct();
return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, TranslatedChoices );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const int nChars)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "string", "type" );
AddItem( Default, "default" );
EndStruct();
return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const int nChars)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "string", "type" );
AddItem( Default, "default" );
EndStruct();
return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieNumericTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const int nChars)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( Default, "default" );
EndStruct();
return ShuttleGui::TieNumericTextBox( Prompt, SettingName, Default, nChars );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const int nChars)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( Default, "default" );
EndStruct();
return ShuttleGui::TieNumericTextBox( Prompt, SettingName, Default, nChars );
}
wxSlider * ShuttleGuiGetDefinition::TieSlider(
const wxString & Prompt,
const wxString & SettingName,
const int iDefault,
const int max,
const int min)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( iDefault, "default" );
EndStruct();
return ShuttleGui::TieSlider( Prompt, SettingName, iDefault, max, min );
}
wxSpinCtrl * ShuttleGuiGetDefinition::TieSpinCtrl(
const wxString &Prompt,
const wxString &SettingName,
const int Value,
const int max,
const int min)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( Value, "default" );
EndStruct();
return ShuttleGui::TieSpinCtrl( Prompt, SettingName, Value, max, min );
}

View File

@ -24,6 +24,9 @@
#include "WrappedType.h"
// For ShuttleGuiGetDefinitions.
#include "commands/CommandTargets.h"
const int nMaxNestedSizers = 20;
enum teShuttleMode
@ -33,6 +36,7 @@ enum teShuttleMode
eIsSettingToDialog,
eIsSavingViaShuttle,
eIsGettingViaShuttle,
eIsGettingMetadata,
// Next two are only ever seen in constructor.
// After that they revert to one of the modes above.
@ -76,6 +80,7 @@ public:
ShuttleGuiBase(wxWindow * pParent,teShuttleMode ShuttleMode);
~ShuttleGuiBase(void);
void Init();
void ResetId();
//-- Add functions. These only add a widget or 2.
void AddPrompt(const wxString &Prompt);
@ -193,53 +198,53 @@ public:
// Note that unlike the other Tie functions, ALL the arguments are const.
// That's because the data is being exchanged between the dialog and mpShuttle
// so it doesn't need an argument that is writeable.
wxCheckBox * TieCheckBox(
virtual wxCheckBox * TieCheckBox(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault);
wxCheckBox * TieCheckBoxOnRight(
virtual wxCheckBox * TieCheckBoxOnRight(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault);
wxChoice * TieChoice(
virtual wxChoice * TieChoice(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const wxArrayString &Choices,
const wxArrayString & TranslatedChoices );
wxChoice * TieChoice(
virtual wxChoice * TieChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const wxArrayString & Choices,
const std::vector<int> & TranslatedChoices);
wxTextCtrl * TieTextBox(
virtual wxTextCtrl * TieTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const int nChars);
wxTextCtrl * TieTextBox(
virtual wxTextCtrl * TieTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const int nChars);
wxTextCtrl * TieNumericTextBox(
virtual wxTextCtrl * TieNumericTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const int nChars);
wxTextCtrl * TieNumericTextBox(
virtual wxTextCtrl * TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const int nChars);
wxSlider * TieSlider(
virtual wxSlider * TieSlider(
const wxString & Prompt,
const wxString & SettingName,
const int iDefault,
const int max,
const int min = 0);
wxSpinCtrl * TieSpinCtrl(
virtual wxSpinCtrl * TieSpinCtrl(
const wxString &Prompt,
const wxString &SettingName,
const int Value,
@ -387,4 +392,72 @@ public:
teShuttleMode GetMode() { return mShuttleMode; };
};
/**************************************************************************//**
\brief Shuttle that retrieves a JSON format definition of a command's parameters.
********************************************************************************/
class ShuttleGuiGetDefinition : public ShuttleGui, public CommandMessageTargetDecorator
{
public:
ShuttleGuiGetDefinition(wxWindow * pParent,CommandMessageTarget & target );
~ShuttleGuiGetDefinition(void);
wxCheckBox * TieCheckBox(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault) override;
wxCheckBox * TieCheckBoxOnRight(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault) override;
wxChoice * TieChoice(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const wxArrayString &Choices,
const wxArrayString & TranslatedChoices ) override;
wxChoice * TieChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const wxArrayString & Choices,
const std::vector<int> & TranslatedChoices) override;
wxTextCtrl * TieTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const int nChars) override;
wxTextCtrl * TieTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const int nChars) override;
wxTextCtrl * TieNumericTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const int nChars) override;
wxTextCtrl * TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const int nChars) override;
wxSlider * TieSlider(
const wxString & Prompt,
const wxString & SettingName,
const int iDefault,
const int max,
const int min = 0) override;
wxSpinCtrl * TieSpinCtrl(
const wxString &Prompt,
const wxString &SettingName,
const int Value,
const int max,
const int min) override;
};
#endif

View File

@ -63,7 +63,7 @@ void CommandMessageTarget::AddItem(const wxString &value, const wxString &name){
mCounts.Last() += 1;
}
void CommandMessageTarget::AddBool(const bool value, const wxString &name){
Update( wxString::Format( "%s%s%s%s", (mCounts.Last()>0)?", ":"", name, !name.IsEmpty()?":":"",value?"True":"False"));
Update( wxString::Format( "%s%s%s\"%s\"", (mCounts.Last()>0)?", ":"", name, !name.IsEmpty()?":":"",value?"true":"false"));
mCounts.Last() += 1;
}
void CommandMessageTarget::AddItem(const double value, const wxString &name){

View File

@ -39,10 +39,14 @@ This class now lists
#include "../ShuttleGui.h"
#include "CommandContext.h"
#include "../prefs/PrefsDialog.h"
#include "../ShuttleGui.h"
enum {
kCommands,
kCommandsPlus,
kMenus,
kPreferences,
kTracks,
kClips,
kEnvelopes,
@ -56,6 +60,7 @@ static const wxString kTypes[nTypes] =
XO("Commands"),
XO("Commands+"),
XO("Menus"),
XO("Preferences"),
XO("Tracks"),
XO("Clips"),
XO("Envelopes"),
@ -133,6 +138,7 @@ bool GetInfoCommand::ApplyInner(const CommandContext &context)
case kCommands : return SendCommands( context, 0 );
case kCommandsPlus : return SendCommands( context, 1 );
case kMenus : return SendMenus( context );
case kPreferences : return SendPreferences( context );
case kTracks : return SendTracks( context );
case kClips : return SendClips( context );
case kEnvelopes : return SendEnvelopes( context );
@ -171,6 +177,19 @@ bool GetInfoCommand::SendMenus(const CommandContext &context)
return true;
}
bool GetInfoCommand::SendPreferences(const CommandContext &context)
{
context.StartArray();
GlobalPrefsDialog dialog( context.GetProject() );
// wxCommandEvent Evt;
//dialog.Show();
wxWindow * pWin = context.GetProject();
ShuttleGuiGetDefinition S(pWin, *((context.pOutput)->mStatusTarget) );
dialog.ShuttleAll( S );
context.EndArray();
return true;
}
/**
Send the list of commands.
*/

View File

@ -49,6 +49,7 @@ public:
private:
bool SendCommands(const CommandContext & context, int flags);
bool SendMenus(const CommandContext & context);
bool SendPreferences(const CommandContext & context);
bool SendTracks(const CommandContext & context);
bool SendLabels(const CommandContext & context);
bool SendClips(const CommandContext & context);

View File

@ -26,10 +26,10 @@ public:
BatchPrefs(wxWindow * parent, wxWindowID winid);
~BatchPrefs();
bool Commit() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
DECLARE_EVENT_TABLE()
};

View File

@ -178,14 +178,14 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S)
DEFAULT_LATENCY_DURATION,
9);
S.AddUnits(_("milliseconds"));
w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));
w = S.TieNumericTextBox(_("Track &shift after record:"),
wxT("/AudioIO/LatencyCorrection"),
DEFAULT_LATENCY_CORRECTION,
9);
S.AddUnits(_("milliseconds"));
w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));
}
S.EndThreeColumn();
}

View File

@ -29,10 +29,10 @@ class DevicePrefs final : public PrefsPanel
virtual ~DevicePrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void GetNamesAndLabels();
void OnHost(wxCommandEvent & e);

View File

@ -26,10 +26,10 @@ class DirectoriesPrefs final : public PrefsPanel
bool Commit() override;
bool Validate() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void UpdateFreeSpace(wxCommandEvent & e);
void OnChooseTempDir(wxCommandEvent & e);

View File

@ -123,7 +123,7 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S)
wxT("name"),
visualgroups,
prefsgroups);
c->SetMinSize(c->GetBestSize());
if( c ) c->SetMinSize(c->GetBestSize());
S.TieNumericTextBox(_("&Maximum effects per group (0 to disable):"),
wxT("/Effects/MaxPerGroup"),

View File

@ -29,10 +29,10 @@ class EffectsPrefs final : public PrefsPanel
~EffectsPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
class EffectsPrefsFactory final : public PrefsPanelFactory

View File

@ -50,6 +50,7 @@ class ExtImportPrefs final : public PrefsPanel
~ExtImportPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
void OnPluginKeyDown(wxListEvent& event);
void OnPluginBeginDrag(wxListEvent& event);
@ -103,7 +104,6 @@ class ExtImportPrefs final : public PrefsPanel
void DoOnRuleTableSelect (int toprow);
void AddItemToTable (int index, const ExtImportItem *item);
void Populate();
void PopulateOrExchange(ShuttleGui & S);
DECLARE_EVENT_TABLE()
};

View File

@ -29,12 +29,12 @@ class GUIPrefs final : public PrefsPanel
~GUIPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
static void GetRangeChoices(wxArrayString *pChoices, wxArrayString *pCodes);
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
wxArrayString mLangCodes;
wxArrayString mLangNames;

View File

@ -28,10 +28,10 @@ class ImportExportPrefs final : public PrefsPanel
~ImportExportPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
class ImportExportPrefsFactory final : public PrefsPanelFactory

View File

@ -154,11 +154,11 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartRadioButtonGroup(wxT("/Prefs/KeyConfig/ViewBy"), wxT("tree"));
{
mViewByTree = S.Id(ViewByTreeID).TieRadioButton(_("&Tree"), wxT("tree"));
mViewByTree->SetName(_("View by tree"));
if( mViewByTree ) mViewByTree->SetName(_("View by tree"));
mViewByName = S.Id(ViewByNameID).TieRadioButton(_("&Name"), wxT("name"));
mViewByName->SetName(_("View by name"));
if( mViewByName ) mViewByName->SetName(_("View by name"));
mViewByKey = S.Id(ViewByKeyID).TieRadioButton(_("&Key"), wxT("key"));
mViewByKey->SetName(_("View by key"));
if( mViewByKey ) mViewByKey->SetName(_("View by key"));
}
S.EndRadioButtonGroup();
}

View File

@ -40,10 +40,10 @@ public:
bool Commit() override;
void Cancel() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void RefreshBindings(bool bSort);
void FilterKeys( std::vector<NormalizedKeyString> & arr );
wxString NameFromKey(const NormalizedKeyString & key);

View File

@ -158,7 +158,7 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
wxT("/Library/FFmpegOnDemand"),
false);
#if !defined(USE_FFMPEG)
checkbox->Enable(FALSE);
if( checkbox ) checkbox->Enable(FALSE);
#endif
#endif
}

View File

@ -29,10 +29,10 @@ class LibraryPrefs final : public PrefsPanel
~LibraryPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void SetMP3VersionText(bool prompt = false);
void SetFFmpegVersionText();

View File

@ -34,10 +34,10 @@ class MidiIOPrefs final : public PrefsPanel
bool Commit() override;
bool Validate() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void GetNamesAndLabels();
void OnHost(wxCommandEvent & e);

View File

@ -38,6 +38,7 @@ class ModulePrefs final : public PrefsPanel
~ModulePrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
static int GetModuleStatus( const wxString &fname );
static void SetModuleStatus( const wxString &fname, int iStatus );
@ -45,7 +46,6 @@ class ModulePrefs final : public PrefsPanel
private:
void GetAllModuleStatuses();
void Populate();
void PopulateOrExchange(ShuttleGui & S);
wxArrayString mModules;
std::vector<int> mStatuses;
wxArrayString mPaths;

View File

@ -26,10 +26,10 @@ class MousePrefs final : public PrefsPanel
~MousePrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void CreateList();
void AddItem(wxString const & buttons,
wxString const & tool,

View File

@ -65,7 +65,7 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
6.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
}
S.EndThreeColumn();
}
@ -81,14 +81,14 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
2.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
w = S.TieNumericTextBox(_("&After cut region:"),
wxT("/AudioIO/CutPreviewAfterLen"),
1.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
}
S.EndThreeColumn();
}
@ -103,14 +103,14 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
1.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
w = S.TieNumericTextBox(_("Lo&ng period:"),
wxT("/AudioIO/SeekLongPeriod"),
15.0,
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
}
S.EndThreeColumn();
}

View File

@ -27,10 +27,10 @@ class PlaybackPrefs final : public PrefsPanel
virtual ~PlaybackPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
class PlaybackPrefsFactory final : public PrefsPanelFactory

View File

@ -428,6 +428,23 @@ void PrefsDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
HelpSystem::ShowHelp(this, page, true);
}
void PrefsDialog::ShuttleAll( ShuttleGui & S)
{
// Validate all pages first
if (mCategories) {
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {
S.ResetId();
PrefsPanel *panel = (PrefsPanel *)mCategories->GetPage(i);
panel->PopulateOrExchange( S );
}
}
else
{
S.ResetId();
mUniquePage->PopulateOrExchange( S );
}
}
void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event)
{
if(event.GetKeyCode() == WXK_RETURN)

View File

@ -24,6 +24,7 @@
class PrefsPanel;
class PrefsPanelFactory;
class ShuttleGui;
#ifdef __GNUC__
#define CONST
@ -56,6 +57,7 @@ class PrefsDialog /* not final */ : public wxDialogWrapper
// Defined this so a protected virtual can be invoked after the constructor
int ShowModal() override;
void ShuttleAll( ShuttleGui & S);
void OnCategoryChange(wxCommandEvent & e);
void OnOK(wxCommandEvent & e);

View File

@ -40,6 +40,8 @@ ThemePrefs.
#define TOP_LEVEL_BORDER 5
#define GENERIC_CONTROL_BORDER 5
class ShuttleGui;
class PrefsPanel /* not final */ : public wxPanelWrapper
{
public:
@ -59,6 +61,7 @@ class PrefsPanel /* not final */ : public wxPanelWrapper
// If it returns True, the Preview button is added below the panel
// Default returns false
virtual bool ShowsPreviewButton();
virtual void PopulateOrExchange( ShuttleGui & WXUNUSED(S) ){};
// If not empty string, the Help button is added below the panel
// Default returns empty string.

View File

@ -28,10 +28,10 @@ class ProjectsPrefs final : public PrefsPanel
~ProjectsPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
};
class ProjectsPrefsFactory final : public PrefsPanelFactory

View File

@ -31,10 +31,10 @@ class QualityPrefs final : public PrefsPanel
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void GetNamesAndLabels();
void OnSampleRateChoice(wxCommandEvent & e);

View File

@ -138,8 +138,10 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
wxT("/GUI/TrackNames/RecodingTrackName"),
_("Recorded_Audio"),
30);
mToggleCustomName->SetName(_("Custom name text"));
mToggleCustomName->Enable(mUseCustomTrackName);
if( mToggleCustomName ) {
mToggleCustomName->SetName(_("Custom name text"));
mToggleCustomName->Enable(mUseCustomTrackName);
}
}
S.EndMultiColumn();

View File

@ -28,10 +28,10 @@ class RecordingPrefs final : public PrefsPanel
virtual ~RecordingPrefs();
bool Commit() override;
wxString HelpPageName() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void OnToggleCustomName(wxCommandEvent & /* Evt */);
wxTextCtrl *mToggleCustomName;

View File

@ -300,7 +300,9 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
} S.EndScroller();
EnableDisableSTFTOnlyControls();
// Enabling and disabling belongs outside this function.
if( S.GetMode() != eIsGettingMetadata )
EnableDisableSTFTOnlyControls();
mPopulating = false;
}

View File

@ -46,6 +46,7 @@ class SpectrumPrefs final : public PrefsPanel
virtual ~SpectrumPrefs();
void Preview() override;
bool Commit() override;
void PopulateOrExchange(ShuttleGui & S) override;
void Rollback();
bool ShowsPreviewButton() override;
bool Validate() override;
@ -54,7 +55,6 @@ class SpectrumPrefs final : public PrefsPanel
private:
void Populate(size_t windowSize);
void PopulatePaddingChoices(size_t windowSize);
void PopulateOrExchange(ShuttleGui & S);
void OnControl(wxCommandEvent &event);
void OnWindowSize(wxCommandEvent &event);

View File

@ -30,7 +30,7 @@ class ThemePrefs final : public PrefsPanel
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void PopulateOrExchange(ShuttleGui & S) override;
void OnLoadThemeComponents(wxCommandEvent & e);
void OnSaveThemeComponents(wxCommandEvent & e);
void OnLoadThemeCache(wxCommandEvent & e);

View File

@ -31,7 +31,7 @@ class TracksBehaviorsPrefs final : public PrefsPanel
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void PopulateOrExchange(ShuttleGui & S) override;
wxArrayString mSoloCodes;
wxArrayString mSoloChoices;

View File

@ -38,7 +38,7 @@ class TracksPrefs final : public PrefsPanel
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void PopulateOrExchange(ShuttleGui & S) override;
static int iPreferencePinned;

View File

@ -31,7 +31,7 @@ class WarningsPrefs final : public PrefsPanel
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void PopulateOrExchange(ShuttleGui & S) override;
};
class WarningsPrefsFactory final : public PrefsPanelFactory

View File

@ -28,10 +28,10 @@ public:
bool Commit() override;
bool ShowsPreviewButton() override;
bool Validate() override;
void PopulateOrExchange(ShuttleGui & S) override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void OnControl(wxCommandEvent&);
void OnScale(wxCommandEvent&);