11#ifndef __AUDACITY_LABEL_TRACK_VIEW__
12#define __AUDACITY_LABEL_TRACK_VIEW__
14#include "../../ui/CommonChannelView.h"
45 void Reparent(
const std::shared_ptr<Track> &parent )
override;
48 enum :
int { DefaultFontSize = 0 };
49 static constexpr int TextFramePadding { 2 };
50 static constexpr int TextFrameYOffset { -1 };
51 static constexpr int LabelBarHeight { 6 };
68 const wxString &
title = {},
69 int restoreFocus = -1);
80 (wxKeyEvent &event,
ViewInfo &viewInfo, wxWindow *pParent,
84 (wxKeyEvent &event,
ViewInfo &viewInfo, wxWindow *pParent,
88 (wxKeyEvent &event,
ViewInfo &viewInfo, wxWindow *pParent,
97 static void DoEditLabels(
100 static int DialogForLabelName(
102 const wxString& initialValue, wxString& value);
107 void CreateCustomGlyphs();
110 static wxFont GetFont(
const wxString &faceName,
int size = DefaultFontSize);
111 static void ResetFont();
119 bool PasteSelectedText(
122 static void OverGlyph(
126 static wxBitmap & GetGlyph(
int i);
132 operator int()
const;
133 Index &operator =(
int index);
134 Index &operator ++();
135 Index &operator --();
137 bool IsModified()
const;
138 void SetModified(
bool modified);
154 Flags SaveFlags()
const;
155 void RestoreFlags(
const Flags& flags );
157 static int OverATextBox(
const LabelTrack &track,
int xx,
int yy );
159 static bool OverTextBox(
const LabelStruct *pLabel,
int x,
int y );
162 static bool IsTextClipSupported();
170 int GetLabelIndex(
double t,
double t1);
178 void CalcHighlightXs(
int *x1,
int *x2)
const;
188 mutable Index mNavigationIndex{ -1 };
206 int mRestoreFocus{-2};
209 void ComputeTextPosition(
const wxRect & r,
int index)
const;
210 void ComputeLayout(
const wxRect & r,
const ZoomInfo &zoomInfo)
const;
211 static void DrawLines( wxDC & dc,
const LabelStruct &ls,
const wxRect & r);
212 static void DrawGlyphs( wxDC & dc,
const LabelStruct &ls,
const wxRect & r,
213 int GlyphLeft,
int GlyphRight);
214 static int GetTextFrameHeight();
215 static void DrawText( wxDC & dc,
const LabelStruct &ls,
const wxRect & r);
216 static void DrawTextBox( wxDC & dc,
const LabelStruct &ls,
const wxRect & r);
217 static void DrawBar(wxDC& dc,
const LabelStruct& ls,
const wxRect& r);
218 static void DrawHighlight(
219 wxDC & dc,
const LabelStruct &ls,
int xPos1,
int xPos2,
int charHeight);
223 int FindCursorPosition(
int labelIndex, wxCoord xPos);
225 void SetCurrentCursorPosition(
int pos);
230 void SetTextSelection(
int labelIndex,
int start = 1,
int end = 1);
232 void ResetTextSelection();
234 void SetNavigationIndex(
int index);
242 const wxRect &rect,
unsigned iPass )
override;
244 static void calculateFontHeight(wxDC & dc);
249 void RemoveSelectedText();
258 std::shared_ptr<LabelTrack> FindLabelTrack();
259 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
static ChannelView & Get(Channel &channel)
void CopyTo(Track &track) 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
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.
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)
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.