123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- #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; // 左键状态:TRUE=DOWN; FALSE=UP;
- 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 m_nDragHandle; // 图元句柄,标识鼠标位置;
- int m_nBDragHandle; // 保持;
- BOOL m_bDrag; // 是否拖动(点在图元中,鼠标按住 + 鼠标移动 = 拖动);
- BOOL m_bFreezed; // 冻结状态;
- BOOL m_bRectSelect; // 是否区选(区域的起点和终点都不在图元内容, 鼠标按住 + 鼠标移动 = 区选);
- CRect m_mouseRect;
- // 字体;
- int m_nRudoPosition; // 撤销位置;
- int m_nCanUndoTimes; // 可以撤销的次数;
- int m_nCanRedoTimes; // 可以重做的次数;
- 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
|