Audacity 3.2.0
|
#include <LabelTrackView.h>
Classes | |
struct | Flags |
struct | Index |
Public Types | |
enum | : int { DefaultFontSize = 0 } |
Public Types inherited from ChannelView | |
enum | : unsigned { DefaultHeight = 150 } |
using | Refinement = std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > > |
Public Member Functions | |
LabelTrackView (const std::shared_ptr< Channel > &pChannel) | |
~LabelTrackView () override | |
bool | DoCaptureKey (AudacityProject &project, wxKeyEvent &event) |
bool | DoKeyDown (AudacityProject &project, NotifyingSelectedRegion &sel, wxKeyEvent &event) |
KeyEvent is called for every keypress when over the label track. More... | |
bool | DoChar (AudacityProject &project, NotifyingSelectedRegion &sel, wxKeyEvent &event) |
int | AddLabel (const SelectedRegion ®ion, const wxString &title={}, int restoreFocus=-1) |
bool | IsTextSelected (AudacityProject &project) const |
void | Draw (TrackPanelDrawingContext &context, const wxRect &r) const |
bool | CutSelectedText (AudacityProject &project) |
bool | CopySelectedText (AudacityProject &project) |
bool | SelectAllText (AudacityProject &project) |
bool | PasteSelectedText (AudacityProject &project, double sel0, double sel1) |
void | ResetFlags () |
Flags | SaveFlags () const |
void | RestoreFlags (const Flags &flags) |
void | AddedLabel (const wxString &title, int pos) |
void | DeletedLabel (int index) |
bool | CalcCursorX (AudacityProject &project, int *x) const |
void | ShowContextMenu (AudacityProject &project) |
int | FindCursorPosition (int labelIndex, wxCoord xPos) |
convert pixel coordinate to character position in text box More... | |
int | GetCurrentCursorPosition () const |
void | SetCurrentCursorPosition (int pos) |
int | GetInitialCursorPosition () const |
void | SetTextSelection (int labelIndex, int start=1, int end=1) |
int | GetTextEditIndex (AudacityProject &project) const |
void | ResetTextSelection () |
void | SetNavigationIndex (int index) |
int | GetNavigationIndex (AudacityProject &project) const |
Public Member Functions inherited from CommonChannelView | |
std::shared_ptr< TrackPanelCell > | ContextMenuDelegate () override |
std::vector< UIHandlePtr > | HitTest (const TrackPanelMouseState &, const AudacityProject *pProject) final |
void | TimeShiftHitTest () |
virtual int | GetMinimizedHeight () const override |
ChannelView (const std::shared_ptr< Channel > &pChannel) | |
Public Member Functions inherited from ChannelView | |
ChannelView (const std::shared_ptr< Channel > &pChannel) | |
virtual | ~ChannelView ()=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. More... | |
void | CopyTo (Track &track, size_t iChannel) const override |
Copy state, for undo/redo purposes. More... | |
bool | GetMinimized () const |
void | SetMinimized (bool minimized) |
int | GetCumulativeHeightBefore () const |
int | GetExpandedHeight () const |
virtual int | GetMinimizedHeight () const =0 |
int | GetHeight () const |
void | SetCumulativeHeightBefore (int y) |
Set cached value dependent on position within the track list. More... | |
void | SetExpandedHeight (int height) |
std::shared_ptr< ChannelVRulerControls > | GetVRulerControls () |
std::shared_ptr< const ChannelVRulerControls > | GetVRulerControls () const |
virtual std::shared_ptr< CommonTrackCell > | GetAffordanceControls () |
void | WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const override |
Serialize persistent attributes. More... | |
bool | HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel) override |
Deserialize an attribute, returning true if recognized. More... | |
virtual Refinement | GetSubViews (const wxRect &rect) |
virtual bool | IsSpectral () const |
virtual void | DoSetMinimized (bool isMinimized) |
Public Member Functions inherited from CommonChannelCell | |
CommonChannelCell (const std::shared_ptr< Channel > &pChannel) | |
Construct from a channel. More... | |
~CommonChannelCell () | |
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. More... | |
template<typename Subtype = Channel> | |
auto | FindChannel () -> std::shared_ptr< Subtype > |
May return null. More... | |
template<typename Subtype = const Channel> | |
auto | FindChannel () const -> std::enable_if_t< std::is_const_v< Subtype >, std::shared_ptr< Subtype > > |
May return null. More... | |
Public Member Functions inherited from CommonTrackPanelCell | |
CommonTrackPanelCell () | |
virtual | ~CommonTrackPanelCell ()=0 |
HitTestPreview | DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override |
std::shared_ptr< Track > | FindTrack () |
std::shared_ptr< const Track > | FindTrack () const |
virtual std::vector< MenuItem > | GetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject) |
Return a list of items for DoContextMenu() (empties for separators) More... | |
Public Member Functions inherited from TrackPanelCell | |
TrackPanelCell ()=default | |
TrackPanelCell (const TrackPanelCell &)=delete | |
TrackPanelCell & | operator= (const TrackPanelCell &)=delete |
virtual | ~TrackPanelCell ()=0 |
virtual HitTestPreview | DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject) |
virtual std::vector< UIHandlePtr > | HitTest (const TrackPanelMouseState &state, const AudacityProject *pProject)=0 |
virtual unsigned | HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) |
virtual std::shared_ptr< TrackPanelCell > | ContextMenuDelegate () |
virtual unsigned | DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) |
virtual unsigned | CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
virtual unsigned | KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
virtual unsigned | KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
virtual unsigned | Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
virtual unsigned | LoseFocus (AudacityProject *project) |
Public Member Functions inherited from TrackPanelNode | |
TrackPanelNode () | |
virtual | ~TrackPanelNode ()=0 |
Public Member Functions inherited from TrackPanelDrawable | |
virtual | ~TrackPanelDrawable ()=0 |
virtual void | Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) |
virtual wxRect | DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass) |
Public Member Functions inherited from ChannelAttachment | |
virtual | ~ChannelAttachment () |
virtual void | CopyTo (Track &track, size_t iChannel) const |
Copy state, for undo/redo purposes. More... | |
virtual void | Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) |
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More... | |
virtual void | WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const |
Serialize persistent attributes. More... | |
virtual bool | HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel) |
Deserialize an attribute, returning true if recognized. More... | |
Static Public Member Functions | |
static LabelTrackView & | Get (LabelTrack &) |
static const LabelTrackView & | Get (const LabelTrack &) |
static void | DoEditLabels (AudacityProject &project, LabelTrack *lt=nullptr, int index=-1) |
static int | DialogForLabelName (AudacityProject &project, const SelectedRegion ®ion, const wxString &initialValue, wxString &value) |
static wxFont | GetFont (const wxString &faceName, int size=DefaultFontSize) |
static void | ResetFont () |
static void | OverGlyph (const LabelTrack &track, LabelTrackHit &hit, int x, int y) |
static int | OverATextBox (const LabelTrack &track, int xx, int yy) |
static bool | OverTextBox (const LabelStruct *pLabel, int x, int y) |
Static Public Member Functions inherited from CommonChannelView | |
static void | GetEnvelopeValues (const Envelope &env, double aligned_time, double sampleDur, double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo) |
Get many envelope points for pixel columns at once, but don't assume uniform time per pixel. More... | |
Static Public Member Functions inherited from ChannelView | |
static ChannelView & | Get (Channel &channel) |
static const ChannelView & | Get (const Channel &channel) |
static ChannelView * | Find (Channel *pChannel) |
static const ChannelView * | Find (const Channel *pChannel) |
static int | GetChannelGroupHeight (const Track *pTrack) |
static int | GetCumulativeHeight (const Channel *pChannel) |
static int | GetCumulativeHeight (const Track *pTrack) |
static int | GetTotalHeight (const TrackList &list) |
Static Public Member Functions inherited from TrackPanelDrawable | |
static wxRect | MaximizeWidth (const wxRect &rect, const wxRect &panelRect) |
static wxRect | MaximizeHeight (const wxRect &rect, const wxRect &panelRect) |
Static Public Attributes | |
static constexpr int | TextFramePadding { 2 } |
static constexpr int | TextFrameYOffset { -1 } |
static constexpr int | LabelBarHeight { 6 } |
Private Member Functions | |
LabelTrackView (const LabelTrackView &)=delete | |
LabelTrackView & | operator= (const LabelTrackView &)=delete |
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. More... | |
void | BindTo (LabelTrack *pParent) |
std::vector< UIHandlePtr > | DetailedHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override |
unsigned | CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override |
unsigned | KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override |
unsigned | Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override |
std::shared_ptr< ChannelVRulerControls > | DoGetVRulerControls () override |
void | CopyTo (Track &track, size_t iChannel) const override |
Copy state, for undo/redo purposes. More... | |
void | CreateCustomGlyphs () |
int | GetLabelIndex (double t, double t1) |
void | CalcHighlightXs (int *x1, int *x2) const |
void | OnContextMenu (AudacityProject &project, wxCommandEvent &evt) |
void | ComputeTextPosition (const wxRect &r, int index) const |
void | ComputeLayout (const wxRect &r, const ZoomInfo &zoomInfo) const |
void | Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override |
bool | IsValidIndex (const Index &index, AudacityProject &project) const |
void | RemoveSelectedText () |
void | OnLabelAdded (const LabelTrackEvent &) |
void | OnLabelDeleted (const LabelTrackEvent &) |
void | OnLabelPermuted (const LabelTrackEvent &) |
void | OnSelectionChange (const LabelTrackEvent &) |
std::shared_ptr< LabelTrack > | FindLabelTrack () |
std::shared_ptr< const LabelTrack > | FindLabelTrack () const |
Static Private Member Functions | |
static wxBitmap & | GetGlyph (int i) |
static bool | IsTextClipSupported () |
static void | DrawLines (wxDC &dc, const LabelStruct &ls, const wxRect &r) |
static void | DrawGlyphs (wxDC &dc, const LabelStruct &ls, const wxRect &r, int GlyphLeft, int GlyphRight) |
static int | GetTextFrameHeight () |
static void | DrawText (wxDC &dc, const LabelStruct &ls, const wxRect &r) |
static void | DrawTextBox (wxDC &dc, const LabelStruct &ls, const wxRect &r) |
static void | DrawBar (wxDC &dc, const LabelStruct &ls, const wxRect &r) |
static void | DrawHighlight (wxDC &dc, const LabelStruct &ls, int xPos1, int xPos2, int charHeight) |
Draws text-selected region within the label. More... | |
static void | calculateFontHeight (wxDC &dc) |
Private Attributes | |
Index | mNavigationIndex { -1 } |
Index | mTextEditIndex { -1 } |
Index of the current label text being edited. More... | |
wxString | mUndoLabel |
int | mCurrentCursorPos |
int | mInitialCursorPos |
current cursor position More... | |
int | mRestoreFocus {-2} |
initial cursor position More... | |
Observer::Subscription | mSubscription |
std::weak_ptr< LabelGlyphHandle > | mGlyphHandle |
std::weak_ptr< LabelTextHandle > | mTextHandle |
int | mEditIndex |
Static Private Attributes | |
static int | mIconHeight |
static int | mIconWidth |
static int | mTextHeight |
static bool | mbGlyphsReady =false |
static wxBitmap | mBoundaryGlyphs [NUM_GLYPH_CONFIGS *NUM_GLYPH_HIGHLIGHTS] |
static int | mFontHeight =-1 |
static wxFont | msFont |
Additional Inherited Members | |
Public Attributes inherited from CommonChannelView | |
std::weak_ptr< TimeShiftHandle > | mTimeShiftHandle |
Public Attributes inherited from ChannelView | |
std::pair< int, int > | vrulerSize |
virtual std::vector< UIHandlePtr > | DetailedHitTest (const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0 |
virtual std::shared_ptr< ChannelVRulerControls > | DoGetVRulerControls ()=0 |
Protected Member Functions inherited from CommonTrackPanelCell | |
virtual std::shared_ptr< Track > | DoFindTrack ()=0 |
unsigned | DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override |
unsigned | HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override |
Protected Attributes inherited from CommonChannelView | |
std::weak_ptr< SelectHandle > | mSelectHandle |
Protected Attributes inherited from ChannelView | |
std::shared_ptr< ChannelVRulerControls > | mpVRulerControls |
Definition at line 40 of file LabelTrackView.h.
anonymous enum : int |
|
privatedelete |
|
explicit |
Definition at line 100 of file LabelTrackView.cpp.
References BindTo(), CreateCustomGlyphs(), FindLabelTrack(), ResetFlags(), and ResetFont().
|
override |
Definition at line 112 of file LabelTrackView.cpp.
void LabelTrackView::AddedLabel | ( | const wxString & | title, |
int | pos | ||
) |
int LabelTrackView::AddLabel | ( | const SelectedRegion & | region, |
const wxString & | title = {} , |
||
int | restoreFocus = -1 |
||
) |
Definition at line 2071 of file LabelTrackView.cpp.
References FindLabelTrack(), mRestoreFocus, and title.
Referenced by anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), DoChar(), and PasteSelectedText().
|
private |
Definition at line 127 of file LabelTrackView.cpp.
References mSubscription, Observer::Publisher< Message, NotifyAll >::Subscribe(), and LabelTrackEvent::type.
Referenced by LabelTrackView(), and Reparent().
bool LabelTrackView::CalcCursorX | ( | AudacityProject & | project, |
int * | x | ||
) | const |
Definition at line 699 of file LabelTrackView.cpp.
References FindLabelTrack(), anonymous_namespace{LabelTrackView.cpp}::getXPos(), IsValidIndex(), mCurrentCursorPos, mIconWidth, msFont, mTextEditIndex, and project.
Referenced by KeyDown(), and ShowContextMenu().
|
private |
Definition at line 719 of file LabelTrackView.cpp.
References FindLabelTrack(), anonymous_namespace{LabelTrackView.cpp}::getXPos(), mCurrentCursorPos, mInitialCursorPos, msFont, mTextEditIndex, and anonymous_namespace{NoteTrack.cpp}::swap().
Referenced by Draw().
|
staticprivate |
Definition at line 1010 of file LabelTrackView.cpp.
References mFontHeight, and wxT().
Referenced by Draw().
|
overrideprivatevirtual |
Reimplemented from TrackPanelCell.
Definition at line 1408 of file LabelTrackView.cpp.
References DoCaptureKey(), project, and RefreshCode::RefreshNone.
|
overrideprivatevirtual |
Reimplemented from TrackPanelCell.
Definition at line 1460 of file LabelTrackView.cpp.
References CONSOLIDATE, DoChar(), FindLabelTrack(), ProjectHistory::Get(), LabelTrackView::Index::IsModified(), IsValidIndex(), mTextEditIndex, mUndoLabel, NONE, project, ProjectHistory::PushState(), RefreshCode::RefreshAll, RefreshCode::RefreshCell, RefreshCode::RefreshNone, ViewInfo::selectedRegion, LabelTrackView::Index::SetModified(), NotifyingSelectedRegion::t0(), NotifyingSelectedRegion::t1(), title, and XO().
|
private |
ComputeLayout determines which row each label should be placed on, and reserves space for it. Function assumes that the labels are sorted.
Definition at line 427 of file LabelTrackView.cpp.
References ComputeTextPosition(), FindLabelTrack(), MAX_NUM_ROWS, mIconHeight, mIconWidth, mTextHeight, and ZoomInfo::TimeToPosition().
Referenced by Draw().
|
private |
Restore focus to this track when done editing
ComputeTextPosition is 'smart' about where to display the label text.
The text must be displayed between its endpoints x and x1 We'd also like it centered between them, and we'd like it on screen. It isn't always possible to achieve all of this, so we do the best we can.
This function has a number of tests and adjustments to the text start position. The tests later in the function will take priority over the ones earlier, so because centering is the first thing we do, it's the first thing we lose if we can't do everything we want to.
Definition at line 280 of file LabelTrackView.cpp.
References FindLabelTrack(), and mIconWidth.
Referenced by ComputeLayout().
bool LabelTrackView::CopySelectedText | ( | AudacityProject & | project | ) |
Copy the selected text in the text box
Definition at line 1099 of file LabelTrackView.cpp.
References FindLabelTrack(), IsTextSelected(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, project, safenew, and anonymous_namespace{NoteTrack.cpp}::swap().
Referenced by OnContextMenu().
|
overrideprivatevirtual |
Copy state, for undo/redo purposes.
iChannel | position of the attachment's channel in the group The default does nothing |
Reimplemented from ChannelAttachment.
Definition at line 146 of file LabelTrackView.cpp.
References ChannelView::CopyTo(), ChannelView::Get(), ChannelGroup::GetChannel(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, mCurrentCursorPos, mInitialCursorPos, mNavigationIndex, mTextEditIndex, and mUndoLabel.
|
private |
CreateCustomGlyphs() creates the mBoundaryGlyph array. It's a bit like painting by numbers!
Schematically the glyphs we want will 'look like': <O, O> and <O> for a left boundary to a label, a right boundary and both. we're creating all three glyphs using the one Xpm Spec.
When we hover over a glyph we highlight the inside of either the '<', the 'O' or the '>' or none, giving 3 x 4 = 12 combinations.
Two of those combinations aren't used, but treating them specially would make other code more complicated.
Definition at line 2211 of file LabelTrackView.cpp.
References GlyphXpmRegionSpec, mbGlyphsReady, mBoundaryGlyphs, mIconHeight, mIconWidth, mTextHeight, NUM_GLYPH_CONFIGS, NUM_GLYPH_HIGHLIGHTS, and safenew.
Referenced by LabelTrackView().
bool LabelTrackView::CutSelectedText | ( | AudacityProject & | project | ) |
Cut the selected text in the text box
Definition at line 1046 of file LabelTrackView.cpp.
References FindLabelTrack(), LabelTrackView::Index::IsModified(), IsTextSelected(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, mUndoLabel, project, safenew, LabelTrackView::Index::SetModified(), and anonymous_namespace{NoteTrack.cpp}::swap().
Referenced by OnContextMenu().
void LabelTrackView::DeletedLabel | ( | int | index | ) |
|
overrideprivatevirtual |
Implements CommonChannelView.
Definition at line 180 of file LabelTrackView.cpp.
References FindLabelTrack(), LabelGlyphHandle::HitTest(), LabelTextHandle::HitTest(), mGlyphHandle, mTextHandle, TrackPanelMouseState::rect, and TrackPanelMouseState::state.
|
static |
Definition at line 2285 of file LabelTrackView.cpp.
References TrackFocus::Get(), ViewInfo::Get(), TrackPanel::Get(), ZoomInfo::GetLeftOffset(), GetProjectFrame(), project, SelectedRegion::t0(), ZoomInfo::TimeToPosition(), and XO().
Referenced by anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), and DoChar().
bool LabelTrackView::DoCaptureKey | ( | AudacityProject & | project, |
wxKeyEvent & | event | ||
) |
Definition at line 1339 of file LabelTrackView.cpp.
References FindLabelTrack(), AudioIOBase::Get(), ViewInfo::Get(), GetLabelIndex(), gPrefs, IsGoodLabelEditKey(), IsGoodLabelFirstKey(), IsValidIndex(), mTextEditIndex, project, audacity::BasicSettings::Read(), ViewInfo::selectedRegion, and wxT().
Referenced by CaptureKey().
bool LabelTrackView::DoChar | ( | AudacityProject & | project, |
NotifyingSelectedRegion & | sel, | ||
wxKeyEvent & | event | ||
) |
OnChar is called for incoming characters – that's any keypress not handled by OnKeyDown.
Definition at line 1791 of file LabelTrackView.cpp.
References AddLabel(), DialogForLabelName(), FindLabelTrack(), ProjectHistory::Get(), ViewInfo::Get(), gPrefs, IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, project, ProjectHistory::PushState(), audacity::BasicSettings::Read(), RemoveSelectedText(), ViewInfo::selectedRegion, title, wxT(), and XO().
Referenced by Char().
|
static |
Definition at line 2261 of file LabelTrackView.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, ProjectNumericFormats::Get(), ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), GetProjectFrame(), project, ProjectHistory::PushState(), tracks, and XO().
Referenced by anonymous_namespace{LabelMenus.cpp}::OnEditLabels(), and ShowContextMenu().
|
overrideprivatevirtual |
Implements ChannelView.
Definition at line 2341 of file LabelTrackView.cpp.
bool LabelTrackView::DoKeyDown | ( | AudacityProject & | project, |
NotifyingSelectedRegion & | sel, | ||
wxKeyEvent & | event | ||
) |
KeyEvent is called for every keypress when over the label track.
Definition at line 1500 of file LabelTrackView.cpp.
References TrackList::Any(), CONSOLIDATE, FindLabelTrack(), TrackFocus::Get(), ProjectHistory::Get(), TrackList::Get(), Viewport::Get(), IsGoodLabelEditKey(), IsGoodLabelFirstKey(), LabelTrackView::Index::IsModified(), IsValidIndex(), mCurrentCursorPos, min(), mInitialCursorPos, mNavigationIndex, mRestoreFocus, mTextEditIndex, mUndoLabel, NONE, project, ProjectHistory::PushState(), RemoveSelectedText(), ResetTextSelection(), Viewport::ScrollIntoView(), SetNavigationIndex(), SetTextSelection(), ShowContextMenu(), NotifyingSelectedRegion::t0(), title, and XO().
Referenced by KeyDown().
void LabelTrackView::Draw | ( | TrackPanelDrawingContext & | context, |
const wxRect & | r | ||
) | const |
Draw calls other functions to draw the LabelTrack.
dc | the device context |
r | the LabelTrack rectangle. |
Definition at line 765 of file LabelTrackView.cpp.
References CalcHighlightXs(), calculateFontHeight(), ThemeBase::Colour(), ComputeLayout(), TrackPanelDrawingContext::dc, TrackArt::DrawBackgroundWithSelection(), DrawBar(), DrawGlyphs(), DrawHighlight(), DrawLines(), DrawText(), DrawTextBox(), CommonChannelCell::FindChannel(), anonymous_namespace{LabelTrackView.cpp}::findHit(), CommonTrackPanelCell::FindTrack(), LabelTextHandle::FindTrack(), TrackArtist::Get(), LabelTrack::GetLabels(), SyncLock::IsSelectedOrSyncLockSelected(), IsValidIndex(), LabelBarHeight, AColor::labelSelectedBrush, AColor::labelSurroundPen, AColor::labelTextEditBrush, AColor::labelTextNormalBrush, AColor::labelUnselectedBrush, AColor::Line(), mCurrentCursorPos, mFontHeight, mInitialCursorPos, mNavigationIndex, msFont, mTextEditIndex, mTextHeight, project, TrackPanelDrawingContext::target, TextFramePadding, TextFrameYOffset, theTheme, and AColor::uglyBrush.
Referenced by Draw().
|
overrideprivatevirtual |
Reimplemented from TrackPanelDrawable.
Definition at line 912 of file LabelTrackView.cpp.
References Draw(), TrackPanelDrawable::Draw(), and TrackArtist::PassTracks.
|
staticprivate |
Definition at line 645 of file LabelTrackView.cpp.
References GetTextFrameHeight(), LabelBarHeight, mIconWidth, LabelStruct::x, LabelStruct::x1, and LabelStruct::y.
Referenced by Draw().
|
staticprivate |
DrawGlyphs draws the wxIcons at the start and end of a label.
dc | the device context |
r | the LabelTrack rectangle. |
Definition at line 553 of file LabelTrackView.cpp.
References GetGlyph(), mIconHeight, mIconWidth, mTextHeight, LabelStruct::x, LabelStruct::x1, and LabelStruct::y.
Referenced by Draw().
|
staticprivate |
Draws text-selected region within the label.
Definition at line 670 of file LabelTrackView.cpp.
References LabelBarHeight, mTextHeight, TextFramePadding, TextFrameYOffset, wxT(), and LabelStruct::y.
Referenced by Draw().
|
staticprivate |
Draw vertical lines that go exactly through the position of the start or end of a label.
dc | the device context |
r | the LabelTrack rectangle. |
Definition at line 502 of file LabelTrackView.cpp.
References LabelStruct::getT0(), LabelStruct::getT1(), AColor::Line(), mIconHeight, mTextHeight, LabelStruct::x, LabelStruct::x1, and LabelStruct::y.
Referenced by Draw().
|
staticprivate |
Draw the text of the label and also draw a long thin rectangle for its full extent from x to x1 and a rectangular frame behind the text itself.
dc | the device context |
r | the LabelTrack rectangle. |
Definition at line 588 of file LabelTrackView.cpp.
References LabelBarHeight, mFontHeight, mIconWidth, mTextHeight, TextFramePadding, TextFrameYOffset, LabelStruct::title, LabelStruct::width, LabelStruct::xText, and LabelStruct::y.
Referenced by Draw().
|
staticprivate |
Definition at line 618 of file LabelTrackView.cpp.
References GetTextFrameHeight(), LabelBarHeight, mIconWidth, TextFrameYOffset, LabelStruct::width, LabelStruct::xText, and LabelStruct::y.
Referenced by Draw().
int LabelTrackView::FindCursorPosition | ( | int | labelIndex, |
wxCoord | xPos | ||
) |
convert pixel coordinate to character position in text box
uses GetTextExtent to find the character position corresponding to the x pixel position.
Definition at line 923 of file LabelTrackView.cpp.
References FindLabelTrack(), msFont, and title.
|
private |
Definition at line 170 of file LabelTrackView.cpp.
Referenced by AddLabel(), CalcCursorX(), CalcHighlightXs(), Char(), ComputeLayout(), ComputeTextPosition(), CopySelectedText(), CutSelectedText(), DetailedHitTest(), DoCaptureKey(), DoChar(), DoKeyDown(), FindCursorPosition(), FindLabelTrack(), GetLabelIndex(), IsValidIndex(), KeyDown(), LabelTrackView(), OnContextMenu(), OnLabelAdded(), OnLabelDeleted(), OnLabelPermuted(), OnSelectionChange(), PasteSelectedText(), RemoveSelectedText(), Reparent(), SelectAllText(), and ShowContextMenu().
|
private |
Definition at line 175 of file LabelTrackView.cpp.
References FindLabelTrack().
|
static |
Definition at line 165 of file LabelTrackView.cpp.
References ChannelView::Get().
|
static |
Definition at line 160 of file LabelTrackView.cpp.
References ChannelView::Get().
Referenced by SetLabelCommand::Apply(), LabelDefaultClickHandle::Click(), anonymous_namespace{EditMenus.cpp}::CutCopyAvailableFlag(), anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), anonymous_namespace{EditMenus.cpp}::DoPasteText(), LabelTextHandle::Drag(), LabelGlyphHandle::HandleGlyphClick(), LabelGlyphHandle::HandleGlyphDragRelease(), LabelTextHandle::HandleTextClick(), LabelTextHandle::HandleTextDragRelease(), LabelTrackShifter::HitTest(), anonymous_namespace{EditMenus.cpp}::OnCopy(), anonymous_namespace{EditMenus.cpp}::OnCut(), anonymous_namespace{LabelMenus.cpp}::OnPasteNewLabel(), SelectActions::Handler::OnSelectAll(), LabelDefaultClickHandle::RestoreState(), LabelDefaultClickHandle::SaveState(), and LabelDialog::TransferDataFromWindow().
|
inline |
Definition at line 225 of file LabelTrackView.h.
|
static |
Definition at line 243 of file LabelTrackView.cpp.
References size.
Referenced by LabelTrackMenuTable::OnSetFont(), and ResetFont().
|
staticprivate |
Definition at line 2151 of file LabelTrackView.cpp.
References ThemeBase::Bitmap(), and theTheme.
Referenced by DrawGlyphs().
|
inline |
Definition at line 227 of file LabelTrackView.h.
|
private |
Definition at line 2045 of file LabelTrackView.cpp.
References FindLabelTrack().
Referenced by DoCaptureKey().
int LabelTrackView::GetNavigationIndex | ( | AudacityProject & | project | ) | const |
Definition at line 1003 of file LabelTrackView.cpp.
References IsValidIndex(), mNavigationIndex, and project.
Referenced by LabelTrackShifter::HitTest().
int LabelTrackView::GetTextEditIndex | ( | AudacityProject & | project | ) | const |
Definition at line 987 of file LabelTrackView.cpp.
References IsValidIndex(), mTextEditIndex, and project.
Referenced by anonymous_namespace{EditMenus.cpp}::DoPasteText().
|
staticprivate |
Definition at line 577 of file LabelTrackView.cpp.
References mTextHeight, and TextFramePadding.
Referenced by DrawBar(), and DrawTextBox().
|
staticprivate |
Definition at line 1202 of file LabelTrackView.cpp.
Referenced by PasteSelectedText(), and ShowContextMenu().
bool LabelTrackView::IsTextSelected | ( | AudacityProject & | project | ) | const |
Definition at line 1039 of file LabelTrackView.cpp.
References IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, and project.
Referenced by CopySelectedText(), anonymous_namespace{EditMenus.cpp}::CutCopyAvailableFlag(), CutSelectedText(), and ShowContextMenu().
|
private |
Definition at line 1028 of file LabelTrackView.cpp.
References FindLabelTrack(), TrackFocus::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), and project.
Referenced by CalcCursorX(), Char(), DoCaptureKey(), DoChar(), DoKeyDown(), Draw(), GetNavigationIndex(), GetTextEditIndex(), IsTextSelected(), KeyDown(), OnContextMenu(), PasteSelectedText(), SelectAllText(), and ShowContextMenu().
|
overrideprivatevirtual |
Reimplemented from TrackPanelCell.
Definition at line 1415 of file LabelTrackView.cpp.
References CalcCursorX(), CONSOLIDATE, DoKeyDown(), FindLabelTrack(), ProjectHistory::Get(), Viewport::Get(), LabelTrackView::Index::IsModified(), IsValidIndex(), mTextEditIndex, mUndoLabel, NONE, project, ProjectHistory::PushState(), RefreshCode::RefreshAll, RefreshCode::RefreshCell, RefreshCode::RefreshNone, Viewport::ScrollIntoView(), ViewInfo::selectedRegion, LabelTrackView::Index::SetModified(), NotifyingSelectedRegion::t0(), NotifyingSelectedRegion::t1(), title, and XO().
|
private |
Cut selected text if cut menu item is selected
Copy selected text if copy menu item is selected
paste selected text if paste menu item is selected
DELETE selected label
Definition at line 1958 of file LabelTrackView.cpp.
References CONSOLIDATE, CopySelectedText(), CutSelectedText(), FindLabelTrack(), ProjectHistory::Get(), ViewInfo::Get(), LabelTrackView::Index::IsModified(), IsValidIndex(), mEditIndex, mTextEditIndex, NONE, OnCopySelectedTextID, OnCutSelectedTextID, OnDeleteSelectedLabelID, OnEditSelectedLabelID, OnPasteSelectedTextID, PasteSelectedText(), project, ProjectHistory::PushState(), ViewInfo::selectedRegion, and XO().
Referenced by ShowContextMenu().
|
private |
Definition at line 2080 of file LabelTrackView.cpp.
References FindLabelTrack(), mCurrentCursorPos, mInitialCursorPos, LabelTrackEvent::mPresentPosition, LabelTrackEvent::mpTrack, mRestoreFocus, mTextEditIndex, LabelTrackEvent::mTitle, and title.
|
private |
Definition at line 2101 of file LabelTrackView.cpp.
References FindLabelTrack(), LabelTrackEvent::mFormerPosition, LabelTrackEvent::mpTrack, mTextEditIndex, and ResetTextSelection().
|
private |
Definition at line 2119 of file LabelTrackView.cpp.
References FindLabelTrack(), LabelTrackEvent::mFormerPosition, mNavigationIndex, LabelTrackEvent::mPresentPosition, LabelTrackEvent::mpTrack, and mTextEditIndex.
|
private |
Definition at line 2139 of file LabelTrackView.cpp.
References FindLabelTrack(), LabelTrackEvent::mpTrack, ResetTextSelection(), and SetNavigationIndex().
|
privatedelete |
|
static |
Definition at line 1278 of file LabelTrackView.cpp.
References LabelTrack::GetLabels(), and OverTextBox().
Referenced by LabelTextHandle::HandleTextClick(), LabelTrackShifter::HitTest(), and LabelTextHandle::HitTest().
|
static |
TODO: Investigate what happens with large numbers of labels, might need a binary search rather than a linear one.
Definition at line 1210 of file LabelTrackView.cpp.
References LabelTrack::GetLabels(), LabelTrackHit::mEdge, LabelTrackHit::mMouseOverLabel, LabelTrackHit::mMouseOverLabelLeft, LabelTrackHit::mMouseOverLabelRight, mTextHeight, and OverTextBox().
Referenced by LabelGlyphHandle::HandleGlyphClick(), and LabelGlyphHandle::HitTest().
|
static |
Definition at line 1292 of file LabelTrackView.cpp.
References mIconHeight, mIconWidth, LabelStruct::width, LabelStruct::xText, and LabelStruct::y.
Referenced by LabelTextHandle::Drag(), LabelTextHandle::HandleTextClick(), LabelTextHandle::HandleTextDragRelease(), OverATextBox(), and OverGlyph().
bool LabelTrackView::PasteSelectedText | ( | AudacityProject & | project, |
double | sel0, | ||
double | sel1 | ||
) |
Paste the text on the clipboard to text box
Definition at line 1133 of file LabelTrackView.cpp.
References AddLabel(), FindLabelTrack(), LabelTrackView::Index::IsModified(), IsTextClipSupported(), IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, mUndoLabel, project, LabelTrackView::Index::SetModified(), SetTextSelection(), anonymous_namespace{NoteTrack.cpp}::swap(), title, and wxT().
Referenced by OnContextMenu().
|
private |
Definition at line 2013 of file LabelTrackView.cpp.
References FindLabelTrack(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, anonymous_namespace{NoteTrack.cpp}::swap(), and title.
Referenced by DoChar(), and DoKeyDown().
|
overrideprivatevirtual |
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
iChannel | position of the attachment's channel in the group The default does nothing |
Reimplemented from ChannelAttachment.
Definition at line 116 of file LabelTrackView.cpp.
References BindTo(), FindLabelTrack(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and ChannelView::Reparent().
void LabelTrackView::ResetFlags | ( | ) |
Definition at line 219 of file LabelTrackView.cpp.
References mCurrentCursorPos, mInitialCursorPos, mNavigationIndex, and mTextEditIndex.
Referenced by LabelTrackView().
|
static |
Definition at line 259 of file LabelTrackView.cpp.
References DefaultFontSize, GetFont(), gPrefs, mFontHeight, msFont, audacity::BasicSettings::Read(), size, and wxT().
Referenced by LabelTrackView(), and LabelTrackMenuTable::OnSetFont().
void LabelTrackView::ResetTextSelection | ( | ) |
Definition at line 993 of file LabelTrackView.cpp.
References mCurrentCursorPos, mInitialCursorPos, and mTextEditIndex.
Referenced by DoKeyDown(), OnLabelDeleted(), anonymous_namespace{LabelMenus.cpp}::OnPasteNewLabel(), OnSelectionChange(), and LabelDialog::TransferDataFromWindow().
void LabelTrackView::RestoreFlags | ( | const Flags & | flags | ) |
Definition at line 235 of file LabelTrackView.cpp.
References LabelTrackView::Flags::mCurrentCursorPos, mCurrentCursorPos, LabelTrackView::Flags::mInitialCursorPos, mInitialCursorPos, LabelTrackView::Flags::mNavigationIndex, mNavigationIndex, LabelTrackView::Flags::mTextEditIndex, and mTextEditIndex.
LabelTrackView::Flags LabelTrackView::SaveFlags | ( | ) | const |
Definition at line 227 of file LabelTrackView.cpp.
References mCurrentCursorPos, mInitialCursorPos, mNavigationIndex, mTextEditIndex, and mUndoLabel.
bool LabelTrackView::SelectAllText | ( | AudacityProject & | project | ) |
Definition at line 1184 of file LabelTrackView.cpp.
References FindLabelTrack(), IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, project, and title.
void LabelTrackView::SetCurrentCursorPosition | ( | int | pos | ) |
Definition at line 977 of file LabelTrackView.cpp.
References mCurrentCursorPos.
void LabelTrackView::SetNavigationIndex | ( | int | index | ) |
Definition at line 999 of file LabelTrackView.cpp.
References mNavigationIndex.
Referenced by DoKeyDown(), and OnSelectionChange().
void LabelTrackView::SetTextSelection | ( | int | labelIndex, |
int | start = 1 , |
||
int | end = 1 |
||
) |
Sets the label with specified index for editing, optionally selection may be specified with [start, end]
Definition at line 981 of file LabelTrackView.cpp.
References details::end(), mCurrentCursorPos, mInitialCursorPos, and mTextEditIndex.
Referenced by DoKeyDown(), and PasteSelectedText().
void LabelTrackView::ShowContextMenu | ( | AudacityProject & | project | ) |
Definition at line 1895 of file LabelTrackView.cpp.
References _, CalcCursorX(), DoEditLabels(), BasicUI::FindFocus(), FindLabelTrack(), GetProjectFrame(), IsTextClipSupported(), IsTextSelected(), IsValidIndex(), mEditIndex, mIconHeight, msFont, mTextEditIndex, OnContextMenu(), OnCopySelectedTextID, OnCutSelectedTextID, OnDeleteSelectedLabelID, OnEditSelectedLabelID, OnPasteSelectedTextID, BasicMenu::Handle::Popup(), project, and LabelStruct::y.
Referenced by DoKeyDown().
|
staticconstexpr |
Definition at line 52 of file LabelTrackView.h.
Referenced by Draw(), DrawBar(), DrawHighlight(), DrawText(), and DrawTextBox().
|
staticprivate |
Definition at line 199 of file LabelTrackView.h.
Referenced by CreateCustomGlyphs().
|
staticprivate |
We have several variants of the icons (highlighting). The icons are draggable, and you can drag one boundary or all boundaries at the same timecode depending on whether you click the centre (for all) or the arrow part (for one). Currently we have twelve variants but we're only using six.
Definition at line 200 of file LabelTrackView.h.
Referenced by CreateCustomGlyphs().
|
mutableprivate |
Definition at line 203 of file LabelTrackView.h.
Referenced by CalcCursorX(), CalcHighlightXs(), CopySelectedText(), CopyTo(), CutSelectedText(), DoChar(), DoKeyDown(), Draw(), IsTextSelected(), OnLabelAdded(), PasteSelectedText(), RemoveSelectedText(), ResetFlags(), ResetTextSelection(), RestoreFlags(), SaveFlags(), SelectAllText(), SetCurrentCursorPosition(), and SetTextSelection().
|
private |
Definition at line 268 of file LabelTrackView.h.
Referenced by OnContextMenu(), and ShowContextMenu().
|
staticprivate |
Definition at line 202 of file LabelTrackView.h.
Referenced by calculateFontHeight(), Draw(), DrawText(), and ResetFont().
|
private |
Definition at line 262 of file LabelTrackView.h.
Referenced by DetailedHitTest().
|
staticprivate |
Definition at line 195 of file LabelTrackView.h.
Referenced by ComputeLayout(), CreateCustomGlyphs(), DrawGlyphs(), DrawLines(), OverTextBox(), and ShowContextMenu().
|
staticprivate |
Definition at line 196 of file LabelTrackView.h.
Referenced by CalcCursorX(), ComputeLayout(), ComputeTextPosition(), CreateCustomGlyphs(), DrawBar(), DrawGlyphs(), DrawText(), DrawTextBox(), and OverTextBox().
|
mutableprivate |
current cursor position
Definition at line 204 of file LabelTrackView.h.
Referenced by CalcHighlightXs(), CopySelectedText(), CopyTo(), CutSelectedText(), DoChar(), DoKeyDown(), Draw(), IsTextSelected(), OnLabelAdded(), PasteSelectedText(), RemoveSelectedText(), ResetFlags(), ResetTextSelection(), RestoreFlags(), SaveFlags(), SelectAllText(), and SetTextSelection().
|
mutableprivate |
Keeps track of the currently selected label (not same as selection region) used for navigation between labels
Definition at line 189 of file LabelTrackView.h.
Referenced by CopyTo(), DoKeyDown(), Draw(), GetNavigationIndex(), OnLabelPermuted(), ResetFlags(), RestoreFlags(), SaveFlags(), and SetNavigationIndex().
|
private |
initial cursor position
Definition at line 207 of file LabelTrackView.h.
Referenced by AddLabel(), DoKeyDown(), and OnLabelAdded().
|
staticprivate |
Definition at line 265 of file LabelTrackView.h.
Referenced by CalcCursorX(), CalcHighlightXs(), Draw(), FindCursorPosition(), ResetFont(), and ShowContextMenu().
|
private |
Definition at line 257 of file LabelTrackView.h.
Referenced by BindTo().
|
mutableprivate |
Index of the current label text being edited.
Definition at line 191 of file LabelTrackView.h.
Referenced by CalcCursorX(), CalcHighlightXs(), Char(), CopySelectedText(), CopyTo(), CutSelectedText(), DoCaptureKey(), DoChar(), DoKeyDown(), Draw(), GetTextEditIndex(), IsTextSelected(), KeyDown(), OnContextMenu(), OnLabelAdded(), OnLabelDeleted(), OnLabelPermuted(), PasteSelectedText(), RemoveSelectedText(), ResetFlags(), ResetTextSelection(), RestoreFlags(), SaveFlags(), SelectAllText(), SetTextSelection(), and ShowContextMenu().
|
private |
Definition at line 263 of file LabelTrackView.h.
Referenced by DetailedHitTest().
|
staticprivate |
Definition at line 197 of file LabelTrackView.h.
Referenced by ComputeLayout(), CreateCustomGlyphs(), Draw(), DrawGlyphs(), DrawHighlight(), DrawLines(), DrawText(), GetTextFrameHeight(), and OverGlyph().
|
mutableprivate |
Definition at line 193 of file LabelTrackView.h.
Referenced by Char(), CopyTo(), CutSelectedText(), DoKeyDown(), KeyDown(), PasteSelectedText(), and SaveFlags().
|
staticconstexpr |
Definition at line 50 of file LabelTrackView.h.
Referenced by Draw(), DrawHighlight(), DrawText(), and GetTextFrameHeight().
|
staticconstexpr |
Definition at line 51 of file LabelTrackView.h.
Referenced by Draw(), DrawHighlight(), DrawText(), and DrawTextBox().