[REVERT] revert the fixing cursor bug in incremental find : due to the regression.

[CLEAN_UP] Clean up.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@474 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-05-01 20:57:13 +00:00
parent 9867d7b578
commit b20baeac19
9 changed files with 61 additions and 97 deletions

View File

@ -4,21 +4,24 @@ Notepad++ v5.4 new features and fixed bugs (from v5.3.1) :
2. Add google chrome drag and derop tab feature : drag out tab to create a new instance, transfer documents among several instances by drag and drop.
3. Add Mark all extension : user can mark any occurrence with 5 different colours.
4. Add new feature : column selection allows to insertion a string by typing characters in sequence (w/o column mode editor).
5. Fixed crash bug : Double click a file associated with an older version of Notepad++ while a newer version of Notepad++ instance is running.
6. Improve main menu structure (more compact). Language Menu can be compacted as well (optional, in Preference dialog).
7. line numbers margin width is changed dynamically according to the needed space (but keeping at least 3 digits).
8. File history list (under the File menu) is limited to 100 characters per item. Longer file names are fitted to 100 characters by replacing path components with ellipses.
9. Update Scintilla from v1.75 to v1.77.
10. Fixed two bugs when calculating the width of the TaskList (document list when pressing ctrl+tab or right-click + mouse wheel.
11. Add an (hidden) option to make the "Filters" and "Directory" fields follow the current opened document in "Find in files" dialog. The new parameters are located in config.xml and are called: "fifFilterFollowsDoc" and "fifFolderFollowsDoc" (set to "yes"/"no")
12. Add new command parameters : -c (column) -x et -y (startup position).
13. Remove change line marker which does not work correctly. Include ChangeMarkers plugin instead.
14. Fix bug "Switch to found results window" command now switches back to the current edit view if the focus is already on the found results.
15. Fix the search result inaccurate colorization bug.
16. Fix the Mark all in selection bug (while Find Replace Dialog loosing the focus).
17. Add 2 plugins messages : NPPN_FILEBEFORELOAD and NPPN_FILELOADFAILED.
18. Fix New document not be switched while double clicking in Find in files result panel.
19. Fix conversion min to Maj and Maj to min (or vice et versa) in column selection bug.
5. Detect UTF16 encoding (BE and LE) w/o BOM.
6. Iixed crash bug : Double click a file associated with an older version of Notepad++ while a newer version of Notepad++ instance is running.
7. lmprove main menu structure (more compact). Language Menu can be compacted as well (optional, in Preference dialog).
8. Fine numbers margin width is changed dynamically according to the needed space (but keeping at least 3 digits).
9. ile history list (under the File menu) is limited to 100 characters per item. Longer file names are fitted to 100 characters by replacing path components with ellipses.
10. Update Scintilla from v1.75 to v1.77.
11. Indent guideline can be shown w/o whitespace or tab symbol.
12. Fixed two bugs when calculating the width of the TaskList (document list when pressing ctrl+tab or right-click + mouse wheel.
13. Add an (hidden) option to make the "Filters" and "Directory" fields follow the current opened document in "Find in files" dialog. The new parameters are located in config.xml and are called: "fifFilterFollowsDoc" and "fifFolderFollowsDoc" (set to "yes"/"no")
14. Add new command parameters : -c (column) -x et -y (startup position).
15. Remove change line marker which does not work correctly. Include ChangeMarkers plugin instead.
16. Fix bug "Switch to found results window" command now switches back to the current edit view if the focus is already on the found results.
17. Fix the search result inaccurate colorization bug.
18. Fix the Mark all in selection bug (while Find Replace Dialog loosing the focus).
19. Add 2 plugins messages : NPPN_FILEBEFORELOAD and NPPN_FILELOADFAILED.
20. Fix New document not be switched while double clicking in Find in files result panel.
21. Fix conversion min to Maj and Maj to min (or vice et versa) in column selection bug.
Included plugins (Unicode):
@ -30,7 +33,7 @@ Included plugins (Unicode):
6. NppExport v0.2.8
7. Doc Monitor v2.2
8. NppNetNote v0.1
9. ChangeMarkers 1.1.0
9. ChangeMarkers 1.2.0
Included plugins (ANSI):
@ -43,4 +46,4 @@ Included plugins (ANSI):
7. Light Explorer v1.5
8. Doc Monitor v2.2
9. NppNetNote v0.1
10. ChangeMarkers 1.1.0
10. ChangeMarkers 1.2.0

View File

@ -3313,9 +3313,10 @@ void Notepad_plus::command(int id)
const int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize];
_pEditView->getGenericSelectedText(str, strSize, false);
if (0!=str[0]) // the selected text is not empty, then use it
_incrementFindDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit); _incrementFindDlg.display();
_pEditView->getGenericSelectedText(str, strSize);
_incrementFindDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit);
_incrementFindDlg.display();
}
break;

View File

@ -282,8 +282,6 @@ private:
WindowsMenu _windowsMenu;
HMENU _mainMenuHandle;
HMENU _menuLang;
HMENU _menuLangCompact;
bool _sysMenuEntering;

