#pragma once

#define _MX_INVALID_FILEID -2

// -------------------------------------------------------------------------
// Summary:
// 		申明自定义实体类的类信息，该宏对类信息的函数做了申明，如isA,desc,cast,rxInit等函数
// -------------------------------------------------------------------------
#define MCRX_DECLARE_MEMBERS(CLASS_NAME,ENTITY_VERSION) \
public:	\
	virtual const McRxClass* isA() const; \
	static  McRxClass* gpDesc; \
	static  McRxClass* desc(); \
	static CLASS_NAME* cast(const McRxObject* inPtr) \
		{ return ((inPtr == NULL) || !inPtr->isKindOf(CLASS_NAME::desc())) \
		? NULL : (CLASS_NAME*)inPtr; }; \
		static void rxInit(LPCMSTR pszDxf0 = NULL,short lFileId = _MX_INVALID_FILEID,LPCMSTR pszAppName = NULL,bool isDynamicRegen = false,short iEntityVersion = ENTITY_VERSION); \


#define MCDB_DECLARE_MEMBERS(CLASSNAME) \
public: \
	MCRX_DECLARE_MEMBERS(CLASSNAME,1)

#define MCDB_DECLARE_MEMBERS2(CLASSNAME,ENTITY_VERSION) \
public: \
	MCRX_DECLARE_MEMBERS(CLASSNAME,ENTITY_VERSION)

