Audacity  2.2.2
Public Member Functions | Private Attributes | List of all members
ExportCLOptions Class Referencefinal
Inheritance diagram for ExportCLOptions:
wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Public Member Functions

 ExportCLOptions (wxWindow *parent, int format)
 
virtual ~ExportCLOptions ()
 
void PopulateOrExchange (ShuttleGui &S)
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void OnBrowse (wxCommandEvent &event)
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&...args)
 

Private Attributes

wxComboBox * mCmd
 
FileHistory mHistory
 

Detailed Description

Definition at line 44 of file ExportCL.cpp.

Constructor & Destructor Documentation

ExportCLOptions::ExportCLOptions ( wxWindow *  parent,
int  format 
)

Definition at line 71 of file ExportCL.cpp.

References eIsCreatingFromPrefs, and gPrefs.

72 : wxPanelWrapper(parent, wxID_ANY)
73 {
74  mHistory.Load(*gPrefs, wxT("/FileFormats/ExternalProgramHistory"));
75 
76  if (mHistory.GetCount() == 0) {
77  mHistory.AddFileToHistory(wxT("ffmpeg -i - \"%f\""), false);
78  mHistory.AddFileToHistory(wxT("lame - \"%f\""), false);
79  }
80 
81  mHistory.AddFileToHistory(gPrefs->Read(wxT("/FileFormats/ExternalProgramExportCommand"),
83  false);
84 
87 
89 
90  parent->Layout();
91 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
FileHistory mHistory
Definition: ExportCL.cpp:58
const wxString & GetHistoryFile(size_t i) const
Definition: FileHistory.cpp:85
bool TransferDataToWindow() override
Definition: ExportCL.cpp:139
void Load(wxConfigBase &config, const wxString &group)
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportCL.cpp:100
void AddFileToHistory(const wxString &file, bool update=true)
Definition: FileHistory.cpp:36
size_t GetCount()
Definition: FileHistory.cpp:97
ExportCLOptions::~ExportCLOptions ( )
virtual

Definition at line 93 of file ExportCL.cpp.

References TransferDataFromWindow().

94 {
96 }
bool TransferDataFromWindow() override
Definition: ExportCL.cpp:146

Member Function Documentation

void ExportCLOptions::OnBrowse ( wxCommandEvent &  event)

Definition at line 164 of file ExportCL.cpp.

References _(), mCmd, FileNames::Open, and FileNames::SelectFile().

165 {
166  wxString path;
167  wxString ext;
168 
169 #if defined(__WXMSW__)
170  ext = wxT(".exe");
171 #endif
172 
174  _("Find path to command"),
175  wxEmptyString,
176  wxEmptyString,
177  ext,
178  wxT("*") + ext,
179  wxFD_OPEN | wxRESIZE_BORDER,
180  this);
181  if (path.IsEmpty()) {
182  return;
183  }
184 
185  if (path.Find(wxT(' ')) == wxNOT_FOUND) {
186  mCmd->SetValue(path);
187  }
188  else {
189  mCmd->SetValue(wxT('"') + path + wxT('"'));
190  }
191 
192  mCmd->SetInsertionPointEnd();
193 
194  return;
195 }
wxComboBox * mCmd
Definition: ExportCL.cpp:57
static wxString SelectFile(Operation op, const wxString &message, const wxString &default_path, const wxString &default_filename, const wxString &default_extension, const wxString &wildcard, int flags, wxWindow *parent)
Definition: FileNames.cpp:411
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void ExportCLOptions::PopulateOrExchange ( ShuttleGui S)

Definition at line 100 of file ExportCL.cpp.

References _(), ShuttleGuiBase::AddButton(), ShuttleGuiBase::AddCombo(), ShuttleGuiBase::AddFixedText(), ShuttleGuiBase::AddTitle(), ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::EndVerticalLay(), FileHistory::GetCount(), FileHistory::GetHistoryFile(), ShuttleGui::Id(), ID_BROWSE, mCmd, mHistory, ShuttleGuiBase::SetSizerProportion(), ShuttleGuiBase::SetStretchyCol(), ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::StartVerticalLay(), and ShuttleGuiBase::TieCheckBox().

Referenced by TransferDataFromWindow().

101 {
102  wxArrayString cmds;
103  wxString cmd;
104 
105  for (size_t i = 0; i < mHistory.GetCount(); i++) {
106  cmds.Add(mHistory.GetHistoryFile(i));
107  }
108  cmd = cmds[0];
109 
110  S.StartVerticalLay();
111  {
112  S.StartHorizontalLay(wxEXPAND);
113  {
114  S.SetSizerProportion(1);
115  S.StartMultiColumn(3, wxEXPAND);
116  {
117  S.SetStretchyCol(1);
118  mCmd = S.AddCombo(_("Command:"),
119  cmd,
120  &cmds);
121  S.Id(ID_BROWSE).AddButton(_("Browse..."),
122  wxALIGN_CENTER_VERTICAL);
123  S.AddFixedText( {} );
124  S.TieCheckBox(_("Show output"),
125  wxT("/FileFormats/ExternalProgramShowOutput"),
126  false);
127  }
128  S.EndMultiColumn();
129  }
130  S.EndHorizontalLay();
131 
132  S.AddTitle(_("Data will be piped to standard in. \"%f\" uses the file name in the export window."));
133  }
134  S.EndVerticalLay();
135 }
void EndMultiColumn()
FileHistory mHistory
Definition: ExportCL.cpp:58
void SetSizerProportion(int iProp)
Definition: ShuttleGui.h:289
const wxString & GetHistoryFile(size_t i) const
Definition: FileHistory.cpp:85
void EndHorizontalLay()
void EndVerticalLay()
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
ShuttleGui & Id(int id)
void AddFixedText(const wxString &Str, bool bCenter=false)
Definition: ShuttleGui.cpp:397
void AddTitle(const wxString &Prompt)
Centred text string.
Definition: ShuttleGui.cpp:274
wxComboBox * mCmd
Definition: ExportCL.cpp:57
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxComboBox * AddCombo(const wxString &Prompt, const wxString &Selected, const wxArrayString *pChoices, long style=0)
Definition: ShuttleGui.cpp:440
wxCheckBox * TieCheckBox(const wxString &Prompt, WrappedType &WrappedRef)
#define ID_BROWSE
Definition: ExportCL.cpp:63
wxButton * AddButton(const wxString &Text, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:341
size_t GetCount()
Definition: FileHistory.cpp:97
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:203
void StartVerticalLay(int iProp=1)
bool ExportCLOptions::TransferDataFromWindow ( )
override

Definition at line 146 of file ExportCL.cpp.

References FileHistory::AddFileToHistory(), eIsSavingToPrefs, gPrefs, mCmd, mHistory, PopulateOrExchange(), and FileHistory::Save().

Referenced by ~ExportCLOptions().

147 {
148  ShuttleGui S(this, eIsSavingToPrefs);
150 
151  wxString cmd = mCmd->GetValue();
152 
153  mHistory.AddFileToHistory(cmd, false);
154  mHistory.Save(*gPrefs, wxT("/FileFormats/ExternalProgramHistory"));
155 
156  gPrefs->Write(wxT("/FileFormats/ExternalProgramExportCommand"), cmd);
157  gPrefs->Flush();
158 
159  return true;
160 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
FileHistory mHistory
Definition: ExportCL.cpp:58
void Save(wxConfigBase &config, const wxString &group)
wxComboBox * mCmd
Definition: ExportCL.cpp:57
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportCL.cpp:100
void AddFileToHistory(const wxString &file, bool update=true)
Definition: FileHistory.cpp:36
bool ExportCLOptions::TransferDataToWindow ( )
override

Definition at line 139 of file ExportCL.cpp.

140 {
141  return true;
142 }

Member Data Documentation

wxComboBox* ExportCLOptions::mCmd
private

Definition at line 57 of file ExportCL.cpp.

Referenced by OnBrowse(), PopulateOrExchange(), and TransferDataFromWindow().

FileHistory ExportCLOptions::mHistory
private

Definition at line 58 of file ExportCL.cpp.

Referenced by PopulateOrExchange(), and TransferDataFromWindow().


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