Audacity  2.2.2
Macros | Enumerations | Functions
Menus.cpp File Reference

All AudacityProject functions that provide the menus. Implements AudacityProjectCommandFunctor. More...

#include "Audacity.h"
#include "Project.h"
#include <cfloat>
#include <iterator>
#include <algorithm>
#include <limits>
#include <math.h>
#include <wx/defs.h>
#include <wx/docview.h>
#include <wx/filedlg.h>
#include <wx/textfile.h>
#include <wx/textdlg.h>
#include <wx/progdlg.h>
#include <wx/scrolbar.h>
#include <wx/ffile.h>
#include <wx/statusbr.h>
#include <wx/utils.h>
#include "FreqWindow.h"
#include "effects/Contrast.h"
#include "TrackPanel.h"
#include "effects/EffectManager.h"
#include "AudacityApp.h"
#include "AudacityLogger.h"
#include "AudioIO.h"
#include "Dependencies.h"
#include "float_cast.h"
#include "LabelTrack.h"
#include "import/ImportRaw.h"
#include "export/Export.h"
#include "export/ExportMultiple.h"
#include "prefs/PrefsDialog.h"
#include "prefs/PlaybackPrefs.h"
#include "ShuttleGui.h"
#include "HistoryWindow.h"
#include "LyricsWindow.h"
#include "MixerBoard.h"
#include "Internat.h"
#include "FileFormats.h"
#include "ModuleManager.h"
#include "PluginManager.h"
#include "Prefs.h"
#include "Printing.h"
#include "Tags.h"
#include "TimeTrack.h"
#include "Mix.h"
#include "AboutDialog.h"
#include "Benchmark.h"
#include "Screenshot.h"
#include "ondemand/ODManager.h"
#include "BatchProcessDialog.h"
#include "BatchCommands.h"
#include "prefs/BatchPrefs.h"
#include "toolbars/ToolManager.h"
#include "toolbars/ControlToolBar.h"
#include "toolbars/ToolsToolBar.h"
#include "toolbars/EditToolBar.h"
#include "toolbars/DeviceToolBar.h"
#include "toolbars/MixerToolBar.h"
#include "toolbars/TranscriptionToolBar.h"
#include "tracks/ui/SelectHandle.h"
#include "widgets/LinkingHtmlWindow.h"
#include "Experimental.h"
#include "PlatformCompatibility.h"
#include "FileNames.h"
#include "TimeDialog.h"
#include "TimerRecordDialog.h"
#include "SoundActivatedRecord.h"
#include "LabelDialog.h"
#include "SplashDialog.h"
#include "widgets/HelpSystem.h"
#include "DeviceManager.h"
#include "UndoManager.h"
#include "WaveTrack.h"
#include "tracks/ui/Scrubbing.h"
#include "prefs/TracksPrefs.h"
#include "widgets/Meter.h"
#include "widgets/ErrorDialog.h"
#include "commands/CommandFunctors.h"
#include "commands/ScreenshotCommand.h"
#include "TrackPanelAx.h"
#include "tracks/ui/TimeShiftHandle.h"

Go to the source code of this file.

Macros

#define FN(X)   ident, static_cast<CommandFunctorPointer>(& AudacityProject :: X)
 

Enumerations

enum  {
  kAlignStartZero = 0, kAlignStartSelStart, kAlignStartSelEnd, kAlignEndSelStart,
  kAlignEndSelEnd, kAlignEndToEnd, kAlignTogether
}
 
enum  {
  POST_TIMER_RECORD_STOPPED = -3, POST_TIMER_RECORD_CANCEL_WAIT, POST_TIMER_RECORD_CANCEL, POST_TIMER_RECORD_NOTHING,
  POST_TIMER_RECORD_CLOSE, POST_TIMER_RECORD_RESTART, POST_TIMER_RECORD_SHUTDOWN
}
 

Functions

static bool SortEffectsByName (const PluginDescriptor *a, const PluginDescriptor *b)
 
static bool SortEffectsByPublisher (const PluginDescriptor *a, const PluginDescriptor *b)
 
static bool SortEffectsByPublisherAndName (const PluginDescriptor *a, const PluginDescriptor *b)
 
static bool SortEffectsByTypeAndName (const PluginDescriptor *a, const PluginDescriptor *b)
 
static bool SortEffectsByType (const PluginDescriptor *a, const PluginDescriptor *b)
 
static CommandHandlerObjectident (AudacityProject &project)
 

Detailed Description

All AudacityProject functions that provide the menus. Implements AudacityProjectCommandFunctor.

This file implements the method that creates the menu bar, plus all of the methods that get called when you select an item from a menu.

All of the menu bar handling is part of the class AudacityProject, but the event handlers for all of the menu items have been moved to Menus.h and Menus.cpp for clarity.

Definition in file Menus.cpp.

Macro Definition Documentation

#define FN (   X)    ident, static_cast<CommandFunctorPointer>(& AudacityProject :: X)

Enumeration Type Documentation

anonymous enum
Enumerator
kAlignStartZero 
kAlignStartSelStart 
kAlignStartSelEnd 
kAlignEndSelStart 
kAlignEndSelEnd 
kAlignEndToEnd 
kAlignTogether 

Definition at line 143 of file Menus.cpp.

143  {
144  kAlignStartZero = 0,
149  // The next two are only in one subMenu, so more easily handled at the end.
152 };
anonymous enum
Enumerator
POST_TIMER_RECORD_STOPPED 
POST_TIMER_RECORD_CANCEL_WAIT 
POST_TIMER_RECORD_CANCEL 
POST_TIMER_RECORD_NOTHING 
POST_TIMER_RECORD_CLOSE 
POST_TIMER_RECORD_RESTART 
POST_TIMER_RECORD_SHUTDOWN 

