Audacity 3.2.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
OpenProjectCommand Class Reference

Command for opening an Audacity project. More...

#include <OpenSaveCommands.h>

Inheritance diagram for OpenProjectCommand:
[legend]
Collaboration diagram for OpenProjectCommand:
[legend]

Public Member Functions

ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
template<bool Const>
bool VisitSettings (SettingsVisitorBase< Const > &S)
 
bool VisitSettings (SettingsVisitor &S) override
 
bool VisitSettings (ConstSettingsVisitor &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool Apply (const CommandContext &context) override
 
ManualPageID ManualPage () override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
PluginPath GetPath () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
ComponentInterfaceSymbol GetSymbol () const override=0
 
virtual TranslatableString GetDescription () const override
 
virtual ManualPageID ManualPage ()
 
virtual bool IsBatchProcessing () const
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
bool SaveSettingsAsString (wxString &parms)
 
bool LoadSettingsFromString (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipAudacityCommand ()
 
virtual void End ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
virtual bool VisitSettings (SettingsVisitor &)
 
virtual bool VisitSettings (ConstSettingsVisitor &)
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Public Attributes

wxString mFileName
 
bool mbAddToHistory
 
bool bHasAddToHistory
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Open Project2") }
 

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 

Detailed Description

Command for opening an Audacity project.

Definition at line 30 of file OpenSaveCommands.h.

Member Function Documentation

◆ Apply()

bool OpenProjectCommand::Apply ( const CommandContext context)
override

Definition at line 65 of file OpenSaveCommands.cpp.

65 {
66
67 auto &projectFileIO = ProjectFileIO::Get(context.project);
68
69 auto oldFileName = projectFileIO.GetFileName();
70 if(mFileName.empty())
71 {
72 // This path queries the user for files to open
73 auto project = &context.project;
74 // Error check?
76 }
77 else
78 {
79 ProjectManager::ProjectChooser chooser{ &context.project, true };
81 std::ref(chooser), mFileName, mbAddToHistory))
82 chooser.Commit();
83 }
84 const auto &newFileName = projectFileIO.GetFileName();
85
86 // Because Open does not return a success or failure, we have to guess
87 // at this point, based on whether the project file name has
88 // changed and what to...
89 return !newFileName.empty() && newFileName != oldFileName;
90}
const auto project
AudacityProject & project
static ProjectFileIO & Get(AudacityProject &project)
static AudacityProject * OpenFile(const ProjectChooserFn &chooser, const FilePath &fileName, bool addtohistory=true)
Callable object that supplies the chooser argument of ProjectFileManager::OpenFile.
static void OpenFiles(AudacityProject *proj)

References ProjectFileIO::Get(), mbAddToHistory, mFileName, ProjectFileManager::OpenFile(), ProjectManager::OpenFiles(), CommandContext::project, and project.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString OpenProjectCommand::GetDescription ( ) const
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 37 of file OpenSaveCommands.h.

37{return XO("Opens a project.");};
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol OpenProjectCommand::GetSymbol ( ) const
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 36 of file OpenSaveCommands.h.

36{return Symbol;};
static const ComponentInterfaceSymbol Symbol

References Symbol.

◆ ManualPage()

ManualPageID OpenProjectCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 45 of file OpenSaveCommands.h.

45{return L"Extra_Menu:_Scriptables_II#open_project";}

◆ PopulateOrExchange()

void OpenProjectCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 53 of file OpenSaveCommands.cpp.

54{
55 S.AddSpace(0, 5);
56
57 S.StartMultiColumn(2, wxALIGN_CENTER);
58 {
59 S.TieTextBox(XXO("File Name:"),mFileName);
60 S.TieCheckBox(XXO("Add to History"), mbAddToHistory );
61 }
62 S.EndMultiColumn();
63}
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64

References mbAddToHistory, mFileName, S, and XXO().

Here is the call graph for this function:

◆ VisitSettings() [1/3]

bool OpenProjectCommand::VisitSettings ( ConstSettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 50 of file OpenSaveCommands.cpp.

51 { return VisitSettings<true>(S); }

References S.

◆ VisitSettings() [2/3]

bool OpenProjectCommand::VisitSettings ( SettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 47 of file OpenSaveCommands.cpp.

48 { return VisitSettings<false>(S); }

References S.

◆ VisitSettings() [3/3]

template<bool Const>
bool OpenProjectCommand::VisitSettings ( SettingsVisitorBase< Const > &  S)

Definition at line 41 of file OpenSaveCommands.cpp.

41 {
42 S.Define( mFileName, wxT("Filename"), wxString{"test.aup3"} );
43 S.OptionalN(bHasAddToHistory).Define( mbAddToHistory, wxT("AddToHistory"), false );
44 return true;
45}
wxT("CloseDown"))

References bHasAddToHistory, mbAddToHistory, mFileName, S, and wxT().

Here is the call graph for this function:

Member Data Documentation

◆ bHasAddToHistory

bool OpenProjectCommand::bHasAddToHistory

Definition at line 49 of file OpenSaveCommands.h.

Referenced by VisitSettings().

◆ mbAddToHistory

bool OpenProjectCommand::mbAddToHistory

Definition at line 48 of file OpenSaveCommands.h.

Referenced by Apply(), PopulateOrExchange(), and VisitSettings().

◆ mFileName

wxString OpenProjectCommand::mFileName

Definition at line 47 of file OpenSaveCommands.h.

Referenced by Apply(), PopulateOrExchange(), and VisitSettings().

◆ Symbol

const ComponentInterfaceSymbol OpenProjectCommand::Symbol { XO("Open Project2") }
static

Definition at line 33 of file OpenSaveCommands.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files: