From 3c7a885a89c09252b6d2896aa5a3294ba198ffb2 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 27 May 2010 00:05:51 +0000 Subject: [PATCH] [NEW_FEATURE] Add "Inverse bookmark" feature. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@636 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 16 ++++++++++++++++ PowerEditor/src/Notepad_plus.h | 1 + PowerEditor/src/Notepad_plus.rc | 1 + PowerEditor/src/NppCommands.cpp | 4 ++++ PowerEditor/src/menuCmdID.h | 2 +- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 5e8be1e82..90b50ae33 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1578,6 +1578,22 @@ void Notepad_plus::deleteMarkedline(int ln) _pEditView->replaceTarget(emptyString, lineBegin, lineBegin + lineLen); } +void Notepad_plus::inverseMarks() +{ + int lastLine = _pEditView->lastZeroBasedLineNumber(); + for (int i = 0 ; i <= lastLine ; i++) + { + if (bookmarkPresent(i)) + { + bookmarkDelete(i); + } + else + { + bookmarkAdd(i); + } + } +} + void Notepad_plus::replaceMarkedline(int ln, const TCHAR *str) { int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index c781243a5..cdab3c244 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -536,6 +536,7 @@ private: void deleteMarkedLines(); void pasteToMarkedLines(); void deleteMarkedline(int ln); + void inverseMarks(); void replaceMarkedline(int ln, const TCHAR *str); generic_string getMarkedLine(int ln); void findMatchingBracePos(int & braceAtCaret, int & braceOpposite); diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 21776f7b2..a4cf7dbb3 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -325,6 +325,7 @@ BEGIN MENUITEM "Copy Bookmarked Lines", IDM_SEARCH_COPYMARKEDLINES MENUITEM "Paste to (Replace) Bookmarked Lines", IDM_SEARCH_PASTEMARKEDLINES MENUITEM "Delete Bookmarked Lines", IDM_SEARCH_DELETEMARKEDLINES + MENUITEM "Inverse Bookmark", IDM_SEARCH_INVERSEMARKS END POPUP "&View" diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 952cbd13c..ca9192797 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -651,6 +651,10 @@ void Notepad_plus::command(int id) deleteMarkedLines(); break; + case IDM_SEARCH_INVERSEMARKS : + inverseMarks(); + break; + case IDM_VIEW_FULLSCREENTOGGLE : fullScreenToggle(); break; diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 5304c77c6..960eefdf1 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -153,7 +153,7 @@ #define IDM_SEARCH_SETANDFINDNEXT (IDM_SEARCH + 48) #define IDM_SEARCH_SETANDFINDPREV (IDM_SEARCH + 49) - + #define IDM_SEARCH_INVERSEMARKS (IDM_SEARCH + 50) #define IDM_VIEW (IDM + 4000) //#define IDM_VIEW_TOOLBAR_HIDE (IDM_VIEW + 1)