WaveEditDoc.cpp
上传用户:samlee1007
上传日期:2007-01-02
资源大小:123k
文件大小:4k
- // WaveEditDoc.cpp : implementation of the CWaveEditDoc class
- //
- #include "stdafx.h"
- #include "WaveEdit.h"
- #include "WaveEditDoc.h"
- #include "WaveEditView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CWaveEditDoc
- IMPLEMENT_DYNCREATE(CWaveEditDoc, CDocument)
- BEGIN_MESSAGE_MAP(CWaveEditDoc, CDocument)
- //{{AFX_MSG_MAP(CWaveEditDoc)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- BEGIN_DISPATCH_MAP(CWaveEditDoc, CDocument)
- //{{AFX_DISPATCH_MAP(CWaveEditDoc)
- DISP_FUNCTION(CWaveEditDoc, "ShowApp", ShowApp, VT_EMPTY, VTS_NONE)
- DISP_FUNCTION(CWaveEditDoc, "HideApp", HideApp, VT_EMPTY, VTS_NONE)
- DISP_FUNCTION(CWaveEditDoc, "ShowWindow", ShowWindow, VT_EMPTY, VTS_NONE)
- DISP_FUNCTION(CWaveEditDoc, "SetCursor", SetCursor, VT_EMPTY, VTS_NONE)
- DISP_FUNCTION(CWaveEditDoc, "SetPlay", SetPlay, VT_EMPTY, VTS_NONE)
- DISP_FUNCTION(CWaveEditDoc, "SetPause", SetPause, VT_EMPTY, VTS_NONE)
- DISP_FUNCTION(CWaveEditDoc, "SetStop", SetStop, VT_EMPTY, VTS_NONE)
- DISP_FUNCTION(CWaveEditDoc, "IsWaveEnd", IsWaveEnd, VT_BOOL, VTS_NONE)
- //}}AFX_DISPATCH_MAP
- END_DISPATCH_MAP()
- static const IID IID_IWaveEdit =
- { 0x618031a7, 0x6a68, 0x11d2, { 0xb4, 0xad, 0xde, 0xc1, 0xca, 0xfe, 0x5b, 0x54 } };
- BEGIN_INTERFACE_MAP(CWaveEditDoc, CDocument)
- INTERFACE_PART(CWaveEditDoc, IID_IWaveEdit, Dispatch)
- END_INTERFACE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CWaveEditDoc construction/destruction
- CWaveEditDoc::CWaveEditDoc()
- {
- EnableAutomation();
- AfxOleLockApp();
- m_bSvrTimerStopped = FALSE;
- m_bAppClosed = FALSE;
- }
- CWaveEditDoc::~CWaveEditDoc()
- {
- AfxOleUnlockApp();
- }
- BOOL CWaveEditDoc::OnNewDocument()
- {
- if (!CDocument::OnNewDocument())
- return FALSE;
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CWaveEditDoc serialization
- void CWaveEditDoc::Serialize(CArchive& ar)
- {
- if (ar.IsStoring())
- {
- }
- else
- {
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- // CWaveEditDoc diagnostics
- #ifdef _DEBUG
- void CWaveEditDoc::AssertValid() const
- {
- CDocument::AssertValid();
- }
- void CWaveEditDoc::Dump(CDumpContext& dc) const
- {
- CDocument::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CWaveEditDoc commands
- void CWaveEditDoc::ShowApp()
- {
- CWaveEditApp* pApp = (CWaveEditApp*)AfxGetApp();
- pApp->ShowApp(SW_SHOW);
-
- }
- void CWaveEditDoc::HideApp()
- {
- CWaveEditApp* pApp = (CWaveEditApp*)AfxGetApp();
- pApp->ShowApp(SW_HIDE);
- }
- void CWaveEditDoc::ShowWindow()
- {
- // Display the view
- POSITION pos = GetFirstViewPosition();
- CView* pV = GetNextView(pos);
- if (pV != NULL)
- {
- CFrameWnd* pFrame = pV->GetParentFrame();
- if (pFrame != NULL)
- pFrame->ActivateFrame(SW_SHOW);
- }
-
- UpdateAllViews(NULL);
- }
- void CWaveEditDoc::SetCursor()
- {
- POSITION pos = GetFirstViewPosition();
- CWaveEditView* pView = (CWaveEditView*)GetNextView(pos);
- pView->SetCursor();
- }
- void CWaveEditDoc::SetPlay()
- {
- POSITION pos = GetFirstViewPosition();
- CWaveEditView* pView = (CWaveEditView*)GetNextView(pos);
- m_bSvrTimerStopped = FALSE;
- pView->SetPlay();
- }
- void CWaveEditDoc::SetPause()
- {
- POSITION pos = GetFirstViewPosition();
- CWaveEditView* pView = (CWaveEditView*)GetNextView(pos);
- pView->SetPause();
- }
- void CWaveEditDoc::SetStop()
- {
- POSITION pos = GetFirstViewPosition();
- CWaveEditView* pView = (CWaveEditView*)GetNextView(pos);
- pView->SetStop();
- }
- BOOL CWaveEditDoc::IsWaveEnd()
- {
- if (m_bSvrTimerStopped || m_bAppClosed)
- return TRUE;
- else
- return FALSE;
- }