From fdc6f7d8b0da887bd5de05cf28c9fc1c856ec1fd Mon Sep 17 00:00:00 2001 From: donho Date: Mon, 26 May 2008 17:38:27 +0000 Subject: [PATCH] [NEW_FEATURE] Marked line operation (in progress). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@208 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 4 ++++ PowerEditor/src/Notepad_plus.h | 23 +++++++++++++++++++++++ PowerEditor/src/Notepad_plus.rc | 12 +++++++----- PowerEditor/src/menuCmdID.h | 5 +++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index c604edc0c..5aa58e6f8 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2973,6 +2973,10 @@ void Notepad_plus::command(int id) } break; + case IDM_EDIT_DELETEMARKEDLINES : + markedLinesOperation(0); + break; + case IDM_VIEW_FULLSCREENTOGGLE : fullScreenToggle(); break; diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 82d6ab029..0ad6ed23f 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -536,6 +536,29 @@ private: _pEditView->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); }; + void markedLinesOperation(int whichOp) { + int nbLine = _pEditView->getNbLine(); + + for (int i = 0 ; i < nbLine ; i++) + { + if (bookmarkPresent(i)) + lineOperation(i, whichOp); + } + }; + + void lineOperation(int ln, int op) { + int lineLen = _pEditView->execute(SCI_LINELENGTH, ln); + int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); + + bookmarkDelete(ln); + + _pEditView->execute(SCI_SETTARGETSTART, lineBegin); + _pEditView->execute(SCI_SETTARGETEND, lineBegin + lineLen); + + char emptyString[2] = ""; + _pEditView->execute(SCI_REPLACETARGET, strlen(emptyString), (LPARAM)emptyString); + }; + int hideLinesMarkPresent(int lineno) const { LRESULT state = _pEditView->execute(SCI_MARKERGET, lineno); if ((state & (1 << MARK_HIDELINESBEGIN)) != 0) diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index e2a293134..4fba64ac9 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -305,8 +305,10 @@ BEGIN MENUITEM "Set Read Only", IDM_EDIT_SETREADONLY MENUITEM "Clear Read Only Flag", IDM_EDIT_CLEARREADONLY MENUITEM SEPARATOR - MENUITEM "Text Direction RTL", IDM_EDIT_RTL - MENUITEM "Text Direction LTR", IDM_EDIT_LTR + MENUITEM "Cut marked lines", IDM_EDIT_CUTMARKEDLINES + MENUITEM "Copy marked lines", IDM_EDIT_COPYMARKEDLINES + MENUITEM "Paste to (Replace) marked lines", IDM_EDIT_PASTEMARKEDLINES + MENUITEM "Delete marked lines", IDM_EDIT_DELETEMARKEDLINES END POPUP "&Search" @@ -383,9 +385,9 @@ BEGIN MENUITEM "Clone to another view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH - //MENUITEM SEPARATOR - //MENUITEM "Vertical tabbar", IDM_VIEW_DRAWTABBAR_VERTICAL - //MENUITEM "Multiline tabbar", IDM_VIEW_DRAWTABBAR_MULTILINE + MENUITEM SEPARATOR + MENUITEM "Text Direction RTL", IDM_EDIT_RTL + MENUITEM "Text Direction LTR", IDM_EDIT_LTR END POPUP "For&mat" diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 0c21e817d..2c4c4e9ec 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -76,6 +76,11 @@ #define IDM_EDIT_COLUMNMODE (IDM_EDIT+34) #define IDM_EDIT_BLOCK_COMMENT_SET (IDM_EDIT+35) #define IDM_EDIT_BLOCK_UNCOMMENT (IDM_EDIT+36) + + #define IDM_EDIT_CUTMARKEDLINES (IDM_EDIT+42) + #define IDM_EDIT_COPYMARKEDLINES (IDM_EDIT+43) + #define IDM_EDIT_PASTEMARKEDLINES (IDM_EDIT+44) + #define IDM_EDIT_DELETEMARKEDLINES (IDM_EDIT+45) #define IDM_EDIT_AUTOCOMPLETE (50000+0) #define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000+1)