MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / NotifyMarginClick

Method NotifyMarginClick

scintilla/src/Editor.cxx:4610–4653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4608}
4609
4610bool Editor::NotifyMarginClick ( Point pt, bool shift, bool ctrl, bool alt )
4611{
4612 int marginClicked = -1;
4613 int x = vs.textStart - vs.fixedColumnWidth;
4614 for ( int margin = 0; margin <= SC_MAX_MARGIN; margin++ ) {
4615 if ( ( pt.x >= x ) && ( pt.x < x + vs.ms[margin].width ) ) {
4616 marginClicked = margin;
4617 }
4618 x += vs.ms[margin].width;
4619 }
4620 if ( ( marginClicked >= 0 ) && vs.ms[marginClicked].sensitive ) {
4621 int position = pdoc->LineStart ( LineFromLocation ( pt ) );
4622 if ( ( vs.ms[marginClicked].mask & SC_MASK_FOLDERS ) && ( foldAutomatic & SC_AUTOMATICFOLD_CLICK ) ) {
4623 int lineClick = pdoc->LineFromPosition ( position );
4624 if ( shift && ctrl ) {
4625 FoldAll ( SC_FOLDACTION_TOGGLE );
4626 } else {
4627 int levelClick = pdoc->GetLevel ( lineClick );
4628 if ( levelClick & SC_FOLDLEVELHEADERFLAG ) {
4629 if ( shift ) {
4630 // Ensure all children visible
4631 FoldExpand ( lineClick, SC_FOLDACTION_EXPAND, levelClick );
4632 } else if ( ctrl ) {
4633 FoldExpand ( lineClick, SC_FOLDACTION_TOGGLE, levelClick );
4634 } else {
4635 // Toggle this line
4636 FoldLine ( lineClick, SC_FOLDACTION_TOGGLE );
4637 }
4638 }
4639 }
4640 return true;
4641 }
4642 SCNotification scn = {0};
4643 scn.nmhdr.code = SCN_MARGINCLICK;
4644 scn.modifiers = ( shift ? SCI_SHIFT : 0 ) | ( ctrl ? SCI_CTRL : 0 ) |
4645 ( alt ? SCI_ALT : 0 );
4646 scn.position = position;
4647 scn.margin = marginClicked;
4648 NotifyParent ( scn );
4649 return true;
4650 } else {
4651 return false;
4652 }
4653}
4654
4655void Editor::NotifyNeedShown ( int pos, int len )
4656{

Callers

nothing calls this directly

Calls 3

LineStartMethod · 0.45
LineFromPositionMethod · 0.45
GetLevelMethod · 0.45

Tested by

no test coverage detected