[ENHANCE] refine the hide lines feature.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@36 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-09-16 21:40:08 +00:00
parent 98fc4be762
commit 4e26d3b469
2 changed files with 13 additions and 1 deletions

View File

@ -3053,7 +3053,7 @@ void Notepad_plus::command(int id)
_pEditView->execute(SCI_HIDELINES, startLine, endLine); _pEditView->execute(SCI_HIDELINES, startLine, endLine);
_pEditView->execute(SCI_MARKERADD, startLine-1, MARK_HIDELINESBEGIN); _pEditView->execute(SCI_MARKERADD, startLine-1, MARK_HIDELINESBEGIN);
_pEditView->execute(SCI_MARKERADD, endLine+1, MARK_HIDELINESEND); _pEditView->execute(SCI_MARKERADD, endLine+1, MARK_HIDELINESEND);
_hideLinesMarks.push_back(pair<int, int>(startLine-1, endLine+1));
break; break;
} }
@ -6601,11 +6601,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_DOCSWITCHOFF : case NPPM_INTERNAL_DOCSWITCHOFF :
{ {
removeHideLinesBookmarks();
return TRUE; return TRUE;
} }
case NPPM_INTERNAL_DOCSWITCHIN : case NPPM_INTERNAL_DOCSWITCHIN :
{ {
_hideLinesMarks.empty();
return TRUE; return TRUE;
} }

View File

@ -511,6 +511,8 @@ private:
HWND _hParent; HWND _hParent;
} _scintillaCtrls4Plugins; } _scintillaCtrls4Plugins;
vector<pair<int, int>> _hideLinesMarks;
static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
@ -913,6 +915,14 @@ private:
} }
return userLangName; return userLangName;
} }
void removeHideLinesBookmarks() {
for (size_t i = 0 ; i < _hideLinesMarks.size() ; i++)
{
hideLinesMarkDelete(_hideLinesMarks[i].first, MARK_HIDELINESBEGIN);
hideLinesMarkDelete(_hideLinesMarks[i].second, MARK_HIDELINESEND);
}
};
}; };
#endif //NOTEPAD_PLUS_H #endif //NOTEPAD_PLUS_H