Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
HighlightTextCtrl Class Referencefinal

#include <Lyrics.h>

Inheritance diagram for HighlightTextCtrl:
[legend]
Collaboration diagram for HighlightTextCtrl:
[legend]

Public Member Functions

 HighlightTextCtrl (LyricsPanel *parent, wxWindowID id, const wxString &value={}, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 
virtual ~HighlightTextCtrl ()
 
void OnMouseEvent (wxMouseEvent &evt)
 

Private Attributes

LyricsPanelmLyricsPanel
 

Detailed Description

Definition at line 52 of file Lyrics.h.

Constructor & Destructor Documentation

◆ HighlightTextCtrl()

HighlightTextCtrl::HighlightTextCtrl ( LyricsPanel parent,
wxWindowID  id,
const wxString &  value = {},
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)

Definition at line 35 of file Lyrics.cpp.

40: wxTextCtrl(parent, id, // wxWindow* parent, wxWindowID id,
41 value, // const wxString& value = {},
42 pos, // const wxPoint& pos = wxDefaultPosition,
43 size, // const wxSize& size = wxDefaultSize,
44 wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 | wxTE_AUTO_URL | wxTE_NOHIDESEL), //v | wxHSCROLL)
45 mLyricsPanel(parent)
46{
47}
LyricsPanel * mLyricsPanel
Definition: Lyrics.h:65

◆ ~HighlightTextCtrl()

virtual HighlightTextCtrl::~HighlightTextCtrl ( )
inlinevirtual

Definition at line 60 of file Lyrics.h.

60{};

Member Function Documentation

◆ OnMouseEvent()

void HighlightTextCtrl::OnMouseEvent ( wxMouseEvent &  evt)

Definition at line 49 of file Lyrics.cpp.

50{
51 if (event.ButtonUp())
52 {
53 long from, to;
54 this->GetSelection(&from, &to);
55
57 int nNewSyl = mLyricsPanel->FindSyllable(from);
58 if (nNewSyl != nCurSyl)
59 {
60 Syllable* pCurSyl = mLyricsPanel->GetSyllable(nNewSyl);
61 auto pProj = FindProjectFromWindow( this );
62 auto &selectedRegion = ViewInfo::Get( *pProj ).selectedRegion;
63 selectedRegion.setT0( pCurSyl->t );
64
65 //v Should probably select to end as in
66 // SelectUtilities::Handler::OnSelectCursorEnd,
67 // but better to generalize that in AudacityProject methods.
68 selectedRegion.setT1( pCurSyl->t );
69 }
70 }
71
72 event.Skip();
73}
AudacityProject * FindProjectFromWindow(wxWindow *pWindow)
int FindSyllable(long startChar)
Definition: Lyrics.cpp:225
int GetCurrentSyllableIndex()
Definition: Lyrics.h:96
Syllable * GetSyllable(int nSyl)
Definition: Lyrics.h:97
bool setT0(double t, bool maySwap=true)
Definition: ViewInfo.cpp:61
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:215
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
used in LyricsPanel, a Syllable gives positional information to be used with the bouncing ball effect...
Definition: Lyrics.h:32
double t
Definition: Lyrics.h:39

References FindProjectFromWindow(), LyricsPanel::FindSyllable(), ViewInfo::Get(), LyricsPanel::GetCurrentSyllableIndex(), LyricsPanel::GetSyllable(), mLyricsPanel, ViewInfo::selectedRegion, NotifyingSelectedRegion::setT0(), and Syllable::t.

Here is the call graph for this function:

Member Data Documentation

◆ mLyricsPanel

LyricsPanel* HighlightTextCtrl::mLyricsPanel
private

Definition at line 65 of file Lyrics.h.

Referenced by OnMouseEvent().


The documentation for this class was generated from the following files: