[NEW_FEATURE] (Author: Andreas Jonsson) Add Begin/End Select feature.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1057 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-06-09 08:52:15 +00:00
parent fe5b147fe3
commit 874d5605c4
8 changed files with 39 additions and 12 deletions

View File

@ -231,6 +231,7 @@ BEGIN
MENUITEM "&Paste", IDM_EDIT_PASTE
MENUITEM "&Delete", IDM_EDIT_DELETE
MENUITEM "Select A&ll", IDM_EDIT_SELECTALL
MENUITEM "Begin/End Select", IDM_EDIT_BEGINENDSELECT
MENUITEM SEPARATOR
POPUP "Copy to Clipboard"
BEGIN

View File

@ -309,6 +309,12 @@ void Notepad_plus::command(int id)
}
break;
case IDM_EDIT_BEGINENDSELECT:
{
_pEditView->beginOrEndSelect();
}
break;
case IDM_EDIT_CHAR_PANEL:
{
launchAnsiCharPanel();

View File

@ -106,6 +106,7 @@ WinMenuKeyDefinition winKeyDefs[] = {
{VK_NULL, IDM_EDIT_TAB2SW, false, false, false, NULL},
{VK_NULL, IDM_EDIT_SW2TAB_ALL, false, false, false, NULL},
{VK_NULL, IDM_EDIT_SW2TAB_LEADING, false, false, false, NULL},
{VK_NULL, IDM_EDIT_BEGINENDSELECT, false, false, false, NULL},
{VK_C, IDM_EDIT_COLUMNMODE, false, true, false, NULL},
{VK_U, IDM_EDIT_UPPERCASE, true, false, true, NULL},

View File

@ -2044,6 +2044,19 @@ void ScintillaEditView::addText(int length, const char *buf)
execute(SCI_ADDTEXT, length, (LPARAM)buf);
}
void ScintillaEditView::beginOrEndSelect()
{
if(_beginSelectPosition == -1)
{
_beginSelectPosition = execute(SCI_GETCURRENTPOS);
}
else
{
execute(SCI_SETANCHOR, (WPARAM)_beginSelectPosition);
_beginSelectPosition = -1;
}
}
void ScintillaEditView::marginClick(int position, int modifiers)
{
int lineClick = int(execute(SCI_LINEFROMPOSITION, position, 0));

View File

@ -203,7 +203,7 @@ friend class Finder;
public:
ScintillaEditView()
: Window(), _pScintillaFunc(NULL),_pScintillaPtr(NULL),
_lineNumbersShown(false), _wrapRestoreNeeded(false)
_lineNumbersShown(false), _wrapRestoreNeeded(false), _beginSelectPosition(-1)
{
++_refCount;
};
@ -277,6 +277,8 @@ public:
void saveCurrentFold();
void restoreCurrentFold();
void beginOrEndSelect();
int getCurrentDocLen() const {
return int(execute(SCI_GETLENGTH));
};
@ -676,6 +678,8 @@ protected:
typedef std::map<BufferID, StyleMap*> BufferStyleMap;
BufferStyleMap _hotspotStyles;
int _beginSelectPosition;
//Lexers and Styling
void restyleBuffer();
const char * getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex);

View File

@ -18,6 +18,7 @@ http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Context_Menu
<Item MenuEntryName="Edit" MenuItemName="Paste"/>
<Item MenuEntryName="Edit" MenuItemName="Delete"/>
<Item MenuEntryName="Edit" MenuItemName="Select all"/>
<Item MenuEntryName="Edit" MenuItemName="Begin/End Select"/>
<!-- id="0" is the separator -->
<Item id="0"/>

View File

@ -62,6 +62,7 @@
#define IDM_EDIT_PASTE (IDM_EDIT + 5)
#define IDM_EDIT_DELETE (IDM_EDIT + 6)
#define IDM_EDIT_SELECTALL (IDM_EDIT + 7)
#define IDM_EDIT_BEGINENDSELECT (IDM_EDIT + 20)
#define IDM_EDIT_INS_TAB (IDM_EDIT + 8)
#define IDM_EDIT_RMV_TAB (IDM_EDIT + 9)

View File

@ -29,12 +29,12 @@
#ifndef RESOURCE_H
#define RESOURCE_H
#define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v6.3.3")
#define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v6.4")
// should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71
// ex : #define VERSION_VALUE TEXT("5.63\0")
#define VERSION_VALUE TEXT("6.33\0")
#define VERSION_DIGITALVALUE 6, 3, 3, 0
#define VERSION_VALUE TEXT("6.4\0")
#define VERSION_DIGITALVALUE 6, 4, 0, 0
#ifdef UNICODE
#define UNICODE_ANSI_MODE TEXT("(UNICODE)")