Definition at line 156 of file Menus.cpp.

Function Documentation

static CommandHandlerObject& ident ( AudacityProject project)
static

CreateMenusAndCommands builds the menus, and also rebuilds them after changes in configured preferences - for example changes in key-bindings affect the short-cut key legend that appears beside each command,

Definition at line 290 of file Menus.cpp.

Referenced by AutoSaveFile::Decode(), PluginManager::DropFile(), EffectManager::GetEffect(), and WaveTrack::SetAutoSaveIdent().

290 { return project; }
static bool SortEffectsByName ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 171 of file Menus.cpp.

References PluginDescriptor::GetPath(), and PluginDescriptor::GetTranslatedName().

Referenced by AudacityProject::PopulateEffectsMenu().

172 {
173  wxString akey = a->GetTranslatedName();
174  wxString bkey = b->GetTranslatedName();
175 
176  akey += a->GetPath();
177  bkey += b->GetPath();
178 
179  return akey.CmpNoCase(bkey) < 0;
180 }
wxString GetTranslatedName() const
const wxString & GetPath() const
static bool SortEffectsByPublisher ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 182 of file Menus.cpp.

References _(), PluginDescriptor::GetPath(), PluginDescriptor::GetTranslatedName(), and PluginDescriptor::GetTranslatedVendor().

Referenced by AudacityProject::PopulateEffectsMenu().

183 {
184  wxString akey = a->GetTranslatedVendor();
185  wxString bkey = b->GetTranslatedVendor();
186 
187  if (akey.IsEmpty())
188  {
189  akey = _("Uncategorized");
190  }
191  if (bkey.IsEmpty())
192  {
193  bkey = _("Uncategorized");
194  }
195 
196  akey += a->GetTranslatedName();
197  bkey += b->GetTranslatedName();
198 
199  akey += a->GetPath();
200  bkey += b->GetPath();
201 
202  return akey.CmpNoCase(bkey) < 0;
203 }
wxString GetTranslatedName() const
wxString GetTranslatedVendor() const
const wxString & GetPath() const
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
static bool SortEffectsByPublisherAndName ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 205 of file Menus.cpp.

References PluginDescriptor::GetPath(), PluginDescriptor::GetTranslatedName(), PluginDescriptor::GetTranslatedVendor(), and PluginDescriptor::IsEffectDefault().

Referenced by AudacityProject::PopulateEffectsMenu().

206 {
207  wxString akey = a->GetTranslatedVendor();
208  wxString bkey = b->GetTranslatedVendor();
209 
210  if (a->IsEffectDefault())
211  {
212  akey = wxEmptyString;
213  }
214  if (b->IsEffectDefault())
215  {
216  bkey = wxEmptyString;
217  }
218 
219  akey += a->GetTranslatedName();
220  bkey += b->GetTranslatedName();
221 
222  akey += a->GetPath();
223  bkey += b->GetPath();
224 
225  return akey.CmpNoCase(bkey) < 0;
226 }
wxString GetTranslatedName() const
wxString GetTranslatedVendor() const
const wxString & GetPath() const
bool IsEffectDefault() const
static bool SortEffectsByType ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 261 of file Menus.cpp.

References _(), EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), and PluginDescriptor::GetTranslatedName().

Referenced by AudacityProject::PopulateEffectsMenu().

262 {
263  auto &em = EffectManager::Get();
264  auto akey = em.GetEffectFamilyName(a->GetID());
265  auto bkey = em.GetEffectFamilyName(b->GetID());
266 
267  if (akey.IsEmpty())
268  {
269  akey = _("Uncategorized");
270  }
271  if (bkey.IsEmpty())
272  {
273  bkey = _("Uncategorized");
274  }
275 
276  akey += a->GetTranslatedName();
277  bkey += b->GetTranslatedName();
278 
279  akey += a->GetPath();
280  bkey += b->GetPath();
281 
282  return akey.CmpNoCase(bkey) < 0;
283 }
wxString GetTranslatedName() const
const wxString & GetPath() const
static EffectManager & Get()
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
const wxString & GetID() const
static bool SortEffectsByTypeAndName ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 228 of file Menus.cpp.

References _(), EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetTranslatedName(), and PluginDescriptor::IsEffectDefault().

Referenced by AudacityProject::PopulateEffectsMenu().

229 {
230  auto &em = EffectManager::Get();
231  auto akey = em.GetEffectFamilyName(a->GetID());
232  auto bkey = em.GetEffectFamilyName(b->GetID());
233 
234  if (akey.IsEmpty())
235  {
236  akey = _("Uncategorized");
237  }
238  if (bkey.IsEmpty())
239  {
240  bkey = _("Uncategorized");
241  }
242 
243  if (a->IsEffectDefault())
244  {
245  akey = wxEmptyString;
246  }
247  if (b->IsEffectDefault())
248  {
249  bkey = wxEmptyString;
250  }
251 
252  akey += a->GetTranslatedName();
253  bkey += b->GetTranslatedName();
254 
255  akey += a->GetPath();
256  bkey += b->GetPath();
257 
258  return akey.CmpNoCase(bkey) < 0;
259 }
wxString GetTranslatedName() const
const wxString & GetPath() const
static EffectManager & Get()
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
bool IsEffectDefault() const
const wxString & GetID() const