// -------------------------------------------------------------------------
// Summary:
// 		该宏实现自定义实体类的类信息代码
// -------------------------------------------------------------------------
#define MCRX_DEFINE_MEMBERS(CLASS_NAME) \
	 McRxClass* CLASS_NAME::desc() \
{ \
	if (CLASS_NAME::gpDesc != NULL) \
	return CLASS_NAME::gpDesc; \
	return CLASS_NAME::gpDesc \
	= Mx::ClassDictionaryAt(MxString(#CLASS_NAME)); \
} \
	 const McRxClass* CLASS_NAME::isA() const \
{ \
	return CLASS_NAME::desc(); \
} \
	 McRxClass* CLASS_NAME::gpDesc = NULL;

//:Ignore
#if defined(_INCLUDE_MXDRAW_KERNEL) || defined(_MXDEFINE_ARX_SYSTEMENTITY)


// 该宏用于有些类的构造函数是保护成员，不需要用create动态创建对象的
#define MCRX_NO_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_DEFINE_MEMBERS(CLASS_NAME); \
	void CLASS_NAME::rxInit(LPCMSTR pszDxf0 /*= NULL*/,short lFileId /*= 0*/,LPCMSTR pszAppName /*= NULL*/,bool isDynamicRegen /*=false*/,short iEntityVersion) { \
	if (CLASS_NAME::gpDesc != NULL) \
	return; \
	CLASS_NAME::gpDesc = Mx::innerNewMcRxClass(MxString(#CLASS_NAME), MxString(#PARENT_CLASS) ,NULL,pszDxf0,true,lFileId,pszAppName,isDynamicRegen,iEntityVersion); \
}

// 该宏用于需要用create动态创建对象的
#define MCRX_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_DEFINE_MEMBERS(CLASS_NAME); \
	static McRxObject * make##CLASS_NAME() { return new CLASS_NAME(); } \
	void CLASS_NAME::rxInit(LPCMSTR pszDxf0 /*= NULL*/,short lFileId /*= 0*/,LPCMSTR pszAppName /*= NULL*/,bool isDynamicRegen /*=false*/,short iEntityVersion) { \
	if (CLASS_NAME::gpDesc != NULL) \
	return; \
	CLASS_NAME::gpDesc = Mx::innerNewMcRxClass(MxString(#CLASS_NAME), MxString(#PARENT_CLASS), \
	&make##CLASS_NAME,pszDxf0,true,lFileId,pszAppName,isDynamicRegen,iEntityVersion); \
}


// 该宏用于需要用create动态创建对象的,并且实体需要存入到dwg,dxf图中的,所以我们
// 很多时候都使用这个宏
#define MCRX_DXF_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS); \


#define MCRX_DXF_DEFINE_MEMBERS_EX2(CLASS_NAME,PARENT_CLASS,SET_MODIFY_FALG) \
	MCRX_DEFINE_MEMBERS(CLASS_NAME); \
	static McRxObject * make##CLASS_NAME() { return new CLASS_NAME(); } \
	void CLASS_NAME::rxInit(LPCMSTR pszDxf0 /*= NULL*/,short lFileId /*= 0*/,LPCMSTR pszAppName /*= NULL*/,bool isDynamicRegen /*=false*/,short iEntityVersion) { \
	if (CLASS_NAME::gpDesc != NULL) \
	return; \
	CLASS_NAME::gpDesc = Mx::innerNewMcRxClass(MxString(#CLASS_NAME), MxString(#PARENT_CLASS), \
	&make##CLASS_NAME,pszDxf0,SET_MODIFY_FALG,lFileId,pszAppName,isDynamicRegen,iEntityVersion); \
}



#define MCDB_NO_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_NO_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS)

#define MCDB_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS)

#define MCDB_DXF_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_DXF_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS)

#endif
//:End Ignore



// -------------------------------------------------------------------------
// Summary:
// 		该宏实现自定义实体类的类信息代码，并实了动态创建函数
// -------------------------------------------------------------------------

#define MCDB_CUSTOM_DECLARE_MEMBERS(CLASSNAME) \
public: \
	MCRX_DECLARE_MEMBERS(CLASSNAME,1)

#define MCDB_CUSTOM_DECLARE_MEMBERS2(CLASSNAME,ENTITY_VERSION) \
public: \
	MCRX_DECLARE_MEMBERS(CLASSNAME,ENTITY_VERSION)


#define MCRX_CUSTOM_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS,DWG_VERSION,	\
	MAINTENANCE_VERSION,PROXY_FLAGS,DXF_NAME,APP)	\
	MCRX_DEFINE_MEMBERS(CLASS_NAME); \
	static McRxObject * make##CLASS_NAME() { return new CLASS_NAME(); } \
	void CLASS_NAME::rxInit(LPCMSTR pszDxf0 /*= NULL*/,short lFileId /*= -2*/,LPCMSTR pszAppName /*= NULL*/,bool isDynamicRegen /*=false*/,short iEntityVersion) { \
	if (CLASS_NAME::gpDesc != NULL) \
	return; \
	CLASS_NAME::gpDesc = Mx::newMcRxClass(MxString(#CLASS_NAME), MxString(#PARENT_CLASS), \
	DWG_VERSION,MAINTENANCE_VERSION,PROXY_FLAGS,&make##CLASS_NAME,	\
	pszDxf0 == NULL ? _MXT(#DXF_NAME) : pszDxf0,pszAppName == NULL ? _MXT(#APP) : pszAppName ,isDynamicRegen, iEntityVersion); \
}


#define MCRX_CUSTOM_NO_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_DEFINE_MEMBERS(CLASS_NAME); \
	void CLASS_NAME::rxInit(LPCMSTR pszDxf0 /*= NULL*/,short lFileId /*= -2*/,LPCMSTR pszAppName /*= NULL*/,bool isDynamicRegen /*=false*/,short iEntityVersion) { \
	if (CLASS_NAME::gpDesc != NULL) \
	return; \
	CLASS_NAME::gpDesc = Mx::newMcRxClass(MxString(#CLASS_NAME), MxString(#PARENT_CLASS) ,NULL,pszDxf0,pszAppName,isDynamicRegen, iEntityVersion); \
	}

#define MCRX_CUSTOM_CONS_DEFINE_MEMBERS(CLASS_NAME,PARENT_CLASS) \
	MCRX_DEFINE_MEMBERS(CLASS_NAME); \
	static McRxObject * make##CLASS_NAME() { return new CLASS_NAME(); } \
	void CLASS_NAME::rxInit(LPCMSTR pszDxf0 /*= NULL*/,short lFileId /*= -2*/,LPCMSTR pszAppName /*= NULL*/,bool isDynamicRegen /*=false*/,short iEntityVersion) { \
	if (CLASS_NAME::gpDesc != NULL) \
	return; \
	CLASS_NAME::gpDesc = Mx::newMcRxClass(MxString(#CLASS_NAME), MxString(#PARENT_CLASS), \
	&make##CLASS_NAME,pszDxf0,pszAppName,isDynamicRegen, iEntityVersion); \
}


#define MX_ENTITY_FILEID_START_1 0
#define MX_ENTITY_FILEID_START_2 200
#define MX_ENTITY_FILEID_START_3 300
#define MX_ENTITY_FILEID_START_4 400
#define MX_ENTITY_FILEID_START_5 500
#define MX_ENTITY_FILEID_START_6 600
//:Ignore



#define Mdesk_Boolean_is_bool

#define eNotImplemented eNotImplementedYet

#define CurrentDatabase mcdbHostApplicationServices()->workingDatabase

#define AD_INIT_FILE _MXT("adinit.dat")

#define MCRX_COMMAND_DOCK  	_MXT("MCAD_REGISTERED_COMMANDS")
//:End Ignore

// -------------------------------------------------------------------------
// Summary:
// 		随层字符串宏
// -------------------------------------------------------------------------
#define LINETYPE_NAME_BYLAYER _MXT("ByLayer")

// -------------------------------------------------------------------------
// Summary:
// 		随块字符串宏
// -------------------------------------------------------------------------
#define LINETYPE_NAME_BYBLOCK _MXT("ByBlock")

// -------------------------------------------------------------------------
// Summary:
// 		实线名宏定义
// -------------------------------------------------------------------------
#define LINETYPE_NAME_CONTINUOUS _MXT("Continuous")

// -------------------------------------------------------------------------
// Summary:
// 		Image字典名宏定义
// -------------------------------------------------------------------------
#define MCAD_IMAGE_DICT_NAME _MXT("ACAD_IMAGE_DICT")

// -------------------------------------------------------------------------
// Summary:
// 		动态加载对象名宏定义
// -------------------------------------------------------------------------
#define MCRX_DYNAMIC_LINKER  _MXT("DynamicLinker")

// -------------------------------------------------------------------------
// Summary:
// 		编辑事件管理者名称宏定义
// -------------------------------------------------------------------------
#define MCED_EDITOR_OBJ		_MXT("AcEditor")

// -------------------------------------------------------------------------
// Summary:
// 		无捕捉
// -------------------------------------------------------------------------
#define OsModeInvalid      0

// -------------------------------------------------------------------------
// Summary:
// 		端点捕捉
// -------------------------------------------------------------------------
#define OsModeEnd          1
// -------------------------------------------------------------------------
// Summary:
// 		中点捕捉
// -------------------------------------------------------------------------
#define OsModeMid          2
// -------------------------------------------------------------------------
// Summary:
// 		圆心点捕捉
// -------------------------------------------------------------------------
#define OsModeCen          4
// -------------------------------------------------------------------------
// Summary:
// 		节点捕捉
// -------------------------------------------------------------------------
#define OsModeNode         8
// -------------------------------------------------------------------------
// Summary:
// 		象限点捕捉
// -------------------------------------------------------------------------
#define OsModeQuad         16 
// -------------------------------------------------------------------------
// Summary:
// 		交点捕捉
// -------------------------------------------------------------------------
#define OsModeInt          32
// -------------------------------------------------------------------------
// Summary:
// 		插入点捕捉
// -------------------------------------------------------------------------
#define OsModeIns          64
// -------------------------------------------------------------------------
// Summary:
// 		垂足点捕捉
// -------------------------------------------------------------------------
#define OsModePerp         128
// -------------------------------------------------------------------------
// Summary:
// 		切点捕捉
// -------------------------------------------------------------------------
#define OsModeTan          256
// -------------------------------------------------------------------------
// Summary:
// 		最近点捕捉
// -------------------------------------------------------------------------
#define OsModeNear         512

// -------------------------------------------------------------------------
// Summary:
// 		外观交点捕捉
// -------------------------------------------------------------------------
#define OsModeApp          2048
// -------------------------------------------------------------------------
// Summary:
// 		延伸点捕捉
// -------------------------------------------------------------------------
#define OsModeExt          4096
// -------------------------------------------------------------------------
// Summary:
// 		平行点捕捉
// -------------------------------------------------------------------------
#define OsModePar          8192

// -------------------------------------------------------------------------
// Summary:
// 		捕捉关闭
// -------------------------------------------------------------------------
#define OsModeOff          16384

//:Ignore
#define OsModeSInvalidLastPoint  1			// 对上一点的值设置成无效。


#define OsModeSTempDisable       2          // 临时禁用捕捉.

#define OsModeOrthoTempDisable   4          // 临时禁用正交捕捉。

#define OsModeSInvalidLastMovePoint 8		// 上一次的鼠标移动点设置成无效

#define OsModePoloarTempDisable  16         // 临时禁用极轴跟踪

#define OsModeDynTraceTempDisable 32        // 临时禁用动态跟踪

#define OsModeGridSnapTempDisable 64		// 临时禁用栅格捕捉
//:End Ignore

//:Ignore
// 窗口内的鼠标消息是否需要引起退出程序
#define WM_MOUSE_EVENT_NOEXIT_MESSAGE_CYCLE WM_USER + 434


#define MX_INVALID_INCOORD_MAX 10E18
#define MX_INVALID_INCOORD_MIN -10E18


// 函数标记
#define MCRX_FUN_NOFLAG				 0x00000000 
#define MCRX_FUN_SERVERJSCALL        0x00000001  // 该函数只用于后端服务js程序调用,没有设置时，该命令只用来后台c++程序调用。



//:End Ignore


//:Ignore

#define MCRX_CMD_MODAL  		0x00000000
#define MCRX_CMD_TRANSPARENT	0x00000001
#define MCRX_CMD_USEPICKSET		0x00000002
#define MCRX_CMD_REDRAW	        0x00000004
#define MCRX_CMD_NOPERSPECTIVE  0x00000008
#define MCRX_CMD_NOMULTIPLE     0x00000010
#define MCRX_CMD_NOTILEMODE     0x00000020
#define MCRX_CMD_NOPAPERSPACE   0x00000040 
#define MCRX_CMD_PLOTONLY       0x00000080 
#define MCRX_CMD_NOOEM          0x00000100
#define MCRX_CMD_UNDEFINED      0x00000200
#define MCRX_CMD_INPROGRESS     0x00000400
#define MCRX_CMD_DEFUN          0x00000800
#define MCRX_CMD_NONEWSTACK     0x00010000 
#define MCRX_CMD_NOINTERNALLOCK 0x00020000
#define MCRX_CMD_NOMADIC        0x00040000
#define MCRX_CMD_DOCREADLOCK       0x00080000
#define MCRX_CMD_DOCEXCLUSIVELOCK  0x00100000
#define MCRX_CMD_SESSION           0x00200000

#define MCRX_MAX_CMDNAME_LEN  	64
#define MCRX_CMD_NO_UNDO_MARKER    0x01000000
#define MCRX_CMD_NOPRV			   0x04000000	// 不把该命令放入前一个命令名变量中
#define MCRX_CMD_MXDRAWX_DOCOMMAND 0x10000000	// MxDrawX.ocx的DoCommand 命令。
#define MCRX_CMD_SYNC_READWRITE_THREAD   0x20000000   // 正在多线程状态下，读取写文件时，是否还能执行该命令.
#define MCRX_CMD_MULT_THREAD   0x40000000   // 该命令是否在多线程下运行.

#define ACRX_CMD_MODAL  	    0x00000000
#define ACRX_CMD_TRANSPARENT	0x00000001
#define ACRX_CMD_USEPICKSET	    0x00000002
#define ACRX_CMD_REDRAW	        0x00000004
#define ACRX_CMD_NOPERSPECTIVE     0x00000008 
#define ACRX_CMD_NOMULTIPLE     0x00000010
#define ACRX_CMD_NOTILEMODE     0x00000020
#define ACRX_CMD_NOPAPERSPACE   0x00000040
#define ACRX_CMD_PLOTONLY       0x00000080
#define ACRX_CMD_NOOEM          0x00000100
#define ACRX_CMD_UNDEFINED      0x00000200
#define ACRX_CMD_INPROGRESS     0x00000400
#define ACRX_CMD_DEFUN          0x00000800
#define ACRX_CMD_NONEWSTACK     0x00010000
#define ACRX_CMD_NOINTERNALLOCK 0x00020000
#define ACRX_CMD_DOCREADLOCK       0x00080000
#define ACRX_CMD_DOCEXCLUSIVELOCK  0x00100000
#define ACRX_CMD_SESSION           0x00200000
#define ACRX_CMD_INTERRUPTIBLE	   0x00400000


#define ACRX_CMD_NOHISTORY	   0x00800000
#define ACRX_CMD_NO_UNDO_MARKER    0x01000000
#define ACRX_CMD_NOBEDIT        0x02000000

#define ACRX_CMD_NOPRV			   0x04000000	// 不把该命令放入前一个命令名变量中。

#define ACRX_CMD_NOCLEAR_SELECT      0x08000000   // 命令执行开始时，不清除选对象的夹点和高亮显示，命令结束时，不清空当前选择集。

//:End Ignore
