[NEW_FEATURE] (Author: Christian Cuvier) Add macro new ability to record search and replace actions.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@650 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
711e56ad3a
commit
33de57fe1d
|
@ -124,9 +124,11 @@ protected:
|
|||
private:
|
||||
// Since there's no public ctor, we need to void the default assignment operator.
|
||||
WcharMbcsConvertor& operator= (const WcharMbcsConvertor&);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define MACRO_RECORDING_IN_PROGRESS 1
|
||||
#define MACRO_RECORDING_HAS_STOPPED 2
|
||||
|
||||
#if _MSC_VER > 1400 // MS Compiler > VS 2005
|
||||
#define REBARBAND_SIZE REBARBANDINFO_V3_SIZE
|
||||
|
|
|
@ -888,7 +888,7 @@ bool Notepad_plus::replaceAllFiles() {
|
|||
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
|
||||
_invisibleEditView._currentBuffer = pBuf;
|
||||
_invisibleEditView.execute(SCI_BEGINUNDOACTION);
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL);
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc);
|
||||
_invisibleEditView.execute(SCI_ENDUNDOACTION);
|
||||
}
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ bool Notepad_plus::replaceAllFiles() {
|
|||
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
|
||||
_invisibleEditView._currentBuffer = pBuf;
|
||||
_invisibleEditView.execute(SCI_BEGINUNDOACTION);
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL);
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, isEntireDoc);
|
||||
_invisibleEditView.execute(SCI_ENDUNDOACTION);
|
||||
}
|
||||
}
|
||||
|
@ -1094,7 +1094,7 @@ bool Notepad_plus::replaceInFiles()
|
|||
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
|
||||
_invisibleEditView._currentBuffer = pBuf;
|
||||
|
||||
int nbReplaced = _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, true, fileNames.at(i).c_str());
|
||||
int nbReplaced = _findReplaceDlg.processAll(ProcessReplaceAll, FindReplaceDlg::_env, true, fileNames.at(i).c_str());
|
||||
nbTotal += nbReplaced;
|
||||
if (nbReplaced)
|
||||
{
|
||||
|
@ -1176,7 +1176,7 @@ bool Notepad_plus::findInFiles()
|
|||
int cp = _invisibleEditView.execute(SCI_GETCODEPAGE);
|
||||
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
|
||||
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, true, fileNames.at(i).c_str());
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, FindReplaceDlg::_env, true, fileNames.at(i).c_str());
|
||||
if (!dontClose)
|
||||
MainFileManager->closeBuffer(id, _pEditView);
|
||||
}
|
||||
|
@ -1220,7 +1220,7 @@ bool Notepad_plus::findInOpenedFiles()
|
|||
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
|
||||
int cp = _invisibleEditView.execute(SCI_GETCODEPAGE);
|
||||
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, FindReplaceDlg::_env, isEntireDoc, pBuf->getFullPathName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1232,7 +1232,7 @@ bool Notepad_plus::findInOpenedFiles()
|
|||
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
|
||||
int cp = _invisibleEditView.execute(SCI_GETCODEPAGE);
|
||||
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, FindReplaceDlg::_env, isEntireDoc, pBuf->getFullPathName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1265,7 +1265,7 @@ bool Notepad_plus::findInCurrentFile()
|
|||
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
|
||||
int cp = _invisibleEditView.execute(SCI_GETCODEPAGE);
|
||||
_invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8);
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
|
||||
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, FindReplaceDlg::_env, isEntireDoc, pBuf->getFullPathName());
|
||||
|
||||
_findReplaceDlg.finishFilesSearch(nbTotal);
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ public:
|
|||
|
||||
|
||||
bool addCurrentMacro();
|
||||
void macroPlayback(Macro);
|
||||
|
||||
void loadLastSession(){
|
||||
Session lastSession = (NppParameters::getInstance())->getSession();
|
||||
|
|
|
@ -934,8 +934,17 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||
return MAKELONG(auxVer, mainVer);
|
||||
}
|
||||
|
||||
case WM_ISCURRENTMACRORECORDED :
|
||||
return (!_macro.empty() && !_recordingMacro);
|
||||
case WM_GETCURRENTMACROSTATUS :
|
||||
if (_recordingMacro) return MACRO_RECORDING_IN_PROGRESS;
|
||||
return (_macro.empty())?0:MACRO_RECORDING_HAS_STOPPED;
|
||||
|
||||
case WM_FRSAVE_INT:
|
||||
_macro.push_back(recordedMacroStep(wParam, 0, lParam, NULL));
|
||||
break;
|
||||
|
||||
case WM_FRSAVE_STR:
|
||||
_macro.push_back(recordedMacroStep(wParam, 0, 0, (const TCHAR *)lParam));
|
||||
break;
|
||||
|
||||
case WM_MACRODLGRUNMACRO:
|
||||
{
|
||||
|
|
|
@ -21,6 +21,20 @@
|
|||
#include "ShortcutMapper.h"
|
||||
#include "TaskListDlg.h"
|
||||
|
||||
void Notepad_plus::macroPlayback(Macro macro)
|
||||
{
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
|
||||
for (Macro::iterator step = macro.begin(); step != macro.end(); step++)
|
||||
{
|
||||
if (step->isPlayable())
|
||||
step->PlayBack(this->_pPublicInterface, _pEditView);
|
||||
else
|
||||
_findReplaceDlg.execSavedCommand(step->message, step->lParameter, step->sParameter);
|
||||
}
|
||||
|
||||
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||
}
|
||||
|
||||
void Notepad_plus::command(int id)
|
||||
{
|
||||
|
@ -165,14 +179,7 @@ void Notepad_plus::command(int id)
|
|||
|
||||
case IDM_MACRO_PLAYBACKRECORDEDMACRO:
|
||||
if (!_recordingMacro) // if we're not currently recording, then playback the recorded keystrokes
|
||||
{
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
|
||||
for (Macro::iterator step = _macro.begin(); step != _macro.end(); step++)
|
||||
step->PlayBack(this->_pPublicInterface, _pEditView);
|
||||
|
||||
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||
}
|
||||
macroPlayback(_macro);
|
||||
break;
|
||||
|
||||
case IDM_MACRO_RUNMULTIMACRODLG :
|
||||
|
@ -1861,14 +1868,7 @@ void Notepad_plus::command(int id)
|
|||
{
|
||||
int i = id - ID_MACRO;
|
||||
vector<MacroShortcut> & theMacros = (NppParameters::getInstance())->getMacroList();
|
||||
Macro macro = theMacros[i].getMacro();
|
||||
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||
|
||||
for (Macro::iterator step = macro.begin(); step != macro.end(); step++)
|
||||
step->PlayBack(this->_pPublicInterface, _pEditView);
|
||||
|
||||
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||
|
||||
macroPlayback(theMacros[i].getMacro());
|
||||
}
|
||||
else if ((id >= ID_USER_CMD) && (id < ID_USER_CMD_LIMIT))
|
||||
{
|
||||
|
|
|
@ -1820,7 +1820,7 @@ void NppParameters::getActions(TiXmlNode *node, Macro & macro)
|
|||
{
|
||||
int type;
|
||||
const TCHAR *typeStr = (childNode->ToElement())->Attribute(TEXT("type"), &type);
|
||||
if ((!typeStr) || (type > 2))
|
||||
if ((!typeStr) || (type > 3))
|
||||
continue;
|
||||
|
||||
int msg = 0;
|
||||
|
@ -1835,7 +1835,7 @@ void NppParameters::getActions(TiXmlNode *node, Macro & macro)
|
|||
const TCHAR *sParam = (childNode->ToElement())->Attribute(TEXT("sParam"));
|
||||
if (!sParam)
|
||||
sParam = TEXT("");
|
||||
recordedMacroStep step(type, msg, wParam, lParam, sParam);
|
||||
recordedMacroStep step(msg, wParam, lParam, sParam, type);
|
||||
if (step.isValid())
|
||||
macro.push_back(step);
|
||||
|
||||
|
@ -5144,3 +5144,4 @@ void NppParameters::addScintillaModifiedIndex(int index)
|
|||
_scintillaModifiedKeyIndices.push_back(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#include "Notepad_plus_msgs.h"
|
||||
#include "UniConversion.h"
|
||||
|
||||
FindOption * FindReplaceDlg::_env;
|
||||
FindOption FindReplaceDlg::_options;
|
||||
|
||||
int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length) { //query may equal to result, since it always gets smaller
|
||||
int i = 0, j = 0;
|
||||
int charLeft = length;
|
||||
|
@ -680,27 +683,27 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
int nbSelected = cr.cpMax - cr.cpMin;
|
||||
|
||||
_isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK)?1:0;
|
||||
int checkVal = _isInSelection?BST_CHECKED:BST_UNCHECKED;
|
||||
_options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK)?1:0;
|
||||
int checkVal = _options._isInSelection?BST_CHECKED:BST_UNCHECKED;
|
||||
|
||||
if (!_isInSelection)
|
||||
if (!_options._isInSelection)
|
||||
{
|
||||
if (nbSelected <= 1024)
|
||||
{
|
||||
checkVal = BST_UNCHECKED;
|
||||
_isInSelection = false;
|
||||
_options._isInSelection = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
checkVal = BST_CHECKED;
|
||||
_isInSelection = true;
|
||||
_options._isInSelection = true;
|
||||
}
|
||||
}
|
||||
// Searching/replacing in column selection is not allowed
|
||||
if ((*_ppEditView)->execute(SCI_GETSELECTIONMODE) == SC_SEL_RECTANGLE)
|
||||
{
|
||||
checkVal = BST_UNCHECKED;
|
||||
_isInSelection = false;
|
||||
_options._isInSelection = false;
|
||||
nbSelected = 0;
|
||||
}
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nbSelected);
|
||||
|
@ -708,7 +711,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
if (!nbSelected)
|
||||
{
|
||||
checkVal = BST_UNCHECKED;
|
||||
_isInSelection = false;
|
||||
_options._isInSelection = false;
|
||||
}
|
||||
::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, checkVal, 0);
|
||||
}
|
||||
|
@ -733,25 +736,26 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
|
||||
case WM_COMMAND :
|
||||
{
|
||||
bool isMacroRecording = (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS,0,0) == MACRO_RECORDING_IN_PROGRESS);
|
||||
NppParameters *nppParamInst = NppParameters::getInstance();
|
||||
FindHistory & findHistory = nppParamInst->getFindHistory();
|
||||
switch (wParam)
|
||||
{
|
||||
case IDCANCEL : // Close
|
||||
display(false);
|
||||
return TRUE;
|
||||
|
||||
//Single actions
|
||||
case IDCANCEL:
|
||||
display(false);
|
||||
break;
|
||||
case IDOK : // Find Next : only for FIND_DLG and REPLACE_DLG
|
||||
{
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
generic_string str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
updateCombo(IDFINDWHAT);
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
processFindNext(str2Search.c_str());
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
|
||||
processFindNext(_options._str2Search.c_str());
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -763,12 +767,13 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
|
||||
generic_string str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
generic_string str2Replace = getTextFromCombo(hReplaceCombo, isUnicode);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
_options._str4Replace = getTextFromCombo(hReplaceCombo, isUnicode);
|
||||
updateCombos();
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
processReplace(str2Search.c_str(), str2Replace.c_str());
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE);
|
||||
processReplace(_options._str2Search.c_str(), _options._str4Replace.c_str());
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
}
|
||||
|
@ -778,10 +783,14 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
if (_currentStatus == FIND_DLG)
|
||||
{
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
updateCombo(IDFINDWHAT);
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_GLOBAL);
|
||||
findAllIn(ALL_OPEN_DOCS);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
|
@ -790,10 +799,14 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
|
||||
case IDC_FINDALL_CURRENTFILE :
|
||||
{
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
updateCombo(IDFINDWHAT);
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_GLOBAL);
|
||||
findAllIn(CURRENT_DOC);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
|
@ -802,23 +815,28 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
case IDD_FINDINFILES_FIND_BUTTON :
|
||||
{
|
||||
const int filterSize = 256;
|
||||
TCHAR filters[filterSize];
|
||||
TCHAR filters[filterSize+1];
|
||||
filters[filterSize] = '\0';
|
||||
TCHAR directory[MAX_PATH];
|
||||
::GetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters, filterSize);
|
||||
addText2Combo(filters, ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO));
|
||||
_filters = filters;
|
||||
_options._filters = filters;
|
||||
|
||||
::GetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, directory, MAX_PATH);
|
||||
addText2Combo(directory, ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO));
|
||||
_directory = directory;
|
||||
_options._directory = directory;
|
||||
|
||||
if ((lstrlen(directory) > 0) && (directory[lstrlen(directory)-1] != '\\'))
|
||||
_directory += TEXT("\\");
|
||||
_options._directory += TEXT("\\");
|
||||
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
updateCombo(IDFINDWHAT);
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND + FR_OP_FIF);
|
||||
findAllIn(FILES_IN_DIR);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
|
@ -831,26 +849,32 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
TCHAR directory[MAX_PATH];
|
||||
::GetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters, filterSize);
|
||||
addText2Combo(filters, ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO));
|
||||
_filters = filters;
|
||||
_options._filters = filters;
|
||||
|
||||
::GetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, directory, MAX_PATH);
|
||||
addText2Combo(directory, ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO));
|
||||
_directory = directory;
|
||||
_options._directory = directory;
|
||||
|
||||
if ((lstrlen(directory) > 0) && (directory[lstrlen(directory)-1] != '\\'))
|
||||
_directory += TEXT("\\");
|
||||
_options._directory += TEXT("\\");
|
||||
|
||||
generic_string msg = TEXT("Are you sure you want to replace all occurances in :\r");
|
||||
msg += _directory;
|
||||
msg += _options._directory;
|
||||
msg += TEXT("\rfor file type : ");
|
||||
msg += _filters[0]?_filters:TEXT("*.*");
|
||||
msg += _options._filters[0]?_options._filters:TEXT("*.*");
|
||||
|
||||
if (::MessageBox(_hSelf, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL) == IDOK)
|
||||
if (::MessageBox(_hMsgParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL) == IDOK)
|
||||
{
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
|
||||
_options._str4Replace = getTextFromCombo(hReplaceCombo, isUnicode);
|
||||
updateCombo(IDFINDWHAT);
|
||||
updateCombo(IDREPLACEWITH);
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE + FR_OP_FIF);
|
||||
::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
|
@ -861,9 +885,15 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
if (_currentStatus == REPLACE_DLG)
|
||||
{
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
|
||||
_options._str4Replace = getTextFromCombo(hReplaceCombo, isUnicode);
|
||||
updateCombos();
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE + FR_OP_GLOBAL);
|
||||
replaceAllInOpenedDocs();
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
|
@ -874,11 +904,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
if (_currentStatus == REPLACE_DLG)
|
||||
{
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
|
||||
_options._str4Replace = getTextFromCombo(hReplaceCombo, isUnicode);
|
||||
updateCombos();
|
||||
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_REPLACE);
|
||||
(*_ppEditView)->execute(SCI_BEGINUNDOACTION);
|
||||
int nbReplaced = processAll(ProcessReplaceAll, NULL, NULL);
|
||||
int nbReplaced = processAll(ProcessReplaceAll, &_options);
|
||||
(*_ppEditView)->execute(SCI_ENDUNDOACTION);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
|
||||
|
@ -892,7 +928,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced);
|
||||
result = moreInfo;
|
||||
}
|
||||
::MessageBox(_hSelf, result.c_str(), TEXT("Replace All"), MB_OK);
|
||||
::MessageBox(_hMsgParent, result.c_str(), TEXT("Replace All"), MB_OK);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -901,7 +937,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
if (_currentStatus == FIND_DLG)
|
||||
{
|
||||
int nbCounted = processAll(ProcessCountAll, NULL, NULL);
|
||||
int nbCounted = processAll(ProcessCountAll, &_options);
|
||||
generic_string result = TEXT("");
|
||||
|
||||
if (nbCounted < 0)
|
||||
|
@ -912,7 +948,8 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbCounted);
|
||||
result = moreInfo;
|
||||
}
|
||||
::MessageBox(_hSelf, result.c_str(), TEXT("Count"), MB_OK);
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
|
||||
::MessageBox(_hMsgParent, result.c_str(), TEXT("Count"), MB_OK);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -921,10 +958,14 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
if (_currentStatus == FIND_DLG)
|
||||
{
|
||||
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
|
||||
updateCombo(IDFINDWHAT);
|
||||
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
int nbMarked = processAll(ProcessMarkAll, NULL, NULL);
|
||||
int nbMarked = processAll(ProcessMarkAll, &_options);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
generic_string result = TEXT("");
|
||||
if (nbMarked < 0)
|
||||
|
@ -935,7 +976,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbMarked);
|
||||
result = moreInfo;
|
||||
}
|
||||
::MessageBox(_hSelf, result.c_str(), TEXT("Mark"), MB_OK);
|
||||
::MessageBox(_hMsgParent, result.c_str(), TEXT("Mark"), MB_OK);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1007,7 +1048,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
case IDC_PURGE_CHECK :
|
||||
{
|
||||
if (_currentStatus == FIND_DLG)
|
||||
_doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
|
||||
_options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
|
@ -1015,8 +1056,8 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
if (_currentStatus == FIND_DLG)
|
||||
{
|
||||
_doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken));
|
||||
_options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_options._doMarkLine || _options._doStyleFoundToken));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1025,8 +1066,8 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
if (_currentStatus == FIND_DLG)
|
||||
{
|
||||
_doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken));
|
||||
_options._doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_options._doMarkLine || _options._doStyleFoundToken));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1034,7 +1075,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
case IDC_IN_SELECTION_CHECK :
|
||||
{
|
||||
if (_currentStatus <= REPLACE_DLG)
|
||||
_isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK);
|
||||
_options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
|
@ -1084,7 +1125,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
case IDD_FINDINFILES_RECURSIVE_CHECK :
|
||||
{
|
||||
if (_currentStatus == FINDINFILES_DLG)
|
||||
findHistory._isFifRecuisive = _isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK);
|
||||
findHistory._isFifRecuisive = _options._isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK);
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1092,7 +1133,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
case IDD_FINDINFILES_INHIDDENDIR_CHECK :
|
||||
{
|
||||
if (_currentStatus == FINDINFILES_DLG)
|
||||
findHistory._isFifInHiddenFolder = _isInHiddenDir = isCheckedOrNot(IDD_FINDINFILES_INHIDDENDIR_CHECK);
|
||||
findHistory._isFifInHiddenFolder = _options._isInHiddenDir = isCheckedOrNot(IDD_FINDINFILES_INHIDDENDIR_CHECK);
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1115,7 +1156,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
case IDD_FINDINFILES_BROWSE_BUTTON :
|
||||
{
|
||||
if (_currentStatus == FINDINFILES_DLG)
|
||||
folderBrowser(_hSelf, IDD_FINDINFILES_DIR_COMBO, _directory.c_str());
|
||||
folderBrowser(_hSelf, IDD_FINDINFILES_DIR_COMBO, _options._directory.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
|
@ -1131,7 +1172,8 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
// return value :
|
||||
// true : the text2find is found
|
||||
// false : the text2find is not found
|
||||
bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options, FindStatus *oFindStatus)
|
||||
|
||||
bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *options, FindStatus *oFindStatus)
|
||||
{
|
||||
if (oFindStatus)
|
||||
*oFindStatus = FSFound;
|
||||
|
@ -1139,7 +1181,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options,
|
|||
if (!txt2find || !txt2find[0])
|
||||
return false;
|
||||
|
||||
FindOption *pOptions = options?options:&_options;
|
||||
const FindOption *pOptions = options?options:_env;
|
||||
|
||||
int stringSizeFind = lstrlen(txt2find);
|
||||
TCHAR *pText = new TCHAR[stringSizeFind + 1];
|
||||
|
@ -1220,7 +1262,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options,
|
|||
generic_string msg = TEXT("Can't find the text:\r\n\"");
|
||||
msg += txt2find;
|
||||
msg += TEXT("\"");
|
||||
::MessageBox(_hSelf, msg.c_str(), TEXT("Find"), MB_OK);
|
||||
::MessageBox(_hMsgParent, msg.c_str(), TEXT("Find"), MB_OK);
|
||||
// if the dialog is not shown, pass the focus to his parent(ie. Notepad++)
|
||||
if (!::IsWindowVisible(_hSelf))
|
||||
{
|
||||
|
@ -1251,12 +1293,12 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, FindOption *options,
|
|||
// true : the text is replaced, and find the next occurrence
|
||||
// false : the text2find is not found, so the text is NOT replace
|
||||
// || the text is replaced, and do NOT find the next occurrence
|
||||
bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options)
|
||||
bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, const FindOption *options)
|
||||
{
|
||||
if (!txt2find || !txt2find[0] || !txt2replace)
|
||||
return false;
|
||||
|
||||
FindOption *pOptions = options?options:&_options;
|
||||
const FindOption *pOptions = options?options:_env;
|
||||
|
||||
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly()) return false;
|
||||
|
||||
|
@ -1298,18 +1340,19 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
|
|||
|
||||
delete [] pTextFind;
|
||||
delete [] pTextReplace;
|
||||
return processFindNext(txt2find); //after replacing, find the next section for selection
|
||||
return processFindNext(txt2find, pOptions); //after replacing, find the next section for selection
|
||||
}
|
||||
|
||||
|
||||
int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID)
|
||||
{
|
||||
_doStyleFoundToken = true;
|
||||
FindOption opt;
|
||||
opt._isMatchCase = true;
|
||||
opt._isWholeWord = false;
|
||||
opt._doStyleFoundToken = true;
|
||||
opt._str2Search = txt2find;
|
||||
|
||||
int nbFound = processAll(ProcessMarkAllExt, txt2find, NULL, true, NULL, &opt, styleID);
|
||||
int nbFound = processAll(ProcessMarkAllExt, &opt, true, NULL, styleID);
|
||||
return nbFound;
|
||||
}
|
||||
|
||||
|
@ -1325,15 +1368,17 @@ int FindReplaceDlg::markAll2(const TCHAR *txt2find)
|
|||
*/
|
||||
|
||||
|
||||
int FindReplaceDlg::markAllInc(const TCHAR *txt2find, FindOption *opt)
|
||||
int FindReplaceDlg::markAllInc(const FindOption *opt)
|
||||
{
|
||||
int nbFound = processAll(ProcessMarkAll_IncSearch, txt2find, NULL, true, NULL, opt);
|
||||
int nbFound = processAll(ProcessMarkAll_IncSearch, opt, true);
|
||||
return nbFound;
|
||||
}
|
||||
|
||||
int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire, const TCHAR *fileName, FindOption *opt, int colourStyleID)
|
||||
int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool isEntire, const TCHAR *fileName, int colourStyleID)
|
||||
{
|
||||
FindOption *pOptions = opt?opt:&_options;
|
||||
const FindOption *pOptions = opt?opt:_env;
|
||||
const TCHAR *txt2find = pOptions->_str2Search.c_str();
|
||||
const TCHAR *txt2replace = pOptions->_str4Replace.c_str();
|
||||
|
||||
CharacterRange cr = (*_ppEditView)->getSelection();
|
||||
int docLength = int((*_ppEditView)->execute(SCI_GETLENGTH));
|
||||
|
@ -1367,7 +1412,7 @@ int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const
|
|||
}
|
||||
|
||||
//then readjust scope if the selection override is active and allowed
|
||||
if ((_isInSelection) && ((op == ProcessMarkAll) || ((op == ProcessReplaceAll) && (!isEntire)))) //if selection limiter and either mark all or replace all w/o entire document override
|
||||
if ((pOptions->_isInSelection) && ((op == ProcessMarkAll) || ((op == ProcessReplaceAll) && (!isEntire)))) //if selection limiter and either mark all or replace all w/o entire document override
|
||||
{
|
||||
startPosition = cr.cpMin;
|
||||
endPosition = cr.cpMax;
|
||||
|
@ -1382,7 +1427,7 @@ int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const
|
|||
return processRange(op, txt2find, txt2replace, startPosition, endPosition, fileName, opt, colourStyleID);
|
||||
}
|
||||
|
||||
int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName, FindOption *opt, int colourStyleID)
|
||||
int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName, const FindOption *opt, int colourStyleID)
|
||||
{
|
||||
int nbProcessed = 0;
|
||||
|
||||
|
@ -1398,7 +1443,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
|
|||
if (!fileName)
|
||||
fileName = TEXT("");
|
||||
|
||||
FindOption *pOptions = opt?opt:&_options;
|
||||
const FindOption *pOptions = opt?opt:_env;
|
||||
//bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||
bool isUnicode = ((*_ppEditView)->execute(SCI_GETCODEPAGE) == SC_CP_UTF8);
|
||||
|
||||
|
@ -1459,11 +1504,11 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
|
|||
|
||||
if (op == ProcessMarkAll && colourStyleID == -1) //if marking, check if purging is needed
|
||||
{
|
||||
if (_doPurge) {
|
||||
if (_doMarkLine)
|
||||
if (_env->_doPurge) {
|
||||
if (_env->_doMarkLine)
|
||||
(*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
|
||||
|
||||
if (_doStyleFoundToken)
|
||||
if (_env->_doStyleFoundToken)
|
||||
(*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -1554,13 +1599,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
|
|||
|
||||
case ProcessMarkAll:
|
||||
{
|
||||
if (_doStyleFoundToken)
|
||||
if (_env->_doStyleFoundToken)
|
||||
{
|
||||
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
|
||||
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
|
||||
}
|
||||
|
||||
if (_doMarkLine)
|
||||
if (_env->_doMarkLine)
|
||||
{
|
||||
int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, targetStart);
|
||||
int state = (*_ppEditView)->execute(SCI_MARKERGET, lineNumber);
|
||||
|
@ -1807,19 +1852,206 @@ void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
|
|||
|
||||
void FindReplaceDlg::getPatterns(vector<generic_string> & patternVect)
|
||||
{
|
||||
cutString(_filters.c_str(), patternVect);
|
||||
cutString(_env->_filters.c_str(), patternVect);
|
||||
}
|
||||
|
||||
void FindReplaceDlg::saveInMacro(int cmd, int cmdType)
|
||||
{
|
||||
int booleans = 0;
|
||||
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_INIT, 0);
|
||||
::SendMessage(_hParent, WM_FRSAVE_STR, IDFINDWHAT, reinterpret_cast<LPARAM>(_options._str2Search.c_str()));
|
||||
booleans |= _options._isWholeWord?IDF_WHOLEWORD:0;
|
||||
booleans |= _options._isMatchCase?IDF_MATCHCASE:0;
|
||||
::SendMessage(_hParent, WM_FRSAVE_INT, IDNORMAL, _options._searchType);
|
||||
if (cmd == IDCMARKALL)
|
||||
{
|
||||
booleans |= _options._doPurge?IDF_PURGE_CHECK:0;
|
||||
booleans |= _options._doMarkLine?IDF_MARKLINE_CHECK:0;
|
||||
booleans |= _options._doStyleFoundToken?IDF_STYLEFOUND_CHECK:0;
|
||||
}
|
||||
if (cmdType & FR_OP_REPLACE)
|
||||
::SendMessage(_hParent, WM_FRSAVE_STR, IDREPLACEWITH, (LPARAM)_options._str4Replace.c_str());
|
||||
if (cmdType & FR_OP_FIF)
|
||||
{
|
||||
::SendMessage(_hParent, WM_FRSAVE_STR, IDD_FINDINFILES_DIR_COMBO, (LPARAM)_options._directory.c_str());
|
||||
::SendMessage(_hParent, WM_FRSAVE_STR, IDD_FINDINFILES_FILTERS_COMBO, (LPARAM)_options._filters.c_str());
|
||||
booleans |= _options._isRecursive?IDF_FINDINFILES_RECURSIVE_CHECK:0;
|
||||
booleans |= _options._isInHiddenDir?IDF_FINDINFILES_INHIDDENDIR_CHECK:0;
|
||||
}
|
||||
else if (!(cmdType & FR_OP_GLOBAL))
|
||||
{
|
||||
booleans |= _options._isInSelection?IDF_IN_SELECTION_CHECK:0;
|
||||
booleans |= _options._isWrapAround?IDF_WRAP:0;
|
||||
booleans |= _options._whichDirection?IDF_WHICH_DIRECTION:0;
|
||||
}
|
||||
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_BOOLEANS, booleans);
|
||||
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd);
|
||||
}
|
||||
|
||||
void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stringValue)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
case IDC_FRCOMMAND_INIT:
|
||||
_env = new FindOption;
|
||||
_hMsgParent = _hParent;
|
||||
break;
|
||||
case IDFINDWHAT:
|
||||
_env->_str2Search = stringValue;
|
||||
break;
|
||||
case IDC_FRCOMMAND_BOOLEANS:
|
||||
_env->_isWholeWord = ((intValue & IDF_WHOLEWORD)> 0);
|
||||
_env->_isMatchCase = ((intValue & IDF_MATCHCASE)> 0);
|
||||
_env->_isRecursive = ((intValue & IDF_FINDINFILES_RECURSIVE_CHECK)> 0);
|
||||
_env->_isInHiddenDir = ((intValue & IDF_FINDINFILES_INHIDDENDIR_CHECK)> 0);
|
||||
_env->_doPurge = ((intValue & IDF_PURGE_CHECK)> 0);
|
||||
_env->_doMarkLine = ((intValue & IDF_MARKLINE_CHECK)> 0);
|
||||
_env->_doStyleFoundToken = ((intValue & IDF_STYLEFOUND_CHECK)> 0);
|
||||
_env->_isInSelection = ((intValue & IDF_IN_SELECTION_CHECK)> 0);
|
||||
_env->_isWrapAround = ((intValue & IDF_WRAP)> 0);
|
||||
_env->_whichDirection = ((intValue & IDF_WHICH_DIRECTION)> 0);
|
||||
break;
|
||||
case IDNORMAL:
|
||||
_env->_searchType = (SearchType)intValue;
|
||||
break;
|
||||
case IDREPLACEWITH:
|
||||
_env->_str4Replace = stringValue;
|
||||
break;
|
||||
case IDD_FINDINFILES_DIR_COMBO:
|
||||
_env->_directory = stringValue;
|
||||
break;
|
||||
case IDD_FINDINFILES_FILTERS_COMBO:
|
||||
_env->_filters = stringValue;
|
||||
break;
|
||||
case IDC_FRCOMMAND_EXEC:
|
||||
{
|
||||
NppParameters *nppParamInst = NppParameters::getInstance();
|
||||
switch(intValue)
|
||||
{
|
||||
case IDOK:
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
processFindNext(_env->_str2Search.c_str());
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
break;
|
||||
case IDREPLACE:
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
processReplace(_env->_str2Search.c_str(), _env->_str4Replace.c_str(), _env);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
break;
|
||||
case IDC_FINDALL_OPENEDFILES:
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
findAllIn(ALL_OPEN_DOCS);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
break;
|
||||
case IDC_FINDALL_CURRENTFILE:
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
findAllIn(FILES_IN_DIR);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
break;
|
||||
case IDC_REPLACE_OPENEDFILES :
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
replaceAllInOpenedDocs();
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
break;
|
||||
case IDD_FINDINFILES_FIND_BUTTON :
|
||||
{
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
findAllIn(FILES_IN_DIR);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
break;
|
||||
}
|
||||
case IDD_FINDINFILES_REPLACEINFILES :
|
||||
{
|
||||
generic_string msg = TEXT("Are you sure you want to replace all occurances in :\r");
|
||||
msg += _env->_directory;
|
||||
msg += TEXT("\rfor file type : ");
|
||||
msg += (_env->_filters[0])?_env->_filters:TEXT("*.*");
|
||||
|
||||
if (::MessageBox(_hMsgParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL) == IDOK)
|
||||
{
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDREPLACEALL :
|
||||
{
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
(*_ppEditView)->execute(SCI_BEGINUNDOACTION);
|
||||
int nbReplaced = processAll(ProcessReplaceAll, _env);
|
||||
(*_ppEditView)->execute(SCI_ENDUNDOACTION);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
|
||||
generic_string result = TEXT("");
|
||||
|
||||
if (nbReplaced < 0)
|
||||
result = TEXT("The regular expression to search is formed badly");
|
||||
else
|
||||
{
|
||||
TCHAR moreInfo[64];
|
||||
wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced);
|
||||
result = moreInfo;
|
||||
}
|
||||
::MessageBox(_hMsgParent, result.c_str(), TEXT("Replace All"), MB_OK);
|
||||
break;
|
||||
}
|
||||
case IDCCOUNTALL :
|
||||
{
|
||||
int nbCounted = processAll(ProcessCountAll, _env);
|
||||
generic_string result = TEXT("");
|
||||
|
||||
if (nbCounted < 0)
|
||||
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
|
||||
else
|
||||
{
|
||||
TCHAR moreInfo[128];
|
||||
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbCounted);
|
||||
result = moreInfo;
|
||||
}
|
||||
::MessageBox(_hMsgParent, result.c_str(), TEXT("Count"), MB_OK);
|
||||
break;
|
||||
}
|
||||
case IDCMARKALL:
|
||||
{
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
int nbMarked = processAll(ProcessMarkAll, _env);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
generic_string result = TEXT("");
|
||||
if (nbMarked < 0)
|
||||
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
|
||||
else
|
||||
{
|
||||
TCHAR moreInfo[128];
|
||||
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbMarked);
|
||||
result = moreInfo;
|
||||
}
|
||||
::MessageBox(_hMsgParent, result.c_str(), TEXT("Mark"), MB_OK);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw std::runtime_error("Internal error: unknown saved command!");
|
||||
}
|
||||
_hMsgParent = _hSelf;
|
||||
delete _env;
|
||||
_env = &_options;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw std::runtime_error("Internal error: unknown SnR command!");
|
||||
}
|
||||
}
|
||||
|
||||
void FindReplaceDlg::setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters)
|
||||
{
|
||||
if (dir)
|
||||
{
|
||||
_directory = dir;
|
||||
_options._directory = dir;
|
||||
::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir);
|
||||
}
|
||||
if (filters)
|
||||
{
|
||||
_filters = filters;
|
||||
_options._filters = filters;
|
||||
::SetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters);
|
||||
}
|
||||
}
|
||||
|
@ -1830,13 +2062,13 @@ void FindReplaceDlg::initOptionsFromDlg()
|
|||
_options._isMatchCase = isCheckedOrNot(IDMATCHCASE);
|
||||
_options._searchType = isCheckedOrNot(IDREGEXP)?FindRegex:isCheckedOrNot(IDEXTENDED)?FindExtended:FindNormal;
|
||||
_options._isWrapAround = isCheckedOrNot(IDWRAP);
|
||||
_isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK);
|
||||
_options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK);
|
||||
|
||||
_doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
|
||||
_doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
|
||||
_doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK);
|
||||
_options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
|
||||
_options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
|
||||
_options._doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK);
|
||||
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken));
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_options._doMarkLine || _options._doStyleFoundToken));
|
||||
}
|
||||
|
||||
void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow)
|
||||
|
@ -1935,7 +2167,6 @@ void FindReplaceDlg::combo2ExtendedMode(int comboID)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Finder::addSearchLine(const TCHAR *searchName)
|
||||
{
|
||||
generic_string str = TEXT("Search \"");
|
||||
|
@ -2375,7 +2606,8 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt)
|
|||
|
||||
TCHAR text2Find[FINDREPLACE_MAXLENGTH];
|
||||
(*(_pFRDlg->_ppEditView))->getGenericSelectedText(text2Find, FINDREPLACE_MAXLENGTH, false); //do not expand selection (false)
|
||||
_pFRDlg->markAllInc(text2Find, opt);
|
||||
opt->_str2Search = text2Find;
|
||||
_pFRDlg->markAllInc(opt);
|
||||
}
|
||||
|
||||
void FindIncrementDlg::setFindStatus(FindStatus iStatus)
|
||||
|
|
|
@ -61,15 +61,29 @@ enum SearchIncrementalType { NotIncremental, FirstIncremental, NextIncremental }
|
|||
enum SearchType { FindNormal, FindExtended, FindRegex };
|
||||
enum ProcessOperation { ProcessFindAll, ProcessReplaceAll, ProcessCountAll, ProcessMarkAll, ProcessMarkAll_2, ProcessMarkAll_IncSearch, ProcessMarkAllExt };
|
||||
|
||||
struct FindOption {
|
||||
struct FindOption
|
||||
{
|
||||
bool _isWholeWord;
|
||||
bool _isMatchCase;
|
||||
bool _isWrapAround;
|
||||
bool _whichDirection;
|
||||
SearchIncrementalType _incrementalType;
|
||||
SearchType _searchType;
|
||||
FindOption() :_isWholeWord(true), _isMatchCase(true), _searchType(FindNormal),\
|
||||
_isWrapAround(true), _whichDirection(DIR_DOWN), _incrementalType(NotIncremental){};
|
||||
bool _doPurge;
|
||||
bool _doMarkLine;
|
||||
bool _doStyleFoundToken;
|
||||
bool _isInSelection;
|
||||
generic_string _str2Search;
|
||||
generic_string _str4Replace;
|
||||
generic_string _filters;
|
||||
generic_string _directory;
|
||||
bool _isRecursive;
|
||||
bool _isInHiddenDir;
|
||||
FindOption() : _isWholeWord(true), _isMatchCase(true), _searchType(FindNormal),\
|
||||
_isWrapAround(true), _whichDirection(DIR_DOWN), _incrementalType(NotIncremental),
|
||||
_doPurge(false), _doMarkLine(false), _doStyleFoundToken(false),
|
||||
_isInSelection(false), _isRecursive(false), _isInHiddenDir(false),
|
||||
_filters(TEXT("")), _directory(TEXT("")) {};
|
||||
};
|
||||
|
||||
//This class contains generic search functions as static functions for easy access
|
||||
|
@ -77,7 +91,7 @@ class Searching {
|
|||
public:
|
||||
static int convertExtendedToString(const TCHAR * query, TCHAR * result, int length);
|
||||
static TargetRange t;
|
||||
static int buildSearchFlags(FindOption * option) {
|
||||
static int buildSearchFlags(const FindOption * option) {
|
||||
return (option->_isWholeWord ? SCFIND_WHOLEWORD : 0) |
|
||||
(option->_isMatchCase ? SCFIND_MATCHCASE : 0) |
|
||||
(option->_searchType == FindRegex ? SCFIND_REGEXP|SCFIND_POSIX : 0);
|
||||
|
@ -157,10 +171,13 @@ class FindReplaceDlg : public StaticDialog
|
|||
{
|
||||
friend class FindIncrementDlg;
|
||||
public :
|
||||
FindReplaceDlg() : StaticDialog(), _pFinder(NULL), _isRTL(false), _isRecursive(true),_isInHiddenDir(false),\
|
||||
static FindOption _options;
|
||||
static FindOption* _env;
|
||||
FindReplaceDlg() : StaticDialog(), _pFinder(NULL), _isRTL(false),\
|
||||
_fileNameLenMax(1024) {
|
||||
_uniFileName = new char[(_fileNameLenMax + 3) * 2];
|
||||
_winVer = (NppParameters::getInstance())->getWinVersion();
|
||||
_env = &_options;
|
||||
};
|
||||
~FindReplaceDlg();
|
||||
|
||||
|
@ -169,6 +186,7 @@ public :
|
|||
if (!ppEditView)
|
||||
throw std::runtime_error("FindIncrementDlg::init : ppEditView is null.");
|
||||
_ppEditView = ppEditView;
|
||||
_hMsgParent = _hSelf;
|
||||
};
|
||||
|
||||
virtual void create(int dialogID, bool isRTL = false);
|
||||
|
@ -176,16 +194,17 @@ public :
|
|||
void initOptionsFromDlg();
|
||||
|
||||
void doDialog(DIALOG_TYPE whichType, bool isRTL = false, bool toShow = true);
|
||||
bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL, FindStatus *oFindStatus = NULL);
|
||||
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL);
|
||||
bool processFindNext(const TCHAR *txt2find, const FindOption *options = NULL, FindStatus *oFindStatus = NULL);
|
||||
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, const FindOption *options = NULL);
|
||||
|
||||
int markAll(const TCHAR *txt2find, int styleID);
|
||||
//int markAll2(const TCHAR *str2find);
|
||||
int markAllInc(const TCHAR *str2find, FindOption *opt);
|
||||
int markAllInc(const FindOption *opt);
|
||||
|
||||
|
||||
int processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire = false, const TCHAR *fileName = NULL, FindOption *opt = NULL, int colourStyleID = -1);
|
||||
int processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName = NULL, FindOption *opt = NULL, int colourStyleID = -1);
|
||||
int processAll(ProcessOperation op, const FindOption *opt, bool isEntire = false, const TCHAR *fileName = NULL, int colourStyleID = -1);
|
||||
// int processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire = false, const TCHAR *fileName = NULL, const FindOption *opt = NULL, int colourStyleID = -1);
|
||||
int processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName = NULL, const FindOption *opt = NULL, int colourStyleID = -1);
|
||||
void replaceAllInOpenedDocs();
|
||||
void findAllIn(InWhat op);
|
||||
void setSearchText(TCHAR * txt2find);
|
||||
|
@ -195,7 +214,7 @@ public :
|
|||
void putFindResult(int result) {
|
||||
_findAllResult = result;
|
||||
};
|
||||
const TCHAR * getDir2Search() const {return _directory.c_str();};
|
||||
const TCHAR * getDir2Search() const {return _env->_directory.c_str();};
|
||||
|
||||
void getPatterns(vector<generic_string> & patternVect);
|
||||
|
||||
|
@ -206,14 +225,14 @@ public :
|
|||
void setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters);
|
||||
|
||||
generic_string getText2search() const {
|
||||
return getTextFromCombo(::GetDlgItem(_hSelf, IDFINDWHAT));
|
||||
return _env->_str2Search;
|
||||
};
|
||||
|
||||
const generic_string & getFilters() const {return _filters;};
|
||||
const generic_string & getDirectory() const {return _directory;};
|
||||
const FindOption & getCurrentOptions() const {return _options;};
|
||||
bool isRecursive() const { return _isRecursive; };
|
||||
bool isInHiddenDir() const { return _isInHiddenDir; };
|
||||
const generic_string & getFilters() const {return _env->_filters;};
|
||||
const generic_string & getDirectory() const {return _env->_directory;};
|
||||
const FindOption & getCurrentOptions() const {return *_env;};
|
||||
bool isRecursive() const { return _env->_isRecursive; };
|
||||
bool isInHiddenDir() const { return _env->_isInHiddenDir; };
|
||||
void saveFindHistory();
|
||||
void changeTabName(DIALOG_TYPE index, const TCHAR *name2change) {
|
||||
TCITEM tie;
|
||||
|
@ -252,7 +271,8 @@ public :
|
|||
{
|
||||
_pFinder->setFinderStyle();
|
||||
}
|
||||
};
|
||||
}
|
||||
void execSavedCommand(int cmd, int intValue, generic_string stringValue);
|
||||
|
||||
protected :
|
||||
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
@ -266,15 +286,8 @@ protected :
|
|||
void combo2ExtendedMode(int comboID);
|
||||
|
||||
private :
|
||||
|
||||
DIALOG_TYPE _currentStatus;
|
||||
FindOption _options;
|
||||
|
||||
bool _doPurge;
|
||||
bool _doMarkLine;
|
||||
bool _doStyleFoundToken;
|
||||
bool _isInSelection;
|
||||
|
||||
|
||||
RECT _findClosePos, _replaceClosePos, _findInFilesClosePos;
|
||||
|
||||
ScintillaEditView **_ppEditView;
|
||||
|
@ -284,11 +297,6 @@ private :
|
|||
int _findAllResult;
|
||||
TCHAR _findAllResultStr[1024];
|
||||
|
||||
generic_string _filters;
|
||||
generic_string _directory;
|
||||
bool _isRecursive;
|
||||
bool _isInHiddenDir;
|
||||
|
||||
int _fileNameLenMax;
|
||||
char *_uniFileName;
|
||||
|
||||
|
@ -322,6 +330,12 @@ private :
|
|||
void fillFindHistory();
|
||||
void fillComboHistory(int id, const std::vector<generic_string> & strings);
|
||||
int saveComboHistory(int id, int maxcount, vector<generic_string> & strings);
|
||||
static const int FR_OP_FIND = 1;
|
||||
static const int FR_OP_REPLACE = 2;
|
||||
static const int FR_OP_FIF = 4;
|
||||
static const int FR_OP_GLOBAL = 8;
|
||||
void saveInMacro(int cmd, int cmdType);
|
||||
HWND _hMsgParent;
|
||||
};
|
||||
|
||||
//FindIncrementDlg: incremental search dialog, docked in rebar
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#define IDFINDWHAT 1601
|
||||
#define IDREPLACEWITH 1602
|
||||
#define IDWHOLEWORD 1603
|
||||
#define IDF_WHOLEWORD 1
|
||||
#define IDMATCHCASE 1604
|
||||
#define IDF_MATCHCASE 2
|
||||
|
||||
#define IDC_MODE_STATIC 1624
|
||||
#define IDNORMAL 1625
|
||||
|
@ -31,6 +33,7 @@
|
|||
#define IDREGEXP 1605
|
||||
|
||||
#define IDWRAP 1606
|
||||
#define IDF_WRAP 256
|
||||
#define IDUNSLASH 1607
|
||||
#define IDREPLACE 1608
|
||||
#define IDREPLACEALL 1609
|
||||
|
@ -38,11 +41,15 @@
|
|||
#define ID_STATICTEXT_REPLACE 1611
|
||||
#define IDDIRECTIONUP 1612
|
||||
#define IDDIRECTIONDOWN 1613
|
||||
#define IDF_WHICH_DIRECTION 512
|
||||
#define IDCCOUNTALL 1614
|
||||
#define IDCMARKALL 1615
|
||||
#define IDC_MARKLINE_CHECK 1616
|
||||
#define IDF_MARKLINE_CHECK 16
|
||||
#define IDC_STYLEFOUND_CHECK 1617
|
||||
#define IDF_STYLEFOUND_CHECK 8
|
||||
#define IDC_PURGE_CHECK 1618
|
||||
#define IDF_PURGE_CHECK 4
|
||||
#define IDC_FINDALL_STATIC 1619
|
||||
#define IDFINDWHAT_STATIC 1620
|
||||
#define IDC_DIR_STATIC 1621
|
||||
|
@ -55,6 +62,7 @@
|
|||
//#define IDC_OPENED_FILES_RADIO 1630
|
||||
//#define IDC_FILES_RADIO 1631
|
||||
#define IDC_IN_SELECTION_CHECK 1632
|
||||
#define IDF_IN_SELECTION_CHECK 128
|
||||
#define IDC_CLEAR_ALL 1633
|
||||
#define IDC_REPLACEINSELECTION 1634
|
||||
#define IDC_REPLACE_OPENEDFILES 1635
|
||||
|
@ -74,7 +82,9 @@
|
|||
#define IDD_FINDINFILES_FIND_BUTTON 1656
|
||||
#define IDD_FINDINFILES_GOBACK_BUTTON 1657
|
||||
#define IDD_FINDINFILES_RECURSIVE_CHECK 1658
|
||||
#define IDF_FINDINFILES_RECURSIVE_CHECK 32
|
||||
#define IDD_FINDINFILES_INHIDDENDIR_CHECK 1659
|
||||
#define IDF_FINDINFILES_INHIDDENDIR_CHECK 64
|
||||
#define IDD_FINDINFILES_REPLACEINFILES 1660
|
||||
#define IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK 1661
|
||||
|
||||
|
@ -93,4 +103,8 @@
|
|||
#define IDC_TRANSPARENT_LOSSFOCUS_RADIO 1687
|
||||
#define IDC_TRANSPARENT_ALWAYS_RADIO 1688
|
||||
|
||||
#define IDC_FRCOMMAND_INIT 1700
|
||||
#define IDC_FRCOMMAND_EXEC 1701
|
||||
#define IDC_FRCOMMAND_BOOLEANS 1702
|
||||
|
||||
#endif //FINDREPLACE_DLG_H
|
||||
|
|
|
@ -86,6 +86,8 @@ typedef void * SCINTILLA_PTR;
|
|||
#define WM_FINDINFILES (SCINTILLA_USER + 9)
|
||||
#define WM_REPLACEINFILES (SCINTILLA_USER + 10)
|
||||
#define WM_FINDALL_INCURRENTDOC (SCINTILLA_USER + 11)
|
||||
#define WM_FRSAVE_INT (SCINTILLA_USER + 12)
|
||||
#define WM_FRSAVE_STR (SCINTILLA_USER + 13)
|
||||
|
||||
const int NB_FOLDER_STATE = 7;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ void RunMacroDlg::initMacroList()
|
|||
|
||||
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
if (::SendMessage(_hParent, WM_ISCURRENTMACRORECORDED, 0, 0))
|
||||
if (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED)
|
||||
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Current recorded macro"));
|
||||
|
||||
for (size_t i = 0 ; i < macroList.size() ; i++)
|
||||
|
@ -134,6 +134,6 @@ void RunMacroDlg::check(int id)
|
|||
|
||||
int RunMacroDlg::getMacro2Exec() const
|
||||
{
|
||||
bool isCurMacroPresent = ::SendMessage(_hParent, WM_ISCURRENTMACRORECORDED, 0, 0) == TRUE;
|
||||
bool isCurMacroPresent = ::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED;
|
||||
return isCurMacroPresent?(m_macroIndex - 1):m_macroIndex;
|
||||
}
|
||||
|
|
|
@ -558,6 +558,10 @@ recordedMacroStep::recordedMacroStep(int iMessage, long wParam, long lParam)
|
|||
case SCI_STYLESETFONT :
|
||||
case SCI_SEARCHNEXT :
|
||||
case SCI_SEARCHPREV :
|
||||
case IDFINDWHAT:
|
||||
case IDREPLACEWITH:
|
||||
case IDD_FINDINFILES_DIR_COMBO:
|
||||
case IDD_FINDINFILES_FILTERS_COMBO:
|
||||
sParameter = *reinterpret_cast<TCHAR *>(lParameter);
|
||||
MacroType = mtUseSParameter;
|
||||
lParameter = 0;
|
||||
|
|
|
@ -260,7 +260,7 @@ class Window;
|
|||
class ScintillaEditView;
|
||||
|
||||
struct recordedMacroStep {
|
||||
enum MacroTypeIndex {mtUseLParameter, mtUseSParameter, mtMenuCommand};
|
||||
enum MacroTypeIndex {mtUseLParameter, mtUseSParameter, mtMenuCommand, mtSavedSnR};
|
||||
|
||||
int message;
|
||||
long wParameter;
|
||||
|
@ -271,13 +271,15 @@ struct recordedMacroStep {
|
|||
recordedMacroStep(int iMessage, long wParam, long lParam);
|
||||
recordedMacroStep(int iCommandID) : message(0), wParameter(iCommandID), lParameter(0), MacroType(mtMenuCommand) {};
|
||||
|
||||
recordedMacroStep(int type, int iMessage, long wParam, long lParam, const TCHAR *sParam)
|
||||
recordedMacroStep(int iMessage, long wParam, long lParam, const TCHAR *sParam, int type = mtSavedSnR)
|
||||
: message(iMessage), wParameter(wParam), lParameter(lParam), MacroType(MacroTypeIndex(type)){
|
||||
sParameter = *reinterpret_cast<const TCHAR *>(sParam);
|
||||
sParameter = (sParam)?generic_string(sParam):TEXT("");
|
||||
};
|
||||
|
||||
bool isValid() const {
|
||||
return true;
|
||||
};
|
||||
bool isPlayable() const {return MacroType <= mtMenuCommand;};
|
||||
|
||||
void PlayBack(Window* pNotepad, ScintillaEditView *pEditView);
|
||||
};
|
||||
|
|
|
@ -367,7 +367,7 @@
|
|||
|
||||
|
||||
#define MACRO_USER (WM_USER + 4000)
|
||||
#define WM_ISCURRENTMACRORECORDED (MACRO_USER + 01)
|
||||
#define WM_GETCURRENTMACROSTATUS (MACRO_USER + 01)
|
||||
#define WM_MACRODLGRUNMACRO (MACRO_USER + 02)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue