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/AudacityCommand.h"
#include "commands/CommandContext.h"
#include "commands/ScreenshotCommand.h"
#include "TrackPanelAx.h"
#include "tracks/ui/TimeShiftHandle.h"
#include "./prefs/SpectrogramSettings.h"
#include "./prefs/WaveformSettings.h"

Go to the source code of this file.

Macros

#define FN(X)   ident, static_cast<CommandFunctorPointer>(& AudacityProject :: X)
 
#define XXO(X)   _(X), wxString{X}.Contains("...")
 

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)
#define XXO (   X)    _(X), wxString{X}.Contains("...")

Definition at line 301 of file Menus.cpp.

Referenced by AudacityProject::CreateMenusAndCommands().

Enumeration Type Documentation

anonymous enum
Enumerator
kAlignStartZero 
kAlignStartSelStart 
kAlignStartSelEnd 
kAlignEndSelStart 
kAlignEndSelEnd 
kAlignEndToEnd 
kAlignTogether 

Definition at line 145 of file Menus.cpp.

145  {
146  kAlignStartZero = 0,
151  // The next two are only in one subMenu, so more easily handled at the end.
154 };
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 158 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 298 of file Menus.cpp.

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

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

Definition at line 177 of file Menus.cpp.

References PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), and IdentInterfaceSymbol::Translation().

Referenced by AudacityProject::PopulateEffectsMenu().

178 {
179  auto akey = a->GetSymbol().Translation();
180  auto bkey = b->GetSymbol().Translation();
181 
182  akey += a->GetPath();
183  bkey += b->GetPath();
184 
185  return akey.CmpNoCase(bkey) < 0;
186 }
const wxString & Translation() const
const wxString & GetPath() const
const IdentInterfaceSymbol & GetSymbol() const
static bool SortEffectsByPublisher ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 188 of file Menus.cpp.

References _(), EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), and IdentInterfaceSymbol::Translation().

Referenced by AudacityProject::PopulateEffectsMenu().

189 {
190  auto &em = EffectManager::Get();
191  auto akey = em.GetVendorName(a->GetID());
192  auto bkey = em.GetVendorName(b->GetID());
193 
194  if (akey.IsEmpty())
195  {
196  akey = _("Uncategorized");
197  }
198  if (bkey.IsEmpty())
199  {
200  bkey = _("Uncategorized");
201  }
202 
203  akey += a->GetSymbol().Translation();
204  bkey += b->GetSymbol().Translation();
205 
206  akey += a->GetPath();
207  bkey += b->GetPath();
208 
209  return akey.CmpNoCase(bkey) < 0;
210 }
const wxString & Translation() const
const wxString & GetPath() const
const IdentInterfaceSymbol & GetSymbol() const
static EffectManager & Get()
_("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
const wxString & GetID() const
static bool SortEffectsByPublisherAndName ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 212 of file Menus.cpp.

References EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), PluginDescriptor::IsEffectDefault(), and IdentInterfaceSymbol::Translation().

Referenced by AudacityProject::PopulateEffectsMenu().

213 {
214  auto &em = EffectManager::Get();
215  auto akey = em.GetVendorName(a->GetID());
216  auto bkey = em.GetVendorName(b->GetID());
217 
218  if (a->IsEffectDefault())
219  {
220  akey = wxEmptyString;
221  }
222  if (b->IsEffectDefault())
223  {
224  bkey = wxEmptyString;
225  }
226 
227  akey += a->GetSymbol().Translation();
228  bkey += b->GetSymbol().Translation();
229 
230  akey += a->GetPath();
231  bkey += b->GetPath();
232 
233  return akey.CmpNoCase(bkey) < 0;
234 }
const wxString & Translation() const
const wxString & GetPath() const
const IdentInterfaceSymbol & GetSymbol() const
static EffectManager & Get()
bool IsEffectDefault() const
const wxString & GetID() const
static bool SortEffectsByType ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 269 of file Menus.cpp.

References _(), EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), and IdentInterfaceSymbol::Translation().

Referenced by AudacityProject::PopulateEffectsMenu().

270 {
271  auto &em = EffectManager::Get();
272  auto akey = em.GetEffectFamilyName(a->GetID());
273  auto bkey = em.GetEffectFamilyName(b->GetID());
274 
275  if (akey.IsEmpty())
276  {
277  akey = _("Uncategorized");
278  }
279  if (bkey.IsEmpty())
280  {
281  bkey = _("Uncategorized");
282  }
283 
284  akey += a->GetSymbol().Translation();
285  bkey += b->GetSymbol().Translation();
286 
287  akey += a->GetPath();
288  bkey += b->GetPath();
289 
290  return akey.CmpNoCase(bkey) < 0;
291 }
const wxString & Translation() const
const wxString & GetPath() const
const IdentInterfaceSymbol & GetSymbol() const
static EffectManager & Get()
_("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
const wxString & GetID() const
static bool SortEffectsByTypeAndName ( const PluginDescriptor a,
const PluginDescriptor b 
)
static

Definition at line 236 of file Menus.cpp.

References _(), EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), PluginDescriptor::IsEffectDefault(), and IdentInterfaceSymbol::Translation().

Referenced by AudacityProject::PopulateEffectsMenu().

237 {
238  auto &em = EffectManager::Get();
239  auto akey = em.GetEffectFamilyName(a->GetID());
240  auto bkey = em.GetEffectFamilyName(b->GetID());
241 
242  if (akey.IsEmpty())
243  {
244  akey = _("Uncategorized");
245  }
246  if (bkey.IsEmpty())
247  {
248  bkey = _("Uncategorized");
249  }
250 
251  if (a->IsEffectDefault())
252  {
253  akey = wxEmptyString;
254  }
255  if (b->IsEffectDefault())
256  {
257  bkey = wxEmptyString;
258  }
259 
260  akey += a->GetSymbol().Translation();
261  bkey += b->GetSymbol().Translation();
262 
263  akey += a->GetPath();
264  bkey += b->GetPath();
265 
266  return akey.CmpNoCase(bkey) < 0;
267 }
const wxString & Translation() const
const wxString & GetPath() const
const IdentInterfaceSymbol & GetSymbol() const
static EffectManager & Get()
_("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
bool IsEffectDefault() const
const wxString & GetID() const