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)); break; case CommandIDs::showConfigPanel: result.setInfo ("Show Config Panel", "Shows the build options for the project", CommandCategories::general, 0); result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('i', ModifierKeys::commandModifier, 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 ('i', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); break; case CommandIDs::showProjectModules: result.setInfo ("Show Project Modules", "Shows the project's list of modules", CommandCategories::general, 0); result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('m', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); break; case CommandIDs::deleteSelectedItem: result.setInfo ("Delete Selected File", String::empty, CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0)); result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0)); result.setActive (dynamic_cast<TreePanelBase*> (treeViewTabs.getCurrentContentComponent()) != nullptr); break; case CommandIDs::showTranslationTool: result.setInfo ("Translation File Builder", "Shows the translation file helper tool", CommandCategories::general, 0); break; default: break; } }
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; case CommandIDs::showFileExplorerPanel: result.setInfo ("Show File Explorer Panel", "Shows the panel containing the tree of files for this project", CommandCategories::general, 0); result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('f', cmdCtrl, 0)); break; case CommandIDs::showModulesPanel: result.setInfo ("Show Modules Panel", "Shows the panel containing the project's list of modules", CommandCategories::general, 0); result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('m', cmdCtrl, 0)); break; case CommandIDs::showExportersPanel: result.setInfo ("Show Exporters Panel", "Shows the panel containing the project's list of exporters", CommandCategories::general, 0); result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('e', cmdCtrl, 0)); break; case CommandIDs::showExporterSettings: result.setInfo ("Show Exporter Settings", "Shows the settings page for the currently selected exporter", CommandCategories::general, 0); result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('e', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 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::deleteSelectedItem: result.setInfo ("Delete Selected File", String(), CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0)); result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0)); result.setActive (sidebarTabs.getCurrentTabIndex() == 0); break; case CommandIDs::showTranslationTool: result.setInfo ("Translation File Builder", "Shows the translation file helper tool", CommandCategories::general, 0); break; case CommandIDs::cleanAll: result.setInfo ("Clean All", "Cleans all intermediate files", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('k', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); result.setActive (project != nullptr); break; case CommandIDs::toggleBuildEnabled: result.setInfo ("Enable Compilation", "Enables/disables the compiler", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('b', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); result.setActive (project != nullptr); result.setTicked (childProcess != nullptr); break; case CommandIDs::buildNow: result.setInfo ("Build Now", "Recompiles any out-of-date files and updates the JIT engine", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('b', ModifierKeys::commandModifier, 0)); result.setActive (childProcess != nullptr); break; case CommandIDs::toggleContinuousBuild: result.setInfo ("Enable Continuous Recompiling", "Continuously recompiles any changes made in code editors", CommandCategories::general, 0); result.setActive (childProcess != nullptr); result.setTicked (isContinuousRebuildEnabled()); break; case CommandIDs::launchApp: result.setInfo ("Launch Application", "Invokes the app's main() function", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('r', ModifierKeys::commandModifier, 0)); result.setActive (childProcess != nullptr && childProcess->canLaunchApp()); break; case CommandIDs::killApp: result.setInfo ("Stop Application", "Kills the app if it's running", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('.', ModifierKeys::commandModifier, 0)); result.setActive (childProcess != nullptr && childProcess->canKillApp()); break; case CommandIDs::reinstantiateComp: result.setInfo ("Re-instantiate Components", "Re-loads any component editors that are open", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('r', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); result.setActive (childProcess != nullptr); break; case CommandIDs::showWarnings: result.setInfo ("Show Warnings", "Shows or hides compilation warnings", CommandCategories::general, 0); result.setActive (project != nullptr); result.setTicked (areWarningsEnabled()); break; case CommandIDs::nextError: result.setInfo ("Highlight next error", "Jumps to the next error or warning", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('\'', ModifierKeys::commandModifier, 0)); result.setActive (childProcess != nullptr && ! childProcess->errorList.isEmpty()); break; case CommandIDs::prevError: result.setInfo ("Highlight previous error", "Jumps to the last error or warning", CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress ('\"', ModifierKeys::commandModifier, 0)); result.setActive (childProcess != nullptr && ! childProcess->errorList.isEmpty()); break; default: break; } }