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

#include <Lyrics.h>

Inheritance diagram for HighlightTextCtrl:

Public Member Functions

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

Private Attributes

LyricsPanelmLyricsPanel
 

Detailed Description

Definition at line 47 of file Lyrics.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file Lyrics.cpp.

33 : wxTextCtrl(parent, id, // wxWindow* parent, wxWindowID id,
34  value, // const wxString& value = "",
35  pos, // const wxPoint& pos = wxDefaultPosition,
36  size, // const wxSize& size = wxDefaultSize,
37  wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 | wxTE_AUTO_URL | wxTE_NOHIDESEL), //v | wxHSCROLL)
38  mLyricsPanel(parent)
39 {
40 }
LyricsPanel * mLyricsPanel
Definition: Lyrics.h:60
virtual HighlightTextCtrl::~HighlightTextCtrl ( )
inlinevirtual

Definition at line 55 of file Lyrics.h.

55 {};

Member Function Documentation

void HighlightTextCtrl::OnMouseEvent ( wxMouseEvent &  evt)

Definition at line 42 of file Lyrics.cpp.

References LyricsPanel::FindSyllable(), GetActiveProject(), LyricsPanel::GetCurrentSyllableIndex(), LyricsPanel::GetSyllable(), mLyricsPanel, AudacityProject::mViewInfo, ViewInfo::selectedRegion, AudacityProject::SetSel0(), SelectedRegion::setT1(), and Syllable::t.

43 {
44  if (event.ButtonUp())
45  {
46  long from, to;
47  this->GetSelection(&from, &to);
48 
49  int nCurSyl = mLyricsPanel->GetCurrentSyllableIndex();
50  int nNewSyl = mLyricsPanel->FindSyllable(from);
51  if (nNewSyl != nCurSyl)
52  {
53  Syllable* pCurSyl = mLyricsPanel->GetSyllable(nNewSyl);
55  pProj->SetSel0(pCurSyl->t);
56 
57  //v Should probably select to end as in AudacityProject::OnSelectCursorEnd,
58  // but better to generalize that in AudacityProject methods.
59  pProj->mViewInfo.selectedRegion.setT1(pCurSyl->t);
60  }
61  }
62 
63  event.Skip();
64 }
Syllable * GetSyllable(int nSyl)
Definition: Lyrics.h:93
SelectedRegion selectedRegion
Definition: ViewInfo.h:160
void SetSel0(double)
Definition: Project.cpp:1397
LyricsPanel * mLyricsPanel
Definition: Lyrics.h:60
int GetCurrentSyllableIndex()
Definition: Lyrics.h:92
double t
Definition: Lyrics.h:34
int FindSyllable(long startChar)
Definition: Lyrics.cpp:205
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
bool setT1(double t, bool maySwap=true)
ViewInfo mViewInfo
Definition: Project.h:558
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308

Member Data Documentation

LyricsPanel* HighlightTextCtrl::mLyricsPanel
private

Definition at line 60 of file Lyrics.h.

Referenced by OnMouseEvent().


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