Leaked source code of windows server 2003
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.

109 lines
4.3 KiB

  1. #if !defined(CTRL__Sequence_h__INCLUDED)
  2. #define CTRL__Sequence_h__INCLUDED
  3. #pragma once
  4. #if ENABLE_MSGTABLE_API
  5. //------------------------------------------------------------------------------
  6. class DuSequence :
  7. public SequenceImpl<DuSequence, SListener>
  8. {
  9. // Construction
  10. public:
  11. inline DuSequence();
  12. inline ~DuSequence();
  13. // Public API
  14. public:
  15. dapi HRESULT ApiOnEvent(EventMsg * pmsg);
  16. dapi HRESULT ApiAddRef(Sequence::AddRefMsg *) { AddRef(); return S_OK; }
  17. dapi HRESULT ApiRelease(Sequence::ReleaseMsg *) { Release(); return S_OK; }
  18. dapi HRESULT ApiGetLength(Sequence::GetLengthMsg * pmsg);
  19. dapi HRESULT ApiGetDelay(Sequence::GetDelayMsg * pmsg);
  20. dapi HRESULT ApiSetDelay(Sequence::SetDelayMsg * pmsg);
  21. dapi HRESULT ApiGetFlow(Sequence::GetFlowMsg * pmsg);
  22. dapi HRESULT ApiSetFlow(Sequence::SetFlowMsg * pmsg);
  23. dapi HRESULT ApiGetFramePause(Sequence::GetFramePauseMsg * pmsg);
  24. dapi HRESULT ApiSetFramePause(Sequence::SetFramePauseMsg * pmsg);
  25. dapi HRESULT ApiGetKeyFrameCount(Sequence::GetKeyFrameCountMsg * pmsg);
  26. dapi HRESULT ApiAddKeyFrame(Sequence::AddKeyFrameMsg * pmsg);
  27. dapi HRESULT ApiRemoveKeyFrame(Sequence::RemoveKeyFrameMsg * pmsg);
  28. dapi HRESULT ApiRemoveAllKeyFrames(Sequence::RemoveAllKeyFramesMsg * pmsg);
  29. dapi HRESULT ApiFindKeyFrame(Sequence::FindKeyFrameMsg * pmsg);
  30. dapi HRESULT ApiGetTime(Sequence::GetTimeMsg * pmsg);
  31. dapi HRESULT ApiSetTime(Sequence::SetTimeMsg * pmsg);
  32. dapi HRESULT ApiGetKeyFrame(Sequence::GetKeyFrameMsg * pmsg);
  33. dapi HRESULT ApiSetKeyFrame(Sequence::SetKeyFrameMsg * pmsg);
  34. dapi HRESULT ApiGetInterpolation(Sequence::GetInterpolationMsg * pmsg);
  35. dapi HRESULT ApiSetInterpolation(Sequence::SetInterpolationMsg * pmsg);
  36. dapi HRESULT ApiPlay(Sequence::PlayMsg * pmsg);
  37. dapi HRESULT ApiStop(Sequence::StopMsg * pmsg);
  38. dapi HRESULT ApiReset(Sequence::ResetMsg * pmsg);
  39. dapi HRESULT ApiGotoTime(Sequence::GotoTimeMsg * pmsg);
  40. // Implementation
  41. protected:
  42. inline void AddRef();
  43. inline void Release();
  44. void RemoveAllKeyFrames();
  45. inline void SortKeyFrames();
  46. static int __cdecl CompareItems(const void * pva, const void * pvb);
  47. void FindAtTime(float flTime, int * pidxKeyFrame) const;
  48. void ResetSubject(Visual * pgvSubject, int idxFrame);
  49. inline BOOL IsPlaying() const;
  50. HRESULT QueueAnimation(int idxKeyFrame);
  51. HRESULT BuildAnimation(int idxKeyFrame);
  52. void Stop(BOOL fKillAnimations = TRUE);
  53. static void CALLBACK
  54. ActionProc(GMA_ACTIONINFO * pmai);
  55. UINT CALLBACK
  56. OnAnimationComplete(EventMsg * pmsg);
  57. HRESULT CheckComplete() const;
  58. #if DBG
  59. BOOL DEBUG_IsProperTimeOrder() const;
  60. #endif
  61. // Data
  62. protected:
  63. struct SeqData
  64. {
  65. float flTime; // Time of current keyframe
  66. DUser::KeyFrame *
  67. pkf; // Information for this KeyFrame
  68. Interpolation * pipol; // Interpolation to next KeyFrame
  69. };
  70. struct AniData
  71. {
  72. DuSequence * pseq; // Owning Sequence
  73. int idxFrame; // 1st KeyFrame of specific Animation
  74. HACTION hact; // Action of outstanding Animation
  75. };
  76. UINT m_cRef; // Reference count
  77. float m_flDelay; // Delay before starting animation
  78. Flow * m_pflow; // Flow used between keyframes
  79. Visual * m_pgvSubject; // Visual being animated
  80. int m_cQueuedAni; // Outstanding queued animations
  81. DWORD m_dwFramePause; // Generic frame pause
  82. GArrayF<SeqData>
  83. m_arSeqData;
  84. GArrayF<AniData>
  85. m_arAniData;
  86. };
  87. #endif // ENABLE_MSGTABLE_API
  88. #include "Sequence.inl"
  89. #endif // CTRL__Sequence_h__INCLUDED