mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 16:39:30 +02:00
Move functions from AudacityProject to SelectActions
This commit is contained in:
parent
5ed9fa972b
commit
d2717cac21
@ -729,7 +729,7 @@ bool MacroCommands::ApplyEffectCommand(
|
||||
// IF nothing selected, THEN select everything
|
||||
// (most effects require that you have something selected).
|
||||
if( plug->GetPluginType() != PluginTypeAudacityCommand )
|
||||
project->SelectAllIfNone();
|
||||
SelectActions::SelectAllIfNone( *project );
|
||||
|
||||
bool res = false;
|
||||
|
||||
|
@ -115,6 +115,8 @@ void DoUndo( AudacityProject &project );
|
||||
|
||||
/// Namespace for functions for Select menu
|
||||
namespace SelectActions {
|
||||
void SelectAllIfNone( AudacityProject &project );
|
||||
void SelectNone( AudacityProject &project );
|
||||
void DoListSelection(
|
||||
AudacityProject &project, Track *t,
|
||||
bool shift, bool ctrl, bool modifyState );
|
||||
|
@ -828,7 +828,7 @@ void MixerBoardScrolledWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
//v Even when I implement MixerBoard::OnMouseEvent and call event.Skip()
|
||||
// here, MixerBoard::OnMouseEvent never gets called.
|
||||
// So, added mProject to MixerBoardScrolledWindow and just directly do what's needed here.
|
||||
mProject->SelectNone();
|
||||
SelectActions::SelectNone( *mProject );
|
||||
}
|
||||
else
|
||||
event.Skip();
|
||||
|
@ -4281,9 +4281,10 @@ std::vector< std::shared_ptr< Track > >
|
||||
AudacityProject::AddImportedTracks(const FilePath &fileName,
|
||||
TrackHolders &&newTracks)
|
||||
{
|
||||
auto &project = *this;
|
||||
std::vector< std::shared_ptr< Track > > results;
|
||||
|
||||
SelectNone();
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
bool initiallyEmpty = mTracks->empty();
|
||||
double newRate = 0;
|
||||
@ -4393,6 +4394,7 @@ void AudacityProject::ZoomAfterImport(Track *pTrack)
|
||||
// If pNewTrackList is passed in non-NULL, it gets filled with the pointers to NEW tracks.
|
||||
bool AudacityProject::Import(const FilePath &fileName, WaveTrackArray* pTrackArray /*= NULL*/)
|
||||
{
|
||||
auto &project = *this;
|
||||
TrackHolders newTracks;
|
||||
wxString errorMessage;
|
||||
|
||||
@ -4447,9 +4449,9 @@ bool AudacityProject::Import(const FilePath &fileName, WaveTrackArray* pTrackArr
|
||||
int mode = gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"), 0L);
|
||||
if (mode == 1) {
|
||||
//TODO: All we want is a SelectAll()
|
||||
SelectNone();
|
||||
SelectAllIfNone();
|
||||
const CommandContext context( *this);
|
||||
SelectActions::SelectNone( project );
|
||||
SelectActions::SelectAllIfNone( project );
|
||||
const CommandContext context( project );
|
||||
PluginActions::DoEffect(
|
||||
EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")),
|
||||
context,
|
||||
@ -5616,14 +5618,6 @@ ContrastDialog *AudacityProject::GetContrastDialog(bool create)
|
||||
return mContrastDialog.get();
|
||||
}
|
||||
|
||||
void AudacityProject::SelectNone()
|
||||
{
|
||||
for (auto t : GetTracks()->Any())
|
||||
t->SetSelected(false);
|
||||
|
||||
mTrackPanel->Refresh(false);
|
||||
}
|
||||
|
||||
void AudacityProject::ZoomInByFactor( double ZoomFactor )
|
||||
{
|
||||
// LLL: Handling positioning differently when audio is
|
||||
@ -5714,16 +5708,6 @@ void AudacityProject::ZoomOutByFactor( double ZoomFactor )
|
||||
TP_ScrollWindow(newh);
|
||||
}
|
||||
|
||||
// Select the full time range, if no
|
||||
// time range is selected.
|
||||
void AudacityProject::SelectAllIfNone()
|
||||
{
|
||||
auto flags = GetMenuManager(*this).GetUpdateFlags(*this);
|
||||
if(!(flags & TracksSelectedFlag) ||
|
||||
(mViewInfo.selectedRegion.isPoint()))
|
||||
SelectActions::DoSelectAllAudio(*this);
|
||||
}
|
||||
|
||||
// Stop playing or recording, if paused.
|
||||
void AudacityProject::StopIfPaused()
|
||||
{
|
||||
|
@ -401,8 +401,6 @@ public:
|
||||
void UpdatePrefsVariables();
|
||||
void RedrawProject(const bool bForceWaveTracks = false);
|
||||
void RefreshCursor();
|
||||
void SelectNone();
|
||||
void SelectAllIfNone();
|
||||
void StopIfPaused();
|
||||
void Zoom(double level);
|
||||
void ZoomBy(double multiplier);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "../FileNames.h"
|
||||
#include "../LabelTrack.h"
|
||||
#include "../MissingAliasFileDialog.h"
|
||||
#include "../Menus.h"
|
||||
#include "../NoteTrack.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Printing.h"
|
||||
@ -121,7 +122,7 @@ AudacityProject *DoImportMIDI(
|
||||
|
||||
if (::ImportMIDI(fileName, newTrack.get())) {
|
||||
|
||||
pProject->SelectNone();
|
||||
SelectActions::SelectNone( *pProject );
|
||||
auto pTrack = tracks->Add( newTrack );
|
||||
pTrack->SetSelected(true);
|
||||
|
||||
@ -467,7 +468,7 @@ void OnImportLabels(const CommandContext &context)
|
||||
|
||||
newTrack->Import(f);
|
||||
|
||||
project.SelectNone();
|
||||
SelectActions::SelectNone( project );
|
||||
newTrack->SetSelected(true);
|
||||
tracks->Add( newTrack );
|
||||
|
||||
|
@ -412,7 +412,7 @@ bool DoEffect(
|
||||
if (flags & kConfigured)
|
||||
{
|
||||
TransportActions::DoStop(project);
|
||||
project.SelectAllIfNone();
|
||||
SelectActions::SelectAllIfNone( project );
|
||||
}
|
||||
|
||||
MissingAliasFilesDialog::SetShouldShow(true);
|
||||
|
@ -484,6 +484,24 @@ namespace SelectActions {
|
||||
|
||||
// exported helper functions
|
||||
|
||||
void SelectNone( AudacityProject &project )
|
||||
{
|
||||
for (auto t : project.GetTracks()->Any())
|
||||
t->SetSelected(false);
|
||||
|
||||
project.GetTrackPanel()->Refresh(false);
|
||||
}
|
||||
|
||||
// Select the full time range, if no
|
||||
// time range is selected.
|
||||
void SelectAllIfNone( AudacityProject &project )
|
||||
{
|
||||
auto flags = GetMenuManager( project ).GetUpdateFlags( project );
|
||||
if(!(flags & TracksSelectedFlag) ||
|
||||
(project.GetViewInfo().selectedRegion.isPoint()))
|
||||
DoSelectAllAudio( project );
|
||||
}
|
||||
|
||||
void DoListSelection
|
||||
(AudacityProject &project, Track *t, bool shift, bool ctrl, bool modifyState)
|
||||
{
|
||||
@ -549,7 +567,7 @@ void OnSelectNone(const CommandContext &context)
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
selectedRegion.collapseToT0();
|
||||
project.SelectNone();
|
||||
SelectNone( project );
|
||||
project.ModifyState(false);
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ void OnNewWaveTrack(const CommandContext &context)
|
||||
auto rate = project.GetRate();
|
||||
|
||||
auto t = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
project.SelectNone();
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
t->SetSelected(true);
|
||||
|
||||
@ -821,7 +821,7 @@ void OnNewStereoTrack(const CommandContext &context)
|
||||
auto defaultFormat = project.GetDefaultFormat();
|
||||
auto rate = project.GetRate();
|
||||
|
||||
project.SelectNone();
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
auto left = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
left->SetSelected(true);
|
||||
@ -846,7 +846,7 @@ void OnNewLabelTrack(const CommandContext &context)
|
||||
|
||||
auto t = tracks->Add(trackFactory->NewLabelTrack());
|
||||
|
||||
project.SelectNone();
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
t->SetSelected(true);
|
||||
|
||||
@ -870,7 +870,7 @@ void OnNewTimeTrack(const CommandContext &context)
|
||||
|
||||
auto t = tracks->AddToHead(trackFactory->NewTimeTrack());
|
||||
|
||||
project.SelectNone();
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
t->SetSelected(true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user