@ -281,14 +281,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
}
}
return TRUE ;
return TRUE ;
}
}
/*
case WM_SIZE :
{
//resizeFinder();
//resizeStatusBar();
return FALSE ;
}
*/
case WM_NOTIFY :
case WM_NOTIFY :
{
{
NMHDR * nmhdr = ( NMHDR * ) lParam ;
NMHDR * nmhdr = ( NMHDR * ) lParam ;
@ -310,6 +303,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
}
}
break ;
break ;
}
}
case WM_ACTIVATE :
case WM_ACTIVATE :
{
{
CharacterRange cr = ( * _ppEditView ) - > getSelection ( ) ;
CharacterRange cr = ( * _ppEditView ) - > getSelection ( ) ;
@ -322,6 +316,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
: : EnableWindow ( : : GetDlgItem ( _hSelf , IDC_IN_SELECTION_CHECK ) , isSelected ) ;
: : EnableWindow ( : : GetDlgItem ( _hSelf , IDC_IN_SELECTION_CHECK ) , isSelected ) ;
return TRUE ;
return TRUE ;
}
}
case NPPM_MODELESSDIALOG :
case NPPM_MODELESSDIALOG :
return : : SendMessage ( _hParent , NPPM_MODELESSDIALOG , wParam , lParam ) ;
return : : SendMessage ( _hParent , NPPM_MODELESSDIALOG , wParam , lParam ) ;
@ -335,101 +330,128 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDOK : // Find Next
case IDOK : // Find Next
{
{
bool isUnicode = ( * _ppEditView ) - > getCurrentBuffer ( ) . getUnicodeMode ( ) ! = uni8Bit ;
if ( ( _currentStatus = = FIND_DLG ) | | ( _currentStatus = = REPLACE_DLG ) )
HWND hFindCombo = : : GetDlgItem ( _hSelf , IDFINDWHAT ) ;
{
string str2Search = getTextFromCombo ( hFindCombo , isUnicode ) ;
bool isUnicode = ( * _ppEditView ) - > getCurrentBuffer ( ) . getUnicodeMode ( ) ! = uni8Bit ;
addText2Combo ( str2Search . c_str ( ) , hFindCombo , isUnicode ) ;
HWND hFindCombo = : : GetDlgItem ( _hSelf , IDFINDWHAT ) ;
processFindNext ( str2Search . c_str ( ) ) ;
string str2Search = getTextFromCombo ( hFindCombo , isUnicode ) ;
addText2Combo ( str2Search . c_str ( ) , hFindCombo , isUnicode ) ;
processFindNext ( str2Search . c_str ( ) ) ;
}
}
}
return TRUE ;
return TRUE ;
case IDREPLACE :
case IDREPLACE :
{
{
updateCombos ( ) ;
if ( _currentStatus = = REPLACE_DLG )
{
processReplace ( ) ;
updateCombos ( ) ;
return TRUE ;
processReplace ( ) ;
}
}
}
return TRUE ;
case IDREPLACEALL :
case IDREPLACEALL :
{
{
updateCombos ( ) ;
if ( _currentStatus = = REPLACE_DLG )
{
updateCombos ( ) ;
( * _ppEditView ) - > execute ( SCI_BEGINUNDOACTION ) ;
( * _ppEditView ) - > execute ( SCI_BEGINUNDOACTION ) ;
int nbReplaced = processAll ( REPLACE_ALL ) ;
int nbReplaced = processAll ( REPLACE_ALL ) ;
( * _ppEditView ) - > execute ( SCI_ENDUNDOACTION ) ;
( * _ppEditView ) - > execute ( SCI_ENDUNDOACTION ) ;
char result [ 64 ] ;
char result [ 64 ] ;
if ( nbReplaced < 0 )
if ( nbReplaced < 0 )
strcpy ( result , " The regular expression to search is formed badly " ) ;
strcpy ( result , " The regular expression to search is formed badly " ) ;
else
else
{
{
itoa ( nbReplaced , result , 10 ) ;
itoa ( nbReplaced , result , 10 ) ;
strcat ( result , " tokens are replaced. " ) ;
strcat ( result , " tokens are replaced. " ) ;
}
: : MessageBox ( _hSelf , result , " " , MB_OK ) ;
}
}
: : MessageBox ( _hSelf , result , " " , MB_OK ) ;
return TRUE ;
}
}
return TRUE ;
case IDC_REPLACE_OPENEDFILES :
case IDC_REPLACE_OPENEDFILES :
updateCombos ( ) ;
{
replaceAllInOpenedDocs ( ) ;
if ( _currentStatus = = REPLACE_DLG )
return TRUE ;
{
updateCombos ( ) ;
replaceAllInOpenedDocs ( ) ;
}
}
return TRUE ;
case IDC_FINDALL_OPENEDFILES :
case IDC_FINDALL_OPENEDFILES :
updateCombo ( IDFINDWHAT ) ;
{
findAllIn ( ALL_OPEN_DOCS ) ;
if ( _currentStatus = = FIND_DLG )
return TRUE ;
{
updateCombo ( IDFINDWHAT ) ;
findAllIn ( ALL_OPEN_DOCS ) ;
}
}
return TRUE ;
case IDD_FINDINFILES_GOBACK_BUTTON :
/*case IDD_FINDINFILES_GOBACK_BUTTON :
doDialog ( FIND_DLG ) ;
doDialog ( FIND_DLG ) ;
return TRUE ;
return TRUE ;
case IDC_GETCURRENTDOCTYPE :
case IDC_GETCURRENTDOCTYPE :
* ( ( LangType * ) lParam ) = ( * _ppEditView ) - > getCurrentDocType ( ) ;
* ( ( LangType * ) lParam ) = ( * _ppEditView ) - > getCurrentDocType ( ) ;
return TRUE ;
return TRUE ; */
case IDCMARKALL :
case IDCMARKALL :
{
{
updateCombo ( IDFINDWHAT ) ;
if ( _currentStatus = = FIND_DLG )
int nbMarked = processAll ( MARK_ALL ) ;
char result [ 64 ] ;
if ( nbMarked < 0 )
strcpy ( result , " The regular expression to search is formed badly " ) ;
else
{
{
itoa ( nbMarked , result , 10 ) ;
updateCombo ( IDFINDWHAT ) ;
strcat ( result , " tokens are found and marked " ) ;
int nbMarked = processAll ( MARK_ALL ) ;
}
char result [ 64 ] ;
if ( nbMarked < 0 )
strcpy ( result , " The regular expression to search is formed badly " ) ;
else
{
itoa ( nbMarked , result , 10 ) ;
strcat ( result , " tokens are found and marked " ) ;
}
: : MessageBox ( _hSelf , result , " " , MB_OK ) ;
: : MessageBox ( _hSelf , result , " " , MB_OK ) ;
return TRUE ;
}
}
}
return TRUE ;
case IDC_CLEAR_ALL :
case IDC_CLEAR_ALL :
{
{
LangType lt = ( * _ppEditView ) - > getCurrentDocType ( ) ;
if ( _currentStatus = = FIND_DLG )
if ( lt = = L_TXT )
{
( * _ppEditView ) - > defineDocType ( L_CPP ) ;
LangType lt = ( * _ppEditView ) - > getCurrentDocType ( ) ;
( * _ppEditView ) - > defineDocType ( lt ) ;
if ( lt = = L_TXT )
( * _ppEditView ) - > execute ( SCI_MARKERDELETEALL , MARK_SYMBOLE ) ;
( * _ppEditView ) - > defineDocType ( L_CPP ) ;
return TRUE ;
( * _ppEditView ) - > defineDocType ( lt ) ;
( * _ppEditView ) - > execute ( SCI_MARKERDELETEALL , MARK_SYMBOLE ) ;
}
}
}
return TRUE ;
case IDCCOUNTALL :
case IDCCOUNTALL :
{
{
int nbCounted = processAll ( COUNT_ALL ) ;
if ( _currentStatus = = FIND_DLG )
char result [ 64 ] ;
if ( nbCounted < 0 )
strcpy ( result , " The regular expression to search is formed badly " ) ;
else
{
{
itoa ( nbCounted , result , 10 ) ;
int nbCounted = processAll ( COUNT_ALL ) ;
strcat ( result , " tokens are found. " ) ;
char result [ 64 ] ;
if ( nbCounted < 0 )
strcpy ( result , " The regular expression to search is formed badly " ) ;
else
{
itoa ( nbCounted , result , 10 ) ;
strcat ( result , " tokens are found. " ) ;
}
: : MessageBox ( _hSelf , result , " " , MB_OK ) ;
}
}
: : MessageBox ( _hSelf , result , " " , MB_OK ) ;
return TRUE ;
}
}
return TRUE ;
case IDWHOLEWORD :
case IDWHOLEWORD :
_options . _isWholeWord = isCheckedOrNot ( IDWHOLEWORD ) ;
_options . _isWholeWord = isCheckedOrNot ( IDWHOLEWORD ) ;
@ -467,22 +489,38 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
return TRUE ;
return TRUE ;
case IDC_PURGE_CHECK :
case IDC_PURGE_CHECK :
_doPurge = isCheckedOrNot ( IDC_PURGE_CHECK ) ;
{
return TRUE ;
if ( _currentStatus = = FIND_DLG )
_doPurge = isCheckedOrNot ( IDC_PURGE_CHECK ) ;
}
return TRUE ;
case IDC_MARKLINE_CHECK :
case IDC_MARKLINE_CHECK :
_doMarkLine = isCheckedOrNot ( IDC_MARKLINE_CHECK ) ;
{
: : EnableWindow ( : : GetDlgItem ( _hSelf , IDCMARKALL ) , ( _doMarkLine | | _doStyleFoundToken ) ) ;
if ( _currentStatus = = FIND_DLG )
return TRUE ;
{
_doMarkLine = isCheckedOrNot ( IDC_MARKLINE_CHECK ) ;
: : EnableWindow ( : : GetDlgItem ( _hSelf , IDCMARKALL ) , ( _doMarkLine | | _doStyleFoundToken ) ) ;
}
}
return TRUE ;
case IDC_STYLEFOUND_CHECK :
case IDC_STYLEFOUND_CHECK :
_doStyleFoundToken = isCheckedOrNot ( IDC_STYLEFOUND_CHECK ) ;
{
: : EnableWindow ( : : GetDlgItem ( _hSelf , IDCMARKALL ) , ( _doMarkLine | | _doStyleFoundToken ) ) ;
if ( _currentStatus = = FIND_DLG )
return TRUE ;
{
_doStyleFoundToken = isCheckedOrNot ( IDC_STYLEFOUND_CHECK ) ;
: : EnableWindow ( : : GetDlgItem ( _hSelf , IDCMARKALL ) , ( _doMarkLine | | _doStyleFoundToken ) ) ;
}
}
return TRUE ;
case IDC_IN_SELECTION_CHECK :
case IDC_IN_SELECTION_CHECK :
_isInSelection = isCheckedOrNot ( IDC_IN_SELECTION_CHECK ) ;
{
return TRUE ;
if ( _currentStatus = = FIND_DLG )
_isInSelection = isCheckedOrNot ( IDC_IN_SELECTION_CHECK ) ;
}
return TRUE ;
case IDC_TRANSPARENT_CHECK :
case IDC_TRANSPARENT_CHECK :
{
{
@ -505,51 +543,59 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDD_FINDINFILES_FIND_BUTTON :
case IDD_FINDINFILES_FIND_BUTTON :
{
{
char filters [ 256 ] ;
if ( _currentStatus = = FINDINFILES_DLG )
char directory [ MAX_PATH ] ;
{
: : GetDlgItemText ( _hSelf , IDD_FINDINFILES_FILTERS_COMBO , filters , sizeof ( filters ) ) ;
char filters [ 256 ] ;
addText2Combo ( filters , : : GetDlgItem ( _hSelf , IDD_FINDINFILES_FILTERS_COMBO ) ) ;
char directory [ MAX_PATH ] ;
_filters = filters ;
: : GetDlgItemText ( _hSelf , IDD_FINDINFILES_FILTERS_COMBO , filters , sizeof ( filters ) ) ;
addText2Combo ( filters , : : GetDlgItem ( _hSelf , IDD_FINDINFILES_FILTERS_COMBO ) ) ;
_filters = filters ;
: : GetDlgItemText ( _hSelf , IDD_FINDINFILES_DIR_COMBO , directory , sizeof ( directory ) ) ;
: : GetDlgItemText ( _hSelf , IDD_FINDINFILES_DIR_COMBO , directory , sizeof ( directory ) ) ;
addText2Combo ( directory , : : GetDlgItem ( _hSelf , IDD_FINDINFILES_DIR_COMBO ) ) ;
addText2Combo ( directory , : : GetDlgItem ( _hSelf , IDD_FINDINFILES_DIR_COMBO ) ) ;
_directory = directory ;
_directory = directory ;
if ( ( strlen ( directory ) > 0 ) & & ( directory [ strlen ( directory ) - 1 ] ! = ' \\ ' ) )
if ( ( strlen ( directory ) > 0 ) & & ( directory [ strlen ( directory ) - 1 ] ! = ' \\ ' ) )
_directory + = " \\ " ;
_directory + = " \\ " ;
//::SendMessage(_hParent, WM_COMMAND, IDC_FINDINFILES_LAUNCH, 0);
//::SendMessage(_hParent, WM_COMMAND, IDC_FINDINFILES_LAUNCH, 0);
updateCombo ( IDFINDWHAT ) ;
updateCombo ( IDFINDWHAT ) ;
// thread to launch :
// thread to launch :
findAllIn ( FILES_IN_DIR ) ;
findAllIn ( FILES_IN_DIR ) ;
//Thread
//Thread
//HANDLE hEvent = ::CreateEvent(NULL, FALSE, FALSE, "findInFilesEvent");
//HANDLE hEvent = ::CreateEvent(NULL, FALSE, FALSE, "findInFilesEvent");
//--HANDLE hFindInFilesThread = ::CreateThread(NULL, 0, staticFindInFilesFunc, this, 0, NULL);
//--HANDLE hFindInFilesThread = ::CreateThread(NULL, 0, staticFindInFilesFunc, this, 0, NULL);
//::WaitForSingleObject(hEvent, INFINITE);
//::WaitForSingleObject(hEvent, INFINITE);
//::CloseHandle(hFindInFilesThread);
//::CloseHandle(hFindInFilesThread);
//::CloseHandle(hEvent);
//::CloseHandle(hEvent);
//::MessageBox(NULL, "Fin de thread", "", MB_OK);
//::MessageBox(NULL, "Fin de thread", "", MB_OK);
//display(false);
}
//display(false);
return TRUE ;
}
}
return TRUE ;
case IDD_FINDINFILES_RECURSIVE_CHECK :
case IDD_FINDINFILES_RECURSIVE_CHECK :
{
{
_isRecursive = isCheckedOrNot ( IDD_FINDINFILES_RECURSIVE_CHECK ) ;
if ( _currentStatus = = FINDINFILES_DLG )
return TRUE ;
_isRecursive = isCheckedOrNot ( IDD_FINDINFILES_RECURSIVE_CHECK ) ;
}
}
return TRUE ;
case IDD_FINDINFILES_BROWSE_BUTTON :
case IDD_FINDINFILES_BROWSE_BUTTON :
{
{
folderBrowser ( _hSelf , IDD_FINDINFILES_DIR_COMBO ) ;
if ( _currentStatus = = FINDINFILES_DLG )
return TRUE ;
folderBrowser ( _hSelf , IDD_FINDINFILES_DIR_COMBO ) ;
}
}
return TRUE ;
default :
default :
break ;
break ;
}
}