mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
Implement ReloadPreferences for SetPreferences Command.
This commit is contained in:
parent
a8903a6c56
commit
2caad0f407
@ -1618,6 +1618,8 @@ void AudacityProject::CreateMenusAndCommands()
|
|||||||
AudioIONotBusyFlag, AudioIONotBusyFlag);
|
AudioIONotBusyFlag, AudioIONotBusyFlag);
|
||||||
c->AddItem(wxT("SetTrack"), _("Set Track..."), FN(OnAudacityCommand),
|
c->AddItem(wxT("SetTrack"), _("Set Track..."), FN(OnAudacityCommand),
|
||||||
AudioIONotBusyFlag, AudioIONotBusyFlag);
|
AudioIONotBusyFlag, AudioIONotBusyFlag);
|
||||||
|
c->AddItem(wxT("ReloadPreferences"), _("&Reload Preferences..."), FN(OnReloadPreferences),
|
||||||
|
AudioIONotBusyFlag, AudioIONotBusyFlag);
|
||||||
|
|
||||||
|
|
||||||
c->EndSubMenu();
|
c->EndSubMenu();
|
||||||
@ -4892,6 +4894,37 @@ void AudacityProject::OnPreferences(const CommandContext &WXUNUSED(context) )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudacityProject::OnReloadPreferences(const CommandContext &WXUNUSED(context) )
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GlobalPrefsDialog dialog(this /* parent */ );
|
||||||
|
wxCommandEvent Evt;
|
||||||
|
//dialog.Show();
|
||||||
|
dialog.OnOK(Evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// LL: Moved from PrefsDialog since wxWidgets on OSX can't deal with
|
||||||
|
// rebuilding the menus while the PrefsDialog is still in the modal
|
||||||
|
// state.
|
||||||
|
for (size_t i = 0; i < gAudacityProjects.size(); i++) {
|
||||||
|
AudacityProject *p = gAudacityProjects[i].get();
|
||||||
|
|
||||||
|
p->RebuildMenuBar();
|
||||||
|
p->RebuildOtherMenus();
|
||||||
|
// TODO: The comment below suggests this workaround is obsolete.
|
||||||
|
#if defined(__WXGTK__)
|
||||||
|
// Workaround for:
|
||||||
|
//
|
||||||
|
// http://bugzilla.audacityteam.org/show_bug.cgi?id=458
|
||||||
|
//
|
||||||
|
// This workaround should be removed when Audacity updates to wxWidgets 3.x which has a fix.
|
||||||
|
wxRect r = p->GetRect();
|
||||||
|
p->SetSize(wxSize(1,1));
|
||||||
|
p->SetSize(r.GetSize());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AudacityProject::OnPageSetup(const CommandContext &WXUNUSED(context) )
|
void AudacityProject::OnPageSetup(const CommandContext &WXUNUSED(context) )
|
||||||
{
|
{
|
||||||
HandlePageSetup(this);
|
HandlePageSetup(this);
|
||||||
|
@ -235,6 +235,7 @@ void OnExportLabels(const CommandContext &context );
|
|||||||
void OnExportMIDI(const CommandContext &context );
|
void OnExportMIDI(const CommandContext &context );
|
||||||
|
|
||||||
void OnPreferences(const CommandContext &context );
|
void OnPreferences(const CommandContext &context );
|
||||||
|
void OnReloadPreferences(const CommandContext &context );
|
||||||
|
|
||||||
void OnPageSetup(const CommandContext &context );
|
void OnPageSetup(const CommandContext &context );
|
||||||
void OnPrint(const CommandContext &context );
|
void OnPrint(const CommandContext &context );
|
||||||
|
@ -20,6 +20,7 @@ SetPreferenceCommand classes
|
|||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../commands/CommandContext.h"
|
#include "../commands/CommandContext.h"
|
||||||
|
#include "../Project.h" // for "OnReloadPreferences".
|
||||||
|
|
||||||
bool GetPreferenceCommand::DefineParams( ShuttleParams & S ){
|
bool GetPreferenceCommand::DefineParams( ShuttleParams & S ){
|
||||||
S.Define( mName, wxT("Name"), wxT("") );
|
S.Define( mName, wxT("Name"), wxT("") );
|
||||||
@ -68,11 +69,11 @@ void SetPreferenceCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.EndMultiColumn();
|
S.EndMultiColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetPreferenceCommand::Apply(const CommandContext & WXUNUSED(context))
|
bool SetPreferenceCommand::Apply(const CommandContext & context)
|
||||||
{
|
{
|
||||||
bool bOK = gPrefs->Write(mName, mValue) && gPrefs->Flush();
|
bool bOK = gPrefs->Write(mName, mValue) && gPrefs->Flush();
|
||||||
if( bOK && mbReload )
|
if( bOK && mbReload )
|
||||||
bOK = bOK; // Not yet implemented.
|
context.GetProject()->OnReloadPreferences( context );
|
||||||
return bOK;
|
return bOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +518,10 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
WaveformSettings::defaults().LoadPrefs();
|
WaveformSettings::defaults().LoadPrefs();
|
||||||
|
|
||||||
EndModal(true);
|
if( IsModal() )
|
||||||
|
EndModal(true);
|
||||||
|
else
|
||||||
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrefsDialog::SelectPageByName(const wxString &pageName)
|
void PrefsDialog::SelectPageByName(const wxString &pageName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user