16#include "../../../HitTestResult.h" 
   20#include "../../../RefreshCode.h" 
   22#include "../../../TrackPanelMouseEvent.h" 
   24#include "../../../../images/Cursors.h" 
   26#include <wx/clipbrd.h> 
   29( 
const std::shared_ptr<LabelTrack> &pLT, 
int labelNum )
 
   31   , mLabelNum{ labelNum }
 
   37#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING 
   44   static auto ibeamCursor =
 
   47      XO(
"Click to edit label text"),
 
   53(std::weak_ptr<LabelTextHandle> &holder,
 
   54 const wxMouseState &state, 
const std::shared_ptr<LabelTrack> &pLT)
 
   58   if (!state.ControlDown() &&
 
   61      auto result = std::make_shared<LabelTextHandle>( pLT, labelNum );
 
   80   auto pTrack = 
mpLT.lock();
 
   88      if ( selIndex != -1 ) {
 
   92            auto position = view.FindCursorPosition(selIndex, evt.m_x );
 
   98            auto initial = view.GetInitialCursorPosition();
 
   99            if (evt.ShiftDown()) {
 
  103               const auto current = view.GetCurrentCursorPosition();
 
  104               if ( abs( position - current ) > abs( position - initial ) )
 
  113            view.SetTextSelection(selIndex, initial, position );
 
  117            if (!view.IsTextSelected(
project))
 
  119               auto position = view.FindCursorPosition(selIndex, evt.m_x);
 
  120               view.SetTextSelection(selIndex, position, position);
 
  126#if defined(__WXGTK__) && (HAVE_GTK) 
  127         if (evt.MiddleDown()) {
 
  132               view.ResetTextSelection();
 
  133            double t = zoomInfo.PositionToTime(evt.m_x, r.x);
 
  138#if defined(__WXGTK__) && (HAVE_GTK) 
  139      if (evt.MiddleDown()) {
 
  141         wxTheClipboard->UsePrimarySelection(
true);
 
  142         view.PasteSelectedText(
project, newSel.t0(), newSel.t1());
 
  143         wxTheClipboard->UsePrimarySelection(
false);
 
  157   auto pLT = 
mpLT.lock();
 
  163   const wxMouseEvent &
event = evt.
event;
 
  174   auto pTrack = 
mpLT.lock();
 
  186#if defined (__WXGTK__) && defined (HAVE_GTK) 
  189      if (mInitialCursorPos != mCurrentCursorPos) {
 
  190         wxTheClipboard->UsePrimarySelection(
true);
 
  192         wxTheClipboard->UsePrimarySelection(
false);
 
  202      auto index = view.GetTextEditIndex(
project);
 
  205         view.SetCurrentCursorPosition(view.FindCursorPosition(index, evt.m_x ));
 
  211      auto index = view.GetTextEditIndex(
project);
 
  217         view.ShowContextMenu( 
project );
 
  231   const wxMouseEvent &
event = evt.
event;
 
  237   if (event.LeftIsDown()) {
 
  243         if (pLT && (pView->GetTextEditIndex( 
project ) != -1) &&
 
  245               pLT->GetLabel(pView->GetTextEditIndex( 
project )),
 
  274   const wxMouseEvent &
event = evt.
event;
 
std::shared_ptr< UIHandle > UIHandlePtr
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Cancel(AudacityProject *pProject) override
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
Result Cancel(AudacityProject *pProject) override
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
void HandleTextDragRelease(AudacityProject &project, const wxMouseEvent &evt)
virtual ~LabelTextHandle()
static UIHandlePtr HitTest(std::weak_ptr< LabelTextHandle > &holder, const wxMouseState &state, const std::shared_ptr< LabelTrack > &pLT)
void HandleTextClick(AudacityProject &project, const wxMouseEvent &evt)
bool mRightDragging
flag to tell if it's a valid dragging
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
void Enter(bool forward, AudacityProject *) override
LabelTextHandle(const std::shared_ptr< LabelTrack > &pLT, int labelNum)
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
static HitTestPreview HitPreview()
std::shared_ptr< const Track > FindTrack() const override
std::weak_ptr< LabelTrack > mpLT
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
static LabelTrackView & Get(LabelTrack &)
static bool OverTextBox(const LabelStruct *pLabel, int x, int y)
static int OverATextBox(const LabelTrack &track, int xx, int yy)
Defines a selected portion of a project.
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
static TrackList & Get(AudacityProject &project)
static ViewInfo & Get(AudacityProject &project)
Namespace containing an enum 'what to do on a refresh?'.