View File

@ -1095,7 +1095,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options)
endPosition = 0;
}
if (FirstIncremental==pOptions->_incrementalType)
if (pOptions->_isIncremental)
{
startPosition = 0;
endPosition = docLength;
@ -1114,22 +1114,14 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options)
//when wrapping, use the rest of the document (entire document is usable)
if (pOptions->_whichDirection == DIR_DOWN)
{
// the text to find is modified so use the current position
startPosition = cr.cpMin;
endPosition = docLength;
startPosition = 0;
endPosition = docLength;
}
else
{
startPosition = docLength;
endPosition = 0;
}
else if (NextIncremental==pOptions->_incrementalType)
{
// text to find is not modified, so use current position +1
startPosition = cr.cpMin +1;
endPosition = docLength;
if (pOptions->_whichDirection == DIR_UP)
{
//When searching upwards, start is the lower part, end the upper, for backwards search
startPosition = cr.cpMax - 1;
endPosition = 0;
}
}
//new target, search again
posFind = (*_ppEditView)->searchInTarget(pText, startPosition, endPosition);
@ -1137,7 +1129,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options)
if (posFind == -1)
{
//failed, or failed twice with wrap
if (NotIncremental==pOptions->_incrementalType) //incremental search doesnt trigger messages
if (!pOptions->_isIncremental) //incremental search doesnt trigger messages
{
generic_string msg = TEXT("Can't find the text:\r\n\"");
msg += pText;
@ -1848,13 +1840,10 @@ void FindIncrementDlg::display(bool toShow) const
return;
}
if (toShow)
// select the whole find editor text
::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, EM_SETSEL, 0, -1);
::SetFocus(::GetDlgItem(_hSelf, IDC_INCFINDTEXT));
_pRebar->setIDVisible(_rbBand.wID, toShow);
}
#define SHIFTED 0x8000
BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
@ -1873,53 +1862,27 @@ BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case IDC_INCFINDPREVOK :
case IDC_INCFINDNXTOK :
case IDOK :
{
FindOption fo;
fo._isWholeWord = false;
fo._isMatchCase = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_INCFINDMATCHCASE, BM_GETCHECK, 0, 0));
if (LOWORD(wParam) == IDC_INCFINDPREVOK)
fo._whichDirection = DIR_UP;
else if (LOWORD(wParam) == IDOK)
{
SHORT nVirtKey = GetKeyState(VK_SHIFT);
if (nVirtKey & SHIFTED)
fo._whichDirection = DIR_UP;
}
generic_string str2Search = _pFRDlg->getTextFromCombo(::GetDlgItem(_hSelf, IDC_INCFINDTEXT), isUnicode);
_pFRDlg->processFindNext(str2Search.c_str(), &fo);
}
return TRUE;
case IDC_INCFINDTEXT :
{
switch(HIWORD(wParam))
{
case EN_CHANGE :
{
FindOption fo;
fo._isWholeWord = false;
fo._isMatchCase = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_INCFINDMATCHCASE, BM_GETCHECK, 0, 0));
fo._incrementalType = FirstIncremental;
generic_string str2Search = _pFRDlg->getTextFromCombo(::GetDlgItem(_hSelf, IDC_INCFINDTEXT), isUnicode);
_pFRDlg->processFindNext(str2Search.c_str(), &fo);
}
return TRUE;
case EN_KILLFOCUS :
case EN_SETFOCUS :
break;
}
}
return TRUE;
case IDC_INCFINDMATCHCASE:
case IDC_INCFINDTEXT :
case IDC_INCFINDHILITEALL :
{
if (_doSearchFromBegin)
{
FindOption fo;
fo._isWholeWord = false;
fo._incrementalType = NextIncremental;
fo._isIncremental = true;
fo._isMatchCase = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_INCFINDMATCHCASE, BM_GETCHECK, 0, 0));
generic_string str2Search = _pFRDlg->getTextFromCombo(::GetDlgItem(_hSelf, IDC_INCFINDTEXT), isUnicode);
@ -1929,22 +1892,15 @@ BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection();
(*(_pFRDlg->_ppEditView))->execute(SCI_SETSEL, -1, range.cpMin);
}
}
case IDC_INCFINDHILITEALL :
{
FindOption fo;
fo._isWholeWord = false;
fo._incrementalType = FirstIncremental;
fo._isMatchCase = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_INCFINDMATCHCASE, BM_GETCHECK, 0, 0));
generic_string str2Search = _pFRDlg->getTextFromCombo(::GetDlgItem(_hSelf, IDC_INCFINDTEXT), isUnicode);
bool isHiLieAll = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_INCFINDHILITEALL, BM_GETCHECK, 0, 0));
if (str2Search == TEXT(""))
isHiLieAll = false;
markSelectedTextInc(isHiLieAll, &fo);
}
else
_doSearchFromBegin = true;
}
return TRUE;

View File

