Audacity 3.2.0
|
#include <TextEditHelper.h>
Public Member Functions | |
TextEditHelper (const std::weak_ptr< TextEditDelegate > &delegate, const wxString &text, const wxFont &font) | |
~TextEditHelper () | |
void | SetTextColor (const wxColor &textColor) |
void | SetTextSelectionColor (const wxColor &textSelectionColor) |
void | Cancel (AudacityProject *project) |
void | Finish (AudacityProject *project) |
std::pair< int, int > | GetSelection () const |
void | SetSelection (int from, int to) |
void | SelectAll () |
bool | IsSelectionEmpty () |
bool | CaptureKey (int keyCode, int mods) |
bool | OnKeyDown (int keyCode, int mods, AudacityProject *project) |
bool | OnChar (int charCode, AudacityProject *project) |
bool | OnClick (const wxMouseEvent &event, AudacityProject *project) |
bool | OnDrag (const wxMouseEvent &event, AudacityProject *project) |
bool | OnRelease (const wxMouseEvent &event, AudacityProject *project) |
bool | Draw (wxDC &dc, const wxRect &rect) |
bool | CutSelectedText (AudacityProject &project) |
bool | CopySelectedText (AudacityProject &project) |
bool | PasteSelectedText (AudacityProject &project) |
bool | GetCharPositionX (int index, int *outX) |
const wxRect & | GetBBox () const |
Static Public Member Functions | |
static bool | IsGoodEditKeyCode (int keyCode) |
Protected Member Functions | |
bool | HandleDragRelease (const wxMouseEvent &event, AudacityProject *project) |
void | RemoveSelectedText (AudacityProject *project) |
int | FindCursorIndex (const wxPoint &point) |
Private Attributes | |
wxString | mText |
wxFont | mFont |
wxRect | mBBox |
wxColor | mTextSelectionColor |
wxColor | mTextColor |
bool | mRightDragging { false } |
int | mOffset { 0 } |
int | mInitialCursorPos { 0 } |
int | mCurrentCursorPos { 0 } |
std::weak_ptr< TextEditDelegate > | mDelegate |
Definition at line 43 of file TextEditHelper.h.
TextEditHelper::TextEditHelper | ( | const std::weak_ptr< TextEditDelegate > & | delegate, |
const wxString & | text, | ||
const wxFont & | font | ||
) |
Definition at line 44 of file TextEditHelper.cpp.
References mCurrentCursorPos.
|
inline |
Definition at line 69 of file TextEditHelper.h.
void TextEditHelper::Cancel | ( | AudacityProject * | project | ) |
Definition at line 63 of file TextEditHelper.cpp.
bool TextEditHelper::CaptureKey | ( | int | keyCode, |
int | mods | ||
) |
Definition at line 97 of file TextEditHelper.cpp.
Referenced by OnKeyDown().
bool TextEditHelper::CopySelectedText | ( | AudacityProject & | project | ) |
Copy the selected text in the text box
Definition at line 629 of file TextEditHelper.cpp.
References mCurrentCursorPos, mInitialCursorPos, mText, safenew, and anonymous_namespace{NoteTrack.cpp}::swap().
bool TextEditHelper::CutSelectedText | ( | AudacityProject & | project | ) |
Cut the selected text in the text box
Definition at line 584 of file TextEditHelper.cpp.
References mCurrentCursorPos, mDelegate, mInitialCursorPos, mText, project, safenew, and anonymous_namespace{NoteTrack.cpp}::swap().
bool TextEditHelper::Draw | ( | wxDC & | dc, |
const wxRect & | rect | ||
) |
Definition at line 348 of file TextEditHelper.cpp.
References GetCharPositionX(), mBBox, mCurrentCursorPos, mFont, min(), mInitialCursorPos, mOffset, mText, mTextColor, and mTextSelectionColor.
|
protected |
Definition at line 479 of file TextEditHelper.cpp.
References mBBox, mFont, mOffset, and mText.
Referenced by HandleDragRelease(), and OnClick().
void TextEditHelper::Finish | ( | AudacityProject * | project | ) |
const wxRect & TextEditHelper::GetBBox | ( | ) | const |
bool TextEditHelper::GetCharPositionX | ( | int | index, |
int * | outX | ||
) |
Definition at line 545 of file TextEditHelper.cpp.
References mBBox, mFont, mOffset, and mText.
Referenced by Draw().
std::pair< int, int > TextEditHelper::GetSelection | ( | ) | const |
Definition at line 75 of file TextEditHelper.cpp.
References mCurrentCursorPos, and mInitialCursorPos.
|
protected |
Definition at line 429 of file TextEditHelper.cpp.
References FindCursorIndex(), mBBox, mCurrentCursorPos, mDelegate, mRightDragging, and project.
Referenced by OnDrag(), and OnRelease().
|
static |
Definition at line 26 of file TextEditHelper.cpp.
Referenced by WaveTrackAffordanceControls::KeyDown().
bool TextEditHelper::IsSelectionEmpty | ( | ) |
Definition at line 92 of file TextEditHelper.cpp.
References mCurrentCursorPos, and mInitialCursorPos.
bool TextEditHelper::OnChar | ( | int | charCode, |
AudacityProject * | project | ||
) |
Definition at line 247 of file TextEditHelper.cpp.
References mCurrentCursorPos, mDelegate, mInitialCursorPos, mText, project, and RemoveSelectedText().
bool TextEditHelper::OnClick | ( | const wxMouseEvent & | event, |
AudacityProject * | project | ||
) |
Definition at line 283 of file TextEditHelper.cpp.
References FindCursorIndex(), mBBox, mCurrentCursorPos, mInitialCursorPos, mRightDragging, and project.
bool TextEditHelper::OnDrag | ( | const wxMouseEvent & | event, |
AudacityProject * | project | ||
) |
Definition at line 338 of file TextEditHelper.cpp.
References HandleDragRelease(), and project.
bool TextEditHelper::OnKeyDown | ( | int | keyCode, |
int | mods, | ||
AudacityProject * | project | ||
) |
Definition at line 102 of file TextEditHelper.cpp.
References CaptureKey(), mCurrentCursorPos, mDelegate, min(), mInitialCursorPos, mOffset, mText, project, and RemoveSelectedText().
bool TextEditHelper::OnRelease | ( | const wxMouseEvent & | event, |
AudacityProject * | project | ||
) |
Definition at line 343 of file TextEditHelper.cpp.
References HandleDragRelease(), and project.
bool TextEditHelper::PasteSelectedText | ( | AudacityProject & | project | ) |
Paste the text on the clipboard to text box
Definition at line 658 of file TextEditHelper.cpp.
References mCurrentCursorPos, mDelegate, mInitialCursorPos, mText, project, anonymous_namespace{NoteTrack.cpp}::swap(), and wxT().
|
protected |
Definition at line 453 of file TextEditHelper.cpp.
References mCurrentCursorPos, mDelegate, mInitialCursorPos, mText, project, and anonymous_namespace{NoteTrack.cpp}::swap().
Referenced by OnChar(), and OnKeyDown().
void TextEditHelper::SelectAll | ( | ) |
Definition at line 86 of file TextEditHelper.cpp.
References mCurrentCursorPos, mInitialCursorPos, and mText.
void TextEditHelper::SetSelection | ( | int | from, |
int | to | ||
) |
Definition at line 80 of file TextEditHelper.cpp.
References mCurrentCursorPos, and mInitialCursorPos.
void TextEditHelper::SetTextColor | ( | const wxColor & | textColor | ) |
Definition at line 53 of file TextEditHelper.cpp.
References mTextColor.
void TextEditHelper::SetTextSelectionColor | ( | const wxColor & | textSelectionColor | ) |
Definition at line 58 of file TextEditHelper.cpp.
References mTextSelectionColor.
|
private |
Definition at line 47 of file TextEditHelper.h.
Referenced by Draw(), FindCursorIndex(), GetBBox(), GetCharPositionX(), HandleDragRelease(), and OnClick().
|
private |
Definition at line 58 of file TextEditHelper.h.
Referenced by CopySelectedText(), CutSelectedText(), Draw(), GetSelection(), HandleDragRelease(), IsSelectionEmpty(), OnChar(), OnClick(), OnKeyDown(), PasteSelectedText(), RemoveSelectedText(), SelectAll(), SetSelection(), and TextEditHelper().
|
private |
Definition at line 62 of file TextEditHelper.h.
Referenced by Cancel(), CutSelectedText(), Finish(), HandleDragRelease(), OnChar(), OnKeyDown(), PasteSelectedText(), and RemoveSelectedText().
|
private |
Definition at line 46 of file TextEditHelper.h.
Referenced by Draw(), FindCursorIndex(), and GetCharPositionX().
|
private |
Definition at line 57 of file TextEditHelper.h.
Referenced by CopySelectedText(), CutSelectedText(), Draw(), GetSelection(), IsSelectionEmpty(), OnChar(), OnClick(), OnKeyDown(), PasteSelectedText(), RemoveSelectedText(), SelectAll(), and SetSelection().
|
private |
Definition at line 56 of file TextEditHelper.h.
Referenced by Draw(), FindCursorIndex(), GetCharPositionX(), and OnKeyDown().
|
private |
Definition at line 52 of file TextEditHelper.h.
Referenced by HandleDragRelease(), and OnClick().
|
private |
Definition at line 45 of file TextEditHelper.h.
Referenced by CopySelectedText(), CutSelectedText(), Draw(), FindCursorIndex(), Finish(), GetCharPositionX(), OnChar(), OnKeyDown(), PasteSelectedText(), RemoveSelectedText(), and SelectAll().
|
private |
Definition at line 50 of file TextEditHelper.h.
Referenced by Draw(), and SetTextColor().
|
private |
Definition at line 49 of file TextEditHelper.h.
Referenced by Draw(), and SetTextSelectionColor().