本文整理汇总了C++中UserCommand::setID方法的典型用法代码示例。如果您正苦于以下问题:C++ UserCommand::setID方法的具体用法?C++ UserCommand::setID怎么用?C++ UserCommand::setID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserCommand
的用法示例。
在下文中一共展示了UserCommand::setID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_dlgProc
//.........这里部分代码省略.........
case STATE_SCINTILLA:
{
return FALSE; //this is bad
}
case STATE_MACRO:
{
vector<MacroShortcut> & theMacros = nppParam->getMacroList();
vector<MacroShortcut>::iterator it = theMacros.begin();
cmdID = theMacros[shortcutIndex].getID();
theMacros.erase(it + shortcutIndex);
//save the current view
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
_lastCursorRow[_currentState] = _babygrid.getSelectedRow();
const size_t numberRows = _babygrid.getNumberRows();
if (_lastHomeRow[_currentState] == numberRows)
--_lastHomeRow[_currentState];
if (_lastCursorRow[_currentState] == numberRows)
--_lastCursorRow[_currentState];
fillOutBabyGrid();
// preparing to remove from menu
posBase = 6;
nbElem = theMacros.size();
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
hMenu = ::GetSubMenu(m, MENUINDEX_MACRO);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
{
MacroShortcut ms = theMacros[i];
ms.setID(ms.getID() - 1); //shift all IDs
theMacros[i] = ms;
}
break;
}
case STATE_USER:
{
vector<UserCommand> & theUserCmds = nppParam->getUserCommandList();
vector<UserCommand>::iterator it = theUserCmds.begin();
cmdID = theUserCmds[shortcutIndex].getID();
theUserCmds.erase(it + shortcutIndex);
//save the current view
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
_lastCursorRow[_currentState] = _babygrid.getSelectedRow();
const size_t numberRows = _babygrid.getNumberRows();
if (_lastHomeRow[_currentState] == numberRows)
--_lastHomeRow[_currentState];
if (_lastCursorRow[_currentState] == numberRows)
--_lastCursorRow[_currentState];
fillOutBabyGrid();
// preparing to remove from menu
posBase = 2;
nbElem = theUserCmds.size();
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
hMenu = ::GetSubMenu(m, MENUINDEX_RUN);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
{
示例2: run_dlgProc
//.........这里部分代码省略.........
const int row = _babygrid.getSelectedRow();
int shortcutIndex = row-1;
DWORD cmdID = 0;
// Menu data
size_t posBase = 0;
size_t nbElem = 0;
HMENU hMenu = NULL;
int modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
switch(_currentState)
{
case STATE_MENU:
case STATE_PLUGIN:
case STATE_SCINTILLA:
{
return FALSE; //this is bad
}
case STATE_MACRO:
{
vector<MacroShortcut> & theMacros = nppParam->getMacroList();
vector<MacroShortcut>::iterator it = theMacros.begin();
cmdID = theMacros[shortcutIndex].getID();
theMacros.erase(it + shortcutIndex);
fillOutBabyGrid();
// preparing to remove from menu
posBase = 6;
nbElem = theMacros.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_MACRO);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps
{
MacroShortcut ms = theMacros[i];
ms.setID(ms.getID() - 1); //shift all IDs
theMacros[i] = ms;
}
break;
}
case STATE_USER:
{
vector<UserCommand> & theUserCmds = nppParam->getUserCommandList();
vector<UserCommand>::iterator it = theUserCmds.begin();
cmdID = theUserCmds[shortcutIndex].getID();
theUserCmds.erase(it + shortcutIndex);
fillOutBabyGrid();
// preparing to remove from menu
posBase = 2;
nbElem = theUserCmds.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps
{
UserCommand uc = theUserCmds[i];
uc.setID(uc.getID() - 1); //shift all IDs
theUserCmds[i] = uc;
}
break;
}
}
// updateShortcuts() will update all menu item - the menu items will be shifted
nppParam->getAccelerator()->updateShortcuts();
// All menu items are shifted up. So we delete the last item
::RemoveMenu(hMenu, posBase + nbElem - 1, MF_BYPOSITION);
示例3: run_dlgProc
//.........这里部分代码省略.........
return TRUE;
}
case IDC_SHORTCUT_DELETE :
{
NppParameters *nppParam = NppParameters::getInstance();
int index,selected_row=getselectedrow();
TCHAR str[255]={0},msg[255]={0};
if(selected_row<0)
break;
index=getitemindex(selected_row);
ListView_GetItemText(hlistview,selected_row,1,str,sizeof(str)/sizeof(TCHAR));
_sntprintf_s(msg,sizeof(msg)/sizeof(TCHAR),_TRUNCATE,
TEXT("%s\r\n%s"),
TEXT("Are you sure you want to delete this shortcut?"),
str);
if (::MessageBox(_hSelf, msg, TEXT("Are you sure?"), MB_OKCANCEL) == IDOK)
{
int shortcutIndex = index;
DWORD cmdID = 0;
// Menu data
size_t posBase = 0;
size_t nbElem = 0;
HMENU hMenu = NULL;
int modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
switch(_currentState)
{
case STATE_MENU:
case STATE_PLUGIN:
case STATE_SCINTILLA:
{
return FALSE; //this is bad
}
case STATE_MACRO:
{
vector<MacroShortcut> & theMacros = nppParam->getMacroList();
vector<MacroShortcut>::iterator it = theMacros.begin();
cmdID = theMacros[shortcutIndex].getID();
theMacros.erase(it + shortcutIndex);
populateShortCuts();
// preparing to remove from menu
posBase = 6;
nbElem = theMacros.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_MACRO);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps
{
MacroShortcut ms = theMacros[i];
ms.setID(ms.getID() - 1); //shift all IDs
theMacros[i] = ms;
}
break;
}
case STATE_USER:
{
vector<UserCommand> & theUserCmds = nppParam->getUserCommandList();
vector<UserCommand>::iterator it = theUserCmds.begin();
cmdID = theUserCmds[shortcutIndex].getID();
theUserCmds.erase(it + shortcutIndex);
populateShortCuts();
// preparing to remove from menu
posBase = 2;
nbElem = theUserCmds.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps
{
UserCommand uc = theUserCmds[i];
uc.setID(uc.getID() - 1); //shift all IDs
theUserCmds[i] = uc;
}
break;
}
}
// updateShortcuts() will update all menu item - the menu items will be shifted
nppParam->getAccelerator()->updateShortcuts();
// All menu items are shifted up. So we delete the last item
::RemoveMenu(hMenu, posBase + nbElem, MF_BYPOSITION);
if (nbElem == 0)
{
::RemoveMenu(hMenu, modifCmd, MF_BYCOMMAND);
//remove separator
::RemoveMenu(hMenu, posBase-1, MF_BYPOSITION);
::RemoveMenu(hMenu, posBase-1, MF_BYPOSITION);
}
}
return TRUE;
}
}
}
default:
return FALSE;
}
return FALSE;
}