@ -53,7 +53,6 @@ struct TargetRange {
int targetEnd;
};
enum SearchIncrementalType { NotIncremental, FirstIncremental, NextIncremental };
enum SearchType { FindNormal, FindExtended, FindRegex };
enum ProcessOperation { ProcessFindAll, ProcessReplaceAll, ProcessCountAll, ProcessMarkAll, ProcessMarkAll_2, ProcessMarkAll_IncSearch, ProcessMarkAllExt };
@ -62,11 +61,10 @@ struct FindOption {
bool _isMatchCase;
bool _isWrapAround;
bool _whichDirection;
SearchIncrementalType _incrementalType;
bool _isIncremental;
SearchType _searchType;
FindOption() :_isWholeWord(true), _isMatchCase(true), _searchType(FindNormal),\
_isWrapAround(true), _whichDirection(DIR_DOWN), _incrementalType(NotIncremental){};
_isWrapAround(true), _whichDirection(DIR_DOWN), _isIncremental(false){};
};
//This class contains generic search functions as static functions for easy access
@ -556,6 +554,7 @@ public :
virtual void display(bool toShow = true) const;
void setSearchText(const TCHAR * txt2find, bool isUTF8 = false) {
_doSearchFromBegin = false;
#ifdef UNICODE
::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, (LPARAM)txt2find);
#else
@ -587,6 +586,7 @@ private :
ReBar * _pRebar;
REBARBANDINFO _rbBand;
bool _doSearchFromBegin;
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
void markSelectedTextInc(bool enable, FindOption *opt = NULL);
};

View File

@ -81,9 +81,9 @@ FONT 8, TEXT("MS Shell Dlg")
BEGIN
PUSHBUTTON "X",IDCANCEL,2,3,16,14
RTEXT "Find :",IDC_INCSTATIC,20,6,25,12
EDITTEXT IDC_INCFINDTEXT,45,4,175,12,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER | WS_TABSTOP /*|WS_GROUP*/ ,WS_EX_STATICEDGE
PUSHBUTTON "<",IDC_INCFINDPREVOK | WS_TABSTOP,223,3,16,14
PUSHBUTTON ">",IDC_INCFINDNXTOK | WS_TABSTOP,243,3,16,14
EDITTEXT IDC_INCFINDTEXT,45,4,175,12,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER,WS_EX_STATICEDGE
PUSHBUTTON "<",IDC_INCFINDPREVOK,223,3,16,14
DEFPUSHBUTTON ">",IDC_INCFINDNXTOK,243,3,16,14
CONTROL "Highlight all", IDC_INCFINDHILITEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,5,65,12
CONTROL "Match case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,5,60,12
END

View File

@ -30,7 +30,7 @@ EXSTYLE WS_EX_TOOLWINDOW
CAPTION "Style Configurator"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "Switch to theme : ",IDC_SWITCH2THEME_STATIC,6,9,83,8,0,WS_EX_RIGHT
LTEXT "Select theme : ",IDC_SWITCH2THEME_STATIC,6,9,83,8,0,WS_EX_RIGHT
COMBOBOX IDC_SWITCH2THEME_COMBO,95,7,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
LTEXT "Foreground color",IDC_FG_STATIC,203,72,59,8,0,WS_EX_RIGHT
LTEXT "Background color",IDC_BG_STATIC,203,99,59,8,0,WS_EX_RIGHT

View File

@ -28,13 +28,19 @@ using namespace std;
struct MenuItemUnit {
unsigned long _cmdID;
generic_string _itemName;
MenuItemUnit() : _cmdID(0), _itemName(TEXT("")) {};
MenuItemUnit(unsigned long cmdID, generic_string itemName) : _cmdID(cmdID), _itemName(itemName) {};
MenuItemUnit(unsigned long cmdID, const TCHAR *itemName) : _cmdID(cmdID){
generic_string _subMenuName;
MenuItemUnit() : _cmdID(0), _itemName(TEXT("")), _subMenuName(TEXT("")) {};
MenuItemUnit(unsigned long cmdID, generic_string itemName, generic_string subMenuName=TEXT("")) : _cmdID(cmdID), _itemName(itemName), _subMenuName(subMenuName) {};
MenuItemUnit(unsigned long cmdID, const TCHAR *itemName, const TCHAR *subMenuName=NULL) : _cmdID(cmdID){
if (!itemName)
_itemName = TEXT("");
else
_itemName = itemName;
if (!subMenuName)
_subMenuName = TEXT("");
else
_subMenuName = subMenuName;
};
};

View File

@ -19,8 +19,8 @@
<Item id="43031"/>
<Item id="43032"/>
<Item id="0"/>
<Item MenuEntryName="Edit" MenuItemName="to Upper case"/>
<Item MenuEntryName="Edit" MenuItemName="to Lower case"/>
<Item MenuEntryName="Edit" MenuItemName="to UPPERCASE"/>
<Item MenuEntryName="Edit" MenuItemName="to lowercase"/>
<Item id="0"/>
<Item MenuEntryName="Edit" MenuItemName="Toggle block comment"/>
<Item MenuEntryName="Edit" MenuItemName="Stream comment"/>