本文整理汇总了C++中CommandManager类的典型用法代码示例。如果您正苦于以下问题:C++ CommandManager类的具体用法?C++ CommandManager怎么用?C++ CommandManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommandManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetActiveProject
void EditToolBar::ForAllButtons(int Action)
{
AudacityProject *p;
CommandManager* cm = nullptr;
if( Action & ETBActEnableDisable ){
p = GetActiveProject();
if (!p) return;
cm = p->GetCommandManager();
if (!cm) return;
#ifdef OPTION_SYNC_LOCK_BUTTON
bool bSyncLockTracks;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false);
if (bSyncLockTracks)
mButtons[ETBSyncLockID]->PushDown();
else
mButtons[ETBSyncLockID]->PopUp();
#endif
}
for (const auto &entry : EditToolbarButtonList) {
#if wxUSE_TOOLTIPS
if( Action & ETBActTooltips ){
TranslatedInternalString command{
entry.commandName, wxGetTranslation(entry.untranslatedLabel) };
ToolBar::SetButtonToolTip( *mButtons[entry.tool], &command, 1u );
}
#endif
if (cm) {
mButtons[entry.tool]->SetEnabled(cm->GetEnabled(entry.commandName));
}
}
}
示例2: DBG
//==============================================================================
HostFilterComponent::~HostFilterComponent()
{
DBG ("HostFilterComponent::~HostFilterComponent");
knownPluginList.removeChangeListener (this);
// register as listener to transport
getFilter()->getTransport()->removeChangeListener (this);
// deregister ouselves from the plugin (in this case the host)
getFilter()->removeChangeListener (this);
// getFilter()->removeListenerToParameters (this);
// save toolbar layout
Config::getInstance()->toolbarSet = toolbar->toString ();
// close and free editor window
closePluginEditorWindows ();
// clear all childrens and objects
deleteAndZero (navigator);
deleteAndZero (toolbar);
deleteAndZero (factory);
deleteAndZero (main);
deleteAndZero (browser);
deleteAndZero (verticalDividerBar);
deleteAndZero (horizontalDividerBar);
deleteAndZero (tooltipWindow);
deleteAndZero (resizer);
// clear command manager commands... save keymappings before this point !
CommandManager* commandManager = CommandManager::getInstance();
commandManager->setFirstCommandTarget (0);
commandManager->clearCommands ();
}
示例3: Command
/**
* Represents a BIOSManager.
*/
BIOSManager::BIOSManager(){
CommandManager<int>* cmdManager = new CommandManager<int>();
this->fileName = "BIOS Infos.txt";
this->inFileName = "---BIOS INFOs---";
this->onDifferenceName = "BIOSes";
this->numberOfInfos = 6;
this->numberOfCommands = 6;
this->numberOfDevicesCommand = new Command();
this->checkCommand = new Command();
numberOfDevicesCommand->setCommand("dmidecode --type BIOS | grep -i 'BIOS Information' | wc -l");
numberOfDevicesCommand->setFilter("");
this->numberOfDevices = cmdManager->getInfoFromCommand(this->numberOfDevicesCommand);
this->devices = new HWDevice*[this->numberOfDevices];
this->commands = new Command*[this->numberOfCommands];
this->deviceCreator = new BiosCreator();
}
示例4:
void Commands::PasteKeywordsCommandResult::afterExecCallback(const Commands::ICommandManager *commandManagerInterface) const {
CommandManager *commandManager = (CommandManager*)commandManagerInterface;
Models::ArtItemsModel *artItemsModel = commandManager->getArtItemsModel();
artItemsModel->updateItems(m_IndicesToUpdate,
QVector<int>() <<
Models::ArtItemsModel::IsModifiedRole <<
Models::ArtItemsModel::KeywordsCountRole);
}
示例5: Apply
bool ExecMenuCommand::Apply(CommandExecutionContext context)
{
CommandManager *cmdManager = context.GetProject()->GetCommandManager();
wxString cmdName = GetString(wxT("CommandName"));
auto cmdFlags = AlwaysEnabledFlag; // TODO ?
auto cmdMask = AlwaysEnabledFlag;
return cmdManager->HandleTextualCommand(cmdName, cmdFlags, cmdMask);
}
示例6: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
shared_ptr<LightOnCommand> lightOncmd(new LightOnCommand());
shared_ptr<LightOffCommand> lightOffcmd(new LightOffCommand());
CommandManager cmdManager;
cmdManager.addCommand(lightOncmd);
cmdManager.addCommand(lightOffcmd);
cmdManager.execute();
return 0;
}
示例7: EnablePauseCommand
void ControlToolBar::EnablePauseCommand(bool bEnable)
{
// Enable/disable the "P" key command.
// GetActiveProject() won't work for all callers, e.g., MakeButton(), because it hasn't finished initializing.
AudacityProject* pProj = (AudacityProject*)GetParent();
if (pProj)
{
CommandManager* pCmdMgr = pProj->GetCommandManager();
if (pCmdMgr)
pCmdMgr->Enable(wxT("Pause"), bEnable);
}
}
示例8: cmdmanager_hide_and_delete
/**
* Hide and delete resource function pointer.
* This function should notify its Items to hide as well.
*
* @param cmPtr pointer to menu native peer
* @param onExit true if this is called during VM exit.
* All native resource must be deleted in this case.
* @return status of this call
*/
extern "C" MidpError
cmdmanager_hide_and_delete(MidpFrame* cmPtr, jboolean onExit) {
CommandManager *cmdMgr = (CommandManager *)cmPtr->widgetPtr;
if (onExit) {
// Delete Command Manager and its children popup menus
delete cmdMgr;
} else {
// Hide any popup menu
cmdMgr->dismissMenu();
}
return KNI_OK;
}
示例9: FactoryManager
Manager::Manager(int argc, const char * argv[]) {
//gather the factories necessary for constructing commands
FactoryManager* fm = new FactoryManager();
//Parse and construct commands
CommandManager* cm = new CommandManager(fm->getFactories());
Parser* p = new Parser();
myCommandsToExecute = cm->getCommandsToExecute(p->buildCommandMap(argc, argv));
//Define input and outputPaths
//these MUST be called after p->buildCommandMap
myImageIn = p->getInputPath();
myImageOut = p->getOutputPath();
};
示例10: finally
void EditToolBar::OnButton(wxCommandEvent &event)
{
int id = event.GetId()-first_ETB_ID;
// Be sure the pop-up happens even if there are exceptions, except for buttons which toggle.
auto cleanup = finally( [&] { mButtons[id]->InteractionOver();});
AudacityProject *p = GetActiveProject();
if (!p) return;
CommandManager* cm = p->GetCommandManager();
if (!cm) return;
auto flags = GetMenuManager(*p).GetUpdateFlags(*p);
const CommandContext context( *GetActiveProject() );
cm->HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified);
}
示例11: SetFocus
void LogTextControl::OnContextMenu(wxContextMenuEvent& event)
{
SetFocus();
CommandManager cm;
wxMenu m;
m.Append(wxID_COPY, cm.getPopupMenuItemText(_("&Copy"), wxID_COPY));
m.AppendSeparator();
m.Append(wxID_DELETE,
cm.getPopupMenuItemText(_("Clear al&l"), wxID_DELETE));
m.AppendSeparator();
m.Append(wxID_SELECTALL,
cm.getPopupMenuItemText(_("Select &all"), wxID_SELECTALL));
PopupMenu(&m, calcContextMenuPosition(event.GetPosition(), this));
}
示例12: getSelection
void TSelectionHandle::setSelection(TSelection *selection)
{
if (getSelection() == selection)
return;
TSelection *oldSelection = getSelection();
if (oldSelection) {
oldSelection->selectNone();
// disable selection related commands
CommandManager *commandManager = CommandManager::instance();
int i;
for (i = 0; i < (int)m_enabledCommandIds.size(); i++)
commandManager->setHandler(m_enabledCommandIds[i].c_str(), 0);
m_enabledCommandIds.clear();
}
m_selectionStack.back() = selection;
if (selection)
selection->enableCommands();
emit selectionSwitched(oldSelection, selection);
}
示例13: GetBool
bool GetAllMenuCommands::Apply(CommandExecutionContext context)
{
bool showStatus = GetBool(wxT("ShowStatus"));
wxArrayString names;
CommandManager *cmdManager = context.GetProject()->GetCommandManager();
cmdManager->GetAllCommandNames(names, false);
wxArrayString::iterator iter;
for (iter = names.begin(); iter != names.end(); ++iter)
{
wxString name = *iter;
wxString out = name;
if (showStatus)
{
out += wxT("\t");
out += cmdManager->GetEnabled(name) ? wxT("Enabled") : wxT("Disabled");
}
Status(out);
}
return true;
}
示例14: ModuleDispatch
// ModuleDispatch
// is called by Audacity to initialize/terminmate the module,
// and ask if it has anything for the menus.
int ModuleDispatch(ModuleDispatchTypes type){
switch (type){
case AppInitialized:{
wxASSERT(gBench == NULL);
gBench = new NyqBench(NULL);
}
break;
case AppQuiting: {
wxASSERT(gBench != NULL);
if (gBench) {
delete gBench;
gBench = NULL;
}
}
break;
case ProjectInitialized:
case MenusRebuilt: {
AudacityProject *p = GetActiveProject();
wxASSERT(p != NULL);
CommandManager *c = p->GetCommandManager();
wxASSERT(c != NULL);
wxMenuBar * pBar = p->GetMenuBar();
wxASSERT(pBar != NULL );
wxMenu * pMenu = pBar->GetMenu( 2 ); // Menu 2 is the View Menu.
wxASSERT( pMenu != NULL );
c->SetToMenu( pMenu );
c->AddSeparator();
// c->BeginMenu(_("T&ools"));
c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("NyqBench"),
_("&Nyquist Workbench..."),
new ModNyqBenchCommandFunctor());
}
break;
default:
break;
}
return 1;
}
示例15: GetActiveProject
void ControlToolBar::RegenerateToolsTooltips()
{
#if wxUSE_TOOLTIPS
for (long iWinID = ID_PLAY_BUTTON; iWinID < BUTTON_COUNT; iWinID++)
{
wxWindow* pCtrl = this->FindWindow(iWinID);
wxString strToolTip = pCtrl->GetLabel();
AudacityProject* pProj = GetActiveProject();
CommandManager* pCmdMgr = (pProj) ? pProj->GetCommandManager() : NULL;
if (pCmdMgr)
{
wxString strKey(wxT(" ("));
switch (iWinID)
{
case ID_PLAY_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("Play"));
strKey += _(") / Loop Play (");
strKey += pCmdMgr->GetKeyFromName(wxT("PlayLooped"));
break;
case ID_RECORD_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("Record"));
strKey += _(") / Append Record (");
strKey += pCmdMgr->GetKeyFromName(wxT("RecordAppend"));
break;
case ID_PAUSE_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("Pause"));
break;
case ID_STOP_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("Stop"));
break;
case ID_FF_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("SkipEnd"));
break;
case ID_REW_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("SkipStart"));
break;
}
strKey += wxT(")");
strToolTip += strKey;
}
pCtrl->SetToolTip(strToolTip);
}
#endif
}