#pragma once //#include "IDE.h" #include "drawobj.h" #include "graph.h" #include "IDEDoc.h" #define VIEW_USE_THREAD 0 class CIDEView : public CScrollView { protected: // create from serialization only CIDEView(); DECLARE_DYNCREATE(CIDEView) // Attributes public: CIDEDoc* GetDocument(); UINT m_nID; CPoint m_pointMouse; CPoint m_startPoint,m_endPoint; //起始点 CPoint m_lastPoint; //上一个点 BOOL m_bMove; //能移动否 BOOL m_bMoveElements; //是否有可移动的东西; BOOL m_mouseState; BOOL m_bHandle; BOOL m_bModified; CGraph* m_pGraph; CDrawObjList m_selection; CDrawObjList m_freezed; CDrawObjList m_copied; CDrawObjList m_deleted; CDrawObj * m_tempObj; CDrawObj * m_pCurActionObj; // 用来响应动作的当前图元; int m_nCurActionType; // 当前响应的动作类型,为了清除某些动作效果; int nDragHandle; //图元句柄,标识鼠标位置 int nBDragHandle; //保持 BOOL m_bDrag; BOOL m_bFreezed; //冻结状态 BOOL m_bRectSelect; //区选 CRect m_mouseRect; //字体 int m_nRudoPosition; //undo位置 int m_nCanUndoTimes; //可以undo数 int m_nCanRedoTimes; //可以redo数 bool m_bPolygon; CTime m_tblTime; #if VIEW_USE_THREAD HANDLE m_hIDEViewRunObject; HANDLE m_hFreshGraphThread; CRITICAL_SECTION m_csFreshGraph; HANDLE m_hFreshGraphObject; static DWORD WINAPI CIDEView::FreshGraphThread( void *pData ); #endif // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CIDEView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView); //}}AFX_VIRTUAL // Implementation public: void SetHisTime(CTime time); void ChangeView(); CDrawObj * CreateDrawObjbyNo(int objNo); virtual ~CIDEView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif void KeyMove(int x1,int y1,int x2,int y2); BOOL IsSelected(CDrawObj* pDrawObj); void Select(CDrawObj* pObj, BOOL bAdd); void Remove(CDrawObj* pObj); CDrawObj* ObjectAt(CPoint point); void RefreshScrollSizes(void); CRect GetAlignRect(void); void ObjectIn(); //区域选 void ExchangeSave(); //有改动记录 void FileProcess(); //undo redo后,处理临时文件的改名 protected: private: CString RegSearch(HKEY hKey, TCHAR rootKey[], CString path,CString sContent); void ShowOCX( CRect rect,CString sOcxPath,int iIndex,CString sPageName ); CWnd m_OcxWnd; bool m_bOcxCreate; CString GetClsidbyName( CString sName ); public: bool m_bIsHaveOCX; // Generated message map functions protected: //{{AFX_MSG(CIDEView) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnDestroy(); afx_msg void OnEditUnfreeze(); afx_msg void OnEditPaste(); afx_msg void OnEditMovetofront(); afx_msg void OnEditMovetoback(); afx_msg void OnEditHinvert(); afx_msg void OnEditFreeze(); afx_msg void OnEditCut(); afx_msg void OnEditCopy(); afx_msg void OnEditDelete(); afx_msg void OnDeskGrid(); afx_msg void OnAlignTop(); afx_msg void OnAlignVcenter(); afx_msg void OnAlignRight(); afx_msg void OnAlignLeft(); afx_msg void OnAlignHcenter(); afx_msg void OnAlignBottom(); afx_msg void OnEditVinvert(); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnPointer(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnFileNew(); afx_msg void OnFileOpen(); afx_msg void OnFileSave(); afx_msg void OnFileSaveAs(); afx_msg void OnAppExit(); afx_msg void OnUpdateDeskGrid(CCmdUI* pCmdUI); afx_msg void OnUpdateEditFreeze(CCmdUI* pCmdUI); afx_msg void OnRedo(); afx_msg void OnUndo(); afx_msg void OnUpdateUndo(CCmdUI* pCmdUI); afx_msg void OnUpdateRedo(CCmdUI* pCmdUI); afx_msg void OnPicsize(); afx_msg void OnUpdateAlignBottom(CCmdUI* pCmdUI); afx_msg void OnUpdateAlignHcenter(CCmdUI* pCmdUI); afx_msg void OnUpdateAlignLeft(CCmdUI* pCmdUI); afx_msg void OnUpdateAlignRight(CCmdUI* pCmdUI); afx_msg void OnUpdateAlignTop(CCmdUI* pCmdUI); afx_msg void OnUpdateAlignVcenter(CCmdUI* pCmdUI); afx_msg void OnUpdateEditHinvert(CCmdUI* pCmdUI); afx_msg void OnUpdateEditMovetoback(CCmdUI* pCmdUI); afx_msg void OnUpdateEditMovetofront(CCmdUI* pCmdUI); afx_msg void OnUpdateEditVinvert(CCmdUI* pCmdUI); afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI); afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI); afx_msg void OnUpdateEditClear(CCmdUI* pCmdUI); afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI); afx_msg void OnDrawTline(); afx_msg void OnDrawText(); afx_msg void OnDrawRect(); afx_msg void OnDrawData(); afx_msg void OnDraw3drect(); afx_msg void OnDraw3circle(); afx_msg void OnUpdatePointer(CCmdUI* pCmdUI); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnUpdateDraw3circle(CCmdUI* pCmdUI); afx_msg void OnUpdateDraw3drect(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawData(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawText(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawTline(CCmdUI* pCmdUI); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnEditSave(); afx_msg void OnUpdateEditSave(CCmdUI* pCmdUI); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnUpdateDrawRect(CCmdUI* pCmdUI); afx_msg void OnUpdatePicsize(CCmdUI* pCmdUI); afx_msg void OnDrawBitmap(); afx_msg void OnUpdateDrawBitmap(CCmdUI* pCmdUI); afx_msg void OnDrawCurve(); afx_msg void OnUpdateDrawCurve(CCmdUI* pCmdUI); afx_msg void OnDrawWatch(); afx_msg void OnUpdateDrawWatch(CCmdUI* pCmdUI); afx_msg void OnDrawBar(); afx_msg void OnUpdateDrawBar(CCmdUI* pCmdUI); afx_msg void OnVerspace(); afx_msg void OnUpdateVerspace(CCmdUI* pCmdUI); afx_msg void OnSamewidth(); afx_msg void OnUpdateSamewidth(CCmdUI* pCmdUI); afx_msg void OnSameheight(); afx_msg void OnUpdateSameheight(CCmdUI* pCmdUI); afx_msg void OnHorspace(); afx_msg void OnUpdateHorspace(CCmdUI* pCmdUI); afx_msg void OnAllsame(); afx_msg void OnUpdateAllsame(CCmdUI* pCmdUI); afx_msg void OnOpenpic(); afx_msg void OnDrawArc(); afx_msg void OnDrawBreaker(); afx_msg void OnDrawFan(); afx_msg void OnDrawGrid(); afx_msg void OnDrawHiscurve(); afx_msg void OnDrawLine(); afx_msg void OnDrawPie(); afx_msg void OnDrawPipe(); afx_msg void OnDrawPolygon(); afx_msg void OnDrawReport(); afx_msg void OnDrawSinglebar(); afx_msg void OnDrawTransfer(); afx_msg void OnDrawYpipe(); afx_msg void OnDrawZheline(); afx_msg void OnDrawZhepipe(); afx_msg void OnDrawArrow(); afx_msg void OnDrawEllipse(); afx_msg void OnDrawSwitch(); afx_msg void OnCombine(); afx_msg void OnDiscombine(); afx_msg void OnDrawRoundrect(); afx_msg void OnDrawOCX(); afx_msg void OnDrawGIF(); afx_msg void OnDrawFlash(); afx_msg void OnDrawBtnRadio(); afx_msg void OnDrawBtnCheck(); afx_msg void OnUpdateDrawSwitch(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawArc(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawArrow(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawBreaker(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawEllipse(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawFan(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawGrid(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawHiscurve(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawPie(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawPipe(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawPolygon(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawReport(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawSinglebar(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawTransfer(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawYpipe(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawZheline(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawZhepipe(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawLine(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawRoundrect(CCmdUI* pCmdUI); afx_msg void OnUpdateDiscombine(CCmdUI* pCmdUI); afx_msg void OnUpdateCombine(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawOCX(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawGIF(CCmdUI* pCmdUI); afx_msg void OnUpdateDrawFlash(CCmdUI* pCmdUI); //}}AFX_MSG afx_msg long OnOutbarNotify(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() public: afx_msg void OnProperty(); afx_msg void OnUpdateProperty(CCmdUI *pCmdUI); afx_msg void OnEditVar(); afx_msg void OnUpdateEditVar(CCmdUI *pCmdUI); afx_msg void OnRealTimeCurve(); afx_msg void OnUpdateRealTimeCurve(CCmdUI *pCmdUI); afx_msg void OnClose(); afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg void OnSetFocus(CWnd* pOldWnd); void FileSave(); protected: virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView); BOOL IsValidChar(char chr); CString GetVarNameFromGS( CString sGS ); public: afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point); CString m_sVarName; }; #ifndef _DEBUG // debug version in VectorView.cpp inline CIDEDoc* CIDEView::GetDocument() { return (CIDEDoc*)m_pDocument; } #endif