mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-21 12:54:42 +02:00
parent
b47de8048d
commit
360d45db1a
@ -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)
|
||||
{
|
||||
|
@ -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<generic_string> stringSplit(const generic_string& input, const generic_string& delimiter);
|
||||
generic_string stringJoin(const std::vector<generic_string>& strings, const generic_string& separator);
|
||||
|
@ -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<LPARAM>(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<CommandShortcut> & cshortcuts = nppParam->getUserShortcuts();
|
||||
cs_index = 1;
|
||||
for (size_t i = 0; i < nbItems; ++i)
|
||||
{
|
||||
if (isFilterValid(cshortcuts[i]))
|
||||
{
|
||||
if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i))
|
||||
isMarker = _babygrid.setMarker(true);
|
||||
|
||||
_babygrid.setText(i + 1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(cs_index, 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());
|
||||
_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<MacroShortcut> & cshortcuts = nppParam->getMacroList();
|
||||
cs_index = 1;
|
||||
for(size_t i = 0; i < nbItems; ++i)
|
||||
{
|
||||
if (isFilterValid(cshortcuts[i]))
|
||||
{
|
||||
if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i))
|
||||
isMarker = _babygrid.setMarker(true);
|
||||
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(cs_index, 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(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<UserCommand> & cshortcuts = nppParam->getUserCommandList();
|
||||
cs_index = 1;
|
||||
for(size_t i = 0; i < nbItems; ++i)
|
||||
{
|
||||
if (isFilterValid(cshortcuts[i]))
|
||||
{
|
||||
if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i))
|
||||
isMarker = _babygrid.setMarker(true);
|
||||
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(cs_index, 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(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<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList();
|
||||
cs_index = 1;
|
||||
for(size_t i = 0; i < nbItems; ++i)
|
||||
{
|
||||
if (isFilterValid(cshortcuts[i]))
|
||||
{
|
||||
if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i))
|
||||
isMarker = _babygrid.setMarker(true);
|
||||
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(cs_index, 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());
|
||||
_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,7 +361,10 @@ void ShortcutMapper::fillOutBabyGrid()
|
||||
case STATE_SCINTILLA:
|
||||
{
|
||||
vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList();
|
||||
cs_index=1;
|
||||
for(size_t i = 0; i < nbItems; ++i)
|
||||
{
|
||||
if (isFilterValid(cshortcuts[i]))
|
||||
{
|
||||
if (cshortcuts[i].isEnabled())
|
||||
{
|
||||
@ -302,13 +379,17 @@ void ShortcutMapper::fillOutBabyGrid()
|
||||
}
|
||||
}
|
||||
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(cs_index, 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(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);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), false);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
||||
@ -382,13 +463,23 @@ 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;
|
||||
}
|
||||
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<CommandShortcut> & 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<MacroShortcut> & 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<UserCommand> & 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<PluginCmdShortcut> & 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<CommandShortcut> & 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<MacroShortcut> & 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<UserCommand> & 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<PluginCmdShortcut> & 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<ScintillaKeyMap> & 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<size_t> _shortcutIndex;
|
||||
|
||||
//save/restore the last view
|
||||
std::vector<size_t> _lastHomeRow;
|
||||
|
12
PowerEditor/src/WinControls/Grid/ShortcutMapper.rc
Normal file → Executable file
12
PowerEditor/src/WinControls/Grid/ShortcutMapper.rc
Normal file → Executable file
@ -33,7 +33,7 @@
|
||||
#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
|
||||
@ -41,9 +41,11 @@ 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
|
||||
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
|
||||
|
@ -36,5 +36,7 @@
|
||||
#define IDC_BABYGRID_TABBAR (IDD_SHORTCUTMAPPER_DLG + 4)
|
||||
#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
|
||||
|
Loading…
x
Reference in New Issue
Block a user