mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-07 20:22:13 +01:00
Decouple class AudacityProject from some attached frames...
... use registered factories instead, so class AudacityProject needn't know the other classes. This frees 9 .cpp files, related to various non-modal dialogs, to higher levels out of the big strongly connected component, as determined by scripts/graph.pl! But in reality there is still link dependency on them that the script does not detect. The remaining dependency is via the declarations of ViewMenu, EffectMenu, etc. in Menus.cpp. That could be broken with a registration system for menus.
This commit is contained in:
@@ -98,22 +98,17 @@ scroll information. It also has some status flags.
|
||||
#include "AdornedRulerPanel.h"
|
||||
#include "Clipboard.h"
|
||||
#include "widgets/FileHistory.h"
|
||||
#include "FreqWindow.h"
|
||||
#include "effects/Contrast.h"
|
||||
#include "AutoRecovery.h"
|
||||
#include "AColor.h"
|
||||
#include "AudioIO.h"
|
||||
#include "BatchProcessDialog.h"
|
||||
#include "Dependencies.h"
|
||||
#include "Diags.h"
|
||||
#include "HistoryWindow.h"
|
||||
#include "export/Export.h"
|
||||
#include "InconsistencyException.h"
|
||||
#include "MixerBoard.h"
|
||||
#include "import/Import.h"
|
||||
#include "KeyboardCapture.h"
|
||||
#include "LabelTrack.h"
|
||||
#include "Legacy.h"
|
||||
#include "LyricsWindow.h"
|
||||
#include "Menus.h"
|
||||
#include "MissingAliasFileDialog.h"
|
||||
#include "Mix.h"
|
||||
@@ -1352,6 +1347,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
#endif
|
||||
|
||||
AttachedObjects::BuildAll();
|
||||
// But not for the attached windows. They get built only on demand, such as
|
||||
// from menu items.
|
||||
}
|
||||
|
||||
AudacityProject::~AudacityProject()
|
||||
@@ -2479,14 +2476,6 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: consider postponing these steps until after the possible veto
|
||||
// below: closing the two analysis dialogs, and stopping audio streams.
|
||||
// Streams can be for play, recording, or monitoring. But maybe it still
|
||||
// makes sense to stop any recording before putting up the dialog.
|
||||
|
||||
mFreqWindow.reset();
|
||||
mContrastDialog.reset();
|
||||
|
||||
// Check to see if we were playing or recording
|
||||
// audio, and if so, make sure Audio I/O is completely finished.
|
||||
// The main point of this is to properly push the state
|
||||
@@ -2590,16 +2579,6 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
||||
|
||||
projectFileIO.CloseLock();
|
||||
|
||||
// Get rid of the history window
|
||||
// LL: Destroy it before the TrackPanel and ToolBars since they
|
||||
// may/will get additional wxEVT_PAINT events since window
|
||||
// destruction may be queued. This seems to only be a problem
|
||||
// on the Mac.
|
||||
if (mHistoryWindow) {
|
||||
mHistoryWindow->Destroy();
|
||||
mHistoryWindow = NULL;
|
||||
}
|
||||
|
||||
// Some of the AdornedRulerPanel functions refer to the TrackPanel, so destroy this
|
||||
// before the TrackPanel is destroyed. This change was needed to stop Audacity
|
||||
// crashing when running with Jaws on Windows 10 1703.
|
||||
@@ -5507,64 +5486,6 @@ void AudacityProject::PlaybackScroller::OnTimer(wxCommandEvent &event)
|
||||
}
|
||||
}
|
||||
|
||||
LyricsWindow* AudacityProject::GetLyricsWindow(bool create)
|
||||
{
|
||||
if (create && !mLyricsWindow)
|
||||
mLyricsWindow = safenew LyricsWindow{ this };
|
||||
return mLyricsWindow;
|
||||
}
|
||||
|
||||
MixerBoardFrame* AudacityProject::GetMixerBoardFrame(bool create)
|
||||
{
|
||||
if (create && !mMixerBoardFrame)
|
||||
mMixerBoardFrame = safenew MixerBoardFrame{ this };
|
||||
return mMixerBoardFrame;
|
||||
}
|
||||
|
||||
HistoryWindow *AudacityProject::GetHistoryWindow(bool create)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &undoManager = UndoManager::Get( project );
|
||||
if (create && !mHistoryWindow)
|
||||
mHistoryWindow = safenew HistoryWindow{ this, &undoManager };
|
||||
return mHistoryWindow;
|
||||
}
|
||||
|
||||
MacrosWindow *AudacityProject::GetMacrosWindow(bool bExpanded, bool create)
|
||||
{
|
||||
if (create && !mMacrosWindow)
|
||||
mMacrosWindow = safenew MacrosWindow{ this, bExpanded };
|
||||
|
||||
if (mMacrosWindow) {
|
||||
mMacrosWindow->Show();
|
||||
mMacrosWindow->Raise();
|
||||
mMacrosWindow->UpdateDisplay( bExpanded );
|
||||
}
|
||||
return mMacrosWindow;
|
||||
}
|
||||
|
||||
FreqWindow *AudacityProject::GetFreqWindow(bool create)
|
||||
{
|
||||
if (create && !mFreqWindow)
|
||||
mFreqWindow.reset( safenew FreqWindow{
|
||||
this, -1, _("Frequency Analysis"),
|
||||
wxPoint{ 150, 150 }
|
||||
} );
|
||||
return mFreqWindow.get();
|
||||
}
|
||||
|
||||
ContrastDialog *AudacityProject::GetContrastDialog(bool create)
|
||||
{
|
||||
// All of this goes away when the Contrast Dialog is converted to a module
|
||||
if(create && !mContrastDialog)
|
||||
mContrastDialog.reset( safenew ContrastDialog{
|
||||
this, -1, _("Contrast Analysis (WCAG 2 compliance)"),
|
||||
wxPoint{ 150, 150 }
|
||||
} );
|
||||
|
||||
return mContrastDialog.get();
|
||||
}
|
||||
|
||||
void AudacityProject::ZoomInByFactor( double ZoomFactor )
|
||||
{
|
||||
auto &project = *this;
|
||||
|
||||
Reference in New Issue
Block a user