本文整理汇总了C++中ApplicationCommandInfo::setActive方法的典型用法代码示例。如果您正苦于以下问题:C++ ApplicationCommandInfo::setActive方法的具体用法?C++ ApplicationCommandInfo::setActive怎么用?C++ ApplicationCommandInfo::setActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationCommandInfo
的用法示例。
在下文中一共展示了ApplicationCommandInfo::setActive方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCommandInfo
void MainWindow::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
switch (commandID)
{
case CommandIDs::closeWindow:
result.setInfo ("Close Window", "Closes the current window", CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('w', ModifierKeys::commandModifier, 0));
break;
case CommandIDs::goToPreviousWindow:
result.setInfo ("Previous Window", "Activates the previous window", CommandCategories::general, 0);
result.setActive (ProjucerApplication::getApp().mainWindowList.windows.size() > 1);
result.defaultKeypresses.add (KeyPress (KeyPress::tabKey, ModifierKeys::shiftModifier | ModifierKeys::ctrlModifier, 0));
break;
case CommandIDs::goToNextWindow:
result.setInfo ("Next Window", "Activates the next window", CommandCategories::general, 0);
result.setActive (ProjucerApplication::getApp().mainWindowList.windows.size() > 1);
result.defaultKeypresses.add (KeyPress (KeyPress::tabKey, ModifierKeys::ctrlModifier, 0));
break;
default:
break;
}
}
示例2: getCommandInfo
void ProjucerApplication::getCommandInfo (CommandID commandID, ApplicationCommandInfo& result)
{
switch (commandID)
{
case CommandIDs::newProject:
result.setInfo ("New Project...", "Creates a new Jucer project", CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('n', ModifierKeys::commandModifier, 0));
break;
case CommandIDs::open:
result.setInfo ("Open...", "Opens a Jucer project", CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('o', ModifierKeys::commandModifier, 0));
break;
case CommandIDs::showGlobalPreferences:
result.setInfo ("Preferences...", "Shows the preferences window.", CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress (',', ModifierKeys::commandModifier, 0));
break;
case CommandIDs::closeAllDocuments:
result.setInfo ("Close All Documents", "Closes all open documents", CommandCategories::general, 0);
result.setActive (openDocumentManager.getNumOpenDocuments() > 0);
break;
case CommandIDs::saveAll:
result.setInfo ("Save All", "Saves all open documents", CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::altModifier, 0));
break;
case CommandIDs::showUTF8Tool:
result.setInfo ("UTF-8 String-Literal Helper", "Shows the UTF-8 string literal utility", CommandCategories::general, 0);
break;
case CommandIDs::showSVGPathTool:
result.setInfo ("SVG Path Helper", "Shows the SVG->Path data conversion utility", CommandCategories::general, 0);
break;
case CommandIDs::loginLogout:
result.setInfo (ProjucerLicenses::getInstance()->isLoggedIn()
? String ("Sign out ") + ProjucerLicenses::getInstance()->getLoginName()
: String ("Sign in..."),
"Log out of your JUCE account", CommandCategories::general, 0);
result.setActive (ProjucerLicenses::getInstance()->isDLLPresent());
break;
default:
JUCEApplication::getCommandInfo (commandID, result);
break;
}
}
示例3: getCommandInfo
void CodeEditorComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
const bool anythingSelected = isHighlightActive();
switch (commandID)
{
case StandardApplicationCommandIDs::cut:
result.setInfo (TRANS ("Cut"), TRANS ("Copies the currently selected text to the clipboard and deletes it."), "Editing", 0);
result.setActive (anythingSelected);
result.defaultKeypresses.add (KeyPress ('x', ModifierKeys::commandModifier, 0));
break;
case StandardApplicationCommandIDs::copy:
result.setInfo (TRANS ("Copy"), TRANS ("Copies the currently selected text to the clipboard."), "Editing", 0);
result.setActive (anythingSelected);
result.defaultKeypresses.add (KeyPress ('c', ModifierKeys::commandModifier, 0));
break;
case StandardApplicationCommandIDs::paste:
result.setInfo (TRANS ("Paste"), TRANS ("Inserts text from the clipboard."), "Editing", 0);
result.defaultKeypresses.add (KeyPress ('v', ModifierKeys::commandModifier, 0));
break;
case StandardApplicationCommandIDs::del:
result.setInfo (TRANS ("Delete"), TRANS ("Deletes any selected text."), "Editing", 0);
result.setActive (anythingSelected);
break;
case StandardApplicationCommandIDs::selectAll:
result.setInfo (TRANS ("Select All"), TRANS ("Selects all the text in the editor."), "Editing", 0);
result.defaultKeypresses.add (KeyPress ('a', ModifierKeys::commandModifier, 0));
break;
case StandardApplicationCommandIDs::undo:
result.setInfo (TRANS ("Undo"), TRANS ("Undo"), "Editing", 0);
result.defaultKeypresses.add (KeyPress ('z', ModifierKeys::commandModifier, 0));
result.setActive (document.getUndoManager().canUndo());
break;
case StandardApplicationCommandIDs::redo:
result.setInfo (TRANS ("Redo"), TRANS ("Redo"), "Editing", 0);
result.defaultKeypresses.add (KeyPress ('z', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
result.setActive (document.getUndoManager().canRedo());
break;
default:
break;
}
}
示例4: getCommandInfo
void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) override
{
const String fileCategory ("File");
switch (commandID)
{
case MainWindow::newProject:
result.setInfo ("New", "Clears the current project for a new one", fileCategory, 0);
result.addDefaultKeypress ('N', ModifierKeys::commandModifier);
result.setActive (true);
break;
case MainWindow::openProject:
result.setInfo ("Open", "Open a saved project file", fileCategory, 0);
result.addDefaultKeypress ('O', ModifierKeys::commandModifier);
result.setActive (true);
break;
case MainWindow::saveProject:
result.setInfo ("Save", "Save a project or overwrite a current one", fileCategory, 0);
result.addDefaultKeypress ('S', ModifierKeys::commandModifier);
result.setActive (main->hasOpenProject());
break;
case MainWindow::saveAsProject:
result.setInfo ("Save As", "Save a project in a new file", fileCategory, 0);
result.setActive (true);
break;
case MainWindow::showPreferences:
result.setInfo ("Preferences", "Open preferences video", fileCategory, 0);
result.setActive (true);
break;
default:
break;
}
}
示例5: getCommandInfo
void UIComponent::getCommandInfo(CommandID commandID, ApplicationCommandInfo& result)
{
bool acquisitionStarted = getAudioComponent()->callbacksAreActive();
switch (commandID)
{
case openConfiguration:
result.setInfo("Open...", "Load a saved processor graph.", "General", 0);
result.addDefaultKeypress('O', ModifierKeys::commandModifier);
result.setActive(!acquisitionStarted);
break;
case saveConfiguration:
result.setInfo("Save", "Save the current processor graph.", "General", 0);
result.addDefaultKeypress('S', ModifierKeys::commandModifier);
break;
case saveConfigurationAs:
result.setInfo("Save as...", "Save the current processor graph with a new name.", "General", 0);
result.addDefaultKeypress('S', ModifierKeys::commandModifier | ModifierKeys::shiftModifier);
break;
case reloadOnStartup:
result.setInfo("Reload on startup", "Load the last used configuration on startup.", "General", 0);
result.setActive(!acquisitionStarted);
result.setTicked(mainWindow->shouldReloadOnStartup);
break;
case undo:
result.setInfo("Undo", "Undo the last action.", "General", 0);
result.addDefaultKeypress('Z', ModifierKeys::commandModifier);
result.setActive(false);
break;
case redo:
result.setInfo("Redo", "Undo the last action.", "General", 0);
result.addDefaultKeypress('Y', ModifierKeys::commandModifier);
result.setActive(false);
break;
case copySignalChain:
result.setInfo("Copy", "Copy a portion of the signal chain.", "General", 0);
result.addDefaultKeypress('C', ModifierKeys::commandModifier);
result.setActive(false);
break;
case pasteSignalChain:
result.setInfo("Paste", "Paste a portion of the signal chain.", "General", 0);
result.addDefaultKeypress('V', ModifierKeys::commandModifier);
result.setActive(false);
break;
case clearSignalChain:
result.setInfo("Clear signal chain", "Clear the current signal chain.", "General", 0);
result.addDefaultKeypress(KeyPress::backspaceKey, ModifierKeys::commandModifier);
result.setActive(!getEditorViewport()->isSignalChainEmpty() && !acquisitionStarted);
break;
case toggleProcessorList:
result.setInfo("Processor List", "Show/hide Processor List.", "General", 0);
result.addDefaultKeypress('P', ModifierKeys::shiftModifier);
result.setTicked(processorList->isOpen());
break;
case toggleSignalChain:
result.setInfo("Signal Chain", "Show/hide Signal Chain.", "General", 0);
result.addDefaultKeypress('S', ModifierKeys::shiftModifier);
result.setTicked(editorViewportButton->isOpen());
break;
case toggleFileInfo:
result.setInfo("File Info", "Show/hide File Info.", "General", 0);
result.addDefaultKeypress('F', ModifierKeys::shiftModifier);
result.setTicked(controlPanel->isOpen());
break;
case showHelp:
result.setInfo("Show help...", "Take me to the GUI wiki.", "General", 0);
result.setActive(true);
break;
case resizeWindow:
result.setInfo("Reset window bounds", "Reset window bounds", "General", 0);
break;
default:
break;
};
}
示例6: getCommandInfo
// This method is used when something needs to find out the details about one of the commands
// that this object can perform..
void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result)
{
const String generalCategory ("General");
const String demosCategory ("Demos");
switch (commandID)
{
case showRendering:
result.setInfo ("Graphics Rendering", "Shows the graphics demo", demosCategory, 0);
result.setTicked (currentDemoId == showRendering);
result.addDefaultKeypress ('1', ModifierKeys::commandModifier);
break;
case showFontsAndText:
result.setInfo ("Fonts and Text", "Shows the fonts & text demo", demosCategory, 0);
result.setTicked (currentDemoId == showFontsAndText);
result.addDefaultKeypress ('2', ModifierKeys::commandModifier);
break;
case showWidgets:
result.setInfo ("Widgets", "Shows the widgets demo", demosCategory, 0);
result.setTicked (currentDemoId == showWidgets);
result.addDefaultKeypress ('3', ModifierKeys::commandModifier);
break;
case showThreading:
result.setInfo ("Multithreading", "Shows the threading demo", demosCategory, 0);
result.setTicked (currentDemoId == showThreading);
result.addDefaultKeypress ('4', ModifierKeys::commandModifier);
break;
case showTreeView:
result.setInfo ("Treeviews", "Shows the treeviews demo", demosCategory, 0);
result.setTicked (currentDemoId == showTreeView);
result.addDefaultKeypress ('5', ModifierKeys::commandModifier);
break;
case showTable:
result.setInfo ("Table Components", "Shows the table component demo", demosCategory, 0);
result.setTicked (currentDemoId == showTable);
result.addDefaultKeypress ('6', ModifierKeys::commandModifier);
break;
case showAudio:
result.setInfo ("Audio", "Shows the audio demo", demosCategory, 0);
result.setTicked (currentDemoId == showAudio);
result.addDefaultKeypress ('7', ModifierKeys::commandModifier);
break;
case showDragAndDrop:
result.setInfo ("Drag-and-drop", "Shows the drag & drop demo", demosCategory, 0);
result.setTicked (currentDemoId == showDragAndDrop);
result.addDefaultKeypress ('8', ModifierKeys::commandModifier);
break;
case showOpenGL:
result.setInfo ("OpenGL", "Shows the OpenGL demo", demosCategory, 0);
result.addDefaultKeypress ('9', ModifierKeys::commandModifier);
result.setTicked (currentDemoId == showOpenGL);
#if ! JUCE_OPENGL
result.setActive (false);
#endif
break;
case showQuicktime:
result.setInfo ("Quicktime", "Shows the Quicktime demo", demosCategory, 0);
result.addDefaultKeypress ('b', ModifierKeys::commandModifier);
result.setTicked (currentDemoId == showQuicktime);
#if ! (JUCE_QUICKTIME && ! JUCE_LINUX)
result.setActive (false);
#endif
break;
case showDirectShow:
result.setInfo ("DirectShow", "Shows the DirectShow demo", demosCategory, 0);
result.addDefaultKeypress ('b', ModifierKeys::commandModifier);
result.setTicked (currentDemoId == showDirectShow);
#if ! JUCE_DIRECTSHOW
result.setActive (false);
#endif
break;
case showCamera:
result.setInfo ("Camera Capture", "Shows the camera demo", demosCategory, 0);
result.addDefaultKeypress ('c', ModifierKeys::commandModifier);
result.setTicked (currentDemoId == showCamera);
#if ! JUCE_USE_CAMERA
result.setActive (false);
#endif
break;
case showWebBrowser:
result.setInfo ("Web Browser", "Shows the web browser demo", demosCategory, 0);
result.addDefaultKeypress ('i', ModifierKeys::commandModifier);
result.setTicked (currentDemoId == showWebBrowser);
#if (! JUCE_WEB_BROWSER) || JUCE_LINUX
result.setActive (false);
#endif
//.........这里部分代码省略.........
示例7: getCommandInfo
void JucerDocumentEditor::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
ComponentLayout* const currentLayout = getCurrentLayout();
PaintRoutine* const currentPaintRoutine = getCurrentPaintRoutine();
const int cmd = ModifierKeys::commandModifier;
const int shift = ModifierKeys::shiftModifier;
if (commandID >= JucerCommandIDs::newComponentBase
&& commandID < JucerCommandIDs::newComponentBase + ObjectTypes::numComponentTypes)
{
const int index = commandID - JucerCommandIDs::newComponentBase;
result.setInfo ("New " + ObjectTypes::componentTypeHandlers [index]->getTypeName(),
"Creates a new " + ObjectTypes::componentTypeHandlers [index]->getTypeName(),
CommandCategories::editing, 0);
return;
}
if (commandID >= JucerCommandIDs::newElementBase
&& commandID < JucerCommandIDs::newElementBase + ObjectTypes::numElementTypes)
{
const int index = commandID - JucerCommandIDs::newElementBase;
result.setInfo (String ("New ") + ObjectTypes::elementTypeNames [index],
String ("Adds a new ") + ObjectTypes::elementTypeNames [index],
CommandCategories::editing, 0);
result.setActive (currentPaintRoutine != nullptr);
return;
}
switch (commandID)
{
case JucerCommandIDs::toFront:
result.setInfo (TRANS("Bring to front"), TRANS("Brings the currently selected component to the front."), CommandCategories::editing, 0);
result.setActive (isSomethingSelected());
result.defaultKeypresses.add (KeyPress ('f', cmd, 0));
break;
case JucerCommandIDs::toBack:
result.setInfo (TRANS("Send to back"), TRANS("Sends the currently selected component to the back."), CommandCategories::editing, 0);
result.setActive (isSomethingSelected());
result.defaultKeypresses.add (KeyPress ('b', cmd, 0));
break;
case JucerCommandIDs::group:
result.setInfo (TRANS("Group selected items"), TRANS("Turns the currently selected elements into a single group object."), CommandCategories::editing, 0);
result.setActive (currentPaintRoutine != nullptr && currentPaintRoutine->getSelectedElements().getNumSelected() > 1);
result.defaultKeypresses.add (KeyPress ('k', cmd, 0));
break;
case JucerCommandIDs::ungroup:
result.setInfo (TRANS("Ungroup selected items"), TRANS("Turns the currently selected elements into a single group object."), CommandCategories::editing, 0);
result.setActive (currentPaintRoutine != nullptr
&& currentPaintRoutine->getSelectedElements().getNumSelected() == 1
&& currentPaintRoutine->getSelectedElements().getSelectedItem (0)->getTypeName() == "Group");
result.defaultKeypresses.add (KeyPress ('k', cmd | shift, 0));
break;
case JucerCommandIDs::test:
result.setInfo (TRANS("Test component..."), TRANS("Runs the current component interactively."), CommandCategories::view, 0);
result.defaultKeypresses.add (KeyPress ('t', cmd, 0));
break;
case JucerCommandIDs::enableSnapToGrid:
result.setInfo (TRANS("Enable snap-to-grid"), TRANS("Toggles whether components' positions are aligned to a grid."), CommandCategories::view, 0);
result.setTicked (document != nullptr && document->isSnapActive (false));
result.defaultKeypresses.add (KeyPress ('g', cmd, 0));
break;
case JucerCommandIDs::showGrid:
result.setInfo (TRANS("Show snap-to-grid"), TRANS("Toggles whether the snapping grid is displayed on-screen."), CommandCategories::view, 0);
result.setTicked (document != nullptr && document->isSnapShown());
result.defaultKeypresses.add (KeyPress ('g', cmd | shift, 0));
break;
case JucerCommandIDs::editCompLayout:
result.setInfo (TRANS("Edit sub-component layout"), TRANS("Switches to the sub-component editor view."), CommandCategories::view, 0);
result.setTicked (currentLayout != nullptr);
result.defaultKeypresses.add (KeyPress ('n', cmd, 0));
break;
case JucerCommandIDs::editCompGraphics:
result.setInfo (TRANS("Edit background graphics"), TRANS("Switches to the background graphics editor view."), CommandCategories::view, 0);
result.setTicked (currentPaintRoutine != nullptr);
result.defaultKeypresses.add (KeyPress ('m', cmd, 0));
break;
case JucerCommandIDs::bringBackLostItems:
result.setInfo (TRANS("Retrieve offscreen items"), TRANS("Moves any items that are lost beyond the edges of the screen back to the centre."), CommandCategories::editing, 0);
result.setActive (currentPaintRoutine != nullptr || currentLayout != nullptr);
result.defaultKeypresses.add (KeyPress ('m', cmd, 0));
break;
case JucerCommandIDs::zoomIn:
result.setInfo (TRANS("Zoom in"), TRANS("Zooms in on the current component."), CommandCategories::editing, 0);
result.setActive (currentPaintRoutine != nullptr || currentLayout != nullptr);
result.defaultKeypresses.add (KeyPress (']', cmd, 0));
break;
//.........这里部分代码省略.........
示例8: getCommandInfo
void ProjectContentComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
String documentName;
if (currentDocument != nullptr)
documentName = " '" + currentDocument->getName().substring (0, 32) + "'";
#if JUCE_MAC
const ModifierKeys cmdCtrl (ModifierKeys::ctrlModifier | ModifierKeys::commandModifier);
#else
const ModifierKeys cmdCtrl (ModifierKeys::ctrlModifier | ModifierKeys::altModifier);
#endif
switch (commandID)
{
case CommandIDs::saveProject:
result.setInfo ("Save Project",
"Saves the current project",
CommandCategories::general, 0);
result.setActive (project != nullptr);
break;
case CommandIDs::closeProject:
result.setInfo ("Close Project",
"Closes the current project",
CommandCategories::general, 0);
result.setActive (project != nullptr);
break;
case CommandIDs::saveDocument:
result.setInfo ("Save" + documentName,
"Saves the current document",
CommandCategories::general, 0);
result.setActive (currentDocument != nullptr || project != nullptr);
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
break;
case CommandIDs::saveDocumentAs:
result.setInfo ("Save As...",
"Saves the current document to a new location",
CommandCategories::general, 0);
result.setActive (currentDocument != nullptr);
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
break;
case CommandIDs::closeDocument:
result.setInfo ("Close" + documentName,
"Closes the current document",
CommandCategories::general, 0);
result.setActive (contentView != nullptr);
result.defaultKeypresses.add (KeyPress ('w', cmdCtrl, 0));
break;
case CommandIDs::goToPreviousDoc:
result.setInfo ("Previous Document", "Go to previous document", CommandCategories::general, 0);
result.setActive (recentDocumentList.canGoToPrevious());
result.defaultKeypresses.add (KeyPress (KeyPress::leftKey, cmdCtrl, 0));
break;
case CommandIDs::goToNextDoc:
result.setInfo ("Next Document", "Go to next document", CommandCategories::general, 0);
result.setActive (recentDocumentList.canGoToNext());
result.defaultKeypresses.add (KeyPress (KeyPress::rightKey, cmdCtrl, 0));
break;
case CommandIDs::goToCounterpart:
result.setInfo ("Open corresponding header or cpp file", "Open counterpart file", CommandCategories::general, 0);
result.setActive (canGoToCounterpart());
result.defaultKeypresses.add (KeyPress (KeyPress::upKey, cmdCtrl, 0));
break;
case CommandIDs::openInIDE:
result.setInfo ("Open in IDE...",
"Launches the project in an external IDE",
CommandCategories::general, 0);
result.setActive (ProjectExporter::canProjectBeLaunched (project));
break;
case CommandIDs::saveAndOpenInIDE:
result.setInfo ("Save Project and Open in IDE...",
"Saves the project and launches it in an external IDE",
CommandCategories::general, 0);
result.setActive (ProjectExporter::canProjectBeLaunched (project));
result.defaultKeypresses.add (KeyPress ('l', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
break;
case CommandIDs::createNewExporter:
result.setInfo ("Create New Exporter...",
"Creates a new exporter for a compiler type",
CommandCategories::general, 0);
result.setActive (project != nullptr);
break;
case CommandIDs::showFilePanel:
result.setInfo ("Show File Panel",
"Shows the tree of files for this project",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('p', ModifierKeys::commandModifier, 0));
//.........这里部分代码省略.........
示例9: getCommandInfo
//=================================================================================================
// 设置本类能识别并处理的命令信息
void MainWindow::getCommandInfo (CommandID commandID, ApplicationCommandInfo& result)
{
switch (commandID)
{
case AppCommandIDs::newDoc: // 新建文档
result.setInfo(TRANS("New Project"), TRANS("New Project"), AppString::fileCategory, 0);
result.addDefaultKeypress('n', ModifierKeys::commandModifier);
result.setActive(appDoc->getTracksController()->getContainer(0)->subCompNums() > 0 || appDoc->getFile().exists());
break;
case AppCommandIDs::open: // 打开文档
result.setInfo(TRANS("Open Project..."), TRANS("Open Project"), AppString::fileCategory, 0);
result.addDefaultKeypress('o', ModifierKeys::commandModifier);
break;
case AppCommandIDs::close: // 关闭已打开的文档
result.setInfo(TRANS("Close Project"), TRANS("Close Project"), AppString::fileCategory, 0);
result.addDefaultKeypress('w', ModifierKeys::commandModifier);
result.setActive(appDoc->getTracksController()->getContainer(0)->subCompNums() > 0 || appDoc->getFile().exists());
break;
case AppCommandIDs::save: // 保存文档
result.setInfo(TRANS("Save Project"), TRANS("Save Project"), AppString::fileCategory, 0);
result.addDefaultKeypress('s', ModifierKeys::commandModifier);
result.setActive(appDoc->hasChangedSinceSaved());
break;
case AppCommandIDs::saveAs: // 文档另存为
result.setInfo(TRANS("Save Project As..."), TRANS("Save Project As"), AppString::fileCategory, 0);
result.addDefaultKeypress('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier);
result.setActive(appDoc->getTracksController()->getContainer(0)->subCompNums() > 0 || appDoc->getFile().exists());
break;
case AppCommandIDs::systemPreferences: // 系统设置
result.setInfo(TRANS("System Preferences..."), TRANS("System Preferences..."), TRANS("Application"), 0);
result.addDefaultKeypress(KeyPress::F2Key, 0);
break;
case AppCommandIDs::setupAudioDevice: // 设置音频设备
result.setInfo(TRANS("Sound Device..."), TRANS("Sound Device..."), TRANS("Application"), 0);
result.addDefaultKeypress(KeyPress::F3Key, 0);
break;
case AppCommandIDs::keyboardShortcuts: // 快捷键
result.setInfo(TRANS("Shortcuts..."), TRANS("Shortcuts..."), TRANS("Application"), 0);
result.addDefaultKeypress(KeyPress::F4Key, 0);
break;
case AppCommandIDs::aboutThisApp: // 关于
result.setInfo(TRANS("About..."), TRANS("About..."), TRANS("Application"), 0);
result.addDefaultKeypress(KeyPress::F1Key, ModifierKeys::commandModifier);
break;
case AppCommandIDs::undoAction: // 全局性的撤销
result.setInfo(TRANS("Undo ") + undoManager->getUndoDescription(), TRANS("Undo"), AppString::editCategory, 0);
result.addDefaultKeypress('z', ModifierKeys::commandModifier);
result.setActive(undoManager->canUndo());
break;
case AppCommandIDs::redoAction: // 全局性的重做
result.setInfo(TRANS("Redo ") + undoManager->getRedoDescription(), TRANS("Redo"), AppString::editCategory, 0);
result.addDefaultKeypress('y', ModifierKeys::commandModifier);
result.addDefaultKeypress('z', ModifierKeys::commandModifier | ModifierKeys::shiftModifier);
result.setActive(undoManager->canRedo());
break;
case AppCommandIDs::clearUndoHistory: // 清除撤销记录
result.setInfo(TRANS("Clear All Action History"), TRANS("Clear All Action History"), AppString::editCategory, 0);
result.setActive(undoManager->canUndo() || undoManager->canRedo());
break;
}
}
示例10: getCommandInfo
void ProjectContentComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
String documentName;
if (currentDocument != nullptr)
documentName = " '" + currentDocument->getName().substring (0, 32) + "'";
#if JUCE_MAC
const ModifierKeys cmdCtrl (ModifierKeys::ctrlModifier | ModifierKeys::commandModifier);
#else
const ModifierKeys cmdCtrl (ModifierKeys::ctrlModifier | ModifierKeys::altModifier);
#endif
switch (commandID)
{
case CommandIDs::saveProject:
result.setInfo ("Save Project",
"Saves the current project",
CommandCategories::general, 0);
result.setActive (project != nullptr);
break;
case CommandIDs::closeProject:
result.setInfo ("Close Project",
"Closes the current project",
CommandCategories::general, 0);
result.setActive (project != nullptr);
break;
case CommandIDs::saveDocument:
result.setInfo ("Save" + documentName,
"Saves the current document",
CommandCategories::general, 0);
result.setActive (currentDocument != nullptr || project != nullptr);
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
break;
case CommandIDs::saveDocumentAs:
result.setInfo ("Save As...",
"Saves the current document to a new location",
CommandCategories::general, 0);
result.setActive (currentDocument != nullptr);
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
break;
case CommandIDs::closeDocument:
result.setInfo ("Close" + documentName,
"Closes the current document",
CommandCategories::general, 0);
result.setActive (contentView != nullptr);
result.defaultKeypresses.add (KeyPress ('w', cmdCtrl, 0));
break;
case CommandIDs::goToPreviousDoc:
result.setInfo ("Previous Document",
"Go to previous document",
CommandCategories::general, 0);
result.setActive (recentDocumentList.canGoToPrevious());
result.defaultKeypresses.add (KeyPress (KeyPress::leftKey, cmdCtrl, 0));
break;
case CommandIDs::goToNextDoc:
result.setInfo ("Next Document",
"Go to next document",
CommandCategories::general, 0);
result.setActive (recentDocumentList.canGoToNext());
result.defaultKeypresses.add (KeyPress (KeyPress::rightKey, cmdCtrl, 0));
break;
case CommandIDs::goToCounterpart:
result.setInfo ("Open Counterpart File",
"Open corresponding header or cpp file",
CommandCategories::general, 0);
result.setActive (canGoToCounterpart());
result.defaultKeypresses.add (KeyPress (KeyPress::upKey, cmdCtrl, 0));
break;
case CommandIDs::showProjectSettings:
result.setInfo ("Show Project Settings",
"Shows the main project options page",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('x', cmdCtrl, 0));
break;
case CommandIDs::showProjectTab:
result.setInfo ("Show Project Tab",
"Shows the tab containing the project information",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('p', cmdCtrl, 0));
break;
case CommandIDs::showBuildTab:
result.setInfo ("Show Build Tab",
"Shows the tab containing the build panel",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('b', cmdCtrl, 0));
break;
//.........这里部分代码省略.........
示例11: getCommandInfo
// This method is used when something needs to find out the details about one of the commands
// that this object can perform..
void HostFilterComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
const int none = 0;
const int cmd = ModifierKeys::commandModifier;
// const int shift = ModifierKeys::shiftModifier;
GraphComponent* graph = main->getGraph ();
Transport* transport = getFilter()->getTransport();
switch (commandID)
{
//----------------------------------------------------------------------------------------------
case CommandIDs::pluginOpen:
result.setInfo (T("Open Plugin..."), T("Open a plugin"), CommandCategories::file, 0);
result.addDefaultKeypress (T('l'), cmd);
result.setActive (true);
break;
case CommandIDs::pluginClose:
{
result.setInfo (T("Close Plugins"), T("Close selected plugins"), CommandCategories::file, 0);
result.addDefaultKeypress (T('k'), cmd);
// TODO - have to update this !
// GraphComponent* track = tracks.getUnchecked (0);
// result.setActive ((track ? (track->getSelectedPlugin () != -1) : false));
result.setActive (false);
break;
}
case CommandIDs::pluginClear:
{
result.setInfo (T("Clear Plugins"), T("Close all plugins"), CommandCategories::file, 0);
result.addDefaultKeypress (T('j'), cmd);
result.setActive ((graph ? (graph->getPluginsCount () > 2) : false));
break;
}
case CommandIDs::showPluginListEditor:
{
result.setInfo (T("Show Plugin List"), T("Show plugin list window"), CommandCategories::file, 0);
result.addDefaultKeypress (T('p'), cmd);
result.setActive (true);
break;
}
//----------------------------------------------------------------------------------------------
#ifndef JOST_VST_PLUGIN
case CommandIDs::audioOptions:
{
result.setInfo (T("Audio & MIDI Settings..."), T("Show device manager"), CommandCategories::audio, 0);
// result.addDefaultKeypress (KeyPress::backspaceKey, none);
result.setActive (true);
break;
}
#endif
case CommandIDs::audioPlay:
{
result.setInfo (T("Play"), T("Play sequencers"), CommandCategories::audio, 0);
if (! transport->isPlaying())
result.addDefaultKeypress (KeyPress::spaceKey, none);
result.setActive (! transport->isPlaying());
break;
}
case CommandIDs::audioPlayPause:
{
if (transport->isPlaying())
result.setInfo (T("Pause"), T("Pause sequencers"), CommandCategories::audio, 0);
else
result.setInfo (T("Play"), T("Play sequencers"), CommandCategories::audio, 0);
result.addDefaultKeypress (KeyPress::spaceKey, none);
break;
}
case CommandIDs::audioStop:
{
result.setInfo (T("Stop"), T("Stop sequencers"), CommandCategories::audio, 0);
if (transport->isPlaying())
result.addDefaultKeypress (KeyPress::spaceKey, none);
result.setActive (transport->isPlaying());
break;
}
case CommandIDs::audioRecord:
{
result.setInfo (T("Record"), T("Activate recording"), CommandCategories::audio, 0);
result.addDefaultKeypress (T('r'), cmd);
result.setTicked (transport->isRecording());
result.setActive (true);
break;
}
case CommandIDs::audioRewind:
{
result.setInfo (T("Rewind"), T("Rewind sequencers"), CommandCategories::audio, 0);
result.addDefaultKeypress (KeyPress::backspaceKey, none);
result.setActive (transport->getPositionInFrames() != 0);
break;
}
case CommandIDs::audioLoop:
{
result.setInfo (T("Looping"), T("Loop sequencers"), CommandCategories::audio, 0);
result.addDefaultKeypress (T('l'), cmd);
result.setTicked (transport->isLooping());
result.setActive (true);
break;
//.........这里部分代码省略.........
示例12: getCommandInfo
void CtrlrEditor::getCommandInfo (CommandID commandID, ApplicationCommandInfo &result)
{
const String globalCategory ("Global");
const String panelCategory ("Panel");
switch (commandID)
{
case doSaveState:
result.setInfo ("Save CTRLR state", "Saves the CTRLR state to disk", globalCategory, 0);
result.addDefaultKeypress ('s', ModifierKeys::commandModifier | ModifierKeys::altModifier);
break;
case doOpenPanel:
result.setInfo ("Open Panel", "Open a panel from a file", globalCategory, 0);
result.addDefaultKeypress ('o', ModifierKeys::commandModifier);
break;
case doNewPanel:
result.setInfo ("New Panel", "Create a new empty panel", globalCategory, 0);
result.addDefaultKeypress ('n', ModifierKeys::commandModifier);
break;
case showGlobalSettingsDialog:
result.setInfo ("Preferences", "Show global CTRLR preferences", globalCategory, 0);
result.addDefaultKeypress ('p', ModifierKeys::commandModifier);
break;
case showMidiMonitor:
result.setInfo ("MIDI Monitor", "A small MIDI monitor that will display received and sent data", globalCategory, 0);
result.addDefaultKeypress ('m', ModifierKeys::commandModifier);
break;
case showLogViewer:
result.setInfo ("Log viewer", "You can view diagnostic messages here, useful when debugging problems", globalCategory, 0);
result.addDefaultKeypress ('l', ModifierKeys::commandModifier);
break;
case showMidiCalculator:
result.setInfo ("MIDI Calculator", "A useful tool to translate Heximal, Binary, Decimal values", globalCategory, 0);
result.addDefaultKeypress ('j', ModifierKeys::commandModifier);
break;
case showAboutDialog:
result.setInfo ("About", "About CTRLR", globalCategory, 0);
result.addDefaultKeypress ('a', ModifierKeys::commandModifier);
break;
case showKeyboardMappingDialog:
result.setInfo ("Keyboard mapping", "Change default keyboard mappings", globalCategory, 0);
result.addDefaultKeypress ('k', ModifierKeys::commandModifier);
break;
case doViewPropertyDisplayIDs:
result.setInfo ("Property IDs/Names", "View property names or property IDs", panelCategory, 0);
result.setTicked (isPanelActive() ? (bool)getActivePanel()->getProperty(Ids::panelPropertyDisplayIDs) : false);
result.setActive (isPanelActive());
break;
case doZoomIn:
result.setInfo ("Zoom In", "Zoom in the panel", panelCategory, 0);
result.addDefaultKeypress ('+', ModifierKeys::commandModifier);
result.setActive (isPanelActive());
break;
case doZoomOut:
result.setInfo ("Zoom Out", "Zoom out the panel", panelCategory, 0);
result.addDefaultKeypress ('-', ModifierKeys::commandModifier);
result.setActive (isPanelActive());
break;
case doCopy:
result.setInfo ("Copy", "Copy selected components to clipboard", panelCategory, 0);
result.addDefaultKeypress ('c', ModifierKeys::commandModifier);
result.setActive (isPanelActive(true));
break;
case doCut:
result.setInfo ("Cut", "Cut selected components to clipboard", panelCategory, 0);
result.addDefaultKeypress ('x', ModifierKeys::commandModifier);
result.setActive (isPanelActive(true));
break;
case doPaste:
result.setInfo ("Paste", "Paste components from clipboard", panelCategory, 0);
result.addDefaultKeypress ('v', ModifierKeys::commandModifier);
result.setActive (isPanelActive(true));
break;
case doUndo:
result.setInfo ("Undo", "Undo last transaction", panelCategory, 0);
result.addDefaultKeypress ('z', ModifierKeys::commandModifier);
result.setActive (isPanelActive(true));
break;
case doRedo:
result.setInfo ("Redo", "Redo last transaction", panelCategory, 0);
result.addDefaultKeypress ('y', ModifierKeys::commandModifier);
result.setActive (isPanelActive(true));
break;
//.........这里部分代码省略.........