⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compressdemodoc.cpp

📁 < VC++编程宝典> 编程必备,适合初学者!
💻 CPP
字号:
// CompressDemoDoc.cpp : implementation of the CCompressDemoDoc class
//

#include "stdafx.h"
#include "CompressDemo.h"

#include "CompressDemoDoc.h"
#include "CompressDemoView.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCompressDemoDoc

IMPLEMENT_DYNCREATE(CCompressDemoDoc, CDocument)

BEGIN_MESSAGE_MAP(CCompressDemoDoc, CDocument)
	//{{AFX_MSG_MAP(CCompressDemoDoc)
	ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
	ON_COMMAND(ID_HUFFMAN, OnHuffman)
	ON_UPDATE_COMMAND_UI(ID_HUFFMAN, OnUpdateHuffman)
	ON_COMMAND(ID_LZSS, OnLzss)
	ON_UPDATE_COMMAND_UI(ID_LZSS, OnUpdateLzss)
	ON_COMMAND(ID_LZW, OnLzw)
	ON_UPDATE_COMMAND_UI(ID_LZW, OnUpdateLzw)
	ON_COMMAND(ID_NONE, OnNone)
	ON_UPDATE_COMMAND_UI(ID_NONE, OnUpdateNone)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCompressDemoDoc construction/destruction

CCompressDemoDoc::CCompressDemoDoc()
{

	m_nCompressionSelected = 2;

}

CCompressDemoDoc::~CCompressDemoDoc()
{
}

BOOL CCompressDemoDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CCompressDemoDoc serialization

void CCompressDemoDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
	}
	else
	{
	}
}

/////////////////////////////////////////////////////////////////////////////
// CCompressDemoDoc diagnostics

#ifdef _DEBUG
void CCompressDemoDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CCompressDemoDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CCompressDemoDoc commands

extern char szFilter[];
extern CFileDialog FileDlg;

void CCompressDemoDoc::OnFileSaveAs() 
{

	if( FileDlg.DoModal () == IDOK ){

		CMainFrame *pFrame = (CMainFrame *) AfxGetApp()->m_pMainWnd;
		BOOL max;
		CMDIChildWnd *pChild = pFrame->MDIGetActive( &max );
	
		if( pChild != NULL ){
			CCompressDemoView *pView = (CCompressDemoView *) pChild->GetActiveView();
			CString PathName = FileDlg.GetPathName ();
			pView->OnFileSaveAs( PathName );
			}
		}

}

void CCompressDemoDoc::OnHuffman() 
{

	m_nCompressionSelected = 0;

}

void CCompressDemoDoc::OnUpdateHuffman(CCmdUI* pCmdUI) 
{

	pCmdUI->SetCheck( m_nCompressionSelected == 0 );

}

void CCompressDemoDoc::OnLzss() 
{

	m_nCompressionSelected = 1;

}

void CCompressDemoDoc::OnUpdateLzss(CCmdUI* pCmdUI) 
{

	pCmdUI->SetCheck( m_nCompressionSelected == 1 );

}

void CCompressDemoDoc::OnLzw() 
{

	m_nCompressionSelected = 2;

}

void CCompressDemoDoc::OnUpdateLzw(CCmdUI* pCmdUI) 
{

	pCmdUI->SetCheck( m_nCompressionSelected == 2 );

}

void CCompressDemoDoc::OnNone() 
{

	m_nCompressionSelected = -1;

}

void CCompressDemoDoc::OnUpdateNone(CCmdUI* pCmdUI) 
{

	pCmdUI->SetCheck( m_nCompressionSelected == -1 );

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -