#pragma once #include "acgi.h" #ifdef EARTHWORM_EXPORT #define DLLIMPEXP __declspec(dllexport) #else #define DLLIMPEXP __declspec(dllimport) #endif class CGsPreviewCtrl; class DLLIMPEXP CBlkRecsPreviewList : public CWnd { public: CBlkRecsPreviewList(); virtual ~CBlkRecsPreviewList(); public: BOOL Create(const RECT& rect, CWnd* pParentWnd, UINT nID = 0xffff); // 初始化 nCount 为Add方法设置 BOOL Init(HMODULE hRes,int nRows,int nCols,int m_nCount = -1); // 擦除视口 -1 : ALL void Clear(int nIndex = -1); // 添加实体到view BOOL Add(AcDbEntity* pEnt,int nIndex,AcDbExtents* pExtAll = NULL); BOOL Add(LPCTSTR pszDwgFile,LPCTSTR pszName); BOOL Add(LPCTSTR pszDwgFile,LPCTSTR pszShowRc,LPCTSTR pszName); // 预览db的特定以 特定字符串 开头的块 BOOL PreViewNamedRecs(LPCTSTR pszDwgFile,LPCTSTR pszHead = NULL); // 获取选择的索引 rec 名称 BOOL GetCurSelRec(CString& sRecName); // 获取选择的索引 rec 名称 BOOL GetCurSelRec(CString& sDwgFile,CString& sRecName); // 获取选择的索引 int GetCurSelIndex(); void Redraw(AcDbExtents* pExtAll = NULL,int nGsViewIndex = -1); void ZoomExtent(AcGsView* pView,AcDbExtents* pExtAll); void ZoomExtent(int nGsViewIndex,AcDbExtents* pExtAll); public: //{{AFX_VIRTUAL(CBlkRecsPreviewList) //}}AFX_VIRTUAL protected: //{{AFX_MSG(CBlkRecsPreviewList) afx_msg void OnPaint(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnDestroy(); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); //}}AFX_MSG DECLARE_MESSAGE_MAP() protected: // 销毁所有的gs对象 void DestroyAll(); // 计算或画单元 void DrawGridCell(CDC* pDC,CArray& arCells); int HitViewCell(CPoint point); void SetShowViewPort(CArray& arCells); void DrawCurselCell(CDC* pDC); //nIndex 为 DC 的坐标的 cell 索引 CRect GetCellIndexRect(int nIndex); bool GetActiveViewPortInfo (ads_real &height, ads_real &width, AcGePoint3d &target, AcGeVector3d &viewDir, ads_real &viewTwist, bool getViewCenter); Acad::ErrorStatus InitDrawingControl (CGsPreviewCtrl* pPreViewCtrl,AcDbDatabase *pDb, const TCHAR *space = ACDB_MODEL_SPACE); void SetViewTo(AcGsView *pView, AcDbDatabase *pDb, AcGeMatrix3d& viewMat); void RefreshView(AcGsView *pView); protected: AcGsManager* m_pManager; #if (ARX > 19) AcGsGraphicsKernel *m_pFactory; #else AcGsClassFactory *m_pFactory; #endif AcGsDevice* m_pDevice; CStringArray m_arRecNames; int m_nRows; int m_nCols; int m_nCurSel; int m_nIDAdd; static int s_nSpace; CStringArray m_arDwgFiles; CPtrArray m_arViewPtrs; CPtrArray m_arModelPtrs; CPtrArray m_arDbPtrs; BOOL m_bInit; };