void CAddPresetDialog::DoModal( CDmeAnimationSet *pAnimationSet, KeyValues *pContextKeyValues )
{
	int nTextLength = m_pInput->GetTextLength() + 1;
	char* pCurrentGroupName = (char*)_alloca( nTextLength * sizeof(char) );
	m_pInput->GetText( pCurrentGroupName, nTextLength );

	m_pPresetGroup->DeleteAllItems();

	// Populate the combo box with preset group names
	CDmrElementArray< CDmePresetGroup > presetGroupList = pAnimationSet->GetPresetGroups();
	int nCount = presetGroupList.Count();
	for ( int i = 0; i < nCount; ++i )
	{
		CDmePresetGroup *pPresetGroup = presetGroupList[i];
		if ( pPresetGroup->m_bIsReadOnly )
			continue;

		KeyValues *kv = new KeyValues( "entry" );
		SetElementKeyValue( kv, "presetGroup", pPresetGroup );
		int nItemID = m_pPresetGroup->AddItem( pPresetGroup->GetName(), kv );
		if ( pCurrentGroupName && !Q_stricmp( pPresetGroup->GetName(), pCurrentGroupName ) )
		{
			m_pPresetGroup->ActivateItem( nItemID );
		}
	}

	BaseClass::DoModal( pContextKeyValues );

	m_pInput->SetText( "" );
	m_pInput->RequestFocus();

	PlaceUnderCursor( );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionTextMessageStartDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionTextMessageStartDialog.res" );

	BaseClass::Init();

	client_textmessage_t *tm = GetAction()->GetTextMessage();

	m_pX->SetText( va( "%f", tm->x ) );
	m_pY->SetText( va( "%f", tm->y ) );

	m_pFadeInTime->SetText( va( "%.3f", tm->fadein ) );
	m_pFadeOutTime->SetText( va( "%.3f", tm->fadeout ) );
	m_pHoldTime->SetText( va( "%.3f", tm->holdtime ) );
	m_pFXTime->SetText( va( "%.3f", tm->fxtime ) );

	m_pColor1->SetText( va( "%i %i %i %i", tm->r1, tm->g1, tm->b1, tm->a1 ) );
	m_pColor2->SetText( va( "%i %i %i %i", tm->r2, tm->g2, tm->b2, tm->a2 ) );

	m_pMessageText->SetText( GetAction()->GetMessageText() );

	FillInFonts();

	m_pFontName->SetText( GetAction()->GetFontName() );

	int c = NUM_EFFECT_TYPES;
	int i;
	for ( i = 0; i < c ; i++ )
	{
		m_pEffectType->AddItem( NameForEffectType( i ), NULL );
	}

	m_pEffectType->SetText( NameForEffectType( tm->effect ) );
}
void CBaseActionTextMessageStartDialog::FillInFonts()
{
	m_pFontName->AddItem( "TextMessageDefault", NULL );

	KeyValues *schemeFile = new KeyValues( "Fonts" );
	if ( !schemeFile )
		return;

	if ( schemeFile->LoadFromFile( g_pFileSystem, "resource/SourceScheme.res" ) )
	{
		// Iterate fonts
		for (	KeyValues *kv = schemeFile->FindKey("Fonts", true)->GetFirstSubKey(); 
				kv != NULL; 
				kv = kv->GetNextKey() )
		{
			m_pFontName->AddItem( kv->GetName(), NULL );
		}
	}

	schemeFile->deleteThis();
}
Exemplo n.º 4
0
//-----------------------------------------------------------------------------
// Sets up the shader listbox
//-----------------------------------------------------------------------------
void CMaterialEditorPanel::PopulateShaderList()
{
	int iShaderCount = g_pMaterialSystem->GetNumShaders();
	m_pShaderList = new vgui::ComboBox( this, "Shader List", 12, false );

	for (int i = 0; i < iShaderCount; ++i )
	{
		m_pShaderList->AddItem( g_pMaterialSystem->GetShaderName(i), NULL ); 
	}

	m_pShaderList->SortItems();
	m_nShaderIndex = 0;
}