Audacity  3.0.3
HistoryWindow.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  HistoryWindow.cpp
6 
7  Joshua Haberman
8  Leland Lucius
9 
10 *******************************************************************//*******************************************************************/
18 
19 
20 #include "HistoryWindow.h"
21 
22 #include <wx/app.h>
23 #include <wx/defs.h>
24 #include <wx/button.h>
25 #include <wx/dialog.h>
26 #include <wx/event.h>
27 #include <wx/frame.h>
28 #include <wx/imaglist.h>
29 #include <wx/intl.h>
30 #include <wx/listctrl.h>
31 #include <wx/settings.h>
32 #include <wx/spinctrl.h>
33 #include <wx/stattext.h>
34 #include <wx/textctrl.h>
35 
36 #include "AudioIO.h"
37 #include "Clipboard.h"
38 #include "CommonCommandFlags.h"
39 #include "../images/Arrow.xpm"
40 #include "../images/Empty9x16.xpm"
41 #include "UndoManager.h"
42 #include "Project.h"
43 #include "ProjectFileIO.h"
44 #include "ProjectHistory.h"
45 #include "ProjectWindows.h"
46 #include "ShuttleGui.h"
48 #include "widgets/HelpSystem.h"
49 
50 enum {
51  ID_AVAIL = 1000,
58 };
59 
60 BEGIN_EVENT_TABLE(HistoryDialog, wxDialogWrapper)
61  EVT_SHOW(HistoryDialog::OnShow)
62  EVT_SIZE(HistoryDialog::OnSize)
70 
71 #define HistoryTitle XO("History")
72 
74  wxDialogWrapper(FindProjectFrame( parent ), wxID_ANY, HistoryTitle,
75  wxDefaultPosition, wxDefaultSize,
76  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
77 {
78  SetName();
79 
80  mManager = manager;
81  mProject = parent;
82  mSelected = 0;
83  mAudioIOBusy = false;
84 
85  //------------------------- Main section --------------------
86  // Construct the GUI.
87  ShuttleGui S(this, eIsCreating);
88  Populate(S);
89 
90  wxTheApp->Bind(EVT_AUDIOIO_PLAYBACK,
92  this);
93 
94  wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
96  this);
97 
98  Clipboard::Get().Bind(
99  EVT_CLIPBOARD_CHANGE, &HistoryDialog::UpdateDisplay, this);
100  parent->Bind(EVT_UNDO_PUSHED, &HistoryDialog::UpdateDisplay, this);
101  parent->Bind(EVT_UNDO_MODIFIED, &HistoryDialog::UpdateDisplay, this);
102  parent->Bind(EVT_UNDO_OR_REDO, &HistoryDialog::UpdateDisplay, this);
103  parent->Bind(EVT_UNDO_RESET, &HistoryDialog::UpdateDisplay, this);
104  parent->Bind(EVT_UNDO_PURGE, &HistoryDialog::UpdateDisplay, this);
105 }
106 
108 {
109  auto imageList = std::make_unique<wxImageList>(9, 16);
110  imageList->Add(wxIcon(empty9x16_xpm));
111  imageList->Add(wxIcon(arrow_xpm));
112 
113  S.SetBorder(5);
114  S.StartVerticalLay(true);
115  {
116  S.StartStatic(XO("&Manage History"), 1);
117  {
118  mList = S
119  .MinSize()
120  .ConnectRoot(wxEVT_KEY_DOWN, &HistoryDialog::OnListKeyDown)
121  .AddListControlReportMode(
122  { { XO("Action"), wxLIST_FORMAT_LEFT, 260 },
123  { XO("Used Space"), wxLIST_FORMAT_LEFT, 125 } },
124  wxLC_SINGLE_SEL
125  );
126 
127  //Assign rather than set the image list, so that it is deleted later.
128  // AssignImageList takes ownership
129  mList->AssignImageList(imageList.release(), wxIMAGE_LIST_SMALL);
130 
131  S.StartMultiColumn(3, wxCENTRE);
132  {
133  S.AddPrompt(XXO("&Total space used"));
134  mTotal = S.Id(ID_TOTAL).Style(wxTE_READONLY).AddTextBox({}, wxT(""), 10);
135  S.AddVariableText( {} )->Hide();
136 
137 #if defined(ALLOW_DISCARD)
138  S.AddPrompt(XXO("&Undo levels available"));
139  mAvail = S.Id(ID_AVAIL).Style(wxTE_READONLY).AddTextBox({}, wxT(""), 10);
140  S.AddVariableText( {} )->Hide();
141 
142  S.AddPrompt(XXO("&Levels to discard"));
143  mLevels = safenew wxSpinCtrl(S.GetParent(),
144  ID_LEVELS,
145  wxT("1"),
146  wxDefaultPosition,
147  wxDefaultSize,
148  wxSP_ARROW_KEYS,
149  0,
151  0);
152  S.AddWindow(mLevels);
153  /* i18n-hint: (verb)*/
154  mDiscard = S.Id(ID_DISCARD).AddButton(XXO("&Discard"));
155 #endif
156  S.AddPrompt(XXO("Clip&board space used"));
157  mClipboard = S.Style(wxTE_READONLY).AddTextBox({}, wxT(""), 10);
158 
159 #if defined(ALLOW_DISCARD)
160  S.Id(ID_DISCARD_CLIPBOARD).AddButton(XXO("D&iscard"));
161 #endif
162  }
163  S.EndMultiColumn();
164  }
165  S.EndStatic();
166 #if defined(ALLOW_DISCARD)
167  mCompact = safenew wxButton(this, ID_COMPACT, _("&Compact"));
169 #else
171 #endif
172  }
173  S.EndVerticalLay();
174  // ----------------------- End of main section --------------
175 
176  Layout();
177  Fit();
178  SetMinSize(GetSize());
179  mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1));
180  mList->SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
181 }
182 
183 void HistoryDialog::OnAudioIO(wxCommandEvent& evt)
184 {
185  evt.Skip();
186 
187  if (evt.GetInt() != 0)
188  mAudioIOBusy = true;
189  else
190  mAudioIOBusy = false;
191 
192 #if defined(ALLOW_DISCARD)
193  mDiscard->Enable(!mAudioIOBusy);
194  mCompact->Enable(!mAudioIOBusy);
195 #endif
196 }
197 
199 {
200  e.Skip();
201  if(IsShown())
202  DoUpdate();
203 }
204 
205 bool HistoryDialog::Show( bool show )
206 {
207  if ( show && !IsShown())
208  DoUpdate();
209  return wxDialogWrapper::Show( show );
210 }
211 
213 {
214  int i;
215 
217 
218  mList->DeleteAllItems();
219 
220  wxLongLong_t total = 0;
222  for (i = 0; i < (int)mManager->GetNumStates(); i++) {
224 
225  total += mManager->GetLongDescription(i, &desc, &size);
226  mList->InsertItem(i, desc.Translation(), i == mSelected ? 1 : 0);
227  mList->SetItem(i, 1, size.Translation());
228  }
229 
230  mTotal->SetValue(Internat::FormatSize(total).Translation());
231 
232  auto clipboardUsage = mManager->GetClipboardSpaceUsage();
233  mClipboard->SetValue(Internat::FormatSize(clipboardUsage).Translation());
234 #if defined(ALLOW_DISCARD)
235  FindWindowById(ID_DISCARD_CLIPBOARD)->Enable(clipboardUsage > 0);
236 #endif
237 
238  mList->EnsureVisible(mSelected);
239 
240  mList->SetItemState(mSelected,
241  wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
242  wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
243 
244  UpdateLevels();
245 }
246 
248 {
249 #if defined(ALLOW_DISCARD)
250  wxWindow *focus;
251  int value = mLevels->GetValue();
252 
253  if (value > mSelected) {
254  value = mSelected;
255  }
256 
257  if (value == 0) {
258  value = 1;
259  }
260 
261  mLevels->SetValue(value);
262  mLevels->SetRange(1, mSelected);
263 
264  mAvail->SetValue(wxString::Format(wxT("%d"), mSelected));
265 
266  focus = FindFocus();
267  if ((focus == mDiscard || focus == mLevels) && mSelected == 0) {
268  mList->SetFocus();
269  }
270 
271  mLevels->Enable(mSelected > 0);
272  mDiscard->Enable(!mAudioIOBusy && mSelected > 0);
273 #endif
274 }
275 
276 void HistoryDialog::OnDiscard(wxCommandEvent & WXUNUSED(event))
277 {
278  int i = mLevels->GetValue();
279 
280  mSelected -= i;
281  mManager->RemoveStates(0, i);
283 
284  while(--i >= 0)
285  mList->DeleteItem(i);
286 
287  DoUpdate();
288 }
289 
290 void HistoryDialog::OnDiscardClipboard(wxCommandEvent & WXUNUSED(event))
291 {
292  Clipboard::Get().Clear();
293 }
294 
295 void HistoryDialog::OnCompact(wxCommandEvent & WXUNUSED(event))
296 {
297  auto &projectFileIO = ProjectFileIO::Get(*mProject);
298 
299  projectFileIO.ReopenProject();
300 
301  auto baseFile = wxFileName(projectFileIO.GetFileName());
302  auto walFile = wxFileName(projectFileIO.GetFileName() + wxT("-wal"));
303  auto before = baseFile.GetSize() + walFile.GetSize();
304 
305  projectFileIO.Compact({}, true);
306 
307  auto after = baseFile.GetSize() + walFile.GetSize();
308 
310  XO("Compacting actually freed %s of disk space.")
311  .Format(Internat::FormatSize((before - after).GetValue())),
312  XO("History"));
313 }
314 
315 void HistoryDialog::OnGetURL(wxCommandEvent & WXUNUSED(event))
316 {
317  HelpSystem::ShowHelp(this, L"Undo,_Redo_and_History");
318 }
319 
320 void HistoryDialog::OnItemSelected(wxListEvent &event)
321 {
322  if (mAudioIOBusy) {
323  mList->SetItemState(mSelected,
324  wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
325  wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
326  return;
327  }
328 
329  int selected = event.GetIndex();
330  int i;
331 
332  for (i = 0; i < mList->GetItemCount(); i++) {
333  mList->SetItemImage(i, 0);
334  if (i > selected)
335  mList->SetItemTextColour(i, *wxLIGHT_GREY);
336  else
337  mList->SetItemTextColour(i, mList->GetTextColour());
338  }
339  mList->SetItemImage(selected, 1);
340 
341  // Do not do a SetStateTo() if we're not actually changing the selected
342  // entry. Doing so can cause unnecessary delays upon initial load or while
343  // clicking the same entry over and over.
344  if (selected != mSelected) {
345  ProjectHistory::Get( *mProject ).SetStateTo(selected);
346  }
347  mSelected = selected;
348 
349  UpdateLevels();
350 }
351 
352 void HistoryDialog::OnListKeyDown(wxKeyEvent & event)
353 {
354  switch (event.GetKeyCode())
355  {
356  case WXK_RETURN:
357  // Don't know why wxListCtrls prevent default dialog action,
358  // but they do, so handle it.
359  EmulateButtonClickIfPresent(GetAffirmativeId());
360  break;
361 
362  default:
363  event.Skip();
364  break;
365  }
366 }
367 
368 void HistoryDialog::OnCloseWindow(wxCloseEvent & WXUNUSED(event))
369 {
370  this->Show(false);
371 }
372 
373 void HistoryDialog::OnShow(wxShowEvent & event)
374 {
375  if (event.IsShown())
376  {
377  mList->SetFocus();
378  }
379 }
380 
381 void HistoryDialog::OnSize(wxSizeEvent & WXUNUSED(event))
382 {
383  Layout();
384  mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1));
385  if (mList->GetItemCount() > 0)
386  mList->EnsureVisible(mSelected);
387 }
388 
389 // PrefsListener implementation
391 {
392  bool shown = IsShown();
393  if (shown) {
394  Show(false);
395  }
396 
397  SetSizer(nullptr);
398  DestroyChildren();
399 
401  ShuttleGui S(this, eIsCreating);
402  Populate(S);
403 
404  if (shown) {
405  Show(true);
406  }
407 }
408 
409 // Remaining code hooks this add-on into the application
410 #include "commands/CommandContext.h"
411 #include "commands/CommandManager.h"
412 
413 namespace {
414 
415 // History window attached to each project is built on demand by:
416 AttachedWindows::RegisteredFactory sHistoryWindowKey{
417  []( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
418  auto &undoManager = UndoManager::Get( parent );
419  return safenew HistoryDialog( &parent, &undoManager );
420  }
421 };
422 
423 // Define our extra menu item that invokes that factory
425  void OnHistory(const CommandContext &context)
426  {
427  auto &project = context.project;
428 
429  auto historyWindow = &GetAttachedWindows(project).Get(sHistoryWindowKey);
430  historyWindow->Show();
431  historyWindow->Raise();
432  }
433 };
434 
436  // Handler is not stateful. Doesn't need a factory registered with
437  // AudacityProject.
438  static Handler instance;
439  return instance;
440 }
441 
442 // Register that menu item
443 
444 using namespace MenuTable;
445 AttachedItem sAttachment{ wxT("View/Windows"),
446  // History window should be available either for UndoAvailableFlag
447  // or RedoAvailableFlag,
448  // but we can't make the AddItem flags and mask have both,
449  // because they'd both have to be true for the
450  // command to be enabled.
451  // If user has Undone the entire stack, RedoAvailableFlag is on
452  // but UndoAvailableFlag is off.
453  // If user has done things but not Undone anything,
454  // RedoAvailableFlag is off but UndoAvailableFlag is on.
455  // So in either of those cases,
456  // (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask
457  // would fail.
458  // The only way to fix this in the current architecture
459  // is to hack in special cases for RedoAvailableFlag
460  // in AudacityProject::UpdateMenus() (ugly)
461  // and CommandManager::HandleCommandEntry() (*really* ugly --
462  // shouldn't know about particular command names and flags).
463  // Here's the hack that would be necessary in
464  // AudacityProject::UpdateMenus(), if somebody decides to do it:
465  // // Because EnableUsingFlags requires all the flag bits match the
466  // // corresponding mask bits,
467  // // "UndoHistory" specifies only
468  // // AudioIONotBusyFlag | UndoAvailableFlag, because that
469  // // covers the majority of cases where it should be enabled.
470  // // If history is not empty but we've Undone the whole stack,
471  // // we also want to enable,
472  // // to show the Redo's on stack.
473  // // "UndoHistory" might already be enabled,
474  // // but add this check for RedoAvailableFlag.
475  // if (flags & RedoAvailableFlag)
476  // GetCommandManager()->Enable(wxT("UndoHistory"), true);
477  // So for now, enable the command regardless of stack.
478  // It will just show empty sometimes.
479  // FOR REDESIGN,
480  // clearly there are some limitations with the flags/mask bitmaps.
481 
483  /* i18n-hint: Clicking this menu item shows the various editing steps
484  that have been taken.*/
485  Command( wxT("UndoHistory"), XXO("&History..."), &Handler::OnHistory,
486  AudioIONotBusyFlag() ) )
487 };
488 
489 }
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
HistoryDialog
Works with UndoManager to allow user to see descriptions of and undo previous commands....
Definition: HistoryWindow.h:28
HistoryDialog::OnDiscard
void OnDiscard(wxCommandEvent &event)
Definition: HistoryWindow.cpp:276
ProjectFileIO.h
anonymous_namespace{HistoryWindow.cpp}::findCommandHandler
CommandHandlerObject & findCommandHandler(AudacityProject &)
Definition: HistoryWindow.cpp:435
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
HelpSystem.h
MenuTable::FinderScope
Definition: CommandManager.h:485
ID_TOTAL
@ ID_TOTAL
Definition: HistoryWindow.cpp:53
UndoManager::CalculateSpaceUsage
void CalculateSpaceUsage()
Definition: UndoManager.cpp:94
HistoryDialog::mSelected
int mSelected
Definition: HistoryWindow.h:67
ID_DISCARD_CLIPBOARD
@ ID_DISCARD_CLIPBOARD
Definition: HistoryWindow.cpp:56
eHelpButton
@ eHelpButton
Definition: ShuttleGui.h:604
Project.h
ClientData::Site::Get
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309
EVT_LIST_ITEM_SELECTED
EVT_LIST_ITEM_SELECTED(CurvesListID, EditCurvesDialog::OnListSelectionChange) EVT_LIST_ITEM_DESELECTED(CurvesListID
Constructor.
AudioIONotBusyFlag
const ReservedCommandFlag & AudioIONotBusyFlag()
Definition: CommonCommandFlags.cpp:127
Clipboard.h
Format
Abstract base class used in importing a file.
Clipboard::Clear
void Clear()
Definition: Clipboard.cpp:41
CommandManager.h
ShuttleGui::MinSize
ShuttleGui & MinSize()
Definition: ShuttleGui.h:733
XO
#define XO(s)
Definition: Internat.h:31
ProjectFileIO::Get
static ProjectFileIO & Get(AudacityProject &project)
Definition: ProjectFileIO.cpp:266
HistoryDialog::OnGetURL
void OnGetURL(wxCommandEvent &event)
Definition: HistoryWindow.cpp:315
HistoryDialog::mClipboard
wxTextCtrl * mClipboard
Definition: HistoryWindow.h:61
anonymous_namespace{HistoryWindow.cpp}::sAttachment
AttachedItem sAttachment
Definition: HistoryWindow.cpp:445
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
MenuTable::AttachedItem
Definition: CommandManager.h:708
HistoryDialog::OnItemSelected
void OnItemSelected(wxListEvent &event)
Definition: HistoryWindow.cpp:320
HelpSystem::ShowHelp
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237
desc
const TranslatableString desc
Definition: ExportPCM.cpp:58
anonymous_namespace{HistoryWindow.cpp}::Handler
Definition: HistoryWindow.cpp:424
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2274
HistoryDialog::mAvail
wxTextCtrl * mAvail
Definition: HistoryWindow.h:62
HistoryDialog::HistoryDialog
HistoryDialog(AudacityProject *parent, UndoManager *manager)
Definition: HistoryWindow.cpp:73
HistoryDialog::mLevels
wxSpinCtrl * mLevels
Definition: HistoryWindow.h:63
HistoryDialog::OnCompact
void OnCompact(wxCommandEvent &event)
Definition: HistoryWindow.cpp:295
ShuttleGui::Style
ShuttleGui & Style(long iStyle)
Definition: ShuttleGui.h:727
HistoryDialog::OnCloseWindow
void OnCloseWindow(wxCloseEvent &event)
Definition: HistoryWindow.cpp:368
CommandContext.h
XXO
#define XXO(s)
Definition: Internat.h:44
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:34
anonymous_namespace{HistoryWindow.cpp}::Handler::OnHistory
void OnHistory(const CommandContext &context)
Definition: HistoryWindow.cpp:425
ShuttleGuiBase::AddTextBox
wxTextCtrl * AddTextBox(const TranslatableString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:638
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
GetAttachedWindows
AUDACITY_DLL_API AttachedWindows & GetAttachedWindows(AudacityProject &project)
Definition: ProjectWindows.cpp:114
Internat::FormatSize
static TranslatableString FormatSize(wxLongLong size)
Convert a number to a string while formatting it in bytes, KB, MB, GB.
Definition: Internat.cpp:204
ID_DISCARD
@ ID_DISCARD
Definition: HistoryWindow.cpp:55
ID_LEVELS
@ ID_LEVELS
Definition: HistoryWindow.cpp:54
HistoryDialog::mManager
UndoManager * mManager
Definition: HistoryWindow.h:58
ShuttleGuiBase::GetParent
wxWindow * GetParent()
Definition: ShuttleGui.h:496
HistoryDialog::mAudioIOBusy
bool mAudioIOBusy
Definition: HistoryWindow.h:68
UndoManager.h
HistoryDialog::mDiscard
wxButton * mDiscard
Definition: HistoryWindow.h:64
UndoManager::GetLongDescription
wxLongLong_t GetLongDescription(unsigned int n, TranslatableString *desc, TranslatableString *size)
Definition: UndoManager.cpp:131
ShuttleGuiBase::AddWindow
wxWindow * AddWindow(wxWindow *pWindow, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:299
HistoryDialog::mList
wxListCtrl * mList
Definition: HistoryWindow.h:59
HistoryDialog::mTotal
wxTextCtrl * mTotal
Definition: HistoryWindow.h:60
anonymous_namespace{HistoryWindow.cpp}::sHistoryWindowKey
AttachedWindows::RegisteredFactory sHistoryWindowKey
Definition: HistoryWindow.cpp:416
HistoryTitle
#define HistoryTitle
Definition: HistoryWindow.cpp:71
ShuttleGui.h
HistoryDialog::OnDiscardClipboard
void OnDiscardClipboard(wxCommandEvent &event)
Definition: HistoryWindow.cpp:290
ProjectWindows.h
accessors for certain important windows associated with each project
ShuttleGuiBase::AddButton
wxButton * AddButton(const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
Definition: ShuttleGui.cpp:360
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:893
wxDialogWrapper
Definition: wxPanelWrapper.h:81
Clipboard::Get
static Clipboard & Get()
Definition: Clipboard.cpp:29
UndoManager::GetClipboardSpaceUsage
wxLongLong_t GetClipboardSpaceUsage() const
Definition: UndoManager.h:202
eOkButton
@ eOkButton
Definition: ShuttleGui.h:600
HistoryDialog::UpdateLevels
void UpdateLevels()
Definition: HistoryWindow.cpp:247
HistoryDialog::OnSize
void OnSize(wxSizeEvent &event)
Definition: HistoryWindow.cpp:381
HistoryDialog::UpdateDisplay
void UpdateDisplay(wxEvent &e)
Definition: HistoryWindow.cpp:198
_
#define _(s)
Definition: Internat.h:75
UndoManager::Get
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:57
MenuTable::Command
std::unique_ptr< CommandItem > Command(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
Definition: CommandManager.h:675
AudioIO.h
ShuttleGui::ConnectRoot
auto ConnectRoot(wxEventTypeTag< Tag > eventType, void(Handler::*func)(Argument &)) -> typename std::enable_if< std::is_base_of< Argument, Tag >::value, ShuttleGui & >::type
Definition: ShuttleGui.h:699
ID_COMPACT
@ ID_COMPACT
Definition: HistoryWindow.cpp:57
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
AudacityMessageBox.h
HistoryDialog::UpdatePrefs
void UpdatePrefs() override
Definition: HistoryWindow.cpp:390
HistoryDialog::OnShow
void OnShow(wxShowEvent &event)
Definition: HistoryWindow.cpp:373
CommandHandlerObject
wxEvtHandler CommandHandlerObject
Definition: CommandFunctors.h:28
ProjectHistory.h
ID_FILESIZE
@ ID_FILESIZE
Definition: HistoryWindow.cpp:52
HistoryDialog::OnAudioIO
void OnAudioIO(wxCommandEvent &evt)
Definition: HistoryWindow.cpp:183
wxDialogWrapper::SetTitle
void SetTitle(const TranslatableString &title)
Definition: wxPanelWrapper.cpp:66
FindProjectFrame
wxFrame * FindProjectFrame(AudacityProject *project)
Get a pointer to the window associated with a project, or null if the given pointer is null,...
Definition: ProjectWindows.cpp:88
ShuttleGui::AddStandardButtons
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
Definition: ShuttleGui.cpp:2444
UndoManager::GetCurrentState
unsigned int GetCurrentState()
Definition: UndoManager.cpp:265
HistoryDialog::Populate
void Populate(ShuttleGui &S)
Definition: HistoryWindow.cpp:107
HistoryDialog::DoUpdate
void DoUpdate()
Definition: HistoryWindow.cpp:212
HistoryWindow.h
ShuttleGuiBase::AddPrompt
void AddPrompt(const TranslatableString &Prompt, int wrapWidth=0)
Right aligned text string.
Definition: ShuttleGui.cpp:238
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
MenuTable
Definition: CommandManager.h:416
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
ShuttleGuiBase::AddVariableText
wxStaticText * AddVariableText(const TranslatableString &Str, bool bCenter=false, int PositionFlags=0, int wrapWidth=0)
Definition: ShuttleGui.cpp:463
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:922
safenew
#define safenew
Definition: MemoryX.h:10
UndoManager
Maintain a non-persistent list of states of the project, to support undo and redo commands.
Definition: UndoManager.h:137
HistoryDialog::OnListKeyDown
void OnListKeyDown(wxKeyEvent &event)
Definition: HistoryWindow.cpp:352
CommonCommandFlags.h
HistoryDialog::mProject
AudacityProject * mProject
Definition: HistoryWindow.h:57
CommandContext::project
AudacityProject & project
Definition: CommandContext.h:64
END_EVENT_TABLE
END_EVENT_TABLE()
HistoryDialog::mCompact
wxButton * mCompact
Definition: HistoryWindow.h:65
UndoManager::RemoveStates
void RemoveStates(size_t begin, size_t end)
Definition: UndoManager.cpp:207
ID_AVAIL
@ ID_AVAIL
Definition: HistoryWindow.cpp:51
ProjectHistory::Get
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26
HistoryDialog::Show
bool Show(bool show=true) override
Definition: HistoryWindow.cpp:205
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
ProjectHistory::SetStateTo
void SetStateTo(unsigned int n, bool doAutosave=true)
Definition: ProjectHistory.cpp:170
UndoManager::GetNumStates
unsigned int GetNumStates()
Definition: UndoManager.cpp:260