From 86f444f8291bc446875479d880b0841f5d0dad5e Mon Sep 17 00:00:00 2001 From: Don Ho Date: Tue, 26 Jun 2012 00:55:01 +0000 Subject: [PATCH] [BUG_FIXED] Fix un regression: folding/unfolding performance issue. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@919 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/NppCommands.cpp | 7 ++++++- .../src/ScitillaComponent/ScintillaEditView.cpp | 10 ++++------ .../src/WinControls/DocumentMap/documentMap.cpp | 5 +++++ PowerEditor/src/WinControls/DocumentMap/documentMap.h | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index ac479b798..b96bbae35 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -941,7 +941,12 @@ void Notepad_plus::command(int id) case IDM_VIEW_TOGGLE_UNFOLDALL: { _isFolding = true; // So we can ignore events while folding is taking place - _pEditView->foldAll((id==IDM_VIEW_TOGGLE_FOLDALL)?fold_collapse:fold_uncollapse); + bool doCollapse = (id==IDM_VIEW_TOGGLE_FOLDALL)?fold_collapse:fold_uncollapse; + _pEditView->foldAll(doCollapse); + if (_pDocMap) + { + _pDocMap->foldAll(doCollapse); + } _isFolding = false; } break; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 32ad91751..ac40f7824 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -1520,9 +1520,7 @@ void ScintillaEditView::syncFoldStateWith(const std::vector & l bool expanded = isFolded(hls._headerLineNumber); // set line to state folded if (hls._isExpanded != expanded) - { - fold(hls._headerLineNumber, !expanded); - } + execute(SCI_TOGGLEFOLD, hls._headerLineNumber); } } @@ -1636,7 +1634,7 @@ void ScintillaEditView::fold(int line, bool mode) if (isFolded(headerLine) != mode) { execute(SCI_TOGGLEFOLD, headerLine); - + SCNotification scnN; scnN.nmhdr.code = SCN_FOLDINGSTATECHANGED; scnN.nmhdr.hwndFrom = _hSelf; @@ -1664,8 +1662,8 @@ void ScintillaEditView::foldAll(bool mode) { int level = execute(SCI_GETFOLDLEVEL, line); if (level & SC_FOLDLEVELHEADERFLAG) - if (isFolded(line) != mode) - fold(line, mode); + if ((execute(SCI_GETFOLDEXPANDED, line) != 0) != mode) + execute(SCI_TOGGLEFOLD, line); } } diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index 881cf6472..56bd3be59 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -235,6 +235,11 @@ void DocumentMap::fold(int line, bool foldOrNot) _pScintillaEditView->fold(line, foldOrNot); } +void DocumentMap::foldAll(bool mode) +{ + _pScintillaEditView->foldAll(mode); +} + void DocumentMap::scrollMap(bool direction, moveMode whichMode) { // Visible line for the code view diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index 4bc6681a4..e4f26e33f 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -121,6 +121,7 @@ public: void scrollMap(bool direction, moveMode whichMode); void doMove(); void fold(int line, bool foldOrNot); + void foldAll(bool mode); void setSyntaxLiliting(); protected: