void StyledTextCtrl::OnMarginClick(wxStyledTextEvent& event) { int lineClick = LineFromPosition(event.GetPosition()); int levelClick = GetFoldLevel(lineClick); switch (event.GetMargin()) { case MARGIN_FOLD: if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) { ToggleFold(lineClick); } break; case MARGIN_LINE_BREAKS: if (MarkerGet(lineClick) == 0) { MarkerAdd(lineClick, 0); } else { MarkerDelete(lineClick, 0); } break; case MARGIN_LINE_EDITS: break; case MARGIN_LINE_NUMBERS: break; default: break; } }
//! misc void Edit::OnMarginClick (wxStyledTextEvent &event) { if (event.GetMargin() == 2) { int lineClick = LineFromPosition (event.GetPosition()); int levelClick = GetFoldLevel (lineClick); if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) { ToggleFold (lineClick); } } }
/* TextEditor::onMarginClick * Called when a margin is clicked *******************************************************************/ void TextEditor::onMarginClick(wxStyledTextEvent& e) { if (e.GetMargin() == 1) { int line = LineFromPosition(e.GetPosition()); int level = GetFoldLevel(line); if ((level & wxSTC_FOLDLEVELHEADERFLAG) > 0) ToggleFold(line); updateFolding(); } }
void IWnd_stc::OnMarginClick (wxStyledTextEvent &evt) { if (evt.GetMargin() == StcManager::FOLDING_ID) { int lineClick = LineFromPosition (evt.GetPosition()); int levelClick = GetFoldLevel (lineClick); if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) { ToggleFold (lineClick); } } }
void CodeEditor::OnMarginClick(wxScintillaEvent &event) { if (event.GetMargin() == 1) { int lineClick = LineFromPosition(event.GetPosition()); int levelClick = GetFoldLevel(lineClick); if ((levelClick & wxSCI_FOLDLEVELHEADERFLAG) > 0) { ToggleFold (lineClick); } } }
/* TextEditor::foldAll * Folds or unfolds all code folding levels, depending on [fold] *******************************************************************/ void TextEditor::foldAll(bool fold) { #if (wxMAJOR_VERSION >= 3 && wxMINOR_VERSION >= 1) // FoldAll is only available in wxWidgets 3.1+ FoldAll(fold ? wxSTC_FOLDACTION_CONTRACT : wxSTC_FOLDACTION_EXPAND); #else for (int a = 0; a < GetNumberOfLines(); a++) { int level = GetFoldLevel(a); if ((level & wxSTC_FOLDLEVELHEADERFLAG) > 0 && GetFoldExpanded(a) == fold) ToggleFold(a); } #endif updateFolding(); }