17#include "../../widgets/BasicMenu.h"
21#include "../../HitTestResult.h"
22#include "../../RefreshCode.h"
23#include "../../TrackPanelMouseEvent.h"
35 static wxCursor defaultCursor{ wxCURSOR_ARROW };
36 return { {}, &defaultCursor, {} };
41 -> std::vector<MenuItem>
47 wxWindow *pParent,
const wxPoint *pPoint,
AudacityProject *
const pProject)
49 const auto items =
GetMenuItems( rect, pPoint, pProject );
54 commandManager.UpdateMenus();
61 region = { time, time };
62 context.temporarySelection.pSelectedRegion = ®ion;
64 context.temporarySelection.pTrack =
FindTrack().get();
66 auto flags = commandManager.GetUpdateFlags();
69 auto dispatcher = [&]( wxCommandEvent &evt ){
70 auto idx = evt.GetId() - 1;
71 if (idx >= 0 && idx < items.size()) {
72 if (
auto &action = items[idx].action)
75 commandManager.HandleTextualCommand(
76 items[idx].symbol.Internal(), context, flags,
false);
82 for (
const auto &item: items) {
83 if (
const auto &commandID = item.symbol.Internal();
85 menu.AppendSeparator();
90 commandManager.FormatLabelForMenu( commandID, &item.symbol.Msgid() );
91 menu.Append( ii,
label );
92 menu.Bind( wxEVT_COMMAND_MENU_SELECTED, dispatcher );
93 bool enabled = item.enabled &&
94 (item.action || commandManager.GetEnabled( commandID ));
95 menu.Enable( ii, enabled );
102 point = { pPoint->
x, pPoint->y };
136 : mwChannel{ parent }
143 const std::shared_ptr<Track> &parent,
size_t iChannel)
151 if (
const auto pChannel =
mwChannel.lock())
152 pTrack =
dynamic_cast<Track *
>(&pChannel->GetChannelGroup());
Toolkit-neutral facade for basic user interface services.
declares abstract base class Track, TrackList, and iterators over TrackList
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
void Popup(const BasicUI::WindowPlacement &window, const Point &pos={})
Display the menu at pos, invoke at most one action, then hide it.
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
static CommandManager & Get(AudacityProject &project)
CommonChannelCell(const std::shared_ptr< Channel > &pChannel)
Construct from a channel.
std::shared_ptr< Track > DoFindTrack() override
void Reparent(const std::shared_ptr< Track > &parent, size_t iChannel) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
std::shared_ptr< Channel > DoFindChannel()
std::weak_ptr< Channel > mwChannel
std::shared_ptr< Track > DoFindTrack() override
void Reparent(const std::shared_ptr< Track > &parent) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
CommonTrackCell(const std::shared_ptr< Track > &pTrack)
Construct from a track.
std::weak_ptr< Track > mwTrack
unsigned HandleWheelRotation(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
HitTestPreview DefaultPreview(const TrackPanelMouseState &, const AudacityProject *) override
std::shared_ptr< Track > FindTrack()
virtual std::vector< MenuItem > GetMenuItems(const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject)
Return a list of items for DoContextMenu() (empties for separators)
virtual ~CommonTrackPanelCell()=0
unsigned DoContextMenu(const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
static stored_type & Get()
Get the installed value.
Defines a selected portion of a project.
Abstract base class for an object holding data associated with points on a time axis.
std::shared_ptr< Subclass > SharedPointer()
static ViewInfo & Get(AudacityProject &project)
double PositionToTime(int64 position, int64 origin=0, bool ignoreFisheye=false) const
A pair of screen coordinates, x increasing rightward, y downward.