mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-21 08:27:13 +01:00
Several nonmodal top level window tools register their menu items...
... removing link dependencies on them from src/menus, so they are now suitable for moving out into modules. They are: Mixer Board Karaoke (also called Lyrics) History Contrast Plot Spectrum Their header files are now no longer included anywhere but in their own implementation files!
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "../BatchProcessDialog.h"
|
||||
#include "../Benchmark.h"
|
||||
#include "../CommonCommandFlags.h"
|
||||
#include "../FreqWindow.h"
|
||||
#include "../Menus.h"
|
||||
#include "../PluginManager.h"
|
||||
#include "../Prefs.h"
|
||||
@@ -16,7 +15,6 @@
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
#include "../commands/ScreenshotCommand.h"
|
||||
#include "../effects/Contrast.h"
|
||||
#include "../effects/EffectManager.h"
|
||||
#include "../effects/EffectUI.h"
|
||||
#include "../effects/RealtimeEffectManager.h"
|
||||
@@ -25,26 +23,6 @@
|
||||
// private helper classes and functions
|
||||
namespace {
|
||||
|
||||
AudacityProject::AttachedWindows::RegisteredFactory sContrastDialogKey{
|
||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||
auto &window = ProjectWindow::Get( parent );
|
||||
return safenew ContrastDialog(
|
||||
&window, -1, XO("Contrast Analysis (WCAG 2 compliance)"),
|
||||
wxPoint{ 150, 150 }
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
AudacityProject::AttachedWindows::RegisteredFactory sFrequencyWindowKey{
|
||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||
auto &window = ProjectWindow::Get( parent );
|
||||
return safenew FrequencyPlotDialog(
|
||||
&window, -1, parent, XO("Frequency Analysis"),
|
||||
wxPoint{ 150, 150 }
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
AudacityProject::AttachedWindows::RegisteredFactory sMacrosWindowKey{
|
||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||
auto &window = ProjectWindow::Get( parent );
|
||||
@@ -456,31 +434,6 @@ void OnManageAnalyzers(const CommandContext &context)
|
||||
DoManagePluginsMenu(project, EffectTypeAnalyze);
|
||||
}
|
||||
|
||||
void OnContrast(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto contrastDialog =
|
||||
&project.AttachedWindows::Get< ContrastDialog >( sContrastDialogKey );
|
||||
|
||||
contrastDialog->CentreOnParent();
|
||||
if( ScreenshotCommand::MayCapture( contrastDialog ) )
|
||||
return;
|
||||
contrastDialog->Show();
|
||||
}
|
||||
|
||||
void OnPlotSpectrum(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto freqWindow =
|
||||
&project.AttachedWindows::Get< FrequencyPlotDialog >( sFrequencyWindowKey );
|
||||
|
||||
if( ScreenshotCommand::MayCapture( freqWindow ) )
|
||||
return;
|
||||
freqWindow->Show(true);
|
||||
freqWindow->Raise();
|
||||
freqWindow->SetFocus();
|
||||
}
|
||||
|
||||
void OnManageTools(const CommandContext &context )
|
||||
{
|
||||
auto &project = context.project;
|
||||
@@ -852,11 +805,7 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
||||
#endif
|
||||
|
||||
Section( "Analyzers",
|
||||
Command( wxT("ContrastAnalyser"), XXO("Contrast..."), FN(OnContrast),
|
||||
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag(),
|
||||
wxT("Ctrl+Shift+T") ),
|
||||
Command( wxT("PlotSpectrum"), XXO("Plot Spectrum..."), FN(OnPlotSpectrum),
|
||||
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag() ),
|
||||
Items( "Windows" ),
|
||||
|
||||
// Delayed evaluation:
|
||||
[](AudacityProject&)
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
#include "../Experimental.h"
|
||||
|
||||
#include "../CommonCommandFlags.h"
|
||||
#include "../HistoryWindow.h"
|
||||
#include "../LyricsWindow.h"
|
||||
#include "../Menus.h"
|
||||
#include "../MixerBoard.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../ProjectHistory.h"
|
||||
@@ -31,25 +28,6 @@
|
||||
// private helper classes and functions
|
||||
namespace {
|
||||
|
||||
AudacityProject::AttachedWindows::RegisteredFactory sMixerBoardKey{
|
||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||
return safenew MixerBoardFrame( &parent );
|
||||
}
|
||||
};
|
||||
|
||||
AudacityProject::AttachedWindows::RegisteredFactory sHistoryWindowKey{
|
||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||
auto &undoManager = UndoManager::Get( parent );
|
||||
return safenew HistoryDialog( &parent, &undoManager );
|
||||
}
|
||||
};
|
||||
|
||||
AudacityProject::AttachedWindows::RegisteredFactory sLyricsWindowKey{
|
||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||
return safenew LyricsWindow( &parent );
|
||||
}
|
||||
};
|
||||
|
||||
double GetZoomOfSelection( const AudacityProject &project )
|
||||
{
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
@@ -325,34 +303,6 @@ void OnGoSelEnd(const CommandContext &context)
|
||||
selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
|
||||
}
|
||||
|
||||
void OnHistory(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
|
||||
auto historyWindow = &project.AttachedWindows::Get( sHistoryWindowKey );
|
||||
historyWindow->Show();
|
||||
historyWindow->Raise();
|
||||
}
|
||||
|
||||
void OnKaraoke(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
|
||||
auto lyricsWindow = &project.AttachedWindows::Get( sLyricsWindowKey );
|
||||
lyricsWindow->Show();
|
||||
lyricsWindow->Raise();
|
||||
}
|
||||
|
||||
void OnMixerBoard(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
|
||||
auto mixerBoardFrame = &project.AttachedWindows::Get( sMixerBoardKey );
|
||||
mixerBoardFrame->Show();
|
||||
mixerBoardFrame->Raise();
|
||||
mixerBoardFrame->SetFocus();
|
||||
}
|
||||
|
||||
void OnShowExtraMenus(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
@@ -487,53 +437,7 @@ MenuTable::BaseItemSharedPtr ViewMenu()
|
||||
)
|
||||
),
|
||||
|
||||
Section( "Windows",
|
||||
// History window should be available either for UndoAvailableFlag
|
||||
// or RedoAvailableFlag,
|
||||
// but we can't make the AddItem flags and mask have both,
|
||||
// because they'd both have to be true for the
|
||||
// command to be enabled.
|
||||
// If user has Undone the entire stack, RedoAvailableFlag is on
|
||||
// but UndoAvailableFlag is off.
|
||||
// If user has done things but not Undone anything,
|
||||
// RedoAvailableFlag is off but UndoAvailableFlag is on.
|
||||
// So in either of those cases,
|
||||
// (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask
|
||||
// would fail.
|
||||
// The only way to fix this in the current architecture
|
||||
// is to hack in special cases for RedoAvailableFlag
|
||||
// in AudacityProject::UpdateMenus() (ugly)
|
||||
// and CommandManager::HandleCommandEntry() (*really* ugly --
|
||||
// shouldn't know about particular command names and flags).
|
||||
// Here's the hack that would be necessary in
|
||||
// AudacityProject::UpdateMenus(), if somebody decides to do it:
|
||||
// // Because EnableUsingFlags requires all the flag bits match the
|
||||
// // corresponding mask bits,
|
||||
// // "UndoHistory" specifies only
|
||||
// // AudioIONotBusyFlag | UndoAvailableFlag, because that
|
||||
// // covers the majority of cases where it should be enabled.
|
||||
// // If history is not empty but we've Undone the whole stack,
|
||||
// // we also want to enable,
|
||||
// // to show the Redo's on stack.
|
||||
// // "UndoHistory" might already be enabled,
|
||||
// // but add this check for RedoAvailableFlag.
|
||||
// if (flags & RedoAvailableFlag)
|
||||
// GetCommandManager()->Enable(wxT("UndoHistory"), true);
|
||||
// So for now, enable the command regardless of stack.
|
||||
// It will just show empty sometimes.
|
||||
// FOR REDESIGN,
|
||||
// clearly there are some limitations with the flags/mask bitmaps.
|
||||
|
||||
/* i18n-hint: Clicking this menu item shows the various editing steps
|
||||
that have been taken.*/
|
||||
Command( wxT("UndoHistory"), XXO("&History..."), FN(OnHistory),
|
||||
AudioIONotBusyFlag() ),
|
||||
|
||||
Command( wxT("Karaoke"), XXO("&Karaoke..."), FN(OnKaraoke),
|
||||
LabelTracksExistFlag() ),
|
||||
Command( wxT("MixerBoard"), XXO("&Mixer Board..."), FN(OnMixerBoard),
|
||||
PlayableTracksExistFlag() )
|
||||
),
|
||||
Section( "Windows" ),
|
||||
|
||||
Section( "",
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user