// SharedDefines.h 
//
// Copyright 1999 Diehl Graphsoft, Inc.
// All Rights Reserved.
//
// Preprocessor stuff that is common to ALL modules of the project.
// This file has companion files for the separate modules:
//		Core:  Core/Source/CoreDefines.h
//		Shell: Include/Common/ShellDefines.h
//
// IMPORTANT:  ALL FILES IN THE PROJECT MUST INCLUDE THIS DIRECTLY OR INDIRECTLY!!!
//
// Started by David Bowman on 11/3/1999.
//

#pragma once
#if _WINDOWS
#ifdef _SHAREDDEFINES_
	#error Error: SharedDefines.h should not be included more than once FOR ANY REASON.
#endif
#endif
#define _SHAREDDEFINES_


/////////////////////////////////////////////////////////////////////////////////////////
// The following flags should be set in the Windows projects' settings or in the
//  Mac projects' Hdr.Xxxx.YY.Zzz.h files to indicate the type of build desired.
//
// RELEASE_BLD, PROFILE_BLD, BETA_BLD, DEV_BLD, SPCDEV_BLD:
//                : Define exactly one of these (and undefine others) to specify
//					the type of the build.  NETBUG, BUG, and TEST are then defined
//					according to which build type is selected (see below).
//
// EXTERNAL_BUILD : Define to 1 to build a version for external distribution--this
//					will ensure that all debugging is off. Undefine or define to 0 to
//					build any internal version.  [Windows only.  Mac uses a distinct
//					XXX_BLD #define for each build version, and Windows will be migrated
//					to that method.  MFH 01/2000]
//
// MPLUS          : Define to 1 if building the VectorWorks application;
//					undefine if building VectorWorks Lt or Azimuth.
//
// AZIM           : Define to 1 if building the Azimuth application;
//					undefine if building VectorWorks or VectorWorks Lt.
//
// _MINICAD_      : Define to 1 if building the main VectorWorks-family application;
//					undefine if not (building plug-ins, SDK, etc.).
//
// _WIN_EXTERNAL_ : Automatically defined to be 1 if building a Windows-based
//					external; automatically undefined if not.
//
// _MFC_EXTERNAL_ :	Automatically defined to be 1 if building an MFC-based
//					Windows external; automatically undefined if not.
//
/////////////////////////////////////////////////////////////////////////////////////////

// this is included very early so it has a chance to pre-define almost anthing
// AutoBuildControl.h does nothing except when special configurations are
// called for by the auto build machine. When this is necessary, AutoBuildControl.h
// is completely overwritten by a generated file which sets flags as appropriate.

#include "AutoBuildControl.h"

/////////////////////////////////////////////////////////////////////////////////////////
// Platform Variables




#if _WINDOWS
	#define GS_WIN				1
	#define GS_MAC				0
	
	#define GS_MAC_MACHO		0
	#define GS_MAC_CFM			0
	
	#define GS_LITTLE_ENDIAN	1
	#define GS_BIG_ENDIAN		0

	#define GS_MAC_IDE_XCODE_3_0 0
	#define GS_MAC_IDE_XCODE_2_5 0

#elif __GNUC__ || TARGET_OS_MAC
	#define GS_WIN				0
	#define GS_MAC				1

	#if __GNUC__
		#define GS_MAC_MACHO	1
		#define GS_MAC_CFM		0
	#else
		#define GS_MAC_MACHO	0
		#define GS_MAC_CFM		1
	#endif

	#if __APPLE_CC__ < 5442
		#define GS_MAC_IDE_XCODE_3_0 0
		#define GS_MAC_IDE_XCODE_2_5 1
	#else
		#define GS_MAC_IDE_XCODE_3_0 1
		#define GS_MAC_IDE_XCODE_2_5 0
	#endif

	#if __LITTLE_ENDIAN__
		#define GS_LITTLE_ENDIAN 1
		#define GS_BIG_ENDIAN	 0
	#else
		#define GS_LITTLE_ENDIAN 0
		#define GS_BIG_ENDIAN	 1
	#endif
	
#else
	#error  No recognized platform variable was defined!
#endif

#if GS_LITTLE_ENDIAN
	#define GS_LITTLE_ENDIAN_ONLY(x) x // Replaces WIN_ONLY when used in the context of byte swapping.
#else
	#define GS_LITTLE_ENDIAN_ONLY(x)
#endif

/////////////////////////////////////////////////////////////////////////////////////////
// Final Release Flag
//
//	Once we are solidly in the beta period & have locked down our file format
//	and other major changes, we need to set NEARING_FINAL_RELEASE to 1 to enable
//	some more strict checks than we otherwise wouldn't perform.

