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

Namespace for functions for View Toolbar menu. More...

Functions

void SetTool (AudacityProject &project, int tool)
 Called by handlers that set tools. More...
 
void OnSelectTool (const CommandContext &context)
 Handler to set the select tool active. More...
 
void OnEnvelopeTool (const CommandContext &context)
 Handler to set the Envelope tool active. More...
 
void OnDrawTool (const CommandContext &context)
 
void OnMultiTool (const CommandContext &context)
 
void OnPrevTool (const CommandContext &context)
 
void OnNextTool (const CommandContext &context)
 
BaseItemSharedPtr ExtraToolsMenu ()
 

Variables

AttachedToolBarMenuItem sAttachment
 
AttachedItem sAttachment2
 

Detailed Description

Namespace for functions for View Toolbar menu.

Function Documentation

◆ ExtraToolsMenu()

BaseItemSharedPtr anonymous_namespace{ToolsToolBar.cpp}::ExtraToolsMenu ( )

Definition at line 337 of file ToolsToolBar.cpp.

338{
339 static BaseItemSharedPtr menu{
340 Menu( wxT("Tools"), XXO("T&ools"),
341 Command( wxT("SelectTool"), XXO("&Selection Tool"), OnSelectTool,
342 AlwaysEnabledFlag, wxT("F1") ),
343 Command( wxT("EnvelopeTool"), XXO("&Envelope Tool"),
345 Command( wxT("DrawTool"), XXO("&Draw Tool"), OnDrawTool,
346 AlwaysEnabledFlag, wxT("F3") ),
347 Command( wxT("MultiTool"), XXO("&Multi Tool"), OnMultiTool,
348 AlwaysEnabledFlag, wxT("F6") ),
349 Command( wxT("PrevTool"), XXO("&Previous Tool"), OnPrevTool,
350 AlwaysEnabledFlag, wxT("A") ),
351 Command( wxT("NextTool"), XXO("&Next Tool"), OnNextTool,
352 AlwaysEnabledFlag, wxT("D") )
353 ) };
354 return menu;
355}
wxT("CloseDown"))
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:34
XXO("&Cut/Copy/Paste Toolbar")
constexpr auto Menu
constexpr auto Command
std::shared_ptr< BaseItem > BaseItemSharedPtr
Definition: Registry.h:74
void OnNextTool(const CommandContext &context)
void OnPrevTool(const CommandContext &context)
void OnMultiTool(const CommandContext &context)
void OnSelectTool(const CommandContext &context)
Handler to set the select tool active.
void OnEnvelopeTool(const CommandContext &context)
Handler to set the Envelope tool active.
void OnDrawTool(const CommandContext &context)

References AlwaysEnabledFlag, MenuTable::Command, MenuTable::Menu, OnDrawTool(), OnEnvelopeTool(), OnMultiTool(), OnNextTool(), OnPrevTool(), OnSelectTool(), wxT(), and XXO().

Here is the call graph for this function:

◆ OnDrawTool()

void anonymous_namespace{ToolsToolBar.cpp}::OnDrawTool ( const CommandContext context)

Definition at line 305 of file ToolsToolBar.cpp.

306{
308}
AudacityProject & project
void SetTool(AudacityProject &project, int tool)
Called by handlers that set tools.

References ToolCodes::drawTool, CommandContext::project, and SetTool().

Referenced by ExtraToolsMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnEnvelopeTool()

void anonymous_namespace{ToolsToolBar.cpp}::OnEnvelopeTool ( const CommandContext context)

Handler to set the Envelope tool active.

Definition at line 300 of file ToolsToolBar.cpp.

301{
303}

References ToolCodes::envelopeTool, CommandContext::project, and SetTool().

Referenced by ExtraToolsMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMultiTool()

void anonymous_namespace{ToolsToolBar.cpp}::OnMultiTool ( const CommandContext context)

Definition at line 310 of file ToolsToolBar.cpp.

311{
313}

References ToolCodes::multiTool, CommandContext::project, and SetTool().

Referenced by ExtraToolsMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnNextTool()

void anonymous_namespace{ToolsToolBar.cpp}::OnNextTool ( const CommandContext context)

Definition at line 326 of file ToolsToolBar.cpp.

327{
328 auto &project = context.project;
329 auto &trackPanel = TrackPanel::Get( project );
330 auto &settings = ProjectSettings::Get( project );
331
332 settings.SetTool( (settings.GetTool() + 1) % ToolCodes::numTools );
333 trackPanel.Refresh(false);
334}
static Settings & settings()
Definition: TrackInfo.cpp:83
static ProjectSettings & Get(AudacityProject &project)
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:231

References ProjectSettings::Get(), TrackPanel::Get(), ToolCodes::numTools, CommandContext::project, and settings().

Referenced by ExtraToolsMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPrevTool()

void anonymous_namespace{ToolsToolBar.cpp}::OnPrevTool ( const CommandContext context)

Definition at line 315 of file ToolsToolBar.cpp.

316{
317 auto &project = context.project;
318 auto &trackPanel = TrackPanel::Get( project );
319 auto &settings = ProjectSettings::Get( project );
320
321 settings.SetTool(
322 (settings.GetTool() + (ToolCodes::numTools - 1 )) % ToolCodes::numTools);
323 trackPanel.Refresh(false);
324}

References ProjectSettings::Get(), TrackPanel::Get(), ToolCodes::numTools, CommandContext::project, and settings().

Referenced by ExtraToolsMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSelectTool()

void anonymous_namespace{ToolsToolBar.cpp}::OnSelectTool ( const CommandContext context)

Handler to set the select tool active.

Definition at line 294 of file ToolsToolBar.cpp.

295{
297}

References CommandContext::project, ToolCodes::selectTool, and SetTool().

Referenced by ExtraToolsMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTool()

void anonymous_namespace{ToolsToolBar.cpp}::SetTool ( AudacityProject project,
int  tool 
)

Called by handlers that set tools.

Definition at line 277 of file ToolsToolBar.cpp.

278{
279 auto toolbar = &ToolsToolBar::Get( project );
280 if (toolbar) {
281 ProjectSettings::Get(project).SetTool(tool);
282 TrackPanel::Get( project ).Refresh(false);
283 }
284}
void SetTool(int tool)
static ToolsToolBar & Get(AudacityProject &project)
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
Definition: TrackPanel.cpp:781

References ProjectSettings::Get(), ToolsToolBar::Get(), TrackPanel::Get(), TrackPanel::Refresh(), and ProjectSettings::SetTool().

Referenced by OnDrawTool(), OnEnvelopeTool(), OnMultiTool(), and OnSelectTool().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sAttachment

AttachedToolBarMenuItem anonymous_namespace{ToolsToolBar.cpp}::sAttachment
Initial value:
{
ToolsToolBar::ID(), wxT("ShowToolsTB"), XXO("T&ools Toolbar"),
}
static Identifier ID()

Definition at line 262 of file ToolsToolBar.cpp.

◆ sAttachment2

AttachedItem anonymous_namespace{ToolsToolBar.cpp}::sAttachment2
Initial value:
{
wxT("Optional/Extra/Part1"),
}
std::unique_ptr< IndirectItem > Indirect(const BaseItemSharedPtr &ptr)
A convenience function.
Definition: Registry.h:97

Definition at line 357 of file ToolsToolBar.cpp.