[BUG_FIXED] (Author: Andreas Jonsson) Fix canceling shutdown make Notepad++ quit w/o saving files bug.

[ENHANCEMENT] (Author: Andreas Jonsson) Check "Begin/End select" menuitem when active.
[ENHANCEMENT] (Author: Andreas Jonsson) Clear Replace dialog status bar before processing any action.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1119 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-09-16 21:12:32 +00:00
parent d56b2eef66
commit 9795408fa8
4 changed files with 22 additions and 5 deletions

View File

@ -1476,8 +1476,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case WM_ENDSESSION:
{
::DestroyWindow(hwnd);
return TRUE;
if(wParam == TRUE)
::DestroyWindow(hwnd);
return 0;
}
case WM_DESTROY:

View File

@ -321,7 +321,10 @@ void Notepad_plus::command(int id)
case IDM_EDIT_BEGINENDSELECT:
{
_pEditView->beginOrEndSelect();
if(_pEditView->beginEndSelectedIsStarted())
::CheckMenuItem(_mainMenuHandle, IDM_EDIT_BEGINENDSELECT, MF_BYCOMMAND | MF_UNCHECKED);
else
::CheckMenuItem(_mainMenuHandle, IDM_EDIT_BEGINENDSELECT, MF_BYCOMMAND | MF_CHECKED);
}
break;

View File

@ -682,6 +682,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
break;
case IDOK : // Find Next : only for FIND_DLG and REPLACE_DLG
{
setStatusbarMessage(TEXT(""), FSNoMessage);
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
@ -695,9 +696,9 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
FindStatus findStatus = FSFound;
processFindNext(_options._str2Search.c_str(), _env, &findStatus);
if (findStatus == FSEndReached)
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of the document has been reached."), FSEndReached);
else if (findStatus == FSTopReached)
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The beginning of the document has been reached."), FSTopReached);
nppParamInst->_isFindReplacing = false;
}
@ -707,6 +708,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{
if (_currentStatus == REPLACE_DLG)
{
setStatusbarMessage(TEXT(""), FSNoMessage);
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
@ -726,6 +728,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{
if (_currentStatus == FIND_DLG)
{
setStatusbarMessage(TEXT(""), FSNoMessage);
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
combo2ExtendedMode(IDFINDWHAT);
@ -742,6 +745,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDC_FINDALL_CURRENTFILE :
{
setStatusbarMessage(TEXT(""), FSNoMessage);
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
combo2ExtendedMode(IDFINDWHAT);
@ -757,6 +761,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDD_FINDINFILES_FIND_BUTTON :
{
setStatusbarMessage(TEXT(""), FSNoMessage);
const int filterSize = 256;
TCHAR filters[filterSize+1];
filters[filterSize] = '\0';
@ -787,6 +792,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDD_FINDINFILES_REPLACEINFILES :
{
setStatusbarMessage(TEXT(""), FSNoMessage);
const int filterSize = 256;
TCHAR filters[filterSize];
TCHAR directory[MAX_PATH];
@ -828,6 +834,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{
if (_currentStatus == REPLACE_DLG)
{
setStatusbarMessage(TEXT(""), FSNoMessage);
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
@ -847,6 +854,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{
if (_currentStatus == REPLACE_DLG)
{
setStatusbarMessage(TEXT(""), FSNoMessage);
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly())
{
generic_string errMsg = TEXT("Replace: Cannot replace text. The current document is read only.");
@ -891,6 +899,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{
if (_currentStatus == FIND_DLG)
{
setStatusbarMessage(TEXT(""), FSNoMessage);
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
updateCombo(IDFINDWHAT);
@ -921,6 +930,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{
if (_currentStatus == MARK_DLG)
{
setStatusbarMessage(TEXT(""), FSNoMessage);
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);

View File

@ -281,6 +281,9 @@ public:
void restoreCurrentFold();
void beginOrEndSelect();
bool beginEndSelectedIsStarted() const {
return _beginSelectPosition != -1;
};
int getCurrentDocLen() const {
return int(execute(SCI_GETLENGTH));