#define NEARING_FINAL_RELEASE 1

/////////////////////////////////////////////////////////////////////////////////////////
// Unused Reference Code Flag
//
//	Use this flag to wrap dead code with an #if and #endif to indicate that
// it should stay in the file, but it will never be compiled into the application.
// 
// For example:
/*
	#if NNA_UNUSED_REFERENCE_CODE 
	// This code was added by request by our Irish distributors, but the project was canceled.
	// Please leave this code here for reference.
	// See Lyndsey Ferguson for more details.
 
	if (monkeySeeMonkeyDo) {
		BeginEepEep();
	}
	 
	#endif // NNA_UNUSED_REFERENCE_CODE
*/
#define NNA_UNUSED_REFERENCE_CODE 0

/////////////////////////////////////////////////////////////////////////////////////////
// Debug flags: PROFILE, NETBUG, BUG, and TEST
//  These are automatically defined (or undefined) based on the build type.
//
//  PROFILE	: Define to include profiling code (currently available only on Mac).
//			   Undefined for all except profile versions.
//  NETBUG	: Define to send ASSERT failures to the network logger.
//			   Undefined for external release and profile versions.
//  BUG		: Define to include code that breaks to the platform's debugger or
//			   writes to the application's debug window.
//			   Undefined for external release, profile, and internal beta versions.
//  TEST	: Define to enable Asserts and include testing code.
//			   Defined when either BUG or NETBUG are, undefined otherwise.

#if defined(RELEASE_BLD) || EXTERNAL_BUILD
	#undef  PROFILE
	#undef  NETBUG
	#undef  BUG
#elif defined(PROFILE_BLD)
	#define PROFILE  1				// Profiling code included
	#undef  NETBUG
	#undef  BUG
#elif defined(BETA_BLD)
	#undef  PROFILE
	#define NETBUG  GS_WIN				// Assert failures sent to network logger
	#undef  BUG
#elif defined(DEV_BLD)
	#undef  PROFILE
	#define NETBUG  GS_WIN				// Assert failures sent to network logger
	#define BUG  1					// Debugging code included
#elif defined(SPCDEV_BLD)
	#undef  PROFILE
	#define NETBUG  GS_WIN				// Assert failures sent to network logger
	#define BUG  1					// Debugging code included
	#define GS_SPECIAL_VERSION 1	// Special features included (e.g. VW 9 stuff in 8.5)
#else
	#error  No recognized version variable was defined!
#endif

#if (defined(NETBUG) || defined(BUG))
	#define TEST  1					// Asserts enabled, testing code included
#else
	#undef  TEST
#endif

// this flag no longer serves a useful purpose and should be removed - PCP
#define GS_LOCALLOGFLAG 1

/////////////////////////////////////////////////////////////////////////////////////////
// STL-related stuff

#define STL_STD	std					// Set from now on; should be cleaned out (MFH, 06/99)
// JAK 11/29/99 The SDK Plug-ins do not support STL yet, so use flag here for now.
#if _MINICAD_
	#define REAL_STL				1	// Set from now on; should be cleaned out (MFH, 06/99)
	#define GS_USE_NEW_STL			1	// Set from now on; should be cleaned out (MFH, 06/99)
	#define GS_USE_STL_INCLUDENAMES	1	// Set from now on; should be cleaned out (MFH, 06/99)
	#define GS_USE_STL_NAMESPACES	1	// Set from now on; should be cleaned out (MFH, 06/99)
#endif


/////////////////////////////////////////////////////////////////////////////////////////
// TXString stuff

#if _MINICAD_
	#define COMPILE_TXStringResource	1
#else
	#undef COMPILE_TXStringResource
#endif


/////////////////////////////////////////////////////////////////////////////////////////
// Miscellaneous

#define _GSDEBUG_LIB_		1		// Debug code in separately-compiled library
#if GS_WIN
	#define GS_HWND_CHECK	1
#else
	#define GS_HWND_CHECK	0
#endif

// This is a do-nothing reading aid which can be used before brackets to
// make it clear that the brackets are meant to be there to indicate scope
// of enclosed vars; ie   ... scope { TFoo foo(); foo.DoSomething(); } ...
#define NNA_SCOPE

// Use this macro in the private section of a class to disallow copying or assignment
//	of that class.

#define DISALLOW_DUPLICATES(T) \
	T (const T &);				/* no copying allowed. */ \
	T& operator=(const T &)		/* no assignment allowed, either. */


#if GS_WIN
/////////////////////////////////////////////////////////////////////////////////////////
// Start Windows-only section.

	/////////////////////////////////////////////////////////////////////////////////////
	// Set structure packing to 2 bytes.

	#pragma pack(2)


	/////////////////////////////////////////////////////////////////////////////////////
	// Turn off annoying compiler warnings. Think long and hard before putting a warning
	// into this section, we don't want to cover up any legitimate errors. More of these
	// are turned off in CoreDefines.h.

	#pragma warning (disable : 4200)	// nonstandard extension used : zero-sized array in struct/union
	#pragma warning (disable : 4250)	// 'x' : inherits 'y::z' via dominance
	#pragma warning (disable : 4291)	// no matching operator delete found; memory will not be freed if in itialization throws an exception
	#pragma warning (disable : 4786)	// identifier was truncated to '255' characters in the browser information
	#pragma warning (disable : 4800)	// forcing value to bool 'true' or 'false'
	#pragma warning (disable : 4503)	// decorated name length exceeded, name was truncated

	/////////////////////////////////////////////////////////////////////////////////////
	// Turn on warnings normally associated with level 4. We cannot as of yet have
	// level 4 warnings for Visual Studio because too much of our code fails.
	//
#if BUG
	//#pragma warning(3: 4100)			// unreferenced formal parameter
	#pragma warning(3: 4189)			// local variable is initialized but not referenced
	#pragma warning(3: 4101)			// unreferenced local variable
#endif

/////////////////////////////////////////////////////////////////////////////////////
	// This turns on the flag that allows VW to build under the .NET compiler
	//	(version 13 or 1300). 
	#if _MSC_VER >= 1300
		#define GS_DOTNET_COMPILER 1
	#else
		#define GS_DOTNET_COMPILER 0  
	#endif 

// End Windows-only section.
/////////////////////////////////////////////////////////////////////////////////////////

#else
/////////////////////////////////////////////////////////////////////////////////////////
// Start Mac-only section.

#define _hypot hypot
#define _stricmp stricmp
#define _strcmpi strcmpi
#define _strcmp strcmp
#define _strnicmp strnicmp


	/////////////////////////////////////////////////////////////////////////////////////
	// Macintosh Universal Interfaces Variables
	#ifndef TARGET_API_MAC_CARBON
		#define TARGET_API_MAC_CARBON  1
	#endif
	
	/////////////////////////////////////////////////////////////////////////////////////
	// Non-GS Library Variables
	#ifndef __dest_os
		#define __dest_os  __mac_os			// Metrowerks Standard Library
	#endif
#ifndef __GNUC__  // XXX: Need to set _MINICAD_ in third-party libs built for the app,
       //  and then test on it, so can avoid #include for externals.  MFH 04/01
	#include <UseDLLPrefix.h>			// Using shared-library version of MSL
	
	
#endif
#if (Paul || Jeff) // Turn network checking off for Jeff & Paul so they don't have to worry about this on MacOS X
#define GS_NEWMACNETWORKCHECK 0
#else
#define GS_NEWMACNETWORKCHECK 1
#endif
	
#if (GS_SHELL_BUILD || GS_COMP_BUILD || GS_PROTECTION_BUILD)
	/////////////////////////////////////////////////////////////////////////////////////
	// Power Plant
	
	#define PP_Target_Carbon 1				// Non-zero builds PowerPlant for Carbon
	
	#if BUG
		#define PP_DEBUG              1
		#define PP_DEBUGNEW_SUPPORT   0		// Not using NEW for arrays, I believe
	#else
		#define PP_DEBUG              0
		#define PP_DEBUGNEW_SUPPORT   0
	#endif
	#define PP_QC_SUPPORT         0
	#if (GS_SPOTLIGHT_DEBUGGING) && (PP_DEBUG)
		#define PP_SPOTLIGHT_SUPPORT  1
	#else
		#define PP_SPOTLIGHT_SUPPORT  0
	#endif
	
	//#ifndef	PP_StdDialogs_Option
		// Check for Nav Services at runtime, and use classic dialogs if not available
	//	#define PP_StdDialogs_Option  3		// PP_StdDialogs_Conditional
	//#endif
#endif  // (GS_SHELL_BUILD || GS_COMP_BUILD || GS_PROTECTION_BUILD)
	

// End Mac-only section.
/////////////////////////////////////////////////////////////////////////////////////////
#endif  // GS_WIN


/////////////////////////////////////////////////////////////////////////////////////////
// The file "User.h" is a file that each person that builds VectorWorks must have. The
// contents of this file is up to each individual user. The most common use is to define
// a name constant so that you can insert code into source that only compiles for you.
// This file MUST NOT be included in the SourceSafe project. The file is only included in
// developer builds of the application.
//
// If you get an error because of a missing User.h file, do this:
//
// Create a file named User.h in Bernini:AppSource:Include:Common: and add
// the following to the file:
//
// #define MyName 1
//
// where MyName is the login name you use for the company file servers and
// the SourceSafe databases. (This should be the same name.) See Paul if you
// don't know what name to use.
//
//
// This allows you to write code like the following:
//
//        #if Dave
//            ...debug code for me only...
//        #else
//            ...code for everyone else...
//        #endif

#if BUG && _MINICAD_
	#include "User.h"  // if you get an error here, see the above comment
#endif

///////////////////////////////////////////////////////////////////////////////
// This section contains function type specifiers for functions exported from GSESDK.
//
//	GS_API: Use this like a pascal modifier for functions in VectorWorks which are part of the
//		externally available interface. E.g. "void GS_API WackyMiniCadFunction();".
//
//	GS_API_PTR: Apply this to pointers to API functions.  E.g.  "typedef void
//		GS_API_PTR(WackyMiniCadFunctionPtr)();".
//
//	GS_CALLBACK: This is the type used for all glue code between the externals and
//		callbacks into MiniCAD
//
//	GS_CALLBACK_PTR: Pointer to GS_CALLBACK

#define GS_API
#define GS_API_PTR(ptr_t)					(*ptr_t)
#define GS_CALLBACK
#define GS_CALLBACK_PTR(name)				(*name)
#if GS_WIN
	#ifndef _MINICAD_
		#define GS_EXTERNAL_ENTRY			__declspec(dllexport)
	#endif
#elif GS_MAC_MACHO
	#define GS_EXTERNAL_ENTRY				__attribute__((visibility("default")))
#endif


/////////////////////////////////////////////////////////////////////////////////////////
// Global Includes

#include "ImportAndExportDefines.h"		// Defines function and class export tags


/////////////////////////////////////////////////////////////////////////////////////////
// Feature/Implementation Variables

	/////////////////////////////////////////////////////////////////////////////////////
	// Carbon-Related Variables
	
	// Code which is apparently functional but needs additional scrutiny for
	//  Carbon should be marked with this identifier in a comment block
	#define GS_CARBON_REVISIT

	// Late 9.5.0 changes to reduce slowdowns caused by large workspaces and menus. 
	// Setting this to 0 will restore the 9.0.1 behavior. - JDW 10/29/01
	#define GS_MENU_SPEEDUP 1

	/////////////////////////////////////////////////////////////////////////////////////
	// VW 10 flags
	#define	GS_VW10_FEATURE			0

	// Turns off incorrect usage of FrontWindow which has been deprecated by Apple.
	#define GS_USE_DEPRECATED_FRONT_WINDOW (0 || GS_WIN)


	#if GS_WIN
		// Set to 0 to use Altura for resource handling. Set to 1 to use QuickTime.
		#define GS_USING_QUICKTIME_FOR_RESOURCES	1
	#else
		// Mac always uses the MacOS for resources.
		#define GS_USING_QUICKTIME_FOR_RESOURCES	0
	#endif
	
	#if 1
		#define NNA_T00529_ENABLE_CLASSIC_VECTORSCRIPT_DIALOG_SUPPORT 1
	#else
		#define NNA_T00529_ENABLE_CLASSIC_VECTORSCRIPT_DIALOG_SUPPORT 0
	#endif

#define POSTDRAWING_NXOR 1
	
	#if 1//GS_WIN & !BUG
		#define SERIES_E_DEVELOPER 0
	#else
		#define SERIES_E_DEVELOPER 1
	#endif

	#if GS_MAC

		#define NNA_T00530_COCOAPALETTECONVERSION_ENABLED	1

		#if NNA_T00530_COCOAPALETTECONVERSION_ENABLED
			#define NNA_T00530_COCOA_RESBROWSER_ENABLED		0
			#define NNA_T00530_COCOA_VS_PALETTE_ENABLED		1
			#define NNA_T00530_COCOA_ATTRIB_PAL_ENABLED		0
			#define NNA_T00530_COCOA_NAVIGATION_ENABLED		1
			#define NNA_T00530_COCOA_VISUALIZATION_ENABLED	1
			
			#define NNA_T00530_CARBON_NAVIGATION_ENABLED	0
			#define NNA_T00530_CARBON_VISUALIZATION_ENABLED	0
		#endif

		#define NNA_USE_CARBON_EVENTS						1
		
	#endif
	
#define WIDGET_FRAMEWORK_ENABLED 1

//#define GS_EXPLORE_2D3DSelectionTool

