11#ifndef __AUDACITY_LABEL_TRACK_VIEW__
12#define __AUDACITY_LABEL_TRACK_VIEW__
14#include "../../ui/CommonChannelView.h"
49 enum :
int { DefaultFontSize = 0 };
50 static constexpr int TextFramePadding { 2 };
51 static constexpr int TextFrameYOffset { -1 };
52 static constexpr int LabelBarHeight { 6 };
69 const wxString &
title = {},
70 int restoreFocus = -1);
81 (wxKeyEvent &event,
ViewInfo &viewInfo, wxWindow *pParent,
85 (wxKeyEvent &event,
ViewInfo &viewInfo, wxWindow *pParent,
89 (wxKeyEvent &event,
ViewInfo &viewInfo, wxWindow *pParent,
98 static void DoEditLabels(
101 static int DialogForLabelName(
103 const wxString& initialValue, wxString& value);
108 void CreateCustomGlyphs();
111 static wxFont GetFont(
const wxString &faceName,
int size = DefaultFontSize);
112 static void ResetFont();
120 bool PasteSelectedText(
123 static void OverGlyph(
127 static wxBitmap & GetGlyph(
int i);
133 operator int()
const;
134 Index &operator =(
int index);
135 Index &operator ++();
136 Index &operator --();
138 bool IsModified()
const;
139 void SetModified(
bool modified);
155 Flags SaveFlags()
const;
156 void RestoreFlags(
const Flags& flags );
158 static int OverATextBox(
const LabelTrack &track,
int xx,
int yy );
160 static bool OverTextBox(
const LabelStruct *pLabel,
int x,
int y );
163 static bool IsTextClipSupported();
171 int GetLabelIndex(
double t,
double t1);
179 void CalcHighlightXs(
int *x1,
int *x2)
const;
189 mutable Index mNavigationIndex{ -1 };
207 int mRestoreFocus{-2};
210 void ComputeTextPosition(
const wxRect & r,
int index)
const;
211 void ComputeLayout(
const wxRect & r,
const ZoomInfo &zoomInfo)
const;
212 static void DrawLines( wxDC & dc,
const LabelStruct &ls,
const wxRect & r);
213 static void DrawGlyphs( wxDC & dc,
const LabelStruct &ls,
const wxRect & r,
214 int GlyphLeft,
int GlyphRight);
215 static int GetTextFrameHeight();
216 static void DrawText( wxDC & dc,
const LabelStruct &ls,
const wxRect & r);
217 static void DrawTextBox( wxDC & dc,
const LabelStruct &ls,
const wxRect & r);
218 static void DrawBar(wxDC& dc,
const LabelStruct& ls,
const wxRect& r);
219 static void DrawHighlight(
220 wxDC & dc,
const LabelStruct &ls,
int xPos1,
int xPos2,
int charHeight);
224 int FindCursorPosition(
int labelIndex, wxCoord xPos);
226 void SetCurrentCursorPosition(
int pos);
231 void SetTextSelection(
int labelIndex,
int start = 1,
int end = 1);
233 void ResetTextSelection();
235 void SetNavigationIndex(
int index);
243 const wxRect &rect,
unsigned iPass )
override;
245 static void calculateFontHeight(wxDC & dc);
250 void RemoveSelectedText();
259 std::shared_ptr<LabelTrack> FindLabelTrack();
260 std::shared_ptr<const LabelTrack> FindLabelTrack()
const;
constexpr int NUM_GLYPH_HIGHLIGHTS
constexpr int MAX_NUM_ROWS
constexpr int NUM_GLYPH_CONFIGS
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
virtual std::shared_ptr< ChannelVRulerControls > DoGetVRulerControls()=0
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.
static ChannelView & Get(Channel &channel)
void CopyTo(Track &track, size_t iChannel) const override
Copy state, for undo/redo purposes.
Implements some hit-testing shared by many ChannelView subtypes.
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
A LabelStruct holds information for ONE label in a LabelTrack.
A LabelTrack is a Track that holds labels (LabelStruct).
int GetInitialCursorPosition() const
int GetCurrentCursorPosition() const
void DeletedLabel(int index)
static bool mbGlyphsReady
LabelTrackView & operator=(const LabelTrackView &)=delete
void AddedLabel(const wxString &title, int pos)
int mInitialCursorPos
current cursor position
LabelTrackView(const LabelTrackView &)=delete
std::weak_ptr< LabelTextHandle > mTextHandle
std::weak_ptr< LabelGlyphHandle > mGlyphHandle
Observer::Subscription mSubscription
A move-only handle representing a connection to a Publisher.
Defines a selected portion of a project.
Abstract base class for an object holding data associated with points on a time axis.
virtual unsigned KeyDown(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned Char(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
const char * end(const char *str) noexcept