#pragma once

//#include "TabKits.h"

#include "ElemView.h"

#include <indx\Picture.h>
#include <indx\Shape.h>

 
//#include "SubEditor.h"
//#include "SelectBox.h"
//#define WM_SIGHT_DBLCLK   (WM_USER + 1506)



class CNCCLS_API  CGlobalView :	public CElemView
{
public:
	CGlobalView(void);
	virtual ~CGlobalView(void);

	enum
	{
		SM_DEFAULT = 0 ,  //导航navi
		SM_EDIT  ,        //编辑cncobj
		SM_RUN,           //运行
	};

	virtual BOOL Create(HWND hParentWnd, const char* strWindowName, int sightWidth, int sightHeight, GRect& rect);
	virtual void Destroy();
	 
	virtual void Refresh(REFRESH_TYPE type);

 
	void SetSpotVisible(BOOL bVisible, BOOL bRefresh) ;
	BOOL IsSpotVisible() { return m_bSpotBoxVisible; };


	 void SetPosMark(int index, CUCObj* hIndicater, BOOL bRefresh);
	 void ClearPosMark(BOOL bRefresh);
	 
	 void SetPosMarkVisible(BOOL bVisible, BOOL bRefresh);
	 BOOL IsPosMarkVisible() { return m_bPosMarkVisible; };

	//void SetOriginSize(int cx, int cy);
	//void GetOriginPos(int &x, int& y);
	//void SetOriginAppearance(RvRgba color, int thick);
	void SetSpotAppearance(RvRgba color, int thick, BOOL bRefresh);

	 

	void SetSubMode(int mode,BOOL bRefresh =FALSE);
	int GetSubMode(){ return m_nSubMode; };

	void  SetSpotSize(int cx, int cy,BOOL bRefresh =FALSE);
	GSize GetSpotSize(void);

    void SetSpotPos(int x, int y,BOOL bRefresh =FALSE);

	//void Relayout(BOOL bRefresh=TRUE);


public:
	//CAxisView* m_pSubEditor;

	BOOL   m_bScrollCanvas;

	CShape   m_selectRect;  //选择矩形
	RvPoint  m_prevPos, m_curPos;

	CMark   m_spotMark;   //当前主轴视场对应的区域

	/////显示定位区域和状态
	//CPicture m_picMark1;  //显示
	//CPicture m_picMark2;  //显示
	//显示十字线，用于矩阵复制
	CUCObj*    m_pPos1Mark;
	CUCObj*    m_pPos2Mark;
	CUCObj*    m_pPos3Mark;

	//CLabel   m_lblName;
	 
	//virtual BOOL EventProc(RV_HANDLE hObj, UINT uEvent, WPARAM wParam, LPARAM lParam);
	virtual BOOL MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam , LRESULT* pResult);


protected :
	BOOL  HandleDefaultMsg( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam , LRESULT* pResult);
private:
	 void DrawSelectRect(HGDC dc, BOOL bForce);
	 void DrawSpotMark(HGDC dc, BOOL bForce);

 
	 //显示位置图
	 void DrawPosMark(HGDC dc, BOOL bForce);

private:
	//RvImage m_image;
	//RvImage m_imVert;  //垂直以后的图像
	BOOL    m_bSelecting;

	//RvPoint_f64* m_pPt;
	int m_nSubMode;

	//m_prevPos
 	
	BOOL    m_bPosMarkVisible;
	BOOL    m_bLocater2Visible;
	 
	BOOL    m_bSelectRectVisible; 	
//	 BOOL    m_bTitleLabelVisible;
	BOOL    m_bSpotBoxVisible;
	 
	
};

