//-----------------------------------------------------------------------------
// Begin editing a particular material
//-----------------------------------------------------------------------------
void CMaterialEditorPanel::BeginEditingMaterial( const char *pMaterialName, IMaterial *pMaterial )
{
	m_bMaterialDirty = false;
	m_EditedMaterial = pMaterialName;
	m_pTitleLabel->SetText( m_EditedMaterial.String() );
	m_pMaterialViewer->SetMaterial(pMaterial);
	m_pMaterial = pMaterial;
}
Beispiel #2
0
//-----------------------------------------------------------------------------
// Purpose: gets the icon for a binding, if it exists
//-----------------------------------------------------------------------------
const char *CControllerMap::GetBindingIcon( int idx )
{
	CUtlSymbol s = m_buttonMap[idx].icon;
	if ( s.IsValid() )
	{
		return s.String();
	}
	return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Updates the value shown in the mapcycle field
//-----------------------------------------------------------------------------
void CServerInfoPanel::UpdateMapCycleValue()
{
	// look at current map
	CUtlSymbol currentMap = GetVarString("map");
	if (!currentMap.IsValid())
		return;

	// find it in the map cycle list
	int listPoint = -1;
	for (int i = 0; i < m_MapCycle.Count(); i++)
	{
		if (!stricmp(m_MapCycle[i].String(), currentMap.String()))
		{
			listPoint = i;
		}
	}

	// take out the next 2 maps and make them the value
	char nextMaps[512];
	nextMaps[0] = 0;
	bool needComma = false;
	for (int i = 0; i < 2; i++)
	{
		int point = listPoint + i + 1;
		if (point >= m_MapCycle.Count())
		{
			point -= m_MapCycle.Count();
		}

		if (m_MapCycle.IsValidIndex(point))
		{
			if (needComma)
			{
				strcat(nextMaps, ", ");
			}
			strcat(nextMaps, m_MapCycle[point].String());
			needComma = true;
		}
	}

	// add some elipses to show there is more maps
	if (needComma)
	{
		strcat(nextMaps, ", ");
	}
	strcat(nextMaps, "...");

	// show in varlist
	SetVarString("mapcycle", nextMaps);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const char *CMaterialSubRect::GetTextureGroupName() const
{
	return m_symTextureGroupName.String();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const char *CMaterialSubRect::GetName() const
{
	return m_symName.String();
}
Beispiel #6
0
//-----------------------------------------------------------------------------
// Purpose: walks the file elements in the vcproj and inserts them into configs
//-----------------------------------------------------------------------------
bool CVCProjConvert::ExtractFiles( IXMLDOMDocument *pDoc  )
{
	if (!pDoc)
	{
		return false;
	}
	Assert( m_Configurations.Count() ); // some configs must be loaded first

#ifdef _WIN32
	CComPtr<IXMLDOMNodeList> pFiles;
	pDoc->getElementsByTagName( _bstr_t("File"), &pFiles);
	if (pFiles)
	{
		long len = 0;
		pFiles->get_length(&len);
		for ( int i=0; i<len; i++ )
		{
			CComPtr<IXMLDOMNode> pNode;
			pFiles->get_item( i, &pNode);
			if (pNode)
			{
				CComQIPtr<IXMLDOMElement> pElem( pNode );
				CUtlSymbol fileName = GetXMLAttribValue(pElem,"RelativePath");
				if ( fileName.IsValid() )
				{
					CConfiguration::FileType_e type = GetFileType( fileName.String() );
					CConfiguration::CFileEntry fileEntry( fileName.String(), type );
					for ( int i = 0; i < m_Configurations.Count(); i++ ) // add the file to all configs
					{
						CConfiguration & config = m_Configurations[i];
						config.InsertFile( fileEntry );
					}
					IterateFileConfigurations( pElem, fileName ); // now remove the excluded ones
				}
			}
		}//for
	}
#elif _LINUX
	DOMNodeList *nodes = pDoc->getElementsByTagName( _bstr_t("File") );
	if (nodes)
	{
		int len = nodes->getLength();
		for ( int i=0; i<len; i++ )
		{
			DOMNode *node = nodes->item(i);
			if (node)
			{
				CUtlSymbol fileName = GetXMLAttribValue(node,"RelativePath");
				if ( fileName.IsValid() )
				{
					char fixedFileName[ MAX_PATH ];
					Q_strncpy( fixedFileName, fileName.String(), sizeof(fixedFileName) );
					if ( fixedFileName[0] == '.' && fixedFileName[1] == '\\' )
					{
						Q_memmove( fixedFileName, fixedFileName+2, sizeof(fixedFileName)-2 );
					}

					Q_FixSlashes( fixedFileName );
					FindFileCaseInsensitive( fixedFileName, sizeof(fixedFileName) );
					CConfiguration::FileType_e type = GetFileType( fileName.String() );
					CConfiguration::CFileEntry fileEntry( fixedFileName, type );
					for ( int i = 0; i < m_Configurations.Count(); i++ ) // add the file to all configs
					{
						CConfiguration & config = m_Configurations[i];
						config.InsertFile( fileEntry );
					}
					IterateFileConfigurations( node, fixedFileName ); // now remove the excluded ones
				}
			}
		}//for
	}
#endif
	return true;
}
Beispiel #7
0
//-----------------------------------------------------------------------------
// Purpose: extracts the list of defines and includes used for this config
//-----------------------------------------------------------------------------
bool CVCProjConvert::ExtractIncludes( IXMLDOMElement *pDoc, CConfiguration & config )
{
	config.ResetDefines();
	config.ResetIncludes();
	
	if (!pDoc)
	{
		return false;
	}

#ifdef _WIN32
	CComPtr<IXMLDOMNodeList> pTools;
	pDoc->getElementsByTagName( _bstr_t("Tool"), &pTools);
	if (pTools)
	{
		long len = 0;
		pTools->get_length(&len);
		for ( int i=0; i<len; i++ )
		{
			CComPtr<IXMLDOMNode> pNode;
			pTools->get_item( i, &pNode );
			if (pNode)
			{
				CComQIPtr<IXMLDOMElement> pElem( pNode );
				CUtlSymbol toolName = GetXMLAttribValue( pElem, "Name" );
				if ( toolName == "VCCLCompilerTool" )
				{
					CUtlSymbol defines = GetXMLAttribValue( pElem, "PreprocessorDefinitions" );
					char *str = (char *)_alloca( Q_strlen( defines.String() ) + 1 );
					Assert( str );
					Q_strcpy( str, defines.String() );
					// now tokenize the string on the ";" char
					char *delim = strchr( str, ';' );
					char *curpos = str;
					while ( delim )
					{
						*delim = 0;
						delim++;
						if ( Q_stricmp( curpos, "WIN32" ) && Q_stricmp( curpos, "_WIN32" )  &&  
							 Q_stricmp( curpos, "_WINDOWS") && Q_stricmp( curpos, "WINDOWS")) // don't add WIN32 defines
						{
							config.AddDefine( curpos );
						}
						curpos = delim;
						delim = strchr( delim, ';' );
					}
					if ( Q_stricmp( curpos, "WIN32" ) && Q_stricmp( curpos, "_WIN32" )  &&  
						 Q_stricmp( curpos, "_WINDOWS") && Q_stricmp( curpos, "WINDOWS")) // don't add WIN32 defines
					{
						config.AddDefine( curpos );
					}

					CUtlSymbol includes = GetXMLAttribValue( pElem, "AdditionalIncludeDirectories" );
					char *str2 = (char *)_alloca( Q_strlen( includes.String() ) + 1 );
					Assert( str2 );
					Q_strcpy( str2, includes.String() );
					// now tokenize the string on the ";" char
					delim = strchr( str2, ',' );
					curpos = str2;
					while ( delim )
					{
						*delim = 0;
						delim++;
						config.AddInclude( curpos );
						curpos = delim;
						delim = strchr( delim, ',' );
					}
					config.AddInclude( curpos );
				}
			}
		}
	}
#elif _LINUX
	DOMNodeList *nodes= pDoc->getElementsByTagName( _bstr_t("Tool"));
	if (nodes)
	{
		int len = nodes->getLength();
		for ( int i=0; i<len; i++ )
		{
			DOMNode *node = nodes->item(i);
			if (node)
			{
				CUtlSymbol toolName = GetXMLAttribValue( node, "Name" );
				if ( toolName == "VCCLCompilerTool" )
				{
					CUtlSymbol defines = GetXMLAttribValue( node, "PreprocessorDefinitions" );
					char *str = (char *)_alloca( Q_strlen( defines.String() ) + 1 );
					Assert( str );
					Q_strcpy( str, defines.String() );
					// now tokenize the string on the ";" char
					char *delim = strchr( str, ';' );
					char *curpos = str;
					while ( delim )
					{
						*delim = 0;
						delim++;
						if ( Q_stricmp( curpos, "WIN32" ) && Q_stricmp( curpos, "_WIN32" )  &&  
							 Q_stricmp( curpos, "_WINDOWS") && Q_stricmp( curpos, "WINDOWS")) // don't add WIN32 defines
						{
							config.AddDefine( curpos );
						}
						curpos = delim;
						delim = strchr( delim, ';' );
					}
					if ( Q_stricmp( curpos, "WIN32" ) && Q_stricmp( curpos, "_WIN32" )  &&  
						 Q_stricmp( curpos, "_WINDOWS") && Q_stricmp( curpos, "WINDOWS")) // don't add WIN32 defines
					{
						config.AddDefine( curpos );
					}

					CUtlSymbol includes = GetXMLAttribValue( node, "AdditionalIncludeDirectories" );
					char *str2 = (char *)_alloca( Q_strlen( includes.String() ) + 1 );
					Assert( str2 );
					Q_strcpy( str2, includes.String() );
					// now tokenize the string on the ";" char
					char token = ',';
					delim = strchr( str2, token );
					if ( !delim )
					{
						token = ';';
						delim = strchr( str2, token );
					}
					curpos = str2;
					while ( delim )
					{
						*delim = 0;
						delim++;
						Q_FixSlashes( curpos );
						Q_strlower( curpos );
						char fullPath[ MAX_PATH ];
						Q_snprintf( fullPath, sizeof(fullPath), "%s/%s", m_BaseDir.String(), curpos );
						Q_StripTrailingSlash( fullPath );
						config.AddInclude( fullPath );
						curpos = delim;
						delim = strchr( delim, token );
					}
					Q_FixSlashes( curpos );
					Q_strlower( curpos );
					char fullPath[ MAX_PATH ];
					Q_snprintf( fullPath, sizeof(fullPath), "%s/%s", m_BaseDir.String(), curpos );
					Q_StripTrailingSlash( fullPath );
					config.AddInclude( fullPath );
				}
			}
		}
	}

#endif
	return true;
}
char const *CBugReporter::GetUserName()
{
	return m_UserName.String();
}