本文整理汇总了C++中GlobalRegistry函数的典型用法代码示例。如果您正苦于以下问题:C++ GlobalRegistry函数的具体用法?C++ GlobalRegistry怎么用?C++ GlobalRegistry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GlobalRegistry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GlobalRegistry
// Loads the default shortcuts from the registry
void EventManager::loadAccelerators() {
if (_debugMode) {
std::cout << "EventManager: Loading accelerators...\n";
}
xml::NodeList shortcutSets = GlobalRegistry().findXPath("user/ui/input//shortcuts");
if (_debugMode) {
std::cout << "Found " << shortcutSets.size() << " sets.\n";
}
// If we have two sets of shortcuts, delete the default ones
if (shortcutSets.size() > 1) {
GlobalRegistry().deleteXPath("user/ui/input//shortcuts[@name='default']");
}
// Find all accelerators
xml::NodeList shortcutList = GlobalRegistry().findXPath("user/ui/input/shortcuts//shortcut");
if (shortcutList.size() > 0) {
rMessage() << "EventManager: Shortcuts found in Registry: " <<
static_cast<int>(shortcutList.size()) << std::endl;
for (unsigned int i = 0; i < shortcutList.size(); i++) {
const std::string key = shortcutList[i].getAttributeValue("key");
if (_debugMode) {
std::cout << "Looking up command: " << shortcutList[i].getAttributeValue("command") << "\n";
std::cout << "Key is: >> " << key << " << \n";
}
// Try to lookup the command
IEventPtr event = findEvent(shortcutList[i].getAttributeValue("command"));
// Check for a non-empty key string
if (key != "") {
// Check for valid command definitions were found
if (!event->empty()) {
// Get the modifier string (e.g. "SHIFT+ALT")
const std::string modifierStr = shortcutList[i].getAttributeValue("modifiers");
if (!duplicateAccelerator(key, modifierStr, event)) {
// Create the accelerator object
IAccelerator& accelerator = addAccelerator(key, modifierStr);
// Connect the newly created accelerator to the command
accelerator.connectEvent(event);
}
}
else {
rWarning() << "EventManager: Cannot load shortcut definition (command invalid)."
<< std::endl;
}
}
}
}
else {
// No accelerator definitions found!
rWarning() << "EventManager: No shortcut definitions found..." << std::endl;
}
}
示例2: GlobalRegistry
void StimTypes::save()
{
// Find the storage entity
std::string storageEClass = GlobalRegistry().get(RKEY_STORAGE_ECLASS);
Entity* storageEntity = findEntityByClass(storageEClass);
if (storageEntity != NULL)
{
std::string prefix = GlobalRegistry().get(RKEY_STORAGE_PREFIX);
// Clean the storage entity from any previous definitions
{
// Instantiate a visitor to gather the keys to delete
CustomStimRemover remover(storageEntity);
// Visit each keyvalue with the <self> class as visitor
storageEntity->forEachKeyValue(remover);
// Scope ends here, the keys are deleted now
// as the CustomStimRemover gets destructed
}
// Now store all custom stim types to the storage entity
for (StimTypeMap::iterator i = _stimTypes.begin(); i != _stimTypes.end(); ++i)
{
StimType& s = i->second;
std::string idStr = string::to_string(i->first);
if (s.custom) {
// spawnarg is something like "editor_dr_stim_1002" => "MyStim"
storageEntity->setKeyValue(prefix + idStr, s.caption);
}
}
}
}
示例3: GlobalRegistry
void WindowPosition::saveToPath(const std::string& path)
{
GlobalRegistry().setAttribute(path, "xPosition", string::to_string(_position[0]));
GlobalRegistry().setAttribute(path, "yPosition", string::to_string(_position[1]));
GlobalRegistry().setAttribute(path, "width", string::to_string(_size[0]));
GlobalRegistry().setAttribute(path, "height", string::to_string(_size[1]));
}
示例4: rMessage
void Clipper::initialiseModule(const ApplicationContext& ctx)
{
rMessage() << "Clipper::initialiseModule called\n";
_useCaulk = registry::getValue<bool>(RKEY_CLIPPER_USE_CAULK);
_caulkShader = GlobalRegistry().get(RKEY_CLIPPER_CAULK_SHADER);
GlobalRegistry().signalForKey(RKEY_CLIPPER_USE_CAULK).connect(
sigc::mem_fun(this, &Clipper::keyChanged)
);
GlobalRegistry().signalForKey(RKEY_CLIPPER_CAULK_SHADER).connect(
sigc::mem_fun(this, &Clipper::keyChanged)
);
constructPreferences();
// Register the clip commands
GlobalCommandSystem().addCommand("ClipSelected", boost::bind(&Clipper::clipSelectionCmd, this, _1));
GlobalCommandSystem().addCommand("SplitSelected", boost::bind(&Clipper::splitSelectedCmd, this, _1));
GlobalCommandSystem().addCommand("FlipClip", boost::bind(&Clipper::flipClipperCmd, this, _1));
// Connect some events to these commands
GlobalEventManager().addCommand("ClipSelected", "ClipSelected");
GlobalEventManager().addCommand("SplitSelected", "SplitSelected");
GlobalEventManager().addCommand("FlipClip", "FlipClip");
}
示例5: GlobalRegistry
void SplitPaneLayout::saveStateToPath(const std::string& path)
{
GlobalRegistry().createKeyWithName(path, "pane", "horizontal");
_splitPane.posHPane.saveToPath(path + "/pane[@name='horizontal']");
GlobalRegistry().createKeyWithName(path, "pane", "vertical1");
_splitPane.posVPane1.saveToPath(path + "/pane[@name='vertical1']");
GlobalRegistry().createKeyWithName(path, "pane", "vertical2");
_splitPane.posVPane2.saveToPath(path + "/pane[@name='vertical2']");
GlobalRegistry().deleteXPath(RKEY_SPLITPANE_VIEWTYPES);
xml::Node node = GlobalRegistry().createKey(RKEY_SPLITPANE_VIEWTYPES);
// Camera is assigned -1 as viewtype
int topLeft = _quadrants[QuadrantTopLeft].xyWnd != NULL ? _quadrants[QuadrantTopLeft].xyWnd->getViewType() : -1;
int topRight = _quadrants[QuadrantTopRight].xyWnd != NULL ? _quadrants[QuadrantTopRight].xyWnd->getViewType() : -1;
int bottomLeft = _quadrants[QuadrantBottomLeft].xyWnd != NULL ? _quadrants[QuadrantBottomLeft].xyWnd->getViewType() : -1;
int bottomRight = _quadrants[QuadrantBottomRight].xyWnd != NULL ? _quadrants[QuadrantBottomRight].xyWnd->getViewType() : -1;
node.setAttributeValue("topleft", string::to_string(topLeft));
node.setAttributeValue("topright", string::to_string(topRight));
node.setAttributeValue("bottomleft", string::to_string(bottomLeft));
node.setAttributeValue("bottomright", string::to_string(bottomRight));
}
示例6: switch
// Get default textures
TexturePtr Doom3ShaderSystem::getDefaultInteractionTexture(ShaderLayer::Type t)
{
TexturePtr defaultTex;
// Look up based on layer type
switch (t)
{
case ShaderLayer::DIFFUSE:
case ShaderLayer::SPECULAR:
defaultTex = GetTextureManager().getBinding(
GlobalRegistry().get(RKEY_BITMAPS_PATH) + IMAGE_BLACK
);
break;
case ShaderLayer::BUMP:
defaultTex = GetTextureManager().getBinding(
GlobalRegistry().get(RKEY_BITMAPS_PATH) + IMAGE_FLAT
);
break;
default:
break;
}
return defaultTex;
}
示例7: GlobalRegistry
// RegistryKeyObserver implementation, gets called upon key change
void MapCompiler::keyChanged (const std::string& changedKey, const std::string& newValue)
{
_errorCheckParameters = GlobalRegistry().get(RKEY_ERROR_CHECK_PARAMETERS);
_errorFixParameters = GlobalRegistry().get(RKEY_ERROR_FIX_PARAMETERS);
_compilerBinary = GlobalRegistry().get(RKEY_COMPILER_BINARY);
_compileParameters = GlobalRegistry().get(RKEY_COMPILE_PARAMETERS);
_materialParameters = GlobalRegistry().get(RKEY_MATERIAL_PARAMETERS);
}
示例8: loadFromPath
void WindowPosition::loadFromPath(const std::string& path)
{
_position[0] = string::convert<int>(GlobalRegistry().getAttribute(path, "xPosition"));
_position[1] = string::convert<int>(GlobalRegistry().getAttribute(path, "yPosition"));
_size[0] = string::convert<int>(GlobalRegistry().getAttribute(path, "width"));
_size[1] = string::convert<int>(GlobalRegistry().getAttribute(path, "height"));
}
示例9: _index
MapPosition::MapPosition(unsigned int index) :
_index(index),
_position(0,0,0),
_angle(0,0,0)
{
// Construct the entity key names from the index
_posKey = GlobalRegistry().get(RKEY_MAP_POSROOT) + string::to_string(_index);
_angleKey = GlobalRegistry().get(RKEY_MAP_ANGLEROOT) + string::to_string(_index);
}
示例10: ToggleShowSizeInfo
// greebo: This toggles the brush size info display in the ortho views
void ToggleShowSizeInfo ()
{
if (GlobalRegistry().get("user/ui/showSizeInfo") == "1") {
GlobalRegistry().set("user/ui/showSizeInfo", "0");
} else {
GlobalRegistry().set("user/ui/showSizeInfo", "1");
}
SceneChangeNotify();
}
示例11: GlobalRegistry
void MainFrame::SaveWindowInfo (void)
{
// Delete all the current window states from the registry
GlobalRegistry().deleteXPath(RKEY_WINDOW_STATE);
// Tell the position tracker to save the information
_windowPosition.saveToPath(RKEY_WINDOW_STATE);
GdkWindow* window = GTK_WIDGET(m_window)->window;
if (window != NULL)
GlobalRegistry().setAttribute(RKEY_WINDOW_STATE, "state", string::toString(gdk_window_get_state(window)));
}
示例12: GlobalRegistry
void Map::removeCameraPosition() {
const std::string keyLastCamPos = GlobalRegistry().get(RKEY_LAST_CAM_POSITION);
const std::string keyLastCamAngle = GlobalRegistry().get(RKEY_LAST_CAM_ANGLE);
if (m_world_node != NULL) {
// Retrieve the entity from the worldspawn node
Entity* worldspawn = Node_getEntity(m_world_node);
assert(worldspawn != NULL); // This must succeed
worldspawn->setKeyValue(keyLastCamPos, "");
worldspawn->setKeyValue(keyLastCamAngle, "");
}
}
示例13: GlobalRegistry
void MouseEventManager::loadCameraEventDefinitions ()
{
xml::NodeList camviews = GlobalRegistry().findXPath("user/ui/input//cameraview");
if (camviews.size() > 0) {
// Find all the camera definitions
xml::NodeList eventList = camviews[0].getNamedChildren("event");
if (eventList.size() > 0) {
globalOutputStream() << "MouseEventManager: Camera Definitions found: " << eventList.size() << "\n";
for (unsigned int i = 0; i < eventList.size(); i++) {
// Get the event name
const std::string eventName = eventList[i].getAttributeValue("name");
// Check if any recognised event names are found and construct the according condition.
if (eventName == "EnableFreeLookMode") {
_cameraConditions[ui::camEnableFreeLookMode] = getCondition(eventList[i]);
} else if (eventName == "DisableFreeLookMode") {
_cameraConditions[ui::camDisableFreeLookMode] = getCondition(eventList[i]);
} else {
globalOutputStream() << "MouseEventManager: Warning: Ignoring unknown event name: " << eventName
<< "\n";
}
}
} else {
// No Camera definitions found!
globalOutputStream() << "MouseEventManager: Critical: No camera event definitions found!\n";
}
} else {
// No Camera definitions found!
globalOutputStream() << "MouseEventManager: Critical: No camera event definitions found!\n";
}
}
示例14: rMessage
void RadiantSelectionSystem::initialiseModule(const ApplicationContext& ctx)
{
rMessage() << "RadiantSelectionSystem::initialiseModule called.\n";
constructStatic();
SetManipulatorMode(eTranslate);
pivotChanged();
_sigSelectionChanged.connect(
sigc::mem_fun(this, &RadiantSelectionSystem::pivotChangedSelection)
);
GlobalGrid().signal_gridChanged().connect(
sigc::mem_fun(this, &RadiantSelectionSystem::pivotChanged)
);
GlobalRegistry().signalForKey(RKEY_ROTATION_PIVOT).connect(
sigc::mem_fun(this, &RadiantSelectionSystem::keyChanged)
);
// Pass a reference to self to the global event manager
GlobalEventManager().connectSelectionSystem(this);
// Connect the bounds changed caller
GlobalSceneGraph().signal_boundsChanged().connect(
sigc::mem_fun(this, &RadiantSelectionSystem::onSceneBoundsChanged)
);
GlobalRenderSystem().attachRenderable(*this);
}
示例15: GlobalRegistry
void MRU::saveRecentFiles()
{
// Delete all existing MRU/element nodes
GlobalRegistry().deleteXPath(RKEY_MAP_MRUS);
std::size_t counter = 1;
// Now wade through the list and save them in the correct order
for (MRUList::const_iterator i = _list.begin(); i != _list.end(); ++counter, ++i)
{
const std::string key = RKEY_MAP_MRUS + "/map" + string::to_string(counter);
// Save the string into the registry
GlobalRegistry().set(key, (*i));
}
}