You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
251 lines
6.4 KiB
251 lines
6.4 KiB
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $NoKeywords: $
|
|
//=============================================================================//
|
|
#include "cbase.h"
|
|
#include <mxtk/mx.h>
|
|
#include <stdio.h>
|
|
#include "resource.h"
|
|
#include "EventProperties.h"
|
|
#include "mdlviewer.h"
|
|
#include "StudioModel.h"
|
|
#include "faceposer_models.h"
|
|
|
|
static CEventParams g_Params;
|
|
|
|
class CEventPropertiesSequenceDialog : public CBaseEventPropertiesDialog
|
|
{
|
|
typedef CBaseEventPropertiesDialog BaseClass;
|
|
|
|
public:
|
|
virtual void InitDialog( HWND hwndDlg );
|
|
virtual BOOL HandleMessage( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
|
virtual void SetTitle();
|
|
virtual void ShowControlsForEventType( CEventParams *params );
|
|
virtual void InitControlData( CEventParams *params );
|
|
|
|
private:
|
|
|
|
void PopulateSequenceList( HWND wnd );
|
|
};
|
|
|
|
void CEventPropertiesSequenceDialog::SetTitle()
|
|
{
|
|
SetDialogTitle( &g_Params, "Sequence", "Sequence" );
|
|
}
|
|
|
|
void CEventPropertiesSequenceDialog::PopulateSequenceList( HWND wnd )
|
|
{
|
|
CStudioHdr *hdr = models->GetActiveStudioModel()->GetStudioHdr();
|
|
if (hdr)
|
|
{
|
|
for (int i = 0; i < hdr->GetNumSeq(); i++)
|
|
{
|
|
SendMessage( wnd, CB_ADDSTRING, 0, (LPARAM)hdr->pSeqdesc(i).pszLabel() );
|
|
}
|
|
}
|
|
}
|
|
|
|
void CEventPropertiesSequenceDialog::InitControlData( CEventParams *params )
|
|
{
|
|
BaseClass::InitControlData( params );
|
|
|
|
HWND choices1 = GetControl( IDC_EVENTCHOICES );
|
|
SendMessage( choices1, CB_RESETCONTENT, 0, 0 );
|
|
SendMessage( choices1, WM_SETTEXT , 0, (LPARAM)params->m_szParameters );
|
|
|
|
SendMessage( GetControl( IDC_CHECK_PLAYOVERSCRIPT ), BM_SETCHECK,
|
|
( WPARAM ) g_Params.m_bPlayOverScript ? BST_CHECKED : BST_UNCHECKED,
|
|
( LPARAM )0 );
|
|
|
|
PopulateSequenceList( choices1 );
|
|
}
|
|
|
|
void CEventPropertiesSequenceDialog::InitDialog( HWND hwndDlg )
|
|
{
|
|
m_hDialog = hwndDlg;
|
|
|
|
g_Params.PositionSelf( m_hDialog );
|
|
|
|
// Set working title for dialog, etc.
|
|
SetTitle();
|
|
|
|
// Show/Hide dialog controls
|
|
ShowControlsForEventType( &g_Params );
|
|
InitControlData( &g_Params );
|
|
|
|
UpdateTagRadioButtons( &g_Params );
|
|
|
|
SetFocus( GetControl( IDC_EVENTNAME ) );
|
|
}
|
|
|
|
static CEventPropertiesSequenceDialog g_EventPropertiesSequenceDialog;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose:
|
|
// Input : wnd -
|
|
// *params -
|
|
// Output : static
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void CEventPropertiesSequenceDialog::ShowControlsForEventType( CEventParams *params )
|
|
{
|
|
BaseClass::ShowControlsForEventType( params );
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose:
|
|
// Input : hwndDlg -
|
|
// uMsg -
|
|
// wParam -
|
|
// lParam -
|
|
// Output : static BOOL CALLBACK
|
|
//-----------------------------------------------------------------------------
|
|
static BOOL CALLBACK EventPropertiesSequenceDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|
{
|
|
return g_EventPropertiesSequenceDialog.HandleMessage( hwndDlg, uMsg, wParam, lParam );
|
|
};
|
|
|
|
BOOL CEventPropertiesSequenceDialog::HandleMessage( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|
{
|
|
m_hDialog = hwndDlg;
|
|
|
|
bool handled = false;
|
|
BOOL bret = InternalHandleMessage( &g_Params, hwndDlg, uMsg, wParam, lParam, handled );
|
|
if ( handled )
|
|
return bret;
|
|
|
|
switch(uMsg)
|
|
{
|
|
case WM_PAINT:
|
|
{
|
|
PAINTSTRUCT ps;
|
|
HDC hdc;
|
|
|
|
hdc = BeginPaint(hwndDlg, &ps);
|
|
DrawSpline( hdc, GetControl( IDC_STATIC_SPLINE ), g_Params.m_pEvent );
|
|
EndPaint(hwndDlg, &ps);
|
|
|
|
return FALSE;
|
|
}
|
|
break;
|
|
case WM_VSCROLL:
|
|
{
|
|
RECT rcOut;
|
|
GetSplineRect( GetControl( IDC_STATIC_SPLINE ), rcOut );
|
|
|
|
InvalidateRect( hwndDlg, &rcOut, TRUE );
|
|
UpdateWindow( hwndDlg );
|
|
return FALSE;
|
|
}
|
|
break;
|
|
case WM_INITDIALOG:
|
|
{
|
|
InitDialog( hwndDlg );
|
|
}
|
|
return FALSE;
|
|
|
|
case WM_COMMAND:
|
|
switch (LOWORD(wParam))
|
|
{
|
|
case IDOK:
|
|
{
|
|
HWND control = GetControl( IDC_EVENTCHOICES );
|
|
if ( control )
|
|
{
|
|
SendMessage( control, WM_GETTEXT, (WPARAM)sizeof( g_Params.m_szParameters ), (LPARAM)g_Params.m_szParameters );
|
|
}
|
|
|
|
GetDlgItemText( m_hDialog, IDC_EVENTNAME, g_Params.m_szName, sizeof( g_Params.m_szName ) );
|
|
|
|
if ( !g_Params.m_szName[ 0 ] )
|
|
{
|
|
Q_strncpy( g_Params.m_szName, g_Params.m_szParameters, sizeof( g_Params.m_szName ) );
|
|
}
|
|
|
|
char szTime[ 32 ];
|
|
GetDlgItemText( m_hDialog, IDC_STARTTIME, szTime, sizeof( szTime ) );
|
|
g_Params.m_flStartTime = atof( szTime );
|
|
GetDlgItemText( m_hDialog, IDC_ENDTIME, szTime, sizeof( szTime ) );
|
|
g_Params.m_flEndTime = atof( szTime );
|
|
|
|
// Parse tokens from tags
|
|
ParseTags( &g_Params );
|
|
|
|
EndDialog( hwndDlg, 1 );
|
|
}
|
|
break;
|
|
case IDCANCEL:
|
|
EndDialog( hwndDlg, 0 );
|
|
break;
|
|
case IDC_CHECK_ENDTIME:
|
|
{
|
|
g_Params.m_bHasEndTime = SendMessage( GetControl( IDC_CHECK_ENDTIME ), BM_GETCHECK, 0, 0 ) == BST_CHECKED ? true : false;
|
|
if ( !g_Params.m_bHasEndTime )
|
|
{
|
|
ShowWindow( GetControl( IDC_ENDTIME ), SW_HIDE );
|
|
}
|
|
else
|
|
{
|
|
ShowWindow( GetControl( IDC_ENDTIME ), SW_RESTORE );
|
|
}
|
|
}
|
|
break;
|
|
case IDC_CHECK_RESUMECONDITION:
|
|
{
|
|
g_Params.m_bResumeCondition = SendMessage( GetControl( IDC_CHECK_RESUMECONDITION ), BM_GETCHECK, 0, 0 ) == BST_CHECKED ? true : false;
|
|
}
|
|
break;
|
|
case IDC_CHECK_PLAYOVERSCRIPT:
|
|
{
|
|
g_Params.m_bPlayOverScript = SendMessage( GetControl( IDC_CHECK_PLAYOVERSCRIPT ), BM_GETCHECK, 0, 0 ) == BST_CHECKED ? true : false;
|
|
}
|
|
break;
|
|
case IDC_EVENTCHOICES:
|
|
{
|
|
HWND control = (HWND)lParam;
|
|
if ( control )
|
|
{
|
|
SendMessage( control, WM_GETTEXT, (WPARAM)sizeof( g_Params.m_szParameters ), (LPARAM)g_Params.m_szParameters );
|
|
}
|
|
}
|
|
break;
|
|
case IDC_ABSOLUTESTART:
|
|
{
|
|
g_Params.m_bUsesTag = false;
|
|
UpdateTagRadioButtons( &g_Params );
|
|
}
|
|
break;
|
|
case IDC_RELATIVESTART:
|
|
{
|
|
g_Params.m_bUsesTag = true;
|
|
UpdateTagRadioButtons( &g_Params );
|
|
}
|
|
break;
|
|
}
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose:
|
|
// Input : *view -
|
|
// *actor -
|
|
// Output : int
|
|
//-----------------------------------------------------------------------------
|
|
int EventProperties_Sequence( CEventParams *params )
|
|
{
|
|
g_Params = *params;
|
|
|
|
int retval = DialogBox( (HINSTANCE)GetModuleHandle( 0 ),
|
|
MAKEINTRESOURCE( IDD_EVENTPROPERTIES_SEQUENCE ),
|
|
(HWND)g_MDLViewer->getHandle(),
|
|
(DLGPROC)EventPropertiesSequenceDialogProc );
|
|
|
|
*params = g_Params;
|
|
|
|
return retval;
|
|
}
|