| 7255 | } |
| 7256 | |
| 7257 | void Editor::FoldAll ( int action ) |
| 7258 | { |
| 7259 | pdoc->EnsureStyledTo ( pdoc->Length() ); |
| 7260 | int maxLine = pdoc->LinesTotal(); |
| 7261 | bool expanding = action == SC_FOLDACTION_EXPAND; |
| 7262 | if ( action == SC_FOLDACTION_TOGGLE ) { |
| 7263 | // Discover current state |
| 7264 | for ( int lineSeek = 0; lineSeek < maxLine; lineSeek++ ) { |
| 7265 | if ( pdoc->GetLevel ( lineSeek ) & SC_FOLDLEVELHEADERFLAG ) { |
| 7266 | expanding = !cs.GetExpanded ( lineSeek ); |
| 7267 | break; |
| 7268 | } |
| 7269 | } |
| 7270 | } |
| 7271 | if ( expanding ) { |
| 7272 | cs.SetVisible ( 0, maxLine - 1, true ); |
| 7273 | for ( int line = 0; line < maxLine; line++ ) { |
| 7274 | int levelLine = pdoc->GetLevel ( line ); |
| 7275 | if ( levelLine & SC_FOLDLEVELHEADERFLAG ) { |
| 7276 | SetFoldExpanded ( line, true ); |
| 7277 | } |
| 7278 | } |
| 7279 | } else { |
| 7280 | for ( int line = 0; line < maxLine; line++ ) { |
| 7281 | int level = pdoc->GetLevel ( line ); |
| 7282 | if ( ( level & SC_FOLDLEVELHEADERFLAG ) && |
| 7283 | ( SC_FOLDLEVELBASE == ( level & SC_FOLDLEVELNUMBERMASK ) ) ) { |
| 7284 | SetFoldExpanded ( line, false ); |
| 7285 | int lineMaxSubord = pdoc->GetLastChild ( line, -1 ); |
| 7286 | if ( lineMaxSubord > line ) { |
| 7287 | cs.SetVisible ( line + 1, lineMaxSubord, false ); |
| 7288 | } |
| 7289 | } |
| 7290 | } |
| 7291 | } |
| 7292 | SetScrollBars(); |
| 7293 | Redraw(); |
| 7294 | } |
| 7295 | |
| 7296 | void Editor::FoldChanged ( int line, int levelNow, int levelPrev ) |
| 7297 | { |
nothing calls this directly
no test coverage detected