书上找到的

源代码在线查看: 毕业设计数字逻辑电子仿真器view.h

软件大小: 296 K
上传用户: struggle10000
关键词:
下载地址: 免注册下载 普通下载 VIP

相关代码

				// 毕业设计数字逻辑电子仿真器View.h : interface of the CMyView class
				//
				/////////////////////////////////////////////////////////////////////////////
				
				#if !defined(AFX_VIEW_H__DFA71A0B_8CB1_11D8_903B_000795A52E88__INCLUDED_)
				#define AFX_VIEW_H__DFA71A0B_8CB1_11D8_903B_000795A52E88__INCLUDED_
				
				#if _MSC_VER > 1000
				#pragma once
				#endif // _MSC_VER > 1000
				
				#include 
				
				
					enum Mytype
					{
						Node,
						Gate,
						Digital
					};
				
					enum MySubtype
					{
						Input,
						Output,
						ANDGate,
						ORGate,
						NOTGate,
						NORGate,
						NANDGate,
						XORGate,
						RSDigital,
						JKDigital
					};
				enum Myput
				{
					Input_1,
					Input_2,
					Output_1
				};
				enum MyStatus 
				{
					NONE,
					ANDGATE,
					ORGATE,
					NOTGATE,
					NORGATE,
					NANDGATE,
					XORGATE,
					RSDIGITAL,
					JKDIGITAL,
					NODEINPUT,
					NODEOUTPUT
				};
				
				typedef struct tagMyNode
				{
					//物件类型
					Mytype type;
					//物件子类型
					MySubtype Subtype;
					//输入端1,2
					tagMyNode* input1;
					tagMyNode* input2;
					//输出端1,2
					tagMyNode* output1;
					tagMyNode* output2;
					//输入端input1的值
					UINT input1value;
					//输入端input2的值
					UINT input2value;
					//输出端output1的值
					UINT output1value;
					//当前已经有几个输入端有值
					int inputs;
					//对于输入结点的序号
					int number;
					//记录物件左上角位置
					CPoint Orgpoint;
					//记录物件宽度
					int width;
					//记录物件高度
					int height;
					//
				
				
				
				
				}MyNode;
				class CMyView : public CView
				{
				protected: // create from serialization only
					CMyView();
					DECLARE_DYNCREATE(CMyView)
				
				// Attributes
				public:
					CMyDoc* GetDocument();
				
				// 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:
					virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
					virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
					virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
					//}}AFX_VIRTUAL
				
				// Implementation
				public:
					void SetInputValue();
					void beginCalculate();
					UINT gatefunction(MyNode* pNode);
					int CalculateResult();
					void moveoutredrawline();
					void redrawnum();
					void LinkLineRedraw(CPoint startpoint,CPoint point);
					void RealLink();
					void DrawLinkLine(CArray* pPointArray);
					void recordLine();
					void LineLink();
					BOOL IsTwoObjectsCanLink();
					BOOL IsPutLinked();
					BOOL IsInArea(CPoint point);
					CPoint GetCirclePoint(Myput put);
					BOOL IsInOutput1(CPoint point);
					BOOL IsInInput2(CPoint point);
					BOOL IsInInput1(CPoint point);
					void EraserMyCircle();
					void DrawMyCircle();
					void LinkStatusDraw(CPoint point);
					BOOL IsPointInPut(CPoint point);
					BOOL IsPointInObject(CPoint point);
					void lineRedraw(CPoint startpoint,CPoint point);
					void redrawMyObject(MyNode* pNode);
					void CreateMyObject(Mytype type,MySubtype Subtype,CPoint point);
					void DrawObject(CPoint point,UINT nID);
					
					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 OnLButtonDown(UINT nFlags, CPoint point);
					afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
					afx_msg void OnMouseMove(UINT nFlags, CPoint point);
					afx_msg void OnAndgate();
					afx_msg void OnJkdigital();
					afx_msg void OnNandgate();
					afx_msg void OnNorgate();
					afx_msg void OnNotgate();
					afx_msg void OnOrgate();
					afx_msg void OnRsdigital();
					afx_msg void OnXorgate();
					afx_msg void OnNone();
					afx_msg void OnNodeinput();
					afx_msg void OnNodeoutput();
					afx_msg void OnSize(UINT nType, int cx, int cy);
					afx_msg void OnBegin();
					//}}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__DFA71A0B_8CB1_11D8_903B_000795A52E88__INCLUDED_)
							

相关资源