[NEW_FEATURE] (Author: Andreas Jonsson) Add new feature: select all between matching braces.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1093 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 11 years ago
parent c866075f58
commit 8fe56ada57

@ -2038,7 +2038,9 @@ bool Notepad_plus::braceMatch()
}
}
enableCommand(IDM_SEARCH_GOTOMATCHINGBRACE, (braceAtCaret != -1) && (braceOpposite != -1), MENU | TOOLBAR);
const bool enable = (braceAtCaret != -1) && (braceOpposite != -1);
enableCommand(IDM_SEARCH_GOTOMATCHINGBRACE, enable, MENU | TOOLBAR);
enableCommand(IDM_SEARCH_SELECTMATCHINGBRACES, enable, MENU);
return (braceAtCaret != -1);
}

@ -328,6 +328,7 @@ BEGIN
MENUITEM "Previous Search Result", IDM_SEARCH_GOTOPREVFOUND
MENUITEM "&Go to...", IDM_SEARCH_GOTOLINE
MENUITEM "Go to Matching Brace", IDM_SEARCH_GOTOMATCHINGBRACE
MENUITEM "Select All Between Matching Braces" IDM_SEARCH_SELECTMATCHINGBRACES
MENUITEM SEPARATOR
POPUP "Mark All"

@ -748,13 +748,19 @@ void Notepad_plus::command(int id)
}
case IDM_SEARCH_GOTOMATCHINGBRACE :
case IDM_SEARCH_SELECTMATCHINGBRACES :
{
int braceAtCaret = -1;
int braceOpposite = -1;
findMatchingBracePos(braceAtCaret, braceOpposite);
if (braceOpposite != -1)
_pEditView->execute(SCI_GOTOPOS, braceOpposite);
{
if(id == IDM_SEARCH_GOTOMATCHINGBRACE)
_pEditView->execute(SCI_GOTOPOS, braceOpposite);
else
_pEditView->execute(SCI_SETSEL, min(braceAtCaret, braceOpposite), max(braceAtCaret, braceOpposite) + 1); // + 1 so we always include the ending brace in the selection.
}
break;
}
@ -2439,6 +2445,7 @@ void Notepad_plus::command(int id)
case IDM_SEARCH_SETANDFINDNEXT :
case IDM_SEARCH_SETANDFINDPREV :
case IDM_SEARCH_GOTOMATCHINGBRACE :
case IDM_SEARCH_SELECTMATCHINGBRACES :
case IDM_SEARCH_TOGGLE_BOOKMARK :
case IDM_SEARCH_NEXT_BOOKMARK:
case IDM_SEARCH_PREV_BOOKMARK:

