コード例 #1
0
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( );
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionScreenFadeStartDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionScreenFadeStartDialog.res" );

	BaseClass::Init();

	ScreenFade_t const *f = GetAction()->GetScreenFade();

	float duration = f->duration * (1.0f/(float)(1<<SCREENFADE_FRACBITS));
	float holdTime = f->holdTime * (1.0f/(float)(1<<SCREENFADE_FRACBITS));
	int fadein = f->fadeFlags & FFADE_IN;
	int fadeout = f->fadeFlags & FFADE_OUT;
	int fademodulate = f->fadeFlags & FFADE_MODULATE;
	int fadestayout = f->fadeFlags & FFADE_STAYOUT;
	int fadepurge = f->fadeFlags & FFADE_PURGE;
	int r = f->r;
	int g = f->g;
	int b = f->b;
	int a = f->a;

	m_pDuration->SetText( va( "%.3f", duration ) );
	m_pHoldTime->SetText( va( "%.3f", holdTime ) );
	m_pColor->SetText( va( "%i %i %i %i", r, g, b, a ) );
	m_pFFADE_IN->SetSelected( fadein );
	m_pFFADE_OUT->SetSelected( fadeout );
	m_pFFADE_MODULATE->SetSelected( fademodulate );
	m_pFFADE_STAYOUT->SetSelected( fadestayout );
	m_pFFADE_PURGE->SetSelected( fadepurge );

}
コード例 #3
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionZoomDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char sz[ 512 ];
	m_pFinalFOV->GetText( sz, sizeof( sz ) );
	float f = (float)atof( sz );

	if ( GetAction()->m_flFinalFOV != f )
	{
		bret = true;
		GetAction()->m_flFinalFOV = f;
	}

	m_pOutRate->GetText( sz, sizeof( sz ) );
	f = (float)atof( sz );

	if ( GetAction()->m_flFOVRateOut != f )
	{
		bret = true;
		GetAction()->m_flFOVRateOut = f;
	}

	m_pInRate->GetText( sz, sizeof( sz ) );
	f = (float)atof( sz );

	if ( GetAction()->m_flFOVRateIn != f )
	{
		bret = true;
		GetAction()->m_flFOVRateIn = f;
	}

	m_pHoldTime->GetText( sz, sizeof( sz ) );
	f = (float)atof( sz );

	if ( GetAction()->m_flHoldTime != f )
	{
		bret = true;
		GetAction()->m_flHoldTime = f;
	}

	if ( m_pSpline->IsSelected() != GetAction()->m_bSpline )
	{
		bret = true;
		GetAction()->m_bSpline = m_pSpline->IsSelected();
	}

	if ( m_pStayout->IsSelected() != GetAction()->m_bStayout )
	{
		bret = true;
		GetAction()->m_bStayout = m_pStayout->IsSelected();
	}

	return bret;
}
コード例 #4
0
//-----------------------------------------------------------------------------
// 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 ) );
}
コード例 #5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionZoomDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionZoomDialog.res" );

	BaseClass::Init();

	m_pFinalFOV->SetText( va( "%f", GetAction()->m_flFinalFOV ) );
	m_pOutRate->SetText( va( "%f", GetAction()->m_flFOVRateOut ) );
	m_pInRate->SetText( va( "%f", GetAction()->m_flFOVRateIn ) );
	m_pHoldTime->SetText( va( "%f", GetAction()->m_flHoldTime ) );

	m_pSpline->SetSelected( GetAction()->m_bSpline );
	m_pStayout->SetSelected( GetAction()->m_bStayout );
}
コード例 #6
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionWithStopTimeDialog::Init( void )
{
	BaseClass::Init();

	if ( GetAction()->m_bUsingStopFrame )
	{
		m_pStopType->SetText( "TimeUseFrame" );
		m_pStop->SetText( va( "%i", GetAction()->m_nStopFrame ) );
	}
	else
	{
		m_pStopType->SetText( "TimeUseClock" );
		m_pStop->SetText( va( "%.3f", GetAction()->m_flStopTime ) );
	}
}
コード例 #7
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionWithStopTimeDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char stoptype[ 512 ];
	m_pStopType->GetText( stoptype, sizeof( stoptype ) );

	char stop[ 512 ];
	m_pStop->GetText( stop, sizeof( stop ) );

	float fstop = (float)atof( stop );
	int	 istop = (int)atoi( stop );

	if ( !Q_strcasecmp( stoptype, "TimeUseFrame" ) )
	{
		if ( GetAction()->m_nStopFrame != istop )
		{
			bret = true;
			GetAction()->SetStopFrame( istop );
			GetAction()->SetStopTime( -1.0f );
		}
	}
	else
	{
		if ( GetAction()->m_flStopTime != fstop )
		{
			bret = true;
			GetAction()->SetStopTime( fstop );
			GetAction()->SetStopFrame( -1 );
		}
	}

	return bret;
}
コード例 #8
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionSkipAheadDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char skiptype[ 512 ];
	m_pSkipType->GetText( skiptype, sizeof( skiptype ) );

	char skipto[ 512 ];
	m_pSkip->GetText( skipto, sizeof( skipto ) );

	float fskip = (float)atof( skipto );
	int	 iskip = (int)atoi( skipto );

	if ( !Q_strcasecmp( skiptype, "TimeUseTick" ) )
	{
		if ( GetAction()->m_nSkipToTick != iskip )
		{
			bret = true;
			GetAction()->SetSkipToTick( iskip );
			GetAction()->SetSkipToTime( -1.0f );
		}
	}
	else
	{
		if ( GetAction()->m_flSkipToTime != fskip )
		{
			bret = true;
			GetAction()->SetSkipToTime( fskip );
			GetAction()->SetSkipToTick( -1 );
		}
	}

	return bret;
}
コード例 #9
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionSkipAheadDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionSkipAheadDialog.res" );

	BaseClass::Init();

	if ( GetAction()->m_bUsingSkipTick )
	{
		m_pSkipType->SetText( "TimeUseTick" );
		m_pSkip->SetText( va( "%i", GetAction()->m_nSkipToTick ) );
	}
	else
	{
		m_pSkipType->SetText( "TimeUseClock" );
		m_pSkip->SetText( va( "%.3f", GetAction()->m_flSkipToTime ) );
	}
}
コード例 #10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionPlayCommandsDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionPlayCommandsDialog.res" );

	BaseClass::Init();

	m_pCommands->SetText( GetAction()->GetCommandStream() );
}
コード例 #11
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionCDTrackStartDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionCDTrackStartDialog.res" );

	BaseClass::Init();

	m_pTrackNumber->SetText( va( "%i", GetAction()->GetTrack() ) );
}
コード例 #12
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionPlaySoundStartDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionPlaySoundStartDialog.res" );

	BaseClass::Init();

	m_pSoundName->SetText( GetAction()->GetSoundName() );
}
コード例 #13
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionPauseDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionPauseDialog.res" );

	BaseClass::Init();

	m_pPauseTime->SetText( va( "%f", GetAction()->GetPauseTime() ) );

}
コード例 #14
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseActionChangePlaybackRateDialog::Init( void )
{
	LoadControlSettings( "resource\\BaseActionPlaybackRateDialog.res" );

	BaseClass::Init();

	m_pRate->SetText( va( "%f", GetAction()->GetPlaybackRate() ) );

}
コード例 #15
0
//-----------------------------------------------------------------------------
// command handler
//-----------------------------------------------------------------------------
void CAddPresetDialog::OnCommand( const char *command )
{
	if ( !Q_stricmp( command, "OK" ) )
	{
		int nTextLength = m_pInput->GetTextLength() + 1;
		char* txt = (char*)_alloca( nTextLength * sizeof(char) );
		m_pInput->GetText( txt, nTextLength );

		nTextLength = m_pPresetGroup->GetTextLength() + 1;
		char* pPresetGroupName = (char*)_alloca( nTextLength * sizeof(char) );
		m_pPresetGroup->GetText( pPresetGroupName, nTextLength );

		KeyValues *pCurrentGroup = m_pPresetGroup->GetActiveItemUserData();
		CDmePresetGroup *pPresetGroup = pCurrentGroup ? GetElementKeyValue<CDmePresetGroup>( pCurrentGroup, "presetGroup" ) : NULL;
		if ( pPresetGroup && Q_stricmp( pPresetGroup->GetName(), pPresetGroupName ) )
		{
			pPresetGroup = NULL;
		}
		KeyValues *kv = new KeyValues( "PresetNameSelected", "text", txt );
		kv->SetString( "presetGroupName", pPresetGroupName );
		SetElementKeyValue( kv, "presetGroup", pPresetGroup );

		if ( m_pContextKeyValues )
		{
			kv->AddSubKey( m_pContextKeyValues );
			m_pContextKeyValues = NULL;
		}
		PostActionSignal( kv );
		CloseModal();
		return;
	}

	if ( !Q_stricmp( command, "Cancel") )
	{
		CloseModal();
		return;
	}

	BaseClass::OnCommand( command );
}
コード例 #16
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionPlayCommandsDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char commands[ 512 ];
	m_pCommands->GetText( commands, sizeof( commands ) );

	if ( Q_strcasecmp( commands, GetAction()->GetCommandStream() ) )
	{
		bret = true;
		GetAction()->SetCommandStream( commands );
	}

	return bret;
}
コード例 #17
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionPlaySoundStartDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char soundname[ 512 ];
	m_pSoundName->GetText( soundname, sizeof( soundname ) );

	if ( Q_strcasecmp( soundname, GetAction()->GetSoundName() ) )
	{
		bret = true;
		GetAction()->SetSoundName( soundname );
	}

	return bret;
}
コード例 #18
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionCDTrackStartDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char track[ 512 ];
	m_pTrackNumber->GetText( track, sizeof( track ) );
	int itrack = atoi( track );

	if ( itrack != GetAction()->GetTrack() )
	{
		bret = true;
		GetAction()->SetTrack( itrack );
	}

	return bret;
}
コード例 #19
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionChangePlaybackRateDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char rate[ 512 ];
	m_pRate->GetText( rate, sizeof( rate ) );

	float frate = (float)atof( rate );

	if ( GetAction()->GetPlaybackRate() != frate )
	{
		bret = true;
		GetAction()->SetPlaybackRate( frate );
	}

	return bret;
}
コード例 #20
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionPauseDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char pausetime[ 512 ];
	m_pPauseTime->GetText( pausetime, sizeof( pausetime ) );

	float ftime = (float)atof( pausetime );

	if ( GetAction()->GetPauseTime() != ftime )
	{
		bret = true;
		GetAction()->SetPauseTime( ftime );
	}

	return bret;
}
コード例 #21
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CBaseActionTextMessageStartDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	client_textmessage_t *tm = GetAction()->GetTextMessage();
	bret |= SaveDifferingFloat( m_pFadeInTime, &tm->fadein );
	bret |= SaveDifferingFloat( m_pFadeOutTime, &tm->fadeout );
	bret |= SaveDifferingFloat( m_pHoldTime, &tm->holdtime );
	bret |= SaveDifferingFloat( m_pFXTime, &tm->fxtime );

	bret |= SaveDifferingFloat( m_pX, &tm->x );
	bret |= SaveDifferingFloat( m_pY, &tm->y );

	bret |= SaveDifferingColor( m_pColor1, &tm->r1, &tm->g1, &tm->b1, &tm->a1 );
	bret |= SaveDifferingColor( m_pColor2, &tm->r2, &tm->g2, &tm->b2, &tm->a2 );

	char sz[ 1024 ];
	m_pEffectType->GetText( sz, sizeof( sz ) );
	int iEffect = EffectTypeForName( sz );
	if ( iEffect != tm->effect )
	{
		tm->effect = iEffect;
		bret = true;
	}

	m_pMessageText->GetText( sz, sizeof( sz ) );
	if ( Q_strcasecmp( sz, GetAction()->GetMessageText() ) )
	{
		GetAction()->SetMessageText( sz );
		bret = true;
	}

	m_pFontName->GetText( sz, sizeof( sz ) );
	if ( Q_strcasecmp( sz, GetAction()->GetFontName() ) )
	{
		GetAction()->SetFontName( sz );
		bret = true;
	}
	return bret;
}
コード例 #22
0
void CBaseActionPlaySoundStartDialog::OnFileSelected( char const *fullpath )
{
	if ( !fullpath || !fullpath[ 0 ] )
		return;

	char relativepath[ 512 ];
	g_pFileSystem->FullPathToRelativePath( fullpath, relativepath );

	COM_FixSlashes( relativepath );

	char *soundname = relativepath;
	if ( !Q_strnicmp( relativepath, "sound\\", strlen( "sound\\" ) ) )
	{
		soundname += strlen( "sound\\" );
	}

	m_pSoundName->SetText( soundname );

	if ( m_hFileOpenDialog )
	{
		m_hFileOpenDialog->MarkForDeletion();
	}
}
コード例 #23
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CBaseActionScreenFadeStartDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	// Grab current settings
	ScreenFade_t *f = GetAction()->GetScreenFade();

	float duration = f->duration * (1.0f/(float)(1<<SCREENFADE_FRACBITS));
	float holdTime = f->holdTime * (1.0f/(float)(1<<SCREENFADE_FRACBITS));
	bool fadein = f->fadeFlags & FFADE_IN;
	bool fadeout = f->fadeFlags & FFADE_OUT;
	bool fademodulate = f->fadeFlags & FFADE_MODULATE;
	bool fadestayout = f->fadeFlags & FFADE_STAYOUT;
	bool fadepurge = f->fadeFlags & FFADE_PURGE;
	int r = f->r;
	int g = f->g;
	int b = f->b;
	int a = f->a;

	char sz[ 512 ];
	m_pDuration->GetText( sz, sizeof( sz ) );
	if ( (float)atof( sz ) != duration )
	{
		bret = true;
		f->duration = (unsigned short)((float)(1<<SCREENFADE_FRACBITS) * (float)atof( sz ) );
	}
	m_pHoldTime->GetText( sz, sizeof( sz ) );
	if ( (float)atof( sz ) != holdTime )
	{
		bret = true;
		f->holdTime = (unsigned short)((float)(1<<SCREENFADE_FRACBITS) * (float)atof( sz ) );
	}

	int rr, gg, bb, aa;
	m_pColor->GetText( sz, sizeof( sz ) );
	if ( 4 == sscanf( sz, "%i %i %i %i", &rr, &gg, &bb, &aa ) )
	{
		rr = clamp( rr, 0, 255 );
		gg = clamp( gg, 0, 255 );
		bb = clamp( bb, 0, 255 );
		aa = clamp( aa, 0, 255 );

		if ( rr != r || gg != g || bb != b || aa != a )
		{
			bret = true;
			f->r = rr;
			f->g = gg;
			f->b = bb;
			f->a = aa;
		}
	}

	if ( CheckFlagDifference( m_pFFADE_IN, fadein, FFADE_IN ) )
	{
		bret = true;
	}
	if ( CheckFlagDifference( m_pFFADE_OUT, fadeout, FFADE_OUT ) )
	{
		bret = true;
	}
	if ( CheckFlagDifference( m_pFFADE_MODULATE, fademodulate, FFADE_MODULATE ) )
	{
		bret = true;
	}
	if ( CheckFlagDifference( m_pFFADE_STAYOUT, fadestayout, FFADE_STAYOUT ) )
	{
		bret = true;
	}
	if ( CheckFlagDifference( m_pFFADE_PURGE, fadepurge, FFADE_PURGE ) )
	{
		bret = true;
	}
	
	return bret;
}