void RegRichTextCtrl::OnChar( wxKeyEvent& event ) { long linePos = GetBuffer().GetVisibleLineNumber(GetCaretPosition(), true, true); wxString line = GetLineText(linePos); for (size_t i = 0; i < 15; ++i) if ( wxNOT_FOUND != line.Find(RegistersName[i]) ) { wxString str = GetStringSelection(); bool bShowEditBox = true; for (size_t k = 0; k < 15; ++k) { if ( 0 == str.Cmp(RegistersName[k]) ) { bShowEditBox = false; break; } } if (bShowEditBox) { this->SetCaretPosition(GetCaretPosition(), true); //EditRegister(RegNames[i], str); break; } } }
void luLogEdit::OnLButtonDBClick(wxMouseEvent& event) { long pos = GetInsertionPoint(); long x = 0, y = 0; PositionToXY(pos, &x, &y); wxString line = GetLineText(y); //01:15:55: TestError.lua:49: attempt to index field 'object' (a nil value) size_t i = wxString(line).MakeLower().find(".lua:"); if (i != wxString::npos) { size_t k = line.rfind(':', i); size_t p = i+4; size_t s = line.find(':', p+1); if (k != wxString::npos && p != wxString::npos && s != wxString::npos) { wxString luaFile = line.SubString(k+1, p-1).Trim().Trim(false); wxString lineNo = line.SubString(p+1, s-1).Trim().Trim(false); long line = 0; if (lineNo.ToLong(&line)) { luMainFrame* frame = getLuMainFrame(); if (frame) frame->gotoLuaSource(luaFile, line); } } } event.Skip(); }
void CChatSession::AddText(const wxString& text, const wxTextAttr& style, bool newline) { // Split multi-line messages into individual lines wxStringTokenizer tokens( text, wxT("\n") ); while ( tokens.HasMoreTokens() ) { // Check if we should add a time-stamp if ( GetNumberOfLines() > 1 ) { // Check if the last line ended with a newline wxString line = GetLineText( GetNumberOfLines() - 1 ); if ( line.IsEmpty() ) { SetDefaultStyle( COLOR_BLACK ); AppendText( wxT(" [") + wxDateTime::Now().FormatISOTime() + wxT("] ") ); } } SetDefaultStyle(style); AppendText( tokens.GetNextToken() ); // Only add newlines after the last line if it is desired if ( tokens.HasMoreTokens() || newline ) { AppendText( wxT("\n") ); } } }
char CaseValue::lireValeur(void) const { // Lire la premièrelettre de l'entrée wxString currentValue(GetLineText(0)); std::string s(currentValue.ToStdString()); // Si la taille est nulle, retourner un point if( s.size()==0 ) return '.'; // Sinon retourner la valeur en tant que caractère return s.at(0); }
void SearchWindow::OnDoubleClick(wxMouseEvent& event) { wxTextCoord col, row; HitTest(event.GetPosition(), &col, &row); wxString line = GetLineText(row); m_mainFrame->GotoError(line); }
void wxTextCtrlHist::OnSendMessage( wxCommandEvent &event ) { const wxString msg = GetLineText(0); if ( msg != wxEmptyString ) { Historical.Add( msg ); current_pos = Historical.GetCount(); if(current_pos > history_max) { Historical.RemoveAt(0); --current_pos; } } event.Skip(); }
void InfoPane::GetText(int index, int col, TCHAR* text, int max_len) { if (photo_ == 0) return; if (index < 0 || index >= selected_lines_.size()) { ASSERT(false); return; } int line= selected_lines_[index]; GetLineText(line, col, text, max_len); }
void CMLineIndexTable::TableDrawCell ( JPainter& p, const JPoint& cell, const JRect& rect ) { HilightIfSelected(p, cell, rect); if (JIndex(cell.x) == kBreakpointColumn) { DrawBreakpoints(p, cell, rect); } else if (JIndex(cell.x) == kExecPointColumn && cell.y == itsCurrentLineIndex) { // We can't use a static polygon because line heights can vary, // e.g. due to underlines. const JCoordinate delta = rect.height()/2; JPolygon poly; poly.AppendElement(JPoint(rect.left+kMarginWidth, rect.top)); poly.AppendElement(JPoint(rect.left+kMarginWidth+delta, rect.top + delta)); poly.AppendElement(JPoint(rect.left+kMarginWidth, rect.top + 2*delta)); p.SetPenColor(GetCurrentLineMarkerColor()); p.SetFilling(kJTrue); p.Polygon(poly); p.SetPenColor(GetColormap()->GetBlackColor()); p.SetFilling(kJFalse); p.Polygon(poly); } else if (JIndex(cell.x) == kLineNumberColumn) { p.SetFont(itsText->GetDefaultFont()); JRect r = rect; r.right -= kMarginWidth; const JString str = GetLineText(cell.y); p.String(r, str, JPainter::kHAlignRight); } }
// TODO: this code require full information about editabel register in dialog // TODO: to make editable all registers which is output void RegRichTextCtrl::OnLeftDClick(wxMouseEvent& event) { wxClientDC dc(this); PrepareDC(dc); dc.SetFont(GetFont()); long position = 0; GetBuffer().HitTest(dc, event.GetLogicalPosition(dc), position); long linePos = GetBuffer().GetVisibleLineNumber(position, true, true); wxString line = GetLineText(linePos); const size_t szRegNames = 15; for (size_t i = 0; i < szRegNames; ++i) if (line.Find(RegistersName[i]) != wxNOT_FOUND) { wxString str = GetStringSelection(); bool bShowEditBox = true; for (size_t k = 0; k < szRegNames; ++k) { if ( 0 == str.Cmp(RegistersName[k]) ) { bShowEditBox = false; break; } } if (bShowEditBox) { EditRegister(RegistersName[i], str); break; } } }
void InfoPane::Filter(const CString& text, bool hide_unknown) { hide_unknown_ = hide_unknown; selected_lines_.clear(); if (photo_ != 0) { int count = file_info_.Count() + LINE_LAST; if (photo_->HasEmbeddedColorProfile()) ++count; CString pattern= text; pattern.MakeLower(); selected_lines_.reserve(count); for (int i= 0; i < count; ++i) { int line= i - LINE_LAST; if (hide_unknown || !text.IsEmpty()) { const int MAX= 2000; TCHAR buf[MAX + 1]; GetLineText(line, 1, buf, MAX); // get tag name buf[MAX] = 0; if (hide_unknown && _tcsicmp(buf, _T("unknown")) == 0) continue; if (text.IsEmpty()) { selected_lines_.push_back(line); continue; } CString s= buf; s.MakeLower(); if (s.Find(pattern) >= 0) { selected_lines_.push_back(line); continue; } GetLineText(line, 2, buf, MAX); // get tag value buf[MAX] = 0; s = buf; s.MakeLower(); if (s.Find(pattern) >= 0) { selected_lines_.push_back(line); continue; } } else selected_lines_.push_back(line); } } disp_wnd_.SetInfo(static_cast<int>(selected_lines_.size())); }
int wxTextCtrl::GetLineLength(long lineNo) const { wxString str = GetLineText (lineNo); return (int) str.length(); }
void luConsoleEdit::OnKeyDown(wxKeyEvent& event) { int ch = event.GetKeyCode(); wxString str; if (ch == WXK_UP) { pasteCommand(-1); return; } else if (ch == WXK_DOWN) { pasteCommand(+1); return; } else if (ch == WXK_ESCAPE) { pasteCommand(0); replaceCommand(""); return; } else if (ch == WXK_LEFT || ch == WXK_BACK) { long x = 0, y = 0; if (PositionToXY(GetInsertionPoint(), &x, &y)) { if (x <= (int)m_prompt.Length()) return; } } else if (ch == WXK_HOME) { long x = 0, y = 0; if (PositionToXY(GetInsertionPoint(), &x, &y)) { x = m_prompt.Length(); long pos = XYToPosition(x, y); SetSelection(pos, pos); } return; } if (ch == WXK_RETURN) { str = GetLineText(GetNumberOfLines() - 1); str.Replace(m_prompt, ""); } else { event.Skip(); } if (ch == WXK_RETURN) { writeLine("\n"); str.Trim().Trim(false); if (!str.IsEmpty()) { runCmd(str, false, false); addCommand(str); } writeLine(m_prompt); pasteCommand(0); } }
void TextCtrl::OnChar(wxKeyEvent& event) { long from, to; GetSelection(&from, &to); switch (event.GetKeyCode()) { case WXK_RETURN: { long int c, l; PositionToXY(GetInsertionPoint(), &c, &l); wxString line = GetLineText(l); WriteText(wxT("\n")); for (int i = 0; i < (int)line.Length(); i++) { if (line.GetChar(i) != ' ') break; WriteText(wxT(" ")); } } return ; break; case WXK_TAB: { long int c, l; PositionToXY(GetInsertionPoint(), &c, &l); do { WriteText(wxT(" ")); c++; } while (c % 4 != 0); SetFocus(); } return ; break; default: break; } if (m_matchParens) { switch (event.GetKeyCode()) { case '(': if (from == to) { WriteText(wxT("()")); SetInsertionPoint(GetInsertionPoint() - 1); } else { SetInsertionPoint(to); WriteText(wxT(")")); SetInsertionPoint(from); WriteText(wxT("(")); SetInsertionPoint(to + 1); } break; case '[': if (from == to) { WriteText(wxT("[]")); SetInsertionPoint(GetInsertionPoint() - 1); } else { SetInsertionPoint(to); WriteText(wxT("]")); SetInsertionPoint(from); WriteText(wxT("[")); SetInsertionPoint(to + 1); } break; case '"': if (from == to) { WriteText(wxT("\"\"")); SetInsertionPoint(GetInsertionPoint() - 1); } else { SetInsertionPoint(to); WriteText(wxT("\"")); SetInsertionPoint(from); WriteText(wxT("\"")); SetInsertionPoint(to + 1); } break; default: event.Skip(); } } else event.Skip(); }
void CliCtrl::AppendAutoCompleteCommad(const wxString& data) { wxString curLine = GetLineText(GetNumberOfLines() - 1); AppendText("\n" + data); AppendText("\n" + curLine); }