mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Remove CommandContext::GetProject() ...
... which called ::GetActiveProject(), but one purpose of the CommandContext class was to eliminate many uses of that global function, because a CommandContext must always be constructed from a reference to a project (which was always in fact the active one), then passed around to where it is needed! Also, just use the project member directly -- because CommandContext was intended as just a P.O.D (plain-old-data) structure. This also eliminates a dependency of CommandContext.cpp on Project.cpp. This is not enough by itself to break any dependency cycles.
This commit is contained in:
@@ -95,7 +95,7 @@ class ScreenFrame final : public wxFrame
|
|||||||
wxStatusBar *mStatus;
|
wxStatusBar *mStatus;
|
||||||
|
|
||||||
std::unique_ptr<ScreenshotCommand> mCommand;
|
std::unique_ptr<ScreenshotCommand> mCommand;
|
||||||
CommandContext mContext;
|
const CommandContext mContext;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
@@ -469,7 +469,7 @@ void ScreenFrame::PopulateOrExchange(ShuttleGui & S)
|
|||||||
CentreOnParent();
|
CentreOnParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetIcon(mContext.GetProject()->GetIcon());
|
SetIcon(mContext.project.GetIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScreenFrame::ProcessEvent(wxEvent & e)
|
bool ScreenFrame::ProcessEvent(wxEvent & e)
|
||||||
@@ -564,8 +564,8 @@ void ScreenFrame::SizeMainWindow(int w, int h)
|
|||||||
{
|
{
|
||||||
int top = 20;
|
int top = 20;
|
||||||
|
|
||||||
mContext.GetProject()->Maximize(false);
|
mContext.project.Maximize(false);
|
||||||
mContext.GetProject()->SetSize(16, 16 + top, w, h);
|
mContext.project.SetSize(16, 16 + top, w, h);
|
||||||
//Bug383 - Toolbar Resets not wanted.
|
//Bug383 - Toolbar Resets not wanted.
|
||||||
//mContext.GetProject()->GetToolManager()->Reset();
|
//mContext.GetProject()->GetToolManager()->Reset();
|
||||||
}
|
}
|
||||||
@@ -669,9 +669,9 @@ void ScreenFrame::OnCaptureSomething(wxCommandEvent & event)
|
|||||||
void ScreenFrame::TimeZoom(double seconds)
|
void ScreenFrame::TimeZoom(double seconds)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
mContext.GetProject()->GetClientSize(&width, &height);
|
mContext.project.GetClientSize(&width, &height);
|
||||||
mContext.GetProject()->mViewInfo.SetZoom((0.75 * width) / seconds);
|
mContext.project.mViewInfo.SetZoom((0.75 * width) / seconds);
|
||||||
mContext.GetProject()->RedrawProject();
|
mContext.project.RedrawProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFrame::OnOneSec(wxCommandEvent & WXUNUSED(event))
|
void ScreenFrame::OnOneSec(wxCommandEvent & WXUNUSED(event))
|
||||||
@@ -708,7 +708,7 @@ void ScreenFrame::SizeTracks(int h)
|
|||||||
// If there should be more-than-stereo tracks, this makes
|
// If there should be more-than-stereo tracks, this makes
|
||||||
// each channel as high as for a stereo channel
|
// each channel as high as for a stereo channel
|
||||||
|
|
||||||
auto tracks = mContext.GetProject()->GetTracks();
|
auto tracks = mContext.project.GetTracks();
|
||||||
for (auto t : tracks->Leaders<WaveTrack>()) {
|
for (auto t : tracks->Leaders<WaveTrack>()) {
|
||||||
auto channels = TrackList::Channels(t);
|
auto channels = TrackList::Channels(t);
|
||||||
auto nChannels = channels.size();
|
auto nChannels = channels.size();
|
||||||
@@ -716,15 +716,15 @@ void ScreenFrame::SizeTracks(int h)
|
|||||||
for (auto channel : channels)
|
for (auto channel : channels)
|
||||||
channel->SetHeight(height);
|
channel->SetHeight(height);
|
||||||
}
|
}
|
||||||
mContext.GetProject()->RedrawProject();
|
mContext.project.RedrawProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFrame::OnShortTracks(wxCommandEvent & WXUNUSED(event))
|
void ScreenFrame::OnShortTracks(wxCommandEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
for (auto t : mContext.GetProject()->GetTracks()->Any<WaveTrack>())
|
for (auto t : mContext.project.GetTracks()->Any<WaveTrack>())
|
||||||
t->SetHeight(t->GetMinimizedHeight());
|
t->SetHeight(t->GetMinimizedHeight());
|
||||||
|
|
||||||
mContext.GetProject()->RedrawProject();
|
mContext.project.RedrawProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFrame::OnMedTracks(wxCommandEvent & WXUNUSED(event))
|
void ScreenFrame::OnMedTracks(wxCommandEvent & WXUNUSED(event))
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
ApplyAndSendResponse(const OldStyleCommandPointer &cmd, std::unique_ptr<CommandOutputTargets> &target);
|
ApplyAndSendResponse(const OldStyleCommandPointer &cmd, std::unique_ptr<CommandOutputTargets> &target);
|
||||||
bool Apply() override;
|
bool Apply() override;
|
||||||
bool Apply(const CommandContext &context) override;// Error to use this.
|
bool Apply(const CommandContext &context) override;// Error to use this.
|
||||||
std::unique_ptr<CommandContext> mCtx;
|
std::unique_ptr<const CommandContext> mCtx;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ messaging from a command back to its invoker.
|
|||||||
#include "CommandContext.h"
|
#include "CommandContext.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <wx/app.h>
|
||||||
|
#include <wx/log.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/variant.h>
|
#include <wx/variant.h>
|
||||||
#include <wx/arrstr.h>
|
#include <wx/arrstr.h>
|
||||||
@@ -32,8 +34,6 @@ messaging from a command back to its invoker.
|
|||||||
#include "CommandTargets.h"
|
#include "CommandTargets.h"
|
||||||
#include "CommandDirectory.h"
|
#include "CommandDirectory.h"
|
||||||
|
|
||||||
#include "../Project.h"
|
|
||||||
|
|
||||||
CommandContext::CommandContext(
|
CommandContext::CommandContext(
|
||||||
AudacityProject &p
|
AudacityProject &p
|
||||||
, const wxEvent *e
|
, const wxEvent *e
|
||||||
@@ -92,9 +92,6 @@ void CommandContext::Progress( double d ) const
|
|||||||
AudacityApp * CommandContext::GetApp() const
|
AudacityApp * CommandContext::GetApp() const
|
||||||
{ return (AudacityApp *) wxTheApp;}
|
{ return (AudacityApp *) wxTheApp;}
|
||||||
|
|
||||||
AudacityProject *CommandContext::GetProject() const
|
|
||||||
{ return GetActiveProject();}
|
|
||||||
|
|
||||||
void CommandContext::StartArray() const
|
void CommandContext::StartArray() const
|
||||||
{
|
{
|
||||||
if( pOutput )
|
if( pOutput )
|
||||||
|
|||||||
@@ -56,6 +56,5 @@ public:
|
|||||||
int index;
|
int index;
|
||||||
CommandParameter parameter;
|
CommandParameter parameter;
|
||||||
AudacityApp *GetApp() const;
|
AudacityApp *GetApp() const;
|
||||||
AudacityProject *GetProject() const;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -59,5 +59,5 @@ void CommandHandler::OnReceiveCommand(AppCommandEvent &event)
|
|||||||
wxUnusedVar(result);
|
wxUnusedVar(result);
|
||||||
|
|
||||||
// Redraw the project
|
// Redraw the project
|
||||||
mCurrentContext->GetProject()->RedrawProject();
|
mCurrentContext->project.RedrawProject();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class CommandContext;
|
|||||||
class CommandHandler
|
class CommandHandler
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<CommandContext> mCurrentContext;
|
std::unique_ptr<const CommandContext> mCurrentContext;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CommandHandler();
|
CommandHandler();
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ inline int min(int a, int b)
|
|||||||
|
|
||||||
bool CompareAudioCommand::Apply(const CommandContext & context)
|
bool CompareAudioCommand::Apply(const CommandContext & context)
|
||||||
{
|
{
|
||||||
if (!GetSelection(context, *context.GetProject()))
|
if (!GetSelection(context, context.project))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ bool DragCommand::Apply(const CommandContext & context)
|
|||||||
if( !bHasToY )
|
if( !bHasToY )
|
||||||
mToY = 10;
|
mToY = 10;
|
||||||
|
|
||||||
wxWindow * pWin = context.GetProject();
|
wxWindow * pWin = &context.project;
|
||||||
wxWindow * pWin1 = nullptr;
|
wxWindow * pWin1 = nullptr;
|
||||||
wxMouseEvent Evt( wxEVT_MOTION );
|
wxMouseEvent Evt( wxEVT_MOTION );
|
||||||
Evt.m_x = mFromX;
|
Evt.m_x = mFromX;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ bool GetInfoCommand::Apply(const CommandContext &context)
|
|||||||
if( mFormat == kLisp )
|
if( mFormat == kLisp )
|
||||||
{
|
{
|
||||||
CommandContext LispyContext(
|
CommandContext LispyContext(
|
||||||
*(context.GetProject()),
|
context.project,
|
||||||
std::make_unique<LispifiedCommandOutputTargets>( *context.pOutput.get() )
|
std::make_unique<LispifiedCommandOutputTargets>( *context.pOutput.get() )
|
||||||
);
|
);
|
||||||
return ApplyInner( LispyContext );
|
return ApplyInner( LispyContext );
|
||||||
@@ -130,7 +130,7 @@ bool GetInfoCommand::Apply(const CommandContext &context)
|
|||||||
if( mFormat == kBrief )
|
if( mFormat == kBrief )
|
||||||
{
|
{
|
||||||
CommandContext BriefContext(
|
CommandContext BriefContext(
|
||||||
*(context.GetProject()),
|
context.project,
|
||||||
std::make_unique<BriefCommandOutputTargets>( *context.pOutput.get() )
|
std::make_unique<BriefCommandOutputTargets>( *context.pOutput.get() )
|
||||||
);
|
);
|
||||||
return ApplyInner( BriefContext );
|
return ApplyInner( BriefContext );
|
||||||
@@ -159,7 +159,7 @@ bool GetInfoCommand::ApplyInner(const CommandContext &context)
|
|||||||
|
|
||||||
bool GetInfoCommand::SendMenus(const CommandContext &context)
|
bool GetInfoCommand::SendMenus(const CommandContext &context)
|
||||||
{
|
{
|
||||||
wxMenuBar * pBar = context.GetProject()->GetMenuBar();
|
wxMenuBar * pBar = context.project.GetMenuBar();
|
||||||
if(!pBar ){
|
if(!pBar ){
|
||||||
wxLogDebug("No menus");
|
wxLogDebug("No menus");
|
||||||
return false;
|
return false;
|
||||||
@@ -418,10 +418,10 @@ wxSpinCtrl * ShuttleGuiGetDefinition::TieSpinCtrl(
|
|||||||
bool GetInfoCommand::SendPreferences(const CommandContext &context)
|
bool GetInfoCommand::SendPreferences(const CommandContext &context)
|
||||||
{
|
{
|
||||||
context.StartArray();
|
context.StartArray();
|
||||||
GlobalPrefsDialog dialog( context.GetProject() );
|
GlobalPrefsDialog dialog( &context.project );
|
||||||
// wxCommandEvent Evt;
|
// wxCommandEvent Evt;
|
||||||
//dialog.Show();
|
//dialog.Show();
|
||||||
wxWindow * pWin = context.GetProject();
|
wxWindow * pWin = &context.project;
|
||||||
ShuttleGuiGetDefinition S(pWin, *((context.pOutput)->mStatusTarget) );
|
ShuttleGuiGetDefinition S(pWin, *((context.pOutput)->mStatusTarget) );
|
||||||
dialog.ShuttleAll( S );
|
dialog.ShuttleAll( S );
|
||||||
context.EndArray();
|
context.EndArray();
|
||||||
@@ -454,7 +454,7 @@ bool GetInfoCommand::SendCommands(const CommandContext &context, int flags )
|
|||||||
bool GetInfoCommand::SendBoxes(const CommandContext &context)
|
bool GetInfoCommand::SendBoxes(const CommandContext &context)
|
||||||
{
|
{
|
||||||
//context.Status("Boxes");
|
//context.Status("Boxes");
|
||||||
wxWindow * pWin = context.GetProject();
|
wxWindow * pWin = &context.project;
|
||||||
|
|
||||||
context.StartArray();
|
context.StartArray();
|
||||||
wxRect R = pWin->GetScreenRect();
|
wxRect R = pWin->GetScreenRect();
|
||||||
@@ -483,11 +483,11 @@ bool GetInfoCommand::SendBoxes(const CommandContext &context)
|
|||||||
|
|
||||||
bool GetInfoCommand::SendTracks(const CommandContext & context)
|
bool GetInfoCommand::SendTracks(const CommandContext & context)
|
||||||
{
|
{
|
||||||
TrackList *projTracks = context.GetProject()->GetTracks();
|
TrackList *projTracks = context.project.GetTracks();
|
||||||
context.StartArray();
|
context.StartArray();
|
||||||
for (auto trk : projTracks->Leaders())
|
for (auto trk : projTracks->Leaders())
|
||||||
{
|
{
|
||||||
TrackPanel *panel = context.GetProject()->GetTrackPanel();
|
TrackPanel *panel = context.project.GetTrackPanel();
|
||||||
Track * fTrack = panel->GetFocusedTrack();
|
Track * fTrack = panel->GetFocusedTrack();
|
||||||
|
|
||||||
context.StartStruct();
|
context.StartStruct();
|
||||||
@@ -530,7 +530,7 @@ bool GetInfoCommand::SendTracks(const CommandContext & context)
|
|||||||
|
|
||||||
bool GetInfoCommand::SendClips(const CommandContext &context)
|
bool GetInfoCommand::SendClips(const CommandContext &context)
|
||||||
{
|
{
|
||||||
TrackList *tracks = context.GetProject()->GetTracks();
|
TrackList *tracks = context.project.GetTracks();
|
||||||
int i=0;
|
int i=0;
|
||||||
context.StartArray();
|
context.StartArray();
|
||||||
for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
|
for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
|
||||||
@@ -552,7 +552,7 @@ bool GetInfoCommand::SendClips(const CommandContext &context)
|
|||||||
|
|
||||||
bool GetInfoCommand::SendEnvelopes(const CommandContext &context)
|
bool GetInfoCommand::SendEnvelopes(const CommandContext &context)
|
||||||
{
|
{
|
||||||
TrackList *tracks = context.GetProject()->GetTracks();
|
TrackList *tracks = context.project.GetTracks();
|
||||||
int i=0;
|
int i=0;
|
||||||
int j=0;
|
int j=0;
|
||||||
context.StartArray();
|
context.StartArray();
|
||||||
@@ -589,7 +589,7 @@ bool GetInfoCommand::SendEnvelopes(const CommandContext &context)
|
|||||||
|
|
||||||
bool GetInfoCommand::SendLabels(const CommandContext &context)
|
bool GetInfoCommand::SendLabels(const CommandContext &context)
|
||||||
{
|
{
|
||||||
TrackList *tracks = context.GetProject()->GetTracks();
|
TrackList *tracks = context.project.GetTracks();
|
||||||
int i=0;
|
int i=0;
|
||||||
context.StartArray();
|
context.StartArray();
|
||||||
for (auto t : tracks->Leaders()) {
|
for (auto t : tracks->Leaders()) {
|
||||||
@@ -640,7 +640,7 @@ void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu,
|
|||||||
if( !pMenu )
|
if( !pMenu )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CommandManager * pMan = context.GetProject()->GetCommandManager();
|
CommandManager * pMan = context.project.GetCommandManager();
|
||||||
|
|
||||||
wxMenuItemList list = pMenu->GetMenuItems();
|
wxMenuItemList list = pMenu->GetMenuItems();
|
||||||
size_t lcnt = list.size();
|
size_t lcnt = list.size();
|
||||||
@@ -714,7 +714,7 @@ void GetInfoCommand::ExploreAdornments( const CommandContext &context,
|
|||||||
void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
|
void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
|
||||||
wxPoint P, wxWindow * pWin, int WXUNUSED(Id), int depth )
|
wxPoint P, wxWindow * pWin, int WXUNUSED(Id), int depth )
|
||||||
{
|
{
|
||||||
AudacityProject * pProj = context.GetProject();
|
AudacityProject * pProj = &context.project;
|
||||||
TrackPanel * pTP = pProj->GetTrackPanel();
|
TrackPanel * pTP = pProj->GetTrackPanel();
|
||||||
|
|
||||||
wxRect trackRect = pWin->GetRect();
|
wxRect trackRect = pWin->GetRect();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void ImportCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ImportCommand::Apply(const CommandContext & context){
|
bool ImportCommand::Apply(const CommandContext & context){
|
||||||
return context.GetProject()->Import(mFileName);
|
return context.project.Import(mFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ void ExportCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
bool ExportCommand::Apply(const CommandContext & context)
|
bool ExportCommand::Apply(const CommandContext & context)
|
||||||
{
|
{
|
||||||
double t0, t1;
|
double t0, t1;
|
||||||
t0 = context.GetProject()->mViewInfo.selectedRegion.t0();
|
t0 = context.project.mViewInfo.selectedRegion.t0();
|
||||||
t1 = context.GetProject()->mViewInfo.selectedRegion.t1();
|
t1 = context.project.mViewInfo.selectedRegion.t1();
|
||||||
|
|
||||||
// Find the extension and check it's valid
|
// Find the extension and check it's valid
|
||||||
int splitAt = mFileName.Find(wxUniChar('.'), true);
|
int splitAt = mFileName.Find(wxUniChar('.'), true);
|
||||||
@@ -80,7 +80,7 @@ bool ExportCommand::Apply(const CommandContext & context)
|
|||||||
|
|
||||||
Exporter exporter;
|
Exporter exporter;
|
||||||
|
|
||||||
bool exportSuccess = exporter.Process(context.GetProject(),
|
bool exportSuccess = exporter.Process(&context.project,
|
||||||
std::max(0, mnChannels),
|
std::max(0, mnChannels),
|
||||||
extension, mFileName,
|
extension, mFileName,
|
||||||
true, t0, t1);
|
true, t0, t1);
|
||||||
|
|||||||
@@ -44,17 +44,17 @@ void OpenProjectCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
|
|
||||||
bool OpenProjectCommand::Apply(const CommandContext & context){
|
bool OpenProjectCommand::Apply(const CommandContext & context){
|
||||||
|
|
||||||
auto oldFileName = context.GetProject()->GetFileName();
|
auto oldFileName = context.project.GetFileName();
|
||||||
if(mFileName.empty())
|
if(mFileName.empty())
|
||||||
{
|
{
|
||||||
auto project = context.GetProject();
|
auto project = &context.project;
|
||||||
AudacityProject::OpenFiles(project);
|
AudacityProject::OpenFiles(project);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
context.GetProject()->OpenFile(mFileName, mbAddToHistory);
|
context.project.OpenFile(mFileName, mbAddToHistory);
|
||||||
}
|
}
|
||||||
const auto &newFileName = context.GetProject()->GetFileName();
|
const auto &newFileName = context.project.GetFileName();
|
||||||
|
|
||||||
// Because Open does not return a success or failure, we have to guess
|
// Because Open does not return a success or failure, we have to guess
|
||||||
// at this point, based on whether the project file name has
|
// at this point, based on whether the project file name has
|
||||||
@@ -85,7 +85,7 @@ void SaveProjectCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
bool SaveProjectCommand::Apply(const CommandContext &context)
|
bool SaveProjectCommand::Apply(const CommandContext &context)
|
||||||
{
|
{
|
||||||
if(mFileName.empty())
|
if(mFileName.empty())
|
||||||
return context.GetProject()->SaveAs(mbCompress);
|
return context.project.SaveAs(mbCompress);
|
||||||
else
|
else
|
||||||
return context.GetProject()->SaveAs(mFileName,mbCompress,mbAddToHistory);
|
return context.project.SaveAs(mFileName,mbCompress,mbAddToHistory);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ void ScreenshotCommand::CaptureScriptables(
|
|||||||
|
|
||||||
void ScreenshotCommand::CaptureCommands(
|
void ScreenshotCommand::CaptureCommands(
|
||||||
const CommandContext & context, const wxArrayStringEx & Commands ){
|
const CommandContext & context, const wxArrayStringEx & Commands ){
|
||||||
AudacityProject * pProject = context.GetProject();
|
AudacityProject * pProject = &context.project;
|
||||||
CommandManager * pMan = pProject->GetCommandManager();
|
CommandManager * pMan = pProject->GetCommandManager();
|
||||||
wxString Str;
|
wxString Str;
|
||||||
// Yucky static variables. Is there a better way? The problem is that we need the
|
// Yucky static variables. Is there a better way? The problem is that we need the
|
||||||
@@ -807,16 +807,16 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||||||
GetDerivedParams();
|
GetDerivedParams();
|
||||||
//Don't reset the toolbars to a known state.
|
//Don't reset the toolbars to a known state.
|
||||||
//We will be capturing variations of them.
|
//We will be capturing variations of them.
|
||||||
//context.GetProject()->GetToolManager()->Reset();
|
//context.project.GetToolManager()->Reset();
|
||||||
|
|
||||||
wxTopLevelWindow *w = GetFrontWindow(context.GetProject());
|
wxTopLevelWindow *w = GetFrontWindow(&context.project);
|
||||||
if (!w)
|
if (!w)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TrackPanel *panel = context.GetProject()->GetTrackPanel();
|
TrackPanel *panel = context.project.GetTrackPanel();
|
||||||
AdornedRulerPanel *ruler = panel->mRuler;
|
AdornedRulerPanel *ruler = panel->mRuler;
|
||||||
|
|
||||||
int nTracks = context.GetProject()->GetTracks()->size();
|
int nTracks = context.project.GetTracks()->size();
|
||||||
|
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
w->ClientToScreen(&x1, &y1);
|
w->ClientToScreen(&x1, &y1);
|
||||||
@@ -826,47 +826,47 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||||||
|
|
||||||
switch (mCaptureMode) {
|
switch (mCaptureMode) {
|
||||||
case kwindow:
|
case kwindow:
|
||||||
return Capture(context, WindowFileName( context.GetProject(), w ) , w, GetWindowRect(w));
|
return Capture(context, WindowFileName( &context.project, w ) , w, GetWindowRect(w));
|
||||||
case kfullwindow:
|
case kfullwindow:
|
||||||
case kwindowplus:
|
case kwindowplus:
|
||||||
return Capture(context, WindowFileName( context.GetProject(), w ) , w, GetFullWindowRect(w));
|
return Capture(context, WindowFileName( &context.project, w ) , w, GetFullWindowRect(w));
|
||||||
case kfullscreen:
|
case kfullscreen:
|
||||||
return Capture(context, mFileName, w,GetScreenRect());
|
return Capture(context, mFileName, w,GetScreenRect());
|
||||||
case ktoolbars:
|
case ktoolbars:
|
||||||
return CaptureDock(context, context.GetProject()->GetToolManager()->GetTopDock(), mFileName);
|
return CaptureDock(context, context.project.GetToolManager()->GetTopDock(), mFileName);
|
||||||
case kscriptables:
|
case kscriptables:
|
||||||
CaptureScriptables(context, context.GetProject(), mFileName);
|
CaptureScriptables(context, &context.project, mFileName);
|
||||||
break;
|
break;
|
||||||
case keffects:
|
case keffects:
|
||||||
CaptureEffects(context, context.GetProject(), mFileName);
|
CaptureEffects(context, &context.project, mFileName);
|
||||||
break;
|
break;
|
||||||
case kpreferences:
|
case kpreferences:
|
||||||
CapturePreferences(context, context.GetProject(), mFileName);
|
CapturePreferences(context, &context.project, mFileName);
|
||||||
break;
|
break;
|
||||||
case kselectionbar:
|
case kselectionbar:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SelectionBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), SelectionBarID, mFileName);
|
||||||
case kspectralselection:
|
case kspectralselection:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SpectralSelectionBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), SpectralSelectionBarID, mFileName);
|
||||||
case ktools:
|
case ktools:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), ToolsBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), ToolsBarID, mFileName);
|
||||||
case ktransport:
|
case ktransport:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), TransportBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), TransportBarID, mFileName);
|
||||||
case kmixer:
|
case kmixer:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), MixerBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), MixerBarID, mFileName);
|
||||||
case kmeter:
|
case kmeter:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), MeterBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), MeterBarID, mFileName);
|
||||||
case krecordmeter:
|
case krecordmeter:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), RecordMeterBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), RecordMeterBarID, mFileName);
|
||||||
case kplaymeter:
|
case kplaymeter:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), PlayMeterBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), PlayMeterBarID, mFileName);
|
||||||
case kedit:
|
case kedit:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), EditBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), EditBarID, mFileName);
|
||||||
case kdevice:
|
case kdevice:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), DeviceBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), DeviceBarID, mFileName);
|
||||||
case ktranscription:
|
case ktranscription:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), TranscriptionBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), TranscriptionBarID, mFileName);
|
||||||
case kscrub:
|
case kscrub:
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), ScrubbingBarID, mFileName);
|
return CaptureToolbar(context, context.project.GetToolManager(), ScrubbingBarID, mFileName);
|
||||||
case ktrackpanel:
|
case ktrackpanel:
|
||||||
return Capture(context, mFileName, panel, GetPanelRect(panel));
|
return Capture(context, mFileName, panel, GetPanelRect(panel));
|
||||||
case kruler:
|
case kruler:
|
||||||
@@ -874,9 +874,9 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||||||
case ktracks:
|
case ktracks:
|
||||||
return Capture(context, mFileName, panel, GetTracksRect(panel));
|
return Capture(context, mFileName, panel, GetTracksRect(panel));
|
||||||
case kfirsttrack:
|
case kfirsttrack:
|
||||||
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 0 ) );
|
return Capture(context, mFileName, panel, GetTrackRect( &context.project, panel, 0 ) );
|
||||||
case ksecondtrack:
|
case ksecondtrack:
|
||||||
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 1 ) );
|
return Capture(context, mFileName, panel, GetTrackRect( &context.project, panel, 1 ) );
|
||||||
case ktracksplus:
|
case ktracksplus:
|
||||||
{ wxRect r = GetTracksRect(panel);
|
{ wxRect r = GetTracksRect(panel);
|
||||||
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
|
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
|
||||||
@@ -884,36 +884,36 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||||||
return Capture(context, mFileName, panel, r);
|
return Capture(context, mFileName, panel, r);
|
||||||
}
|
}
|
||||||
case kfirsttrackplus:
|
case kfirsttrackplus:
|
||||||
{ wxRect r = GetTrackRect(context.GetProject(), panel, 0 );
|
{ wxRect r = GetTrackRect(&context.project, panel, 0 );
|
||||||
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
|
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
|
||||||
r.SetHeight( r.GetHeight() + ruler->GetRulerHeight() );
|
r.SetHeight( r.GetHeight() + ruler->GetRulerHeight() );
|
||||||
return Capture(context, mFileName, panel, r );
|
return Capture(context, mFileName, panel, r );
|
||||||
}
|
}
|
||||||
case kfirsttwotracks:
|
case kfirsttwotracks:
|
||||||
{ wxRect r = GetTrackRect( context.GetProject(), panel, 0 );
|
{ wxRect r = GetTrackRect( &context.project, panel, 0 );
|
||||||
r = r.Union( GetTrackRect( context.GetProject(), panel, 1 ));
|
r = r.Union( GetTrackRect( &context.project, panel, 1 ));
|
||||||
return Capture(context, mFileName, panel, r );
|
return Capture(context, mFileName, panel, r );
|
||||||
}
|
}
|
||||||
case kfirstthreetracks:
|
case kfirstthreetracks:
|
||||||
{ wxRect r = GetTrackRect( context.GetProject(), panel, 0 );
|
{ wxRect r = GetTrackRect( &context.project, panel, 0 );
|
||||||
r = r.Union( GetTrackRect( context.GetProject(), panel, 2 ));
|
r = r.Union( GetTrackRect( &context.project, panel, 2 ));
|
||||||
return Capture(context, mFileName, panel, r );
|
return Capture(context, mFileName, panel, r );
|
||||||
}
|
}
|
||||||
case kfirstfourtracks:
|
case kfirstfourtracks:
|
||||||
{ wxRect r = GetTrackRect( context.GetProject(), panel, 0 );
|
{ wxRect r = GetTrackRect( &context.project, panel, 0 );
|
||||||
r = r.Union( GetTrackRect( context.GetProject(), panel, 3 ));
|
r = r.Union( GetTrackRect( &context.project, panel, 3 ));
|
||||||
return Capture(context, mFileName, panel, r );
|
return Capture(context, mFileName, panel, r );
|
||||||
}
|
}
|
||||||
case kalltracks:
|
case kalltracks:
|
||||||
{ wxRect r = GetTrackRect( context.GetProject(), panel, 0 );
|
{ wxRect r = GetTrackRect( &context.project, panel, 0 );
|
||||||
r = r.Union( GetTrackRect( context.GetProject(), panel, nTracks-1 ));
|
r = r.Union( GetTrackRect( &context.project, panel, nTracks-1 ));
|
||||||
return Capture(context, mFileName, panel, r );
|
return Capture(context, mFileName, panel, r );
|
||||||
}
|
}
|
||||||
case kalltracksplus:
|
case kalltracksplus:
|
||||||
{ wxRect r = GetTrackRect( context.GetProject(), panel, 0 );
|
{ wxRect r = GetTrackRect( &context.project, panel, 0 );
|
||||||
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
|
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
|
||||||
r.SetHeight( r.GetHeight() + ruler->GetRulerHeight() );
|
r.SetHeight( r.GetHeight() + ruler->GetRulerHeight() );
|
||||||
r = r.Union( GetTrackRect( context.GetProject(), panel, nTracks-1 ));
|
r = r.Union( GetTrackRect( &context.project, panel, nTracks-1 ));
|
||||||
return Capture(context, mFileName, panel, r );
|
return Capture(context, mFileName, panel, r );
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void SelectTimeCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
bool SelectTimeCommand::Apply(const CommandContext & context){
|
bool SelectTimeCommand::Apply(const CommandContext & context){
|
||||||
// Many commands need focus on track panel.
|
// Many commands need focus on track panel.
|
||||||
// No harm in setting it with a scripted select.
|
// No harm in setting it with a scripted select.
|
||||||
context.GetProject()->GetTrackPanel()->SetFocus();
|
context.project.GetTrackPanel()->SetFocus();
|
||||||
if( !bHasT0 && !bHasT1 )
|
if( !bHasT0 && !bHasT1 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ bool SelectTimeCommand::Apply(const CommandContext & context){
|
|||||||
if( !bHasRelativeSpec )
|
if( !bHasRelativeSpec )
|
||||||
mRelativeTo = 0;
|
mRelativeTo = 0;
|
||||||
|
|
||||||
AudacityProject * p = context.GetProject();
|
AudacityProject * p = &context.project;
|
||||||
double end = p->GetTracks()->GetEndTime();
|
double end = p->GetTracks()->GetEndTime();
|
||||||
double t0;
|
double t0;
|
||||||
double t1;
|
double t1;
|
||||||
@@ -164,7 +164,7 @@ bool SelectFrequenciesCommand::Apply(const CommandContext & context){
|
|||||||
if( !bHasBottom )
|
if( !bHasBottom )
|
||||||
mBottom = 0.0;
|
mBottom = 0.0;
|
||||||
|
|
||||||
context.GetProject()->SSBL_ModifySpectralSelection(
|
context.project.SSBL_ModifySpectralSelection(
|
||||||
mBottom, mTop, false);// false for not done.
|
mBottom, mTop, false);// false for not done.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ bool SelectTracksCommand::Apply(const CommandContext &context)
|
|||||||
// Used to invalidate cached selection and tracks.
|
// Used to invalidate cached selection and tracks.
|
||||||
Effect::IncEffectCounter();
|
Effect::IncEffectCounter();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
TrackList *tracks = context.GetProject()->GetTracks();
|
TrackList *tracks = context.project.GetTracks();
|
||||||
|
|
||||||
// Defaults if no value...
|
// Defaults if no value...
|
||||||
if( !bHasNumTracks )
|
if( !bHasNumTracks )
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ bool SetLabelCommand::Apply(const CommandContext & context)
|
|||||||
// this code could be put in subroutines/reduced.
|
// this code could be put in subroutines/reduced.
|
||||||
|
|
||||||
//wxString mode = GetString(wxT("Type"));
|
//wxString mode = GetString(wxT("Type"));
|
||||||
AudacityProject * p = context.GetProject();
|
AudacityProject * p = &context.project;
|
||||||
TrackList *tracks = context.GetProject()->GetTracks();
|
TrackList *tracks = context.project.GetTracks();
|
||||||
LabelStruct * pLabel = NULL;
|
LabelStruct * pLabel = NULL;
|
||||||
int i=0;
|
int i=0;
|
||||||
int nn=0;
|
int nn=0;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void SetProjectCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
|
|
||||||
bool SetProjectCommand::Apply(const CommandContext & context)
|
bool SetProjectCommand::Apply(const CommandContext & context)
|
||||||
{
|
{
|
||||||
AudacityProject * pProj = context.GetProject();
|
AudacityProject * pProj = &context.project;
|
||||||
if( bHasName )
|
if( bHasName )
|
||||||
pProj->SetLabel(mName);
|
pProj->SetLabel(mName);
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ bool SetTrackBase::Apply(const CommandContext & context )
|
|||||||
{
|
{
|
||||||
long i = 0;// track counter
|
long i = 0;// track counter
|
||||||
long j = 0;// channel counter
|
long j = 0;// channel counter
|
||||||
auto tracks = context.GetProject()->GetTracks();
|
auto tracks = context.project.GetTracks();
|
||||||
for ( auto t : tracks->Leaders() )
|
for ( auto t : tracks->Leaders() )
|
||||||
{
|
{
|
||||||
auto channels = TrackList::Channels(t);
|
auto channels = TrackList::Channels(t);
|
||||||
@@ -163,7 +163,7 @@ bool SetTrackStatusCommand::ApplyInner(const CommandContext & context, Track * t
|
|||||||
if( !bIsSecondChannel ){
|
if( !bIsSecondChannel ){
|
||||||
if( bHasFocused )
|
if( bHasFocused )
|
||||||
{
|
{
|
||||||
TrackPanel *panel = context.GetProject()->GetTrackPanel();
|
TrackPanel *panel = context.project.GetTrackPanel();
|
||||||
if( bFocused)
|
if( bFocused)
|
||||||
panel->SetFocusedTrack( t );
|
panel->SetFocusedTrack( t );
|
||||||
else if( t== panel->GetFocusedTrack() )
|
else if( t== panel->GetFocusedTrack() )
|
||||||
|
|||||||
Reference in New Issue
Block a user