Add the capacity to switch among Find/Replace/FiF/Mark via their shortcuts
Add Find/Replace/Find in fles/Mark shortcuts detection capacity in Find Replace dialog. Fix #10019, close #10177
This commit is contained in:
parent
fdb2951e00
commit
aa69711d4c
|
@ -1207,7 +1207,19 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDM_SEARCH_FIND:
|
case IDM_SEARCH_FIND:
|
||||||
goToCenter();
|
enableReplaceFunc(false); // enable relace false so only find
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDM_SEARCH_REPLACE:
|
||||||
|
enableReplaceFunc(true);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDM_SEARCH_FINDINFILES:
|
||||||
|
enableFindInFilesFunc();
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDM_SEARCH_MARK:
|
||||||
|
enableMarkFunc();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDREPLACE :
|
case IDREPLACE :
|
||||||
|
|
|
@ -496,10 +496,9 @@ void Accelerator::updateShortcuts()
|
||||||
size_t nbPluginCmd = pluginCommands.size();
|
size_t nbPluginCmd = pluginCommands.size();
|
||||||
|
|
||||||
delete [] _pAccelArray;
|
delete [] _pAccelArray;
|
||||||
_pAccelArray = new ACCEL[nbMenu+nbMacro+nbUserCmd+nbPluginCmd];
|
_pAccelArray = new ACCEL[nbMenu + nbMacro+nbUserCmd + nbPluginCmd];
|
||||||
vector<ACCEL> incrFindAcc;
|
vector<ACCEL> incrFindAcc;
|
||||||
|
vector<ACCEL> findReplaceAcc;
|
||||||
ACCEL *pSearchFindAccel = nullptr;
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
//no validation performed, it might be that invalid shortcuts are being used by default. Allows user to 'hack', might be a good thing
|
//no validation performed, it might be that invalid shortcuts are being used by default. Allows user to 'hack', might be a good thing
|
||||||
|
@ -515,8 +514,9 @@ void Accelerator::updateShortcuts()
|
||||||
if (std::find(incrFindAccIds.begin(), incrFindAccIds.end(), shortcuts[i].getID()) != incrFindAccIds.end())
|
if (std::find(incrFindAccIds.begin(), incrFindAccIds.end(), shortcuts[i].getID()) != incrFindAccIds.end())
|
||||||
incrFindAcc.push_back(_pAccelArray[offset]);
|
incrFindAcc.push_back(_pAccelArray[offset]);
|
||||||
|
|
||||||
if (shortcuts[i].getID() == IDM_SEARCH_FIND)
|
if (shortcuts[i].getID() == IDM_SEARCH_FIND || shortcuts[i].getID() == IDM_SEARCH_REPLACE ||
|
||||||
pSearchFindAccel = &_pAccelArray[offset];
|
shortcuts[i].getID() == IDM_SEARCH_FINDINFILES || shortcuts[i].getID() == IDM_SEARCH_MARK)
|
||||||
|
findReplaceAcc.push_back(_pAccelArray[offset]);
|
||||||
|
|
||||||
++offset;
|
++offset;
|
||||||
}
|
}
|
||||||
|
@ -582,11 +582,13 @@ void Accelerator::updateShortcuts()
|
||||||
|
|
||||||
if (_hFindAccTab)
|
if (_hFindAccTab)
|
||||||
::DestroyAcceleratorTable(_hFindAccTab);
|
::DestroyAcceleratorTable(_hFindAccTab);
|
||||||
if (pSearchFindAccel != nullptr)
|
size_t nbFindReplaceAcc = findReplaceAcc.size();
|
||||||
|
if (nbFindReplaceAcc)
|
||||||
{
|
{
|
||||||
ACCEL *tmpFindAccelArray = new ACCEL[1];
|
ACCEL* tmpFindAccelArray = new ACCEL[nbFindReplaceAcc];
|
||||||
tmpFindAccelArray[0] = *pSearchFindAccel;
|
for (size_t i = 0; i < nbFindReplaceAcc; ++i)
|
||||||
_hFindAccTab = ::CreateAcceleratorTable(tmpFindAccelArray, 1);
|
tmpFindAccelArray[i] = findReplaceAcc[i];
|
||||||
|
_hFindAccTab = ::CreateAcceleratorTable(tmpFindAccelArray, static_cast<int>(nbFindReplaceAcc));
|
||||||
delete[] tmpFindAccelArray;
|
delete[] tmpFindAccelArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue