(!event.GetSkipped())
52 if(event.Moving() || event.Dragging())
54 else if(event.LeftDown())
56 else if(event.LeftUp())
58 else if(event.LeftDClick())
68 inttextX, textY, caretX, caretY;
72panel->SetCursor(wxCursor(wxCURSOR_IBEAM));
74panel->
SetCaretPos(pos.x + caretX, pos.y + caretY);
77panel->SetCursor(wxCursor(wxCURSOR_IBEAM));
88 if(!event.HasAnyModifiers())
89 context->SelectItem(0,
false,
false);
91 inttextX, textY, caretX, caretY;
97panel->
SetCaretPos(pos.x + caretX, pos.y + caretY);
108 inttextX, textY, caretX, caretY;
112panel->
SetCaretPos(pos.x + caretX, pos.y + caretY);
118 static boolIsAlpha(
charch)
120 return(ch >=
'0'&& ch <=
'9') || (ch >=
'A'&& ch <=
'Z') || (ch >=
'a'&& ch <=
'z') || ch ==
'_';
129wxClientDC dc(panel);
132dc.GetCharHeight(),
context->GetIndentWidth(), event.m_x, event.m_y);
135 inttextX, textY, caretX, caretY;
142 if(textX >= line.length())
143textX =
static_cast<int>(line.length() - 1);
145 intselStart = textX, selEnd = textX + 1;
146 if(line[selStart] ==
' ') {
147 while(selStart > 0 && line[selStart - 1] ==
' ')
149 while(selEnd < line.length() && line[selEnd] ==
' ')
152 else if(IsAlpha(line[selStart])) {
153 while(selStart > 0 && IsAlpha(line[selStart - 1]))
155 while(selEnd < line.length() && IsAlpha(line[selEnd]))
164dc.GetCharHeight(),
context->GetIndentWidth(),
169panel->
SetCaretPos(pos.x + caretX, pos.y + caretY);
174 int& textX,
int& textY,
175 int& caretX,
int& caretY)
178wxClientDC dc(textPanel);
181dc.GetCharHeight(),
context->GetIndentWidth(), x, y);
186dc.GetCharHeight(),
context->GetIndentWidth(),
203CCopyText(wxTextOutputStream& os,
204 intstartRow,
intstartCol,
205 intendRow,
intendCol) :
207m_StartRow(startRow), m_StartCol(startCol),
208m_EndRow(endRow), m_EndCol(endCol), m_CurRow(0),
209m_CurrentLineLength(0) {}
211 virtualStreamHint GetHint()
const{
returnkCopyText; }
212 virtualwxTextOutputStream* GetTextStream()
const{
return&m_OS; }
213 virtual boolIsVisible()
const;
214 virtual voidUpdatePosition(
intshift) { m_CurrentLineLength += shift; }
218 virtual intCurrentRowLength()
const{
returnm_CurrentLineLength; }
220 virtual voidSetStyle(
const CTextStyle*
) {}
221 virtual voidSetDefaultStyle() {}
222 virtual void Indent(
size_tsteps);
226wxTextOutputStream& m_OS;
232 intm_CurrentLineLength;
235 boolCCopyText::IsVisible()
const 237 if(m_CurRow > m_StartRow && m_CurRow < m_EndRow)
240 if(m_CurRow == m_StartRow) {
241 if(m_CurrentLineLength < m_StartCol)
243 if(m_CurRow == m_EndRow)
244 returnm_CurrentLineLength < m_EndCol;
248 if(m_CurRow == m_EndRow)
249 returnm_CurrentLineLength < m_EndCol;
262 voidCCopyText::NewLine()
264 if(m_CurRow >= m_StartRow && m_CurRow < m_EndRow)
268m_CurrentLineLength = 0;
273 intlength =
static_cast<int>(
text.length());
274 intselStart = length, selEnd = length;
276 if(m_CurRow == m_EndRow) {
278selEnd = m_EndCol-m_CurrentLineLength;
280 if(m_CurRow == m_StartRow)
281selStart = m_StartCol-m_CurrentLineLength;
283 if(m_CurRow > m_StartRow && m_CurRow < m_EndRow) {
288 if(selEnd < selStart)
289 swap(selStart, selEnd);
291 if(selStart < selEnd && selStart < length && selEnd > 0) {
292selStart =
max(selStart, 0);
293selEnd =
min(selEnd, length);
297m_CurrentLineLength += length;
309CCopyText ostream(os,
b.GetStart().GetRow(),
b.GetStart().GetCol(),
310 b.GetEnd().GetRow(),
b.GetEnd().GetCol());
static void Indent(FILE *output_stream, int indent_depth, const char *indent)
void GetCaretPos(int &caretPosX, int &caretPosY) const
void GetTextPos(int &textPosX, int &textPosY) const
void SelStart(int row, int col, bool shift)
CTextPanelContext * GetContext()
void SetCaretPos(int x, int y)
void SelMove(int row, int col)
void SelEnd(int row, int col)
virtual wxPoint GetPosition() const
virtual int GetStartLine() const
virtual void TextPosToExpanded(CTextPosition &WXUNUSED(pos), CTextPanelContext *WXUNUSED(context)) const
virtual void x_RenderText(CStyledTextOStream &WXUNUSED(ostream), CTextPanelContext *WXUNUSED(context)) const
virtual void MouseEvent(wxMouseEvent &event, CTextPanelContext &context)
virtual void GetText(wxTextOutputStream &os, const CTextBlock &block, CTextPanelContext *context)
virtual void x_CalcTextPos(CTextPanelContext *context, int x, int y, int &textX, int &textY, int &caretX, int &caretY)
void MouseMove(wxMouseEvent &event)
void MouseLeftUp(wxMouseEvent &event)
void MouseLeftDown(wxMouseEvent &event)
void MouseLeftDClick(wxMouseEvent &event)
virtual void MouseEvent(wxMouseEvent &event, CTextPanelContext &context)
CNcbiOstream & operator<<(CNcbiOstream &out, const CEquivRange &range)
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static void text(MDB_val *v)
static CS_CONTEXT * context
wxString ToWxString(const string &s)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4