[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
This commit is contained in:
Don Ho 2012-06-26 00:55:01 +00:00
parent 07671e8d71
commit 86f444f829
4 changed files with 16 additions and 7 deletions

View File

@ -941,7 +941,12 @@ void Notepad_plus::command(int id)
case IDM_VIEW_TOGGLE_UNFOLDALL: case IDM_VIEW_TOGGLE_UNFOLDALL:
{ {
_isFolding = true; // So we can ignore events while folding is taking place _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; _isFolding = false;
} }
break; break;

View File

@ -1520,9 +1520,7 @@ void ScintillaEditView::syncFoldStateWith(const std::vector<HeaderLineState> & l
bool expanded = isFolded(hls._headerLineNumber); bool expanded = isFolded(hls._headerLineNumber);
// set line to state folded // set line to state folded
if (hls._isExpanded != expanded) if (hls._isExpanded != expanded)
{ execute(SCI_TOGGLEFOLD, hls._headerLineNumber);
fold(hls._headerLineNumber, !expanded);
}
} }
} }
@ -1636,7 +1634,7 @@ void ScintillaEditView::fold(int line, bool mode)
if (isFolded(headerLine) != mode) if (isFolded(headerLine) != mode)
{ {
execute(SCI_TOGGLEFOLD, headerLine); execute(SCI_TOGGLEFOLD, headerLine);
SCNotification scnN; SCNotification scnN;
scnN.nmhdr.code = SCN_FOLDINGSTATECHANGED; scnN.nmhdr.code = SCN_FOLDINGSTATECHANGED;
scnN.nmhdr.hwndFrom = _hSelf; scnN.nmhdr.hwndFrom = _hSelf;
@ -1664,8 +1662,8 @@ void ScintillaEditView::foldAll(bool mode)
{ {
int level = execute(SCI_GETFOLDLEVEL, line); int level = execute(SCI_GETFOLDLEVEL, line);
if (level & SC_FOLDLEVELHEADERFLAG) if (level & SC_FOLDLEVELHEADERFLAG)
if (isFolded(line) != mode) if ((execute(SCI_GETFOLDEXPANDED, line) != 0) != mode)
fold(line, mode); execute(SCI_TOGGLEFOLD, line);
} }
} }

View File

@ -235,6 +235,11 @@ void DocumentMap::fold(int line, bool foldOrNot)
_pScintillaEditView->fold(line, foldOrNot); _pScintillaEditView->fold(line, foldOrNot);
} }
void DocumentMap::foldAll(bool mode)
{
_pScintillaEditView->foldAll(mode);
}
void DocumentMap::scrollMap(bool direction, moveMode whichMode) void DocumentMap::scrollMap(bool direction, moveMode whichMode)
{ {
// Visible line for the code view // Visible line for the code view

View File

@ -121,6 +121,7 @@ public:
void scrollMap(bool direction, moveMode whichMode); void scrollMap(bool direction, moveMode whichMode);
void doMove(); void doMove();
void fold(int line, bool foldOrNot); void fold(int line, bool foldOrNot);
void foldAll(bool mode);
void setSyntaxLiliting(); void setSyntaxLiliting();
protected: protected: