/* TextEditor::onModified * Called when the text is modified *******************************************************************/ void TextEditor::onModified(wxStyledTextEvent& e) { // (Re)start update timer timer_update.Start(1000, true); e.Skip(); }
void ctlSQLBox::OnMarginClick(wxStyledTextEvent &event) { if (event.GetMargin() == 2) ToggleFold(LineFromPosition(event.GetPosition())); event.Skip(); }
void wxCodeCompletionBoxManager::OnStcModified(wxStyledTextEvent& event) { event.Skip(); if(m_box && m_box->IsShown() && m_box->m_stc == event.GetEventObject()) { m_box->StcModified(event); } }
void CodeFormatterDlg::OnPHPCSFixerOptionsUpdated(wxStyledTextEvent& event) { m_isDirty = true; m_options.SetPHPCSFixerPharOptions(m_stc->GetText()); CallAfter(&CodeFormatterDlg::UpdatePreview); event.Skip(); }
void AbbreviationsSettingsDlg::OnMarkDirty(wxStyledTextEvent& event) { event.Skip(); if(m_activeItemName.IsEmpty() == false) { m_dirty = true; } }
void fbtTextFile::zoomEvent(wxStyledTextEvent& evt) { evt.Skip(); // dsiable zoom if (GetZoom() != 0) SetZoom(0); }
void t4p::PhpCallTipProviderClass::OnCallTipClick(wxStyledTextEvent& evt) { wxStyledTextCtrl* ctrl = wxDynamicCast(evt.GetEventObject(), wxStyledTextCtrl); if (!CurrentCallTipResources.empty()) { size_t resourcesSize = CurrentCallTipResources.size(); int position = evt.GetPosition(); wxString callTip; // up arrow. if already at the first choice, then loop around // looping around looks better than hiding arrows; because hiding arrows changes the // rendering position and make the call tip jump around when clicking up/down if (1 == position) { CurrentCallTipIndex = ((CurrentCallTipIndex >= 1) && (CurrentCallTipIndex - 1) < resourcesSize) ? CurrentCallTipIndex - 1 : resourcesSize - 1; callTip = PhpCallTipSignature(CurrentCallTipIndex, CurrentCallTipResources); } else if (2 == position) { // down arrow CurrentCallTipIndex = ((CurrentCallTipIndex + 1) < resourcesSize) ? CurrentCallTipIndex + 1 : 0; callTip = PhpCallTipSignature(CurrentCallTipIndex, CurrentCallTipResources); } if (!callTip.IsEmpty()) { ctrl->CallTipCancel(); ctrl->CallTipShow(ctrl->GetCurrentPos(), callTip); } } evt.Skip(); }
void TextFrame::OnTextModified(wxStyledTextEvent& event) { wxStyledTextCtrl* txt = getCurrentTextCtrl(); if(txt) { int line = txt->LineFromPosition(event.GetPosition()), lines = event.GetLinesAdded(), linecount = txt->GetLineCount(); getDocument()->setModified(txt->IsModified()); if(lines!=0) { // Add or remove lines updateLineNbMargin(); _fastFindLine->SetRange(1, linecount); // Bookmarks if(getDocument()->getBookmarks().addLines(line, lines)) UpdateBookmarkPanel(); // Markers _markbar->SetMax(linecount); _markbar->MoveMarkers(line, lines); } } event.Skip(); }
void SubsTextEditCtrl::OnDoubleClick(wxStyledTextEvent &evt) { auto bounds = GetBoundsOfWordAtPosition(evt.GetPosition()); if (bounds.second != 0) SetSelection(bounds.first, bounds.first + bounds.second); else evt.Skip(); }
/* TextEditor::onCharAdded * Called when a character is added to the text *******************************************************************/ void TextEditor::onCharAdded(wxStyledTextEvent& e) { // Update line numbers margin width string numlines = S_FMT("0%d", GetNumberOfLines()); SetMarginWidth(0, TextWidth(wxSTC_STYLE_LINENUMBER, numlines)); // Auto indent int currentLine = GetCurrentLine(); if (txed_auto_indent && e.GetKey() == '\n') { // Get indentation amount int lineInd = 0; if (currentLine > 0) lineInd = GetLineIndentation(currentLine - 1); // Do auto-indent if needed if (lineInd != 0) { SetLineIndentation(currentLine, lineInd); // Skip to end of tabs while (1) { int chr = GetCharAt(GetCurrentPos()); if (chr == '\t' || chr == ' ') GotoPos(GetCurrentPos()+1); else break; } } } // The following require a language to work if (language) { // Call tip if (e.GetKey() == '(' && txed_calltips_parenthesis) { openCalltip(GetCurrentPos()); } // End call tip if (e.GetKey() == ')') { CallTipCancel(); } // Comma, possibly update calltip if (e.GetKey() == ',' && txed_calltips_parenthesis) { //openCalltip(GetCurrentPos()); //if (CallTipActive()) updateCalltip(); } } // Continue e.Skip(); }
void PyConsole::OnStcEvent(wxStyledTextEvent& event) { if( event.GetEventType() == wxEVT_STC_DOUBLECLICK ) { wxString word = m_control->GetSelectedText(); HighlightOccurrences(word, wxSTC_FIND_MATCHCASE | wxSTC_FIND_WORDSTART ); event.Skip(); } }
/* TextEditor::onUpdateUI * Called when anything is modified in the text editor (cursor * position, styling, text, etc) *******************************************************************/ void TextEditor::onUpdateUI(wxStyledTextEvent& e) { // Check for brace match if (txed_brace_match) checkBraceMatch(); // If a calltip is open, update it if (call_tip->IsShown()) updateCalltip(); // Do word matching if appropriate if (txed_match_cursor_word && language) { int word_start = WordStartPosition(GetCurrentPos(), true); int word_end = WordEndPosition(GetCurrentPos(), true); string current_word = GetTextRange(word_start, word_end); if (!current_word.IsEmpty() && HasFocus()) { if (current_word != prev_word_match) { prev_word_match = current_word; SetIndicatorCurrent(8); IndicatorClearRange(0, GetTextLength()); SetTargetStart(0); SetTargetEnd(GetTextLength()); SetSearchFlags(0); while (SearchInTarget(current_word) != -1) { IndicatorFillRange(GetTargetStart(), GetTargetEnd() - GetTargetStart()); SetTargetStart(GetTargetEnd()); SetTargetEnd(GetTextLength()); } } } else { SetIndicatorCurrent(8); IndicatorClearRange(0, GetTextLength()); prev_word_match = ""; } } // Hilight current line MarkerDeleteAll(1); MarkerDeleteAll(2); if (txed_hilight_current_line > 0 && HasFocus()) { int line = LineFromPosition(GetCurrentPos()); MarkerAdd(line, 1); if (txed_hilight_current_line > 1) MarkerAdd(line, 2); } e.Skip(); }
void SvnConsole::OnUpdateUI(wxStyledTextEvent& event) { //if(m_sci->GetCurrentPos() < m_inferiorEnd) { // m_sci->SetCurrentPos(m_inferiorEnd); // m_sci->SetSelectionStart(m_inferiorEnd); // m_sci->SetSelectionEnd(m_inferiorEnd); // m_sci->EnsureCaretVisible(); //} event.Skip(); }
void ctlSQLBox::OnPositionStc(wxStyledTextEvent &event) { int pos = GetCurrentPos(); wxChar ch = GetCharAt(pos - 1); int st = GetStyleAt(pos - 1); int match; // Line numbers // Ensure we don't recurse through any paint handlers on Mac #ifdef __WXMAC__ Freeze(); #endif UpdateLineNumber(); #ifdef __WXMAC__ Thaw(); #endif // Clear all highlighting BraceBadLight(wxSTC_INVALID_POSITION); // Check for braces that aren't in comment styles, // double quoted styles or single quoted styles if ((ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == '(' || ch == ')') && st != 2 && st != 6 && st != 7) { match = BraceMatch(pos - 1); if (match != wxSTC_INVALID_POSITION) BraceHighlight(pos - 1, match); } // Roll back through the doc and highlight any unmatched braces while ((pos--) >= 0) { ch = GetCharAt(pos); st = GetStyleAt(pos); if ((ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == '(' || ch == ')') && st != 2 && st != 6 && st != 7) { match = BraceMatch(pos); if (match == wxSTC_INVALID_POSITION) { BraceBadLight(pos); break; } } } event.Skip(); }
void CodeEdit::OnCharAdded(wxStyledTextEvent& event) { // Indent the line to the same indentation as the previous line. // Adapted from http://STCntilla.sourceforge.net/STCntillaUsage.html char ch = event.GetKey(); if (ch == '\r' || ch == '\n') { int line = GetCurrentLine(); int lineLength = LineLength(line); if (line > 0 && lineLength <= 2) { wxString buffer = GetLine(line - 1); for (unsigned int i = 0; i < buffer.Length(); ++i) { if (buffer[i] != ' ' && buffer[i] != '\t') { buffer.Truncate(i); break; } } ReplaceSelection(buffer); // Remember that we just auto-indented so that the backspace // key will un-autoindent us. m_autoIndented = true; } } else if (m_enableAutoComplete && m_autoCompleteManager != NULL) { // Handle auto completion. wxString token; if (GetTokenFromPosition(GetCurrentPos() - 1, ".:", token)) { StartAutoCompletion(token); } } event.Skip(); }
/* TextEditor::onUpdateUI * Called when anything is modified in the text editor (cursor * position, styling, text, etc) *******************************************************************/ void TextEditor::onUpdateUI(wxStyledTextEvent& e) { // Check for brace match if (txed_brace_match) checkBraceMatch(); // If a calltip is open, update it if (CallTipActive()) updateCalltip(); e.Skip(); }
void SubsTextEditCtrl::OnDoubleClick(wxStyledTextEvent &evt) { int pos = evt.GetPosition(); if (pos == -1 && !tokenized_line.empty()) { auto tok = tokenized_line.back(); SetSelection(line_text.size() - tok.length, line_text.size()); } else { auto bounds = GetBoundsOfWordAtPosition(evt.GetPosition()); if (bounds.second != 0) SetSelection(bounds.first, bounds.first + bounds.second); else evt.Skip(); } }
void Edit::OnCharAdded(wxStyledTextEvent &event) { event.Skip(); const wxChar c = event.GetKey(); if (c == wxT('\n')) { const int line = GetCurrentLine(); const int indent = line < 1 ? 0 : GetLineIndentation(line - 1); if (indent != 0) { SetLineIndentation(line, indent); GotoPos(GetLineIndentPosition(line)); } } }
void SvnConsole::OnCharAdded(wxStyledTextEvent& event) { if(event.GetKey() == '\n') { // an enter was inserted // take the last inserted line and send it to the m_process wxString line = m_sci->GetTextRange(m_inferiorEnd, m_sci->GetLength()); line.Trim(); if(m_process) { m_process->Write(line); } } event.Skip(); }
void wxCodeCompletionBox::StcCharAdded(wxStyledTextEvent& event) { event.Skip(); int keychar = m_stc->GetCharAt(m_stc->PositionBefore(m_stc->GetCurrentPos())); if(((keychar >= 65) && (keychar <= 90)) || // A-Z ((keychar >= 97) && (keychar <= 122)) || // a-z ((keychar >= 48) && (keychar <= 57)) || // 0-9 (keychar == 95)) // Underscore { DoUpdateList(); } else { DoDestroy(); } }
void wxSTEditorFrame::OnSTCUpdateUI(wxStyledTextEvent &event) { event.Skip(); if (!GetStatusBar()) // nothing to do return; wxStyledTextCtrl* editor = wxStaticCast(event.GetEventObject(), wxStyledTextCtrl); STE_TextPos pos = editor->GetCurrentPos(); int line = editor->GetCurrentLine() + 1; // start at 1 int lines = editor->GetLineCount(); int col = editor->GetColumn(pos) + 1; // start at 1 int chars = editor->GetLength(); wxString txt = wxString::Format("Line %6d of %6d, Col %4d, Chars %6d ", line, lines, col, chars); txt += editor->GetOvertype() ? "[OVR]" : "[INS]"; if (txt != GetStatusBar()->GetStatusText()) // minor flicker reduction SetStatusText(txt, 0); }
void CodeEdit::OnModified(wxStyledTextEvent& event) { event.Skip(); int linesAdded = event.GetLinesAdded(); // If we're inserting new lines before a line, so we need to move the // markers down. STCntilla doesn't do this automatically for the current line. if (linesAdded > 0) { unsigned int position = event.GetPosition(); unsigned int line = LineFromPosition(position); unsigned int lineStartPosition = PositionFromLine(line); if (position == lineStartPosition) { int markers = MarkerGet(line); // Delete all of the markers from the line. for (int i = 0; i < 32; ++i) { MarkerDelete(line, i); } // Add the markers back on the new line. MarkerAddSet(line + linesAdded, markers); } } }
void IWnd_stc::OnStyledTextChanged(wxStyledTextEvent& evt) { if(func) func(); evt.Skip(); }
void wxCodeCompletionBox::StcModified(wxStyledTextEvent& event) { event.Skip(); DoUpdateList(); }
/* TextEntryPanel::onTextModified * Called when the text in the TextEditor is modified *******************************************************************/ void TextEntryPanel::onTextModified(wxStyledTextEvent& e) { if (!isModified() && text_area->CanUndo()) setModified(); e.Skip(); }
void GitConsole::OnStclogStcChange(wxStyledTextEvent& event) { event.Skip(); ::clRecalculateSTCHScrollBar(m_stcLog); }
/* TextEntryPanel::onUpdateUI * Called when the text editor UI is updated *******************************************************************/ void TextEntryPanel::onUpdateUI(wxStyledTextEvent& e) { updateStatus(); e.Skip(); }
void MyStyledText::OnStcKey(wxStyledTextEvent& event) { wxMessageBox("Onstyleddddddddddddddddddddddddd"); printf("key:%d\n", event.GetKey()); event.Skip(); }
virtual void OnAnyChange(wxStyledTextEvent& event) { OnAnyChange(); event.Skip(); }
/*---------------------------------------------------------------------------*/ void wxSQLBook::OnUpdateUI(wxStyledTextEvent& event) { ShowEditorPos(); event.Skip(); }