mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-28 00:03:52 +01:00
Lower DoReloadPreferences into PrefsDialog.cpp
This commit is contained in:
@@ -104,11 +104,6 @@ public:
|
|||||||
// Exported helper functions from various menu handling source files
|
// Exported helper functions from various menu handling source files
|
||||||
|
|
||||||
|
|
||||||
/// Namespace for functions for Edit menu
|
|
||||||
namespace EditActions {
|
|
||||||
void DoReloadPreferences( AudacityProject & );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Namespace for functions for View menu
|
/// Namespace for functions for View menu
|
||||||
namespace ViewActions {
|
namespace ViewActions {
|
||||||
double GetZoomOfToFit( const AudacityProject &project );
|
double GetZoomOfToFit( const AudacityProject &project );
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ SetPreferenceCommand classes
|
|||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
#include "PreferenceCommands.h"
|
#include "PreferenceCommands.h"
|
||||||
|
|
||||||
#include "../Menus.h"
|
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Shuttle.h"
|
#include "../Shuttle.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../commands/CommandContext.h"
|
#include "../commands/CommandContext.h"
|
||||||
|
#include "../prefs/PrefsDialog.h"
|
||||||
|
|
||||||
bool GetPreferenceCommand::DefineParams( ShuttleParams & S ){
|
bool GetPreferenceCommand::DefineParams( ShuttleParams & S ){
|
||||||
S.Define( mName, wxT("Name"), wxT("") );
|
S.Define( mName, wxT("Name"), wxT("") );
|
||||||
@@ -76,7 +76,7 @@ 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 ){
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
EditActions::DoReloadPreferences( project );
|
DoReloadPreferences( project );
|
||||||
}
|
}
|
||||||
return bOK;
|
return bOK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,41 +171,6 @@ bool DoPasteNothingSelected(AudacityProject &project)
|
|||||||
|
|
||||||
namespace EditActions {
|
namespace EditActions {
|
||||||
|
|
||||||
// exported helper functions
|
|
||||||
|
|
||||||
void DoReloadPreferences( AudacityProject &project )
|
|
||||||
{
|
|
||||||
{
|
|
||||||
SpectrogramSettings::defaults().LoadPrefs();
|
|
||||||
WaveformSettings::defaults().LoadPrefs();
|
|
||||||
|
|
||||||
GlobalPrefsDialog dialog(&GetProjectFrame( project ) /* 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 (auto p : AllProjects{}) {
|
|
||||||
MenuManager::Get(*p).RebuildMenuBar(*p);
|
|
||||||
// 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.
|
|
||||||
auto &window = GetProjectFrame( *p );
|
|
||||||
wxRect r = window.GetRect();
|
|
||||||
window.SetSize(wxSize(1,1));
|
|
||||||
window.SetSize(r.GetSize());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Menu handler functions
|
// Menu handler functions
|
||||||
|
|
||||||
struct Handler : CommandHandlerObject {
|
struct Handler : CommandHandlerObject {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include "../Dependencies.h"
|
#include "../Dependencies.h"
|
||||||
#include "../FileNames.h"
|
#include "../FileNames.h"
|
||||||
#include "../HelpText.h"
|
#include "../HelpText.h"
|
||||||
#include "../Menus.h"
|
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../ProjectSelectionManager.h"
|
#include "../ProjectSelectionManager.h"
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
#include "../Theme.h"
|
#include "../Theme.h"
|
||||||
#include "../commands/CommandContext.h"
|
#include "../commands/CommandContext.h"
|
||||||
#include "../commands/CommandManager.h"
|
#include "../commands/CommandManager.h"
|
||||||
|
#include "../prefs/PrefsDialog.h"
|
||||||
#include "../widgets/AudacityMessageBox.h"
|
#include "../widgets/AudacityMessageBox.h"
|
||||||
#include "../widgets/HelpSystem.h"
|
#include "../widgets/HelpSystem.h"
|
||||||
#include "../widgets/LinkingHtmlWindow.h"
|
#include "../widgets/LinkingHtmlWindow.h"
|
||||||
@@ -261,7 +261,7 @@ void QuickFixDialog::OnFix(wxCommandEvent &event)
|
|||||||
// This is overkill (aka slow), as all preferences are reloaded and all
|
// This is overkill (aka slow), as all preferences are reloaded and all
|
||||||
// toolbars recreated.
|
// toolbars recreated.
|
||||||
// Overkill probably doesn't matter, as this command is infrequently used.
|
// Overkill probably doesn't matter, as this command is infrequently used.
|
||||||
EditActions::DoReloadPreferences( *pProject );
|
DoReloadPreferences( *pProject );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -932,3 +932,40 @@ wxString PrefsPanel::HelpPageName()
|
|||||||
{
|
{
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <wx/frame.h>
|
||||||
|
#include "../Menus.h"
|
||||||
|
#include "../Project.h"
|
||||||
|
|
||||||
|
void DoReloadPreferences( AudacityProject &project )
|
||||||
|
{
|
||||||
|
{
|
||||||
|
SpectrogramSettings::defaults().LoadPrefs();
|
||||||
|
WaveformSettings::defaults().LoadPrefs();
|
||||||
|
|
||||||
|
GlobalPrefsDialog dialog(&GetProjectFrame( project ) /* 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 (auto p : AllProjects{}) {
|
||||||
|
MenuManager::Get(*p).RebuildMenuBar(*p);
|
||||||
|
// 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.
|
||||||
|
auto &window = GetProjectFrame( *p );
|
||||||
|
wxRect r = window.GetRect();
|
||||||
|
window.SetSize(wxSize(1,1));
|
||||||
|
window.SetSize(r.GetSize());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -98,4 +98,7 @@ public:
|
|||||||
void SavePreferredPage() override;
|
void SavePreferredPage() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AudacityProject;
|
||||||
|
void DoReloadPreferences( AudacityProject &project );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user