![]() |
Audacity 3.2.0
|
#include <LabelTrackView.h>
Classes | |
struct | Flags |
struct | Index |
Public Types | |
enum | : int { DefaultFontSize = 0 } |
![]() | |
enum | : unsigned { DefaultHeight = 150 } |
using | Refinement = std::vector< std::pair< wxCoord, std::shared_ptr< TrackView > > > |
Public Member Functions | |
LabelTrackView (const std::shared_ptr< Track > &pTrack) | |
~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 |
![]() | |
std::shared_ptr< TrackPanelCell > | ContextMenuDelegate () override |
std::vector< UIHandlePtr > | HitTest (const TrackPanelMouseState &, const AudacityProject *pProject) final override |
void | TimeShiftHitTest () |
virtual int | GetMinimizedHeight () const override |
TrackView (const std::shared_ptr< Track > &pTrack) | |
![]() | |
TrackView (const std::shared_ptr< Track > &pTrack) | |
virtual | ~TrackView ()=0 |
void | CopyTo (Track &track) 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< TrackVRulerControls > | GetVRulerControls () |
std::shared_ptr< const TrackVRulerControls > | GetVRulerControls () const |
virtual std::shared_ptr< CommonTrackCell > | GetAffordanceControls () |
void | WriteXMLAttributes (XMLWriter &) const override |
Serialize persistent attributes. More... | |
bool | HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView) override |
Deserialize an attribute, returning true if recognized. More... | |
virtual Refinement | GetSubViews (const wxRect &rect) |
virtual bool | IsSpectral () const |
virtual void | DoSetMinimized (bool isMinimized) |
![]() | |
CommonTrackCell (const std::shared_ptr< Track > &pTrack) | |
~CommonTrackCell () | |
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. More... | |
![]() | |
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... | |
![]() | |
TrackPanelCell ()=default | |
TrackPanelCell (const TrackPanelCell &) PROHIBITED | |
TrackPanelCell & | operator= (const TrackPanelCell &) PROHIBITED |
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) |
![]() | |
TrackPanelNode () | |
virtual | ~TrackPanelNode ()=0 |
![]() | |
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) |
![]() | |
virtual | ~TrackAttachment () |
virtual void | CopyTo (Track &track) const |
Copy state, for undo/redo purposes. More... | |
virtual void | Reparent (const std::shared_ptr< Track > &parent) |
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More... | |
virtual void | WriteXMLAttributes (XMLWriter &) const |
Serialize persistent attributes. More... | |
virtual bool | HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView) |
Deserialize an attribute, returning true if recognized. More... | |
![]() | |
virtual | ~Base () |
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 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 int | GetTrackHeight (const Track *pTrack) |
static int | GetChannelGroupHeight (const Track *pTrack) |
static int | GetCumulativeHeight (const Track *pTrack) |
static int | GetTotalHeight (const TrackList &list) |
static TrackView & | Get (Track &) |
static const TrackView & | Get (const Track &) |
static TrackView * | Find (Track *) |
static const TrackView * | Find (const Track *) |
![]() | |
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) 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< TrackVRulerControls > | DoGetVRulerControls () override |
void | CopyTo (Track &track) 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 | |
![]() | |
std::weak_ptr< TimeShiftHandle > | mTimeShiftHandle |
virtual std::vector< UIHandlePtr > | DetailedHitTest (const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0 |
virtual std::shared_ptr< TrackVRulerControls > | DoGetVRulerControls ()=0 |
![]() | |
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 |
![]() | |
std::weak_ptr< SelectHandle > | mSelectHandle |
![]() | |
std::shared_ptr< TrackVRulerControls > | mpVRulerControls |
Definition at line 40 of file LabelTrackView.h.
anonymous enum : int |
|
privatedelete |
|
explicit |
Definition at line 99 of file LabelTrackView.cpp.
References BindTo(), CreateCustomGlyphs(), FindLabelTrack(), ResetFlags(), and ResetFont().
|
override |
Definition at line 111 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 2081 of file LabelTrackView.cpp.
References FindLabelTrack(), mRestoreFocus, and title.
Referenced by anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), DoChar(), and PasteSelectedText().
|
private |
Definition at line 124 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 714 of file LabelTrackView.cpp.
References FindLabelTrack(), anonymous_namespace{LabelTrackView.cpp}::getXPos(), IsValidIndex(), mCurrentCursorPos, mIconWidth, msFont, and mTextEditIndex.
Referenced by KeyDown(), and ShowContextMenu().
|
private |
Definition at line 734 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 1021 of file LabelTrackView.cpp.
References mFontHeight, and wxT().
Referenced by Draw().
|
overrideprivatevirtual |
Reimplemented from TrackPanelCell.
Definition at line 1419 of file LabelTrackView.cpp.
References DoCaptureKey(), and RefreshCode::RefreshNone.
|
overrideprivatevirtual |
Reimplemented from TrackPanelCell.
Definition at line 1471 of file LabelTrackView.cpp.
References CONSOLIDATE, DoChar(), FindLabelTrack(), ProjectHistory::Get(), LabelTrackView::Index::IsModified(), IsValidIndex(), mTextEditIndex, mUndoLabel, NONE, 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 424 of file LabelTrackView.cpp.
References ComputeTextPosition(), FindLabelTrack(), gPrefs, MAX_NUM_ROWS, mIconHeight, mIconWidth, mTextHeight, ZoomInfo::TimeToPosition(), and wxT().
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 277 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 1110 of file LabelTrackView.cpp.
References FindLabelTrack(), IsTextSelected(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, safenew, and anonymous_namespace{NoteTrack.cpp}::swap().
Referenced by OnContextMenu().
|
overrideprivatevirtual |
Copy state, for undo/redo purposes.
Reimplemented from TrackAttachment.
Definition at line 143 of file LabelTrackView.cpp.
References TrackView::CopyTo(), TrackView::Get(), 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 2221 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 1057 of file LabelTrackView.cpp.
References FindLabelTrack(), LabelTrackView::Index::IsModified(), IsTextSelected(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, mUndoLabel, safenew, LabelTrackView::Index::SetModified(), and anonymous_namespace{NoteTrack.cpp}::swap().
Referenced by OnContextMenu().
void LabelTrackView::DeletedLabel | ( | int | index | ) |
|
overrideprivatevirtual |
Implements CommonTrackView.
Definition at line 177 of file LabelTrackView.cpp.
References FindLabelTrack(), LabelGlyphHandle::HitTest(), LabelTextHandle::HitTest(), mGlyphHandle, mTextHandle, TrackPanelMouseState::rect, and TrackPanelMouseState::state.
|
static |
Definition at line 2296 of file LabelTrackView.cpp.
References TrackFocus::Get(), ViewInfo::Get(), TrackPanel::Get(), ZoomInfo::GetLeftOffset(), GetProjectFrame(), 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 1350 of file LabelTrackView.cpp.
References FindLabelTrack(), AudioIOBase::Get(), ViewInfo::Get(), GetLabelIndex(), gPrefs, IsGoodLabelEditKey(), IsGoodLabelFirstKey(), IsValidIndex(), mTextEditIndex, 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 1802 of file LabelTrackView.cpp.
References AddLabel(), DialogForLabelName(), FindLabelTrack(), ProjectHistory::Get(), ViewInfo::Get(), gPrefs, IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, ProjectHistory::PushState(), RemoveSelectedText(), ViewInfo::selectedRegion, title, wxT(), and XO().
Referenced by Char().
|
static |
Definition at line 2271 of file LabelTrackView.cpp.
References format, ProjectNumericFormats::Get(), ProjectHistory::Get(), ProjectRate::Get(), ViewInfo::Get(), TrackList::Get(), ProjectWindow::Get(), ProjectRate::GetRate(), ProjectHistory::PushState(), and XO().
Referenced by anonymous_namespace{LabelMenus.cpp}::OnEditLabels(), and ShowContextMenu().
|
overrideprivatevirtual |
Implements TrackView.
Definition at line 2351 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 1511 of file LabelTrackView.cpp.
References TrackList::Any(), CONSOLIDATE, FindLabelTrack(), TrackFocus::Get(), ProjectHistory::Get(), TrackList::Get(), ProjectWindow::Get(), IsGoodLabelEditKey(), IsGoodLabelFirstKey(), LabelTrackView::Index::IsModified(), IsValidIndex(), mCurrentCursorPos, min(), mInitialCursorPos, mNavigationIndex, mRestoreFocus, mTextEditIndex, mUndoLabel, NONE, ProjectHistory::PushState(), RemoveSelectedText(), ResetTextSelection(), ProjectWindow::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 780 of file LabelTrackView.cpp.
References CalcHighlightXs(), calculateFontHeight(), ThemeBase::Colour(), ComputeLayout(), TrackPanelDrawingContext::dc, TrackArt::DrawBackgroundWithSelection(), DrawBar(), DrawGlyphs(), DrawHighlight(), DrawLines(), DrawText(), DrawTextBox(), anonymous_namespace{LabelTrackView.cpp}::findHit(), CommonTrackPanelCell::FindTrack(), TrackArtist::Get(), LabelTextHandle::GetTrack(), SyncLock::IsSelectedOrSyncLockSelected(), IsValidIndex(), LabelBarHeight, AColor::labelSelectedBrush, AColor::labelSurroundPen, AColor::labelTextEditBrush, AColor::labelTextNormalBrush, AColor::labelUnselectedBrush, AColor::Line(), mCurrentCursorPos, mFontHeight, mInitialCursorPos, mNavigationIndex, msFont, mTextEditIndex, mTextHeight, TrackPanelDrawingContext::target, TextFramePadding, TextFrameYOffset, theTheme, and AColor::uglyBrush.
Referenced by Draw().
|
overrideprivatevirtual |
Reimplemented from TrackPanelDrawable.
Definition at line 923 of file LabelTrackView.cpp.
References Draw(), TrackPanelDrawable::Draw(), and TrackArtist::PassTracks.
|
staticprivate |
Definition at line 660 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 568 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 685 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 517 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 603 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 633 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 934 of file LabelTrackView.cpp.
References FindLabelTrack(), msFont, and title.
|
private |
Definition at line 167 of file LabelTrackView.cpp.
References CommonTrackPanelCell::FindTrack().
Referenced by AddLabel(), CalcCursorX(), CalcHighlightXs(), Char(), ComputeLayout(), ComputeTextPosition(), CopySelectedText(), CutSelectedText(), DetailedHitTest(), DoCaptureKey(), DoChar(), DoKeyDown(), FindCursorPosition(), FindLabelTrack(), GetLabelIndex(), IsValidIndex(), KeyDown(), LabelTrackView(), OnContextMenu(), PasteSelectedText(), RemoveSelectedText(), Reparent(), SelectAllText(), and ShowContextMenu().
|
private |
Definition at line 172 of file LabelTrackView.cpp.
References FindLabelTrack().
|
static |
Definition at line 162 of file LabelTrackView.cpp.
References TrackView::Get().
|
static |
Definition at line 157 of file LabelTrackView.cpp.
References TrackView::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 224 of file LabelTrackView.h.
|
static |
Definition at line 240 of file LabelTrackView.cpp.
References size.
Referenced by LabelTrackMenuTable::OnSetFont(), and ResetFont().
|
staticprivate |
Definition at line 2161 of file LabelTrackView.cpp.
References ThemeBase::Bitmap(), and theTheme.
Referenced by DrawGlyphs().
|
inline |
Definition at line 226 of file LabelTrackView.h.
|
private |
Definition at line 2056 of file LabelTrackView.cpp.
References FindLabelTrack().
Referenced by DoCaptureKey().
int LabelTrackView::GetNavigationIndex | ( | AudacityProject & | project | ) | const |
Definition at line 1014 of file LabelTrackView.cpp.
References IsValidIndex(), and mNavigationIndex.
Referenced by LabelTrackShifter::HitTest().
int LabelTrackView::GetTextEditIndex | ( | AudacityProject & | project | ) | const |
Definition at line 998 of file LabelTrackView.cpp.
References IsValidIndex(), and mTextEditIndex.
Referenced by anonymous_namespace{EditMenus.cpp}::DoPasteText().
|
staticprivate |
Definition at line 592 of file LabelTrackView.cpp.
References mTextHeight, and TextFramePadding.
Referenced by DrawBar(), and DrawTextBox().
|
staticprivate |
Definition at line 1213 of file LabelTrackView.cpp.
Referenced by PasteSelectedText(), and ShowContextMenu().
bool LabelTrackView::IsTextSelected | ( | AudacityProject & | project | ) | const |
Definition at line 1050 of file LabelTrackView.cpp.
References IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, and mTextEditIndex.
Referenced by CopySelectedText(), anonymous_namespace{EditMenus.cpp}::CutCopyAvailableFlag(), CutSelectedText(), and ShowContextMenu().
|
private |
Definition at line 1039 of file LabelTrackView.cpp.
References FindLabelTrack(), TrackFocus::Get(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get().
Referenced by CalcCursorX(), Char(), DoCaptureKey(), DoChar(), DoKeyDown(), Draw(), GetNavigationIndex(), GetTextEditIndex(), IsTextSelected(), KeyDown(), OnContextMenu(), PasteSelectedText(), SelectAllText(), and ShowContextMenu().
|
overrideprivatevirtual |
Reimplemented from TrackPanelCell.
Definition at line 1426 of file LabelTrackView.cpp.
References CalcCursorX(), CONSOLIDATE, DoKeyDown(), FindLabelTrack(), ProjectHistory::Get(), ProjectWindow::Get(), LabelTrackView::Index::IsModified(), IsValidIndex(), mTextEditIndex, mUndoLabel, NONE, ProjectHistory::PushState(), RefreshCode::RefreshAll, RefreshCode::RefreshCell, RefreshCode::RefreshNone, ProjectWindow::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 1969 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(), ProjectHistory::PushState(), ViewInfo::selectedRegion, and XO().
Referenced by ShowContextMenu().
|
private |
Definition at line 2090 of file LabelTrackView.cpp.
References CommonTrackPanelCell::FindTrack(), mCurrentCursorPos, mInitialCursorPos, LabelTrackEvent::mPresentPosition, LabelTrackEvent::mpTrack, mRestoreFocus, mTextEditIndex, LabelTrackEvent::mTitle, and title.
|
private |
Definition at line 2111 of file LabelTrackView.cpp.
References CommonTrackPanelCell::FindTrack(), LabelTrackEvent::mFormerPosition, LabelTrackEvent::mpTrack, mTextEditIndex, and ResetTextSelection().
|
private |
Definition at line 2129 of file LabelTrackView.cpp.
References CommonTrackPanelCell::FindTrack(), LabelTrackEvent::mFormerPosition, mNavigationIndex, LabelTrackEvent::mPresentPosition, LabelTrackEvent::mpTrack, and mTextEditIndex.
|
private |
Definition at line 2149 of file LabelTrackView.cpp.
References CommonTrackPanelCell::FindTrack(), LabelTrackEvent::mpTrack, ResetTextSelection(), and SetNavigationIndex().
|
privatedelete |
|
static |
Definition at line 1289 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 1221 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 1303 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 1144 of file LabelTrackView.cpp.
References AddLabel(), FindLabelTrack(), LabelTrackView::Index::IsModified(), IsTextClipSupported(), IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, mUndoLabel, LabelTrackView::Index::SetModified(), SetTextSelection(), anonymous_namespace{NoteTrack.cpp}::swap(), title, and wxT().
Referenced by OnContextMenu().
|
private |
Definition at line 2024 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.
default does nothing
Reimplemented from TrackAttachment.
Definition at line 115 of file LabelTrackView.cpp.
References BindTo(), FindLabelTrack(), and CommonTrackCell::Reparent().
void LabelTrackView::ResetFlags | ( | ) |
Definition at line 216 of file LabelTrackView.cpp.
References mCurrentCursorPos, mInitialCursorPos, mNavigationIndex, and mTextEditIndex.
Referenced by LabelTrackView().
|
static |
Definition at line 256 of file LabelTrackView.cpp.
References DefaultFontSize, GetFont(), gPrefs, mFontHeight, msFont, size, and wxT().
Referenced by LabelTrackView(), and LabelTrackMenuTable::OnSetFont().
void LabelTrackView::ResetTextSelection | ( | ) |
Definition at line 1004 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 232 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 224 of file LabelTrackView.cpp.
References mCurrentCursorPos, mInitialCursorPos, mNavigationIndex, mTextEditIndex, and mUndoLabel.
bool LabelTrackView::SelectAllText | ( | AudacityProject & | project | ) |
Definition at line 1195 of file LabelTrackView.cpp.
References FindLabelTrack(), IsValidIndex(), mCurrentCursorPos, mInitialCursorPos, mTextEditIndex, and title.
void LabelTrackView::SetCurrentCursorPosition | ( | int | pos | ) |
Definition at line 988 of file LabelTrackView.cpp.
References mCurrentCursorPos.
void LabelTrackView::SetNavigationIndex | ( | int | index | ) |
Definition at line 1010 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 992 of file LabelTrackView.cpp.
References PackedArray::end(), mCurrentCursorPos, mInitialCursorPos, and mTextEditIndex.
Referenced by DoKeyDown(), and PasteSelectedText().
void LabelTrackView::ShowContextMenu | ( | AudacityProject & | project | ) |
Definition at line 1906 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(), and LabelStruct::y.
Referenced by DoKeyDown().
|
staticconstexpr |
Definition at line 51 of file LabelTrackView.h.
Referenced by Draw(), DrawBar(), DrawHighlight(), DrawText(), and DrawTextBox().
|
staticprivate |
Definition at line 198 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 199 of file LabelTrackView.h.
Referenced by CreateCustomGlyphs().
|
mutableprivate |
Definition at line 202 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 267 of file LabelTrackView.h.
Referenced by OnContextMenu(), and ShowContextMenu().
|
staticprivate |
Definition at line 201 of file LabelTrackView.h.
Referenced by calculateFontHeight(), Draw(), DrawText(), and ResetFont().
|
private |
Definition at line 261 of file LabelTrackView.h.
Referenced by DetailedHitTest().
|
staticprivate |
Definition at line 194 of file LabelTrackView.h.
Referenced by ComputeLayout(), CreateCustomGlyphs(), DrawGlyphs(), DrawLines(), OverTextBox(), and ShowContextMenu().
|
staticprivate |
Definition at line 195 of file LabelTrackView.h.
Referenced by CalcCursorX(), ComputeLayout(), ComputeTextPosition(), CreateCustomGlyphs(), DrawBar(), DrawGlyphs(), DrawText(), DrawTextBox(), and OverTextBox().
|
mutableprivate |
current cursor position
Definition at line 203 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 188 of file LabelTrackView.h.
Referenced by CopyTo(), DoKeyDown(), Draw(), GetNavigationIndex(), OnLabelPermuted(), ResetFlags(), RestoreFlags(), SaveFlags(), and SetNavigationIndex().
|
private |
initial cursor position
Definition at line 206 of file LabelTrackView.h.
Referenced by AddLabel(), DoKeyDown(), and OnLabelAdded().
|
staticprivate |
Definition at line 264 of file LabelTrackView.h.
Referenced by CalcCursorX(), CalcHighlightXs(), Draw(), FindCursorPosition(), ResetFont(), and ShowContextMenu().
|
private |
Definition at line 256 of file LabelTrackView.h.
Referenced by BindTo().
|
mutableprivate |
Index of the current label text being edited.
Definition at line 190 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 262 of file LabelTrackView.h.
Referenced by DetailedHitTest().
|
staticprivate |
Definition at line 196 of file LabelTrackView.h.
Referenced by ComputeLayout(), CreateCustomGlyphs(), Draw(), DrawGlyphs(), DrawHighlight(), DrawLines(), DrawText(), GetTextFrameHeight(), and OverGlyph().
|
mutableprivate |
Definition at line 192 of file LabelTrackView.h.
Referenced by Char(), CopyTo(), CutSelectedText(), DoKeyDown(), KeyDown(), PasteSelectedText(), and SaveFlags().
|
staticconstexpr |
Definition at line 49 of file LabelTrackView.h.
Referenced by Draw(), DrawHighlight(), DrawText(), and GetTextFrameHeight().
|
staticconstexpr |
Definition at line 50 of file LabelTrackView.h.
Referenced by Draw(), DrawHighlight(), DrawText(), and DrawTextBox().