📄 哈夫曼编码译码器view.h
字号:
// 哈夫曼编码译码器View.h : interface of the CMyView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_VIEW_H__69686E8C_9585_4801_9DEB_C426338A5E6E__INCLUDED_)
#define AFX_VIEW_H__69686E8C_9585_4801_9DEB_C426338A5E6E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "HuffmanTree.h"
#include "BinTree3P.h"
class CMyView : public CView
{
protected: // create from serialization only
CMyView();
DECLARE_DYNCREATE(CMyView)
// Attributes
public:
CMyDoc* GetDocument();
public:
int m_nTreeLever; //储存树的层数
int m_nLeverDista; //储存不同层中间的垂直间隔
int m_nHorizoDista; //储存屏幕宽度的一般 即根节点的横坐标
public:
void DrawTree(CHuffmanTree & pTree,CDC* pDC); //用于画出整个树
void DrawTreNode(CBinTreNode<int> *pNode,int x,int y,int nLeverNow,int nHoriDisNow, CDC * pDC);
//画出一个节点,并递归调用自己从而画出整个树。
void AnalyzeTree();
//调用analyzeNode函数分析树的层数,并储存在treeLever中,同时计算并储存m_nLeverDista。
void AnalyzeNode(CBinTreNode<int> *pNode,int nLeverNow);
//递归调用自己,遍历整个树,如果nLeverNow> m_nTreeLever
//则m_nTreeLever = nLeverNow;且每次递归调用自己时层数加1;
void DrawOtherInfo(CHuffmanTree & pTree,CDC* pDC);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CMyView)
afx_msg void OnMenuitemEncode();
afx_msg void OnMenuitemTran();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in 哈夫曼编码译码器View.cpp
inline CMyDoc* CMyView::GetDocument()
{ return (CMyDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VIEW_H__69686E8C_9585_4801_9DEB_C426338A5E6E__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -