//
//	Copyright © Nemetschek North America, Inc  2005.
//	All Rights Reserved.


#ifdef _WINDOWS
# include <Windows.h>
# include <GSWinSDK.h>	// Graphsoft Required.
#else
# ifdef _DEBUG
#  include "GSBug.h"
# else
#include "GSRELEASE.h"
# endif
#endif

////////////////////////////////////////////////////////////////
// VW SDK
#include <MCCoordTypes.h>
#include <MiniCadHookIntf.h>
#include <GSESetup.h>
#include <MiniCadCallBacks.h>
#include <GSString.h>
#include <GSTypes.h>
#include <MCMatrix.h>

#include <RecordHandler.h>
#include <ExtendedProperties.h>

////////////////////////////////////////////////////////////////
// STL
#include <vector>
#include <map>
#include <fstream>

// provide STL memory allocator for VW type memory for the plug-ins
namespace std
{
	// vw memory allocatorfor objects of class _Ty
	template<class _Ty> class vwallocator
	{
	public:
		typedef _Ty 				value_type;


		typedef value_type*			pointer;
		typedef value_type& 		reference;
		typedef const value_type*	const_pointer;
		typedef const value_type& 	const_reference;

		typedef size_t				size_type;
		typedef ptrdiff_t			difference_type;

		template<class _Other> struct rebind {	// convert an vwallocator<_Ty> to an vwallocator <_Other>
			typedef vwallocator<_Other> other;
 		};

		pointer address(reference _Val) const {	// return address of mutable _Val
			return (&_Val);
		}

		const_pointer address(const_reference _Val) const {	// return address of nonmutable _Val
			return (&_Val);
		}

		vwallocator() {	// construct default vwallocator (do nothing)
		}

		vwallocator(const vwallocator<_Ty>&) {	// construct by copying (do nothing)
		}

		template<class _Other> vwallocator(const vwallocator<_Other>&) {	// construct from a related vwallocator (do nothing)
		}

		template<class _Other> vwallocator<_Ty>& operator=(const vwallocator<_Other>&) {	// assign from a related vwallocator (do nothing)
			return (*this);
		}

		void deallocate(pointer _Ptr, size_type) {	// deallocate object at _Ptr, ignore size
			//operator delete(_Ptr);
			::GS_DisposePtr( gCBP, _Ptr );
		}

		pointer allocate(size_type _Count) {	// allocate array of _Count elements
			//return (_Allocate(_Count, (pointer)0));
			return (pointer) ::GS_NewPtr( gCBP, _Count * sizeof (_Ty) );
		}

		pointer allocate(size_type _Count, const void*) {	// allocate array of _Count elements, ignore hint
			return (allocate(_Count));
		}

		void construct(pointer _Ptr, const _Ty& _Val) {	// construct object at _Ptr with value _Val
			_Construct(_Ptr, _Val);
		}

		void destroy(pointer _Ptr)	{	// destroy object at _Ptr
			_Destroy(_Ptr);
		}

		size_type max_size() const	{	// estimate maximum array size
			size_type _Count = (size_type)(-1) / sizeof (_Ty);
			return (0 < _Count ? _Count : 1);
		}
	};
}




////////////////////////////////////////////////////////////////
// VWUI library
#include <VWUI.h>

using namespace VectorWorks::VWUI;


// -------------------------------------------------------------------------------
// VCOM standard interfaces
#include <VWInterfaces.h>


// -------------------------------------------------------------------------------
// VCOM standard interfaces
#include <VWInterfaces.h>


////////////////////////////////////////////////////////////////
// Plug-in specific