@ -136,6 +136,7 @@ WinMenuKeyDefinition winKeyDefs[] = {
{VK_I, IDM_SEARCH_FINDINCREMENT, true, true, false, NULL},
{VK_G, IDM_SEARCH_GOTOLINE, true, false, false, NULL},
{VK_B, IDM_SEARCH_GOTOMATCHINGBRACE, true, false, false, NULL},
{VK_B, IDM_SEARCH_SELECTMATCHINGBRACES, true, true, false, NULL},
{VK_F2, IDM_SEARCH_TOGGLE_BOOKMARK, true, false, false, NULL},
{VK_F2, IDM_SEARCH_NEXT_BOOKMARK, false, false, false, NULL},
{VK_F2, IDM_SEARCH_PREV_BOOKMARK, false, false, true, NULL},

@ -185,11 +185,11 @@ MenuPosition menuPos[] = {
{ 1, 17, -1, "edit-blankOperations"},
{ 1, 18, -1, "edit-pasteSpecial"},
{ 2, 16, -1, "search-markAll"},
{ 2, 17, -1, "search-unmarkAll"},
{ 2, 18, -1, "search-jumpUp"},
{ 2, 19, -1, "search-jumpDown"},
{ 2, 21, -1, "search-bookmark"},
{ 2, 17, -1, "search-markAll"},
{ 2, 18, -1, "search-unmarkAll"},
{ 2, 19, -1, "search-jumpUp"},
{ 2, 20, -1, "search-jumpDown"},
{ 2, 22, -1, "search-bookmark"},
{ 3, 4, -1, "view-showSymbol"},
{ 3, 5, -1, "view-zoom"},
@ -698,39 +698,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
hDlgArrary[1] = userDefineDlg->getKeywordsHandle();
hDlgArrary[2] = userDefineDlg->getCommentHandle();
hDlgArrary[3] = userDefineDlg->getSymbolHandle();
/*
const int nbGrpFolder = 3;
int folderID[nbGrpFolder][nbControl] = {
//{IDC_DEFAULT_COLORSTYLEGROUP_STATIC, IDC_DEFAULT_FG_STATIC, IDC_DEFAULT_BG_STATIC, IDC_DEFAULT_FONTSTYLEGROUP_STATIC, IDC_DEFAULT_FONTNAME_STATIC, IDC_DEFAULT_FONTSIZE_STATIC, IDC_DEFAULT_BOLD_CHECK, IDC_DEFAULT_ITALIC_CHECK, IDC_DEFAULT_UNDERLINE_CHECK},\
//{IDC_FOLDEROPEN_COLORSTYLEGROUP_STATIC, IDC_FOLDEROPEN_FG_STATIC, IDC_FOLDEROPEN_BG_STATIC, IDC_FOLDEROPEN_FONTSTYLEGROUP_STATIC, IDC_FOLDEROPEN_FONTNAME_STATIC, IDC_FOLDEROPEN_FONTSIZE_STATIC, IDC_FOLDEROPEN_BOLD_CHECK, IDC_FOLDEROPEN_ITALIC_CHECK, IDC_FOLDEROPEN_UNDERLINE_CHECK},\
//{IDC_FOLDERCLOSE_COLORSTYLEGROUP_STATIC, IDC_FOLDERCLOSE_FG_STATIC, IDC_FOLDERCLOSE_BG_STATIC, IDC_FOLDERCLOSE_FONTSTYLEGROUP_STATIC, IDC_FOLDERCLOSE_FONTNAME_STATIC, IDC_FOLDERCLOSE_FONTSIZE_STATIC, IDC_FOLDERCLOSE_BOLD_CHECK, IDC_FOLDERCLOSE_ITALIC_CHECK, IDC_FOLDERCLOSE_UNDERLINE_CHECK}
};
const int nbGrpKeywords = 4;
int keywordsID[nbGrpKeywords][nbControl] = {//\
//{IDC_KEYWORD1_COLORSTYLEGROUP_STATIC, IDC_KEYWORD1_FG_STATIC, IDC_KEYWORD1_BG_STATIC, IDC_KEYWORD1_FONTSTYLEGROUP_STATIC, IDC_KEYWORD1_FONTNAME_STATIC, IDC_KEYWORD1_FONTSIZE_STATIC, IDC_KEYWORD1_BOLD_CHECK, IDC_KEYWORD1_ITALIC_CHECK, IDC_KEYWORD1_UNDERLINE_CHECK},\
//{IDC_KEYWORD2_COLORSTYLEGROUP_STATIC, IDC_KEYWORD2_FG_STATIC, IDC_KEYWORD2_BG_STATIC, IDC_KEYWORD2_FONTSTYLEGROUP_STATIC, IDC_KEYWORD2_FONTNAME_STATIC, IDC_KEYWORD2_FONTSIZE_STATIC, IDC_KEYWORD2_BOLD_CHECK, IDC_KEYWORD2_ITALIC_CHECK, IDC_KEYWORD2_UNDERLINE_CHECK},\
//{IDC_KEYWORD3_COLORSTYLEGROUP_STATIC, IDC_KEYWORD3_FG_STATIC, IDC_KEYWORD3_BG_STATIC, IDC_KEYWORD3_FONTSTYLEGROUP_STATIC, IDC_KEYWORD3_FONTNAME_STATIC, IDC_KEYWORD3_FONTSIZE_STATIC, IDC_KEYWORD3_BOLD_CHECK, IDC_KEYWORD3_ITALIC_CHECK, IDC_KEYWORD3_UNDERLINE_CHECK},\
//{IDC_KEYWORD4_COLORSTYLEGROUP_STATIC, IDC_KEYWORD4_FG_STATIC, IDC_KEYWORD4_BG_STATIC, IDC_KEYWORD4_FONTSTYLEGROUP_STATIC, IDC_KEYWORD4_FONTNAME_STATIC, IDC_KEYWORD4_FONTSIZE_STATIC, IDC_KEYWORD4_BOLD_CHECK, IDC_KEYWORD4_ITALIC_CHECK, IDC_KEYWORD4_UNDERLINE_CHECK}
};
const int nbGrpComment = 3;
int commentID[nbGrpComment][nbControl] = {//\
//{IDC_COMMENT_COLORSTYLEGROUP_STATIC, IDC_COMMENT_FG_STATIC, IDC_COMMENT_BG_STATIC, IDC_COMMENT_FONTSTYLEGROUP_STATIC, IDC_COMMENT_FONTNAME_STATIC, IDC_COMMENT_FONTSIZE_STATIC, IDC_COMMENT_BOLD_CHECK, IDC_COMMENT_ITALIC_CHECK, IDC_COMMENT_UNDERLINE_CHECK},\
//{IDC_NUMBER_COLORSTYLEGROUP_STATIC, IDC_NUMBER_FG_STATIC, IDC_NUMBER_BG_STATIC, IDC_NUMBER_FONTSTYLEGROUP_STATIC, IDC_NUMBER_FONTNAME_STATIC, IDC_NUMBER_FONTSIZE_STATIC, IDC_NUMBER_BOLD_CHECK, IDC_NUMBER_ITALIC_CHECK, IDC_NUMBER_UNDERLINE_CHECK},\
//{IDC_COMMENTLINE_COLORSTYLEGROUP_STATIC, IDC_COMMENTLINE_FG_STATIC, IDC_COMMENTLINE_BG_STATIC, IDC_COMMENTLINE_FONTSTYLEGROUP_STATIC, IDC_COMMENTLINE_FONTNAME_STATIC, IDC_COMMENTLINE_FONTSIZE_STATIC, IDC_COMMENTLINE_BOLD_CHECK, IDC_COMMENTLINE_ITALIC_CHECK, IDC_COMMENTLINE_UNDERLINE_CHECK}
};
const int nbGrpOperator = 4;
int operatorID[nbGrpOperator][nbControl] = {//\
//{IDC_OPERATOR_COLORSTYLEGROUP_STATIC, IDC_OPERATOR_FG_STATIC, IDC_OPERATOR_BG_STATIC, IDC_OPERATOR_FONTSTYLEGROUP_STATIC, IDC_OPERATOR_FONTNAME_STATIC, IDC_OPERATOR_FONTSIZE_STATIC, IDC_OPERATOR_BOLD_CHECK, IDC_OPERATOR_ITALIC_CHECK, IDC_OPERATOR_UNDERLINE_CHECK},\
//{IDC_DELIMITER1_COLORSTYLEGROUP_STATIC, IDC_DELIMITER1_FG_STATIC, IDC_DELIMITER1_BG_STATIC, IDC_DELIMITER1_FONTSTYLEGROUP_STATIC, IDC_DELIMITER1_FONTNAME_STATIC, IDC_DELIMITER1_FONTSIZE_STATIC, IDC_DELIMITER1_BOLD_CHECK, IDC_DELIMITER1_ITALIC_CHECK, IDC_DELIMITER1_UNDERLINE_CHECK},\
//{IDC_DELIMITER2_COLORSTYLEGROUP_STATIC, IDC_DELIMITER2_FG_STATIC, IDC_DELIMITER2_BG_STATIC, IDC_DELIMITER2_FONTSTYLEGROUP_STATIC, IDC_DELIMITER2_FONTNAME_STATIC, IDC_DELIMITER2_FONTSIZE_STATIC, IDC_DELIMITER2_BOLD_CHECK, IDC_DELIMITER2_ITALIC_CHECK, IDC_DELIMITER2_UNDERLINE_CHECK},\
//{IDC_DELIMITER3_COLORSTYLEGROUP_STATIC, IDC_DELIMITER3_FG_STATIC, IDC_DELIMITER3_BG_STATIC, IDC_DELIMITER3_FONTSTYLEGROUP_STATIC, IDC_DELIMITER3_FONTNAME_STATIC, IDC_DELIMITER3_FONTSIZE_STATIC, IDC_DELIMITER3_BOLD_CHECK, IDC_DELIMITER3_ITALIC_CHECK, IDC_DELIMITER3_UNDERLINE_CHECK}
};
int nbGpArray[nbDlg] = {nbGrpFolder, nbGrpKeywords, nbGrpComment, nbGrpOperator};
*/
const char nodeNameArray[nbDlg][16] = {"Folder", "Keywords", "Comment", "Operator"};
for (int i = 0 ; i < nbDlg ; ++i)

@ -185,7 +185,8 @@
#define IDM_SEARCH_INVERSEMARKS (IDM_SEARCH + 50)
#define IDM_SEARCH_DELETEUNMARKEDLINES (IDM_SEARCH + 51)
#define IDM_SEARCH_FINDCHARINRANGE (IDM_SEARCH + 52)
#define IDM_SEARCH_SELECTMATCHINGBRACES (IDM_SEARCH + 53)
#define IDM_MISC (IDM + 3500)
#define IDM_FILESWITCHER_FILESCLOSE (IDM_MISC + 1)
#define IDM_FILESWITCHER_FILESCLOSEOTHERS (IDM_MISC + 2)

Loading…
Cancel
Save