From 360d45db1aa44d890d9ce121894d62f2247e3ca6 Mon Sep 17 00:00:00 2001 From: Christophe Meriaux Date: Mon, 2 Oct 2017 00:08:05 +0200 Subject: [PATCH] Add filter capacity in the shortcut mapper Closes #4096, closes #2562 --- PowerEditor/src/MISC/Common/Common.cpp | 6 + PowerEditor/src/MISC/Common/Common.h | 1 + .../src/WinControls/Grid/ShortcutMapper.cpp | 243 +++++++++++++----- .../src/WinControls/Grid/ShortcutMapper.h | 10 +- .../src/WinControls/Grid/ShortcutMapper.rc | 14 +- .../src/WinControls/Grid/ShortcutMapper_rc.h | 4 +- 6 files changed, 199 insertions(+), 79 deletions(-) mode change 100644 => 100755 PowerEditor/src/WinControls/Grid/ShortcutMapper.rc diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index ecb972c1f..e8eb25d82 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -770,6 +770,12 @@ generic_string stringToUpper(generic_string strToConvert) return strToConvert; } +generic_string stringToLower(generic_string strToConvert) +{ + std::transform(strToConvert.begin(), strToConvert.end(), strToConvert.begin(), ::towlower); + return strToConvert; +} + generic_string stringReplace(generic_string subject, const generic_string& search, const generic_string& replace) { diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index 3d6522937..7f130bdfb 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -172,6 +172,7 @@ generic_string PathRemoveFileSpec(generic_string & path); generic_string PathAppend(generic_string &strDest, const generic_string & str2append); COLORREF getCtrlBgColor(HWND hWnd); generic_string stringToUpper(generic_string strToConvert); +generic_string stringToLower(generic_string strToConvert); generic_string stringReplace(generic_string subject, const generic_string& search, const generic_string& replace); std::vector stringSplit(const generic_string& input, const generic_string& delimiter); generic_string stringJoin(const std::vector& strings, const generic_string& separator); diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp index 658587c0d..85bccab5f 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp @@ -97,6 +97,7 @@ generic_string ShortcutMapper::getTabString(size_t i) const } } + void ShortcutMapper::initBabyGrid() { RECT rect; getClientRect(rect); @@ -136,11 +137,53 @@ void ShortcutMapper::initBabyGrid() { NppParameters::getInstance()->getNativeLangSpeaker()->changeDlgLang(_hSelf, "ShortcutMapper"); } +generic_string ShortcutMapper::getTextFromCombo(HWND hCombo) +{ + const int NB_MAX(128); + TCHAR str[NB_MAX](TEXT("\0")); + ::SendMessage(hCombo, WM_GETTEXT, NB_MAX, reinterpret_cast(str)); + generic_string res(str); + return stringToLower(res); +}; + +bool ShortcutMapper::isFilterValid(Shortcut sc) +{ + bool match = false; + generic_string shortcut_name = stringToLower(generic_string(sc.getName())); + if (_shortcutFilter.empty()) { + return true; + } + // test the filter on the shortcut name + size_t match_pos = shortcut_name.find(_shortcutFilter); + if (match_pos != std::string::npos){ + match = true; + } + return match; +} + +bool ShortcutMapper::isFilterValid(PluginCmdShortcut sc) +{ + // Do like a classic search on shortcut name, then search on the plugin name. + Shortcut shortcut = sc; + bool match = false; + generic_string module_name = stringToLower(generic_string(sc.getModuleName())); + if (isFilterValid(shortcut)){ + return true; + } + size_t match_pos = module_name.find(_shortcutFilter); + if (match_pos != std::string::npos){ + match = true; + } + + return match; +} + void ShortcutMapper::fillOutBabyGrid() { NppParameters *nppParam = NppParameters::getInstance(); _babygrid.clear(); _babygrid.setInitialContent(true); + _shortcutIndex.clear(); size_t nbItems = 0; NativeLangSpeaker* nativeLangSpeaker = nppParam->getNativeLangSpeaker(); @@ -193,24 +236,33 @@ void ShortcutMapper::fillOutBabyGrid() } bool isMarker = false; + size_t cs_index = 0; + _shortcutFilter = getTextFromCombo(::GetDlgItem(_hSelf, IDC_BABYGRID_FILTER)); switch(_currentState) { case STATE_MENU: { vector & cshortcuts = nppParam->getUserShortcuts(); + cs_index = 1; for (size_t i = 0; i < nbItems; ++i) { - if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) - isMarker = _babygrid.setMarker(true); + if (isFilterValid(cshortcuts[i])) + { + if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) + isMarker = _babygrid.setMarker(true); - _babygrid.setText(i + 1, 1, cshortcuts[i].getName()); - if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance - _babygrid.setText(i + 1, 2, cshortcuts[i].toString().c_str()); - _babygrid.setText(i + 1, 3, cshortcuts[i].getCategory()); - if (isMarker) - isMarker = _babygrid.setMarker(false); + _babygrid.setText(cs_index, 1, cshortcuts[i].getName()); + if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance + _babygrid.setText(cs_index, 2, cshortcuts[i].toString().c_str()); + _babygrid.setText(cs_index, 3, cshortcuts[i].getCategory()); + if (isMarker) + isMarker = _babygrid.setMarker(false); + _shortcutIndex.push_back(i); + cs_index++; + } } + _babygrid.setLineColNumber(cs_index - 1 , 3); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), true); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false); @@ -220,18 +272,25 @@ void ShortcutMapper::fillOutBabyGrid() case STATE_MACRO: { vector & cshortcuts = nppParam->getMacroList(); + cs_index = 1; for(size_t i = 0; i < nbItems; ++i) { - if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) - isMarker = _babygrid.setMarker(true); + if (isFilterValid(cshortcuts[i])) + { + if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) + isMarker = _babygrid.setMarker(true); - _babygrid.setText(i+1, 1, cshortcuts[i].getName()); - if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance - _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); - - if (isMarker) - isMarker = _babygrid.setMarker(false); + _babygrid.setText(cs_index, 1, cshortcuts[i].getName()); + if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance + _babygrid.setText(cs_index, 2, cshortcuts[i].toString().c_str()); + + if (isMarker) + isMarker = _babygrid.setMarker(false); + _shortcutIndex.push_back(i); + cs_index++; + } } + _babygrid.setLineColNumber(cs_index - 1 , 2); bool shouldBeEnabled = nbItems > 0; ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled); @@ -242,18 +301,26 @@ void ShortcutMapper::fillOutBabyGrid() case STATE_USER: { vector & cshortcuts = nppParam->getUserCommandList(); + cs_index = 1; for(size_t i = 0; i < nbItems; ++i) { - if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) - isMarker = _babygrid.setMarker(true); + if (isFilterValid(cshortcuts[i])) + { + if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) + isMarker = _babygrid.setMarker(true); - _babygrid.setText(i+1, 1, cshortcuts[i].getName()); - if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance - _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); - - if (isMarker) - isMarker = _babygrid.setMarker(false); + _babygrid.setText(cs_index, 1, cshortcuts[i].getName()); + if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance + _babygrid.setText(cs_index, 2, cshortcuts[i].toString().c_str()); + + if (isMarker) + isMarker = _babygrid.setMarker(false); + _shortcutIndex.push_back(i); + cs_index++; + } } + _babygrid.setLineColNumber(cs_index - 1 , 2); + bool shouldBeEnabled = nbItems > 0; ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled); @@ -264,19 +331,26 @@ void ShortcutMapper::fillOutBabyGrid() case STATE_PLUGIN: { vector & cshortcuts = nppParam->getPluginCommandList(); + cs_index = 1; for(size_t i = 0; i < nbItems; ++i) { - if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) - isMarker = _babygrid.setMarker(true); + if (isFilterValid(cshortcuts[i])) + { + if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i)) + isMarker = _babygrid.setMarker(true); - _babygrid.setText(i+1, 1, cshortcuts[i].getName()); - if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance - _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); - _babygrid.setText(i+1, 3, cshortcuts[i].getModuleName()); - - if (isMarker) - isMarker = _babygrid.setMarker(false); + _babygrid.setText(cs_index, 1, cshortcuts[i].getName()); + if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance + _babygrid.setText(cs_index, 2, cshortcuts[i].toString().c_str()); + _babygrid.setText(cs_index, 3, cshortcuts[i].getModuleName()); + + if (isMarker) + isMarker = _babygrid.setMarker(false); + _shortcutIndex.push_back(i); + cs_index++; + } } + _babygrid.setLineColNumber(cs_index - 1 , 3); bool shouldBeEnabled = nbItems > 0; ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled); @@ -287,28 +361,35 @@ void ShortcutMapper::fillOutBabyGrid() case STATE_SCINTILLA: { vector & cshortcuts = nppParam->getScintillaKeyList(); + cs_index=1; for(size_t i = 0; i < nbItems; ++i) { - if (cshortcuts[i].isEnabled()) + if (isFilterValid(cshortcuts[i])) { - size_t sciCombos = cshortcuts[i].getSize(); - for (size_t sciIndex = 0; sciIndex < sciCombos; ++sciIndex) + if (cshortcuts[i].isEnabled()) { - if (findKeyConflicts(nullptr, cshortcuts[i].getKeyComboByIndex(sciIndex), i)) + size_t sciCombos = cshortcuts[i].getSize(); + for (size_t sciIndex = 0; sciIndex < sciCombos; ++sciIndex) { - isMarker = _babygrid.setMarker(true); - break; + if (findKeyConflicts(nullptr, cshortcuts[i].getKeyComboByIndex(sciIndex), i)) + { + isMarker = _babygrid.setMarker(true); + break; + } } } + + _babygrid.setText(cs_index, 1, cshortcuts[i].getName()); + if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance + _babygrid.setText(cs_index, 2, cshortcuts[i].toString().c_str()); + + if (isMarker) + isMarker = _babygrid.setMarker(false); + _shortcutIndex.push_back(i); + cs_index++; } - - _babygrid.setText(i+1, 1, cshortcuts[i].getName()); - if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance - _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); - - if (isMarker) - isMarker = _babygrid.setMarker(false); } + _babygrid.setLineColNumber(cs_index - 1 , 2); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), false); ::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false); @@ -382,12 +463,22 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM ::MapWindowPoints(NULL, _hSelf, (LPPOINT)&rect, 2); ::SetWindowPos(moveHwnd, NULL, rect.left + addWidth, rect.top + addHeight, 0, 0, SWP_NOSIZE | flags); } - // Move and resize IDC_BABYGRID_INFO + HWND moveHwnd = ::GetDlgItem(_hSelf, IDC_BABYGRID_STATIC); + ::GetWindowRect(moveHwnd, &rect); + ::MapWindowPoints(NULL, _hSelf, (LPPOINT)&rect, 2); + ::SetWindowPos(moveHwnd, NULL, rect.left, rect.top + addHeight, 0, 0, SWP_NOSIZE | flags); + + // Move and resize IDC_BABYGRID_INFO and IDC_BABYGRID_FILTER // Move the Y position, Resize the width HWND resizeHwnd = ::GetDlgItem(_hSelf, IDC_BABYGRID_INFO); ::GetWindowRect(resizeHwnd, &rect); ::MapWindowPoints(NULL, _hSelf, (LPPOINT)&rect, 2); ::SetWindowPos(resizeHwnd, NULL, rect.left, rect.top + addHeight, rect.right - rect.left + addWidth, rect.bottom - rect.top, flags); + + resizeHwnd = ::GetDlgItem(_hSelf, IDC_BABYGRID_FILTER); + ::GetWindowRect(resizeHwnd, &rect); + ::MapWindowPoints(NULL, _hSelf, (LPPOINT)&rect, 2); + ::SetWindowPos(resizeHwnd, NULL, rect.left, rect.top + addHeight, rect.right - rect.left + addWidth, rect.bottom - rect.top, flags); break; } @@ -473,6 +564,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM NppParameters *nppParam = NppParameters::getInstance(); int row = _babygrid.getSelectedRow(); + size_t shortcutIndex = _shortcutIndex[row-1]; bool isModified = false; switch(_currentState) @@ -481,11 +573,11 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get CommandShortcut corresponding to row vector & shortcuts = nppParam->getUserShortcuts(); - CommandShortcut csc = shortcuts[row - 1]; + CommandShortcut csc = shortcuts[shortcutIndex]; csc.clear(); - shortcuts[row - 1] = csc; + shortcuts[shortcutIndex] = csc; //shortcut was altered - nppParam->addUserModifiedIndex(row - 1); + nppParam->addUserModifiedIndex(shortcutIndex); //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -504,9 +596,9 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get MacroShortcut corresponding to row vector & shortcuts = nppParam->getMacroList(); - MacroShortcut msc = shortcuts[row - 1]; + MacroShortcut msc = shortcuts[shortcutIndex]; msc.clear(); - shortcuts[row - 1] = msc; + shortcuts[shortcutIndex] = msc; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); _lastCursorRow[_currentState] = _babygrid.getSelectedRow(); @@ -524,11 +616,11 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get UserCommand corresponding to row vector & shortcuts = nppParam->getUserCommandList(); - UserCommand ucmd = shortcuts[row - 1]; + UserCommand ucmd = shortcuts[shortcutIndex]; ucmd.clear(); //shortcut was altered - shortcuts[row - 1] = ucmd; + shortcuts[shortcutIndex] = ucmd; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -547,11 +639,11 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get PluginCmdShortcut corresponding to row vector & shortcuts = nppParam->getPluginCommandList(); - PluginCmdShortcut pcsc = shortcuts[row - 1]; + PluginCmdShortcut pcsc = shortcuts[shortcutIndex]; pcsc.clear(); //shortcut was altered - nppParam->addPluginModifiedIndex(row - 1); - shortcuts[row - 1] = pcsc; + nppParam->addPluginModifiedIndex(shortcutIndex); + shortcuts[shortcutIndex] = pcsc; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -595,6 +687,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM NppParameters *nppParam = NppParameters::getInstance(); int row = _babygrid.getSelectedRow(); + size_t shortcutIndex = _shortcutIndex[row-1]; bool isModified = false; switch(_currentState) @@ -603,13 +696,13 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get CommandShortcut corresponding to row vector & shortcuts = nppParam->getUserShortcuts(); - CommandShortcut csc = shortcuts[row - 1], prevcsc = shortcuts[row - 1]; + CommandShortcut csc = shortcuts[shortcutIndex], prevcsc = shortcuts[shortcutIndex]; csc.init(_hInst, _hSelf); if (csc.doDialog() != -1 && prevcsc != csc) { //shortcut was altered - nppParam->addUserModifiedIndex(row - 1); - shortcuts[row - 1] = csc; + nppParam->addUserModifiedIndex(shortcutIndex); + shortcuts[shortcutIndex] = csc; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -629,12 +722,12 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get MacroShortcut corresponding to row vector & shortcuts = nppParam->getMacroList(); - MacroShortcut msc = shortcuts[row - 1], prevmsc = shortcuts[row - 1]; + MacroShortcut msc = shortcuts[shortcutIndex], prevmsc = shortcuts[shortcutIndex]; msc.init(_hInst, _hSelf); if (msc.doDialog() != -1 && prevmsc != msc) { //shortcut was altered - shortcuts[row - 1] = msc; + shortcuts[shortcutIndex] = msc; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -654,13 +747,13 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get UserCommand corresponding to row vector & shortcuts = nppParam->getUserCommandList(); - UserCommand ucmd = shortcuts[row - 1]; + UserCommand ucmd = shortcuts[shortcutIndex]; ucmd.init(_hInst, _hSelf); UserCommand prevucmd = ucmd; if (ucmd.doDialog() != -1 && prevucmd != ucmd) { //shortcut was altered - shortcuts[row - 1] = ucmd; + shortcuts[shortcutIndex] = ucmd; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -680,14 +773,14 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get PluginCmdShortcut corresponding to row vector & shortcuts = nppParam->getPluginCommandList(); - PluginCmdShortcut pcsc = shortcuts[row - 1]; + PluginCmdShortcut pcsc = shortcuts[shortcutIndex]; pcsc.init(_hInst, _hSelf); PluginCmdShortcut prevpcsc = pcsc; if (pcsc.doDialog() != -1 && prevpcsc != pcsc) { //shortcut was altered - nppParam->addPluginModifiedIndex(row - 1); - shortcuts[row - 1] = pcsc; + nppParam->addPluginModifiedIndex(shortcutIndex); + shortcuts[shortcutIndex] = pcsc; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -715,13 +808,13 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM { //Get ScintillaKeyMap corresponding to row vector & shortcuts = nppParam->getScintillaKeyList(); - ScintillaKeyMap skm = shortcuts[row - 1], prevskm = shortcuts[row - 1]; + ScintillaKeyMap skm = shortcuts[shortcutIndex], prevskm = shortcuts[shortcutIndex]; skm.init(_hInst, _hSelf); if (skm.doDialog() != -1 && prevskm != skm) { //shortcut was altered - nppParam->addScintillaModifiedIndex(row - 1); - shortcuts[row - 1] = skm; + nppParam->addScintillaModifiedIndex((int)shortcutIndex); + shortcuts[shortcutIndex] = skm; //save the current view _lastHomeRow[_currentState] = _babygrid.getHomeRow(); @@ -760,7 +853,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM if (res == IDOK) { const int row = _babygrid.getSelectedRow(); - int shortcutIndex = row-1; + size_t shortcutIndex = _shortcutIndex[row-1]; DWORD cmdID = 0; // Menu data @@ -994,6 +1087,14 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM } } } + case IDC_BABYGRID_FILTER: + { + if (HIWORD(wParam) == EN_CHANGE) + { + fillOutBabyGrid(); + } + return TRUE; + } } } diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h index 7a2bf9cef..8e46887d1 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h @@ -37,7 +37,9 @@ enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTIL class ShortcutMapper : public StaticDialog { public: - ShortcutMapper() : _currentState(STATE_MENU), StaticDialog() {}; + ShortcutMapper() : _currentState(STATE_MENU), StaticDialog() { + _shortcutFilter = TEXT(""); + }; ~ShortcutMapper() {}; void init(HINSTANCE hInst, HWND parent, GridState initState = STATE_MENU) { @@ -62,6 +64,10 @@ public: bool findKeyConflicts(__inout_opt generic_string * const keyConflictLocation, const KeyCombo & itemKeyCombo, const size_t & itemIndex) const; + generic_string ShortcutMapper::getTextFromCombo(HWND hCombo); + bool ShortcutMapper::isFilterValid(Shortcut); + bool ShortcutMapper::isFilterValid(PluginCmdShortcut sc); + protected : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -74,6 +80,8 @@ private: const static int _nbTab = 5; generic_string _tabNames[_nbTab]; + generic_string _shortcutFilter; + std::vector _shortcutIndex; //save/restore the last view std::vector _lastHomeRow; diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.rc b/PowerEditor/src/WinControls/Grid/ShortcutMapper.rc old mode 100644 new mode 100755 index 25a6cb726..e8f30222c --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.rc +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.rc @@ -33,17 +33,19 @@ #define IDC_STATIC -1 #endif -IDD_SHORTCUTMAPPER_DLG DIALOGEX 0, 0, 450, 344 +IDD_SHORTCUTMAPPER_DLG DIALOGEX 0, 0, 450, 355 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_THICKFRAME //EXSTYLE WS_EX_TOOLWINDOW CAPTION "Shortcut mapper" FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1 BEGIN - CONTROL "",IDC_BABYGRID_TABBAR,"SysTabControl32",WS_TABSTOP,4,6,384,12 - DEFPUSHBUTTON "Modify",IDM_BABYGRID_MODIFY,118,319,47,14 - DEFPUSHBUTTON "Clear", IDM_BABYGRID_CLEAR,172,319,47,14 - DEFPUSHBUTTON "Delete", IDM_BABYGRID_DELETE, 226, 319, 47, 14 - DEFPUSHBUTTON "Close",IDOK,280,319,47,14 + CONTROL "",IDC_BABYGRID_TABBAR,"SysTabControl32",WS_TABSTOP,4,6,384,12 + DEFPUSHBUTTON "Modify",IDM_BABYGRID_MODIFY,118,330,47,14 + DEFPUSHBUTTON "Clear",IDM_BABYGRID_CLEAR,172,330,47,14 + DEFPUSHBUTTON "Delete",IDM_BABYGRID_DELETE,226,330,47,14 + DEFPUSHBUTTON "Close",IDOK,280,330,47,14 EDITTEXT IDC_BABYGRID_INFO,4,279,440,29,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP + RTEXT "Filter :",IDC_BABYGRID_STATIC,4,310,25,12 + EDITTEXT IDC_BABYGRID_FILTER,30,310,415,12,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER,WS_EX_STATICEDGE END diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h index 70e418b94..0637dbc1a 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h @@ -34,7 +34,9 @@ #define IDM_BABYGRID_MODIFY (IDD_SHORTCUTMAPPER_DLG + 2) #define IDM_BABYGRID_DELETE (IDD_SHORTCUTMAPPER_DLG + 3) #define IDC_BABYGRID_TABBAR (IDD_SHORTCUTMAPPER_DLG + 4) -#define IDC_BABYGRID_INFO (IDD_SHORTCUTMAPPER_DLG + 5) +#define IDC_BABYGRID_INFO (IDD_SHORTCUTMAPPER_DLG + 5) #define IDM_BABYGRID_CLEAR (IDD_SHORTCUTMAPPER_DLG + 6) +#define IDC_BABYGRID_STATIC (IDD_SHORTCUTMAPPER_DLG + 7) +#define IDC_BABYGRID_FILTER (IDD_SHORTCUTMAPPER_DLG + 8) #endif// SHORTCUTMAPPER_RC_H