//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // 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; }
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: // 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; }
//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // 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 ); }
//----------------------------------------------------------------------------- // 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; }