Audacity 3.2.0
Classes | Functions | Variables
anonymous_namespace{MenuCreator.cpp} Namespace Reference

Classes

struct  MenuBarListEntry
 
struct  MenuItemVisitor
 
struct  SubMenuListEntry
 

Functions

static wxString FormatLabelWithDisabledAccel (const CommandManager::CommandListEntry &entry)
 

Variables

Journal::RegisteredCommand sCommand
 

Detailed Description

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,

Function Documentation

◆ FormatLabelWithDisabledAccel()

static wxString anonymous_namespace{MenuCreator.cpp}::FormatLabelWithDisabledAccel ( const CommandManager::CommandListEntry entry)
static

Definition at line 267 of file MenuCreator.cpp.

268{
269 auto label = entry.label.Translation();
270#if 1
271 wxString Accel;
272 do{
273 if (!entry.key.empty())
274 {
275 // Dummy accelerator that looks Ok in menus but is non functional.
276 // Note the space before the key.
277#ifdef __WXMSW__
278 // using GET to compose menu item name for wxWidgets
279 auto key = entry.key.GET();
280 Accel = wxString("\t ") + key;
281 if( key.StartsWith("Left" )) break;
282 if( key.StartsWith("Right")) break;
283 if( key.StartsWith("Up" )) break;
284 if( key.StartsWith("Down")) break;
285 if( key.StartsWith("Return")) break;
286 if( key.StartsWith("Tab")) break;
287 if( key.StartsWith("Shift+Tab")) break;
288 if( key.StartsWith("0")) break;
289 if( key.StartsWith("1")) break;
290 if( key.StartsWith("2")) break;
291 if( key.StartsWith("3")) break;
292 if( key.StartsWith("4")) break;
293 if( key.StartsWith("5")) break;
294 if( key.StartsWith("6")) break;
295 if( key.StartsWith("7")) break;
296 if( key.StartsWith("8")) break;
297 if( key.StartsWith("9")) break;
298 // Uncomment the below so as not to add the illegal accelerators.
299 // Accel = "";
300 //if( entry.key.StartsWith("Space" )) break;
301 // These ones appear to be illegal already and mess up accelerator processing.
302 if( key.StartsWith("NUMPAD_ENTER" )) break;
303 if( key.StartsWith("Backspace" )) break;
304 if( key.StartsWith("Delete" )) break;
305
306 // https://github.com/audacity/audacity/issues/4457
307 // This code was proposed by David Bailes to fix
308 // the decimal separator input in wxTextCtrls that
309 // are children of the main window.
310 if( key.StartsWith(",") ) break;
311 if( key.StartsWith(".") ) break;
312
313 // https://github.com/audacity/audacity/issues/5868
314 // On German and Norwegian keyboards, [ and ] are
315 // AltGr 8 and AltGr 9. On Windows typing 8 or 9 match
316 // [ or ] repectively when they are accelerators in menus.
317 if ( key.StartsWith("[") ) break;
318 if ( key.StartsWith("]") ) break;
319
320#endif
321 //wxLogDebug("Added Accel:[%s][%s]", entry.label, entry.key );
322 // Normal accelerator.
323 // using GET to compose menu item name for wxWidgets
324 Accel = wxString("\t") + entry.key.GET();
325 }
326 } while (false );
327 label += Accel;
328#endif
329 return label;
330}
static ProjectFileIORegistry::AttributeWriterEntry entry
static const AudacityProject::AttachedObjects::RegisteredFactory key
TranslatableString label
Definition: TagsEditor.cpp:165

References entry, key, and label.

Referenced by anonymous_namespace{MenuCreator.cpp}::MenuItemVisitor::VisitEntry().

Here is the caller graph for this function:

Variable Documentation

◆ sCommand

Journal::RegisteredCommand anonymous_namespace{MenuCreator.cpp}::sCommand
Initial value:
[]( const wxArrayStringEx &fields )
{
bool handled = false;
if ( fields.size() == 2 ) {
if (auto project = GetActiveProject().lock()) {
auto pManager = &CommandManager::Get( *project );
auto flags = CommandManager::Get( *project ).GetUpdateFlags();
const CommandContext context( *project );
auto &command = fields[1];
handled =
pManager->HandleTextualCommand( command, context, flags, false );
}
}
return handled;
}
}
AUDACITY_DLL_API std::weak_ptr< AudacityProject > GetActiveProject()
constexpr auto JournalCode
const auto project
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
static CommandManager & Get(AudacityProject &project)
CommandFlag GetUpdateFlags(bool quick=false) const
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

Definition at line 546 of file MenuCreator.cpp.