当前位置: 首页>>代码示例>>C++>>正文


C++ GlobalRegistry函数代码示例

本文整理汇总了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;
	}
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:61,代码来源:EventManager.cpp

示例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);
			}
		}
	}
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:33,代码来源:StimTypes.cpp

示例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]));
}
开发者ID:codereader,项目名称:DarkRadiant,代码行数:7,代码来源:WindowPosition.cpp

示例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");
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:26,代码来源:Clipper.cpp

示例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));
}
开发者ID:OpenTechEngine,项目名称:DarkRadiant,代码行数:25,代码来源:SplitPaneLayout.cpp

示例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;
}
开发者ID:nbohr1more,项目名称:DarkRadiant,代码行数:26,代码来源:Doom3ShaderSystem.cpp

示例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);
}
开发者ID:ibrahimmusba,项目名称:ufoai,代码行数:9,代码来源:MapCompiler.cpp

示例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"));
}
开发者ID:codereader,项目名称:DarkRadiant,代码行数:8,代码来源:WindowPosition.cpp

示例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);
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:9,代码来源:MapPosition.cpp

示例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();
}
开发者ID:ptitSeb,项目名称:UFO--AI-OpenPandora,代码行数:10,代码来源:commands.cpp

示例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)));
}
开发者ID:AresAndy,项目名称:ufoai,代码行数:12,代码来源:mainframe.cpp

示例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, "");
    }
}
开发者ID:Zbyl,项目名称:DarkRadiant,代码行数:13,代码来源:Map.cpp

示例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";
	}
}
开发者ID:AresAndy,项目名称:ufoai,代码行数:34,代码来源:MouseEvents.cpp

示例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);
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:31,代码来源:RadiantSelectionSystem.cpp

示例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));
	}
}
开发者ID:codereader,项目名称:DarkRadiant,代码行数:16,代码来源:MRU.cpp


注:本文中的GlobalRegistry函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。