[BUG FIXED] Fix close all files/app exit cancel bug.

Fix default button problem in Find in Files dialog.


git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@364 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-12-08 21:22:30 +00:00
parent b8980eda58
commit e6d799a644
5 changed files with 65 additions and 15 deletions

View File

@ -1266,7 +1266,7 @@ bool Notepad_plus::fileCloseAll()
if (res == IDYES) {
if (!fileSave(id))
return false; //abort entire procedure
else if (res == IDCANCEL)
} else if (res == IDCANCEL) {
return false;
//otherwise continue (IDNO)
}
@ -1324,7 +1324,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
if (res == IDYES) {
if (!fileSave(id))
return false; //abort entire procedure
else if (res == IDCANCEL)
} else if (res == IDCANCEL) {
return false;
//otherwise continue (IDNO)
}
@ -1372,6 +1372,7 @@ bool Notepad_plus::replaceAllFiles() {
if (pBuf->isReadOnly())
continue;
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8);
_invisibleEditView._currentBuffer = pBuf;
_invisibleEditView.execute(SCI_BEGINUNDOACTION);
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL);
@ -1387,6 +1388,7 @@ bool Notepad_plus::replaceAllFiles() {
if (pBuf->isReadOnly())
continue;
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8);
_invisibleEditView._currentBuffer = pBuf;
_invisibleEditView.execute(SCI_BEGINUNDOACTION);
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL);
@ -1648,6 +1650,7 @@ bool Notepad_plus::findInOpenedFiles()
{
pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8);
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
}
}
@ -1658,6 +1661,7 @@ bool Notepad_plus::findInOpenedFiles()
{
pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? 0 : SC_CP_UTF8);
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
}
}
@ -2237,8 +2241,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
cilpFullPathG = wmc->char2wchar(pCilpFullPath, _nativeLangEncoding);
cilpFileNameG = wmc->char2wchar(pCilpFileName, _nativeLangEncoding);
cilpCurrentDirG = wmc->char2wchar(pCilpCurrentDir, _nativeLangEncoding);
removeG = wmc->char2wchar(pRename, _nativeLangEncoding);
renameG = wmc->char2wchar(pRemove, _nativeLangEncoding);
renameG = wmc->char2wchar(pRename, _nativeLangEncoding);
removeG = wmc->char2wchar(pRemove, _nativeLangEncoding);
#else
goToViewG = pGoToView;
cloneToViewG = pCloneToView;
@ -3901,7 +3905,7 @@ void Notepad_plus::command(int id)
ValueDlg valDlg;
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
valDlg.init(_hInst, _preference.getHSelf(), nppGUI._autocFromLen, TEXT("Nb TCHAR : "));
valDlg.init(_hInst, _preference.getHSelf(), nppGUI._autocFromLen, TEXT("Nb char : "));
POINT p;
::GetCursorPos(&p);
::ScreenToClient(_hParent, &p);

View File

@ -929,10 +929,15 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options)
msg += pText;
msg += TEXT("\"");
::MessageBox(_hSelf, msg.c_str(), TEXT("Find"), MB_OK);
// if the dialog is not shown, pass the focus to his parent(ie. Notepad++)
if (!::IsWindowVisible(_hSelf))
{
::SetFocus((*_ppEditView)->getHSelf());
}
else
{
::SetFocus(::GetDlgItem(_hSelf, IDFINDWHAT));
}
}
delete [] pText;
return false;
@ -1415,6 +1420,8 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
TCHAR label[MAX_PATH];
_tab.getCurrentTitle(label, MAX_PATH);
::SetWindowText(_hSelf, label);
setDefaultButton(IDOK);
}
void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
@ -1453,10 +1460,6 @@ void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_GOBACK_BUTTON), isEnable?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_RECURSIVE_CHECK), isEnable?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_INHIDDENDIR_CHECK), isEnable?SW_SHOW:SW_HIDE);
TCHAR label[MAX_PATH];
_tab.getCurrentTitle(label, MAX_PATH);
::SetWindowText(_hSelf, label);
}
void FindReplaceDlg::getPatterns(vector<generic_string> & patternVect)

View File

@ -356,8 +356,51 @@ private :
_currentStatus = FINDINFILES_DLG;
gotoCorrectTab();
::MoveWindow(::GetDlgItem(_hSelf, IDCANCEL), _findInFilesClosePos.left, _findInFilesClosePos.top, _findInFilesClosePos.right, _findInFilesClosePos.bottom, TRUE);
TCHAR label[MAX_PATH];
_tab.getCurrentTitle(label, MAX_PATH);
::SetWindowText(_hSelf, label);
setDefaultButton(IDD_FINDINFILES_FIND_BUTTON);
};
//////////////////
void setDefaultButton(int nID)
{
#if 0
// Where is a problem when you:
// 1. open the find dialog
// 2. press the "close" buttom
// 3. open it again
// 4. search for a non existing text
// 5. when the "Can't find the text:" messagebox appears, hit "OK"
// 6. now, the "Close" button looks like the default button. (but it only looks like that)
// if you hit "Enter" the "Find" button will be "pressed".
// I thought this code might fix this but it doesn't
// See: http://msdn.microsoft.com/en-us/library/ms645413(VS.85).aspx
HWND pButton;
DWORD dwDefInfo = SendMessage(_hSelf, DM_GETDEFID, 0, 0L);
if (HIWORD(dwDefInfo) == DC_HASDEFID && (int)LOWORD(dwDefInfo) != nID)
{
// Reset 'DefButton' style
pButton = GetDlgItem(_hSelf, (int)LOWORD(dwDefInfo));
if (pButton)
SendMessage(pButton, BM_SETSTYLE, LOWORD(BS_PUSHBUTTON | BS_RIGHT ), MAKELPARAM(TRUE, 0));
}
SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L);
pButton = GetDlgItem(_hSelf, nID);
if (pButton)
{
SendMessage(pButton, BM_SETSTYLE, LOWORD(BS_DEFPUSHBUTTON), MAKELPARAM(TRUE, 0));
}
#endif
SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L);
}
////////////////////////
void gotoCorrectTab() {
int currentIndex = _tab.getCurrentTabIndex();
if (currentIndex != _currentStatus)

View File

@ -33,7 +33,7 @@ using namespace std;
/* window styles */
#define POPUP_STYLES (WS_POPUP|WS_CLIPSIBLINGS|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MAXIMIZEBOX)
#define POPUP_EXSTYLES (WS_EX_CONTROLPARENT|WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW)
#define CHILD_STYLES (WS_CHILD|WS_VISIBLE)
#define CHILD_STYLES (WS_CHILD)
#define CHILD_EXSTYLES (0x00000000L)
#define MIN_TABWIDTH 24

View File

@ -18,9 +18,9 @@
#ifndef RESOURCE_H
#define RESOURCE_H
#define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v5.1.1")
#define VERSION_VALUE TEXT("5.11\0") // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71
#define VERSION_DIGITALVALUE 5, 1, 1, 0
#define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v5.1.2")
#define VERSION_VALUE TEXT("5.12\0") // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71
#define VERSION_DIGITALVALUE 5, 1, 2, 0
#ifdef UNICODE
#define UNICODE_ANSI_MODE TEXT("(UNICODE)")