//
// MiniCadHookIntf.h
//
// Copyright 1998-2000 Nemetschek North America
// All Rights Reserved.
//
// This file defines constants for the interface between the VectorWorks application and the SDK Plug-ins.
// This file is shared between the VectorWorks application and SDK Plug-ins code.
//

#ifndef _MINICADHOOKINTF_
#define _MINICADHOOKINTF_

#pragma once

#if TARGET_RT_MAC_CFM
	#include <MixedMode.h>
#endif

#include "SharedDefines.h"
#include "GSTypes.h"

#if defined(_MINICAD_EXTERNAL_) && !defined(__EXTERNDEFINES__) && __MWERKS__
	#error GSBUG.h, GSTEST.h, or GSRELEASE.h MUST be included in your C/C++ compiler preferences when compiling under Metrowerks.
#endif


/////////////	-----------------------------------------------
///////////		BEGIN MENU DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////		-----------------------------------------------
///////
/////
///
//
//
// 	Tool Definition Procedure (TDP) parameter descriptions:
//
//																Message1:						Message2:					Result:
//	Action/Event			When called							Gets							Gets						Returns
//	-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//	kToolInitGlobals		When overlay is activated			0								0							0 or kToolCouldNotInitialize
//	kToolDisposeGlobals		When overlay is deactivated			0								0							0
//	kToolDoSetup			When tool is selected or resumed	0								0							0 or kToolCouldNotSetUp
//																or kSetupSetdownPauseRestoreFlag 
//	kToolDoSetDown			When tool is deselected	or paused	0								0							0
//																or kSetupSetdownPauseRestoreFlag
//	kToolGetCursor			When tool selected and curs in doc	0								0							cursorID or 0 to use default
//	kToolDoInterface		When tool is clicked in drawing		Ptr to WorldPt of click			Ptr to Point of click		0 or kToolDidNotChangeDoc and/or kToolSwitchToCursor 								
//	kToolDoModeEvent		When mouse is clicked in mode bar	(long) mode group				HiWrd = old, LoWrd = new	0
//	kToolDoDoubleClick		When tool is double-clicked			0								0							0
//	kToolDoDrawScrMod
//	kToolDoUndrawScrMod
//	kToolPointAdded			When mouse is clicked in drawing																0, kToolCancel, kToolCompleted, kToolSwitchToCursor		
//	kToolMouseMove			When mouse moves in drawing																		0, kToolCancel, kToolCompleted, kToolSwitchToCursor		
//	kToolDrawingDoubleClick	When double-click in drawing																	kToolCompleted, kHandledDocumentDoubleClick
//	kToolDraw 				Whenever tool needs to draw																		0, kToolCancel, kToolCompleted, kToolSwitchToCursor		
//	kToolHandleComplete 	When tool is done getting points																0, kToolCancel, kToolSwitchToCursor		
//	kToolGetStatus 			When app needs tool's status																	kToolWaitingForFirstPoint, kToolCollectingPoints, kToolWaitingForMouseUp, kToolCompleted, kToolSwitchToCursor
//	kToolPointRemoved       When app removes a point			0
//																or kClearingAllToolPoints									0, kToolCancel, kToolCompleted, kToolSwitchToCursor		
//	kToolGenericStateChange After every key event. When the   	0 								0							0
//																or kToolGenericStateChangeKey 
//																or kToolGenericStateChangeView

// Tool action/event  constants 
//	const long kInternalAction1			= -101L;	// internal use only. external tools will not recieve this.

typedef long ToolPropID;


/////////////////////////////
//	Extended Tool Properties
const ToolPropID kToolXPropSelectionChange = 1;		// tool wants selection change events.
const ToolPropID kToolXPropUnsupported = 2;			// not supported
const ToolPropID kToolXPropWantsMoveSelection2D = 3;		// tool wants kToolMoveSelection2DEvent event with nudge and move 2D commands.
const ToolPropID k2DToolEnabledInStackedLayerMode = 4;		// 2D tool wants to be enabled in Unified View.
const ToolPropID kToolXPropSetUnrestrictedMode	= 5;		// set unrestricted scaling mode to the 2D selection tool

/////////////////////////////

typedef long ToolEventID;

//	Tool actions/Events
const ToolEventID kToolInitGlobals			= 1L;
const ToolEventID kToolDisposeGlobals		= 2L;
const ToolEventID kToolDoSetup				= 3L;
const ToolEventID kToolDoSetDown			= 4L;
const ToolEventID kToolGetCursor			= 5L;
const ToolEventID kToolDoInterface	 		= 6L;	// to be removed
const ToolEventID kToolDoModeEvent			= 7L;
const ToolEventID kToolDoDoubleClick		= 8L;
const ToolEventID kToolDoDrawScrMod			= 9L;
const ToolEventID kToolDoUndrawScrMod		= 10L;
const ToolEventID kToolPointAdded			= 100L;
const ToolEventID kToolMouseMove			= 101L;
const ToolEventID kToolDrawingDoubleClick	= 102L;
const ToolEventID kToolDraw 				= 103L;
const ToolEventID kToolHandleComplete 		= 104L;
const ToolEventID kToolGetStatus 			= 105L;
const ToolEventID kToolPointRemoved			= 106L;
const ToolEventID kToolGenericStateChange	= 107L;			// 	Action called when any program state change
													//	occurs that might affect a tool.  Tools that store cached 
													//	data might listen for this message to update their cache.
													//	Newly written tools should not find any need for this 
													//	action as cached data is usually not required - it is provided 
													//	to ease tool modernization.  An example where this action is
													//	observed is the Wall tool.  It is a very complicated tool
													//	that maintains a cache representing the current walls.  After a 
													//	key is pressed to lock a value in the data bar kToolGenericStateChange
													//	is called and the wall tool updates its cache so it can be redrawn 
													//	correctly.  This would not be necessary if the tool's kToolDraw message
													//	was able, like most tools, to draw itself with the tool points.
													//	GENERAL RULE:  Avoid using cached data to handle kToolDraw action calls.
													//	Use the current tool point data.
													
//	Above actions sent to tool prior to VectorWorks 11.



//	Actions/Events below can be sent to Tool Definition Procedure (TDP) with Extended Properties.
const ToolEventID kToolOnInitXProperties 	= 108L;
const ToolEventID kToolOnSelectionChange   	= 109L;															
const ToolEventID kToolOnMoveSelection2D	= 110L;														
const ToolEventID kToolCustomSubtypeInsert	= 111L;		//	Object has declared itself in the "PExt" resource to have EPluginObjectSubType 
														//	equal to kCustomSubtype.  kCustomSubtype objects are provided a tool that calls 
														//	the object definition procedure main with kToolCustomSubtypeInsert events.  
														//	kToolCustomSubtypeInsert events wrap tool events in a ToolActionHandlerParams structure.  
														//	The message paramameter is a pointer to this structure.
const ToolEventID kToolOnIdleEvent			= 112L;		// 				
const ToolEventID kToolOnCustomBarEvent     = 113L;		// The Tool has installed a Custom Editable data bar.  	CustomBarEventData is supplied in the message1 parameter.			

//	Force the imaging flags for release build

#define ENHANCED_IMAGING	1
#define UPDATED_SELECTION	1
#define ANIMATED_SELECTION	1
#define ANIMATED_SEL_SPEC	0

#if UPDATED_SELECTION
	#define SUPPORT_OBJECT_GRIPS
	//	SUPPORT_OBJECT_GRIPS goes along with UPDATED_SELECTION.  When defined
	const ToolEventID kToolProvideObjectGrips      = 114;		// The Tool wants the application to draw grips for the current selected objects.
#endif

// Actions/Events below are sent to Tools
const ToolEventID kToolDisplayContextualHelp	= 115L;		// The help system would like to know if the tool has a contextual help identifier. It is passing in a pointer to a TXString that should be filled in with the help identifier.

const ToolEventID kToolInitByObject				= 116L;		// Send to the tool with MCObjectHandle as message1.
															// This notifies the tool that is activated from the specified parametric object
															// allowing the tool to initialize itself for creating objects of this type
#ifdef GS_EXPLORE_2D3DSelectionTool
const ToolEventID kToolOnViewChange				= 117L;		// NNA Internal USE
#endif

//----------------------------------------------------------------------------
// Default tool informatoin
// Allow us to use the default insertion tool as base for all tools
struct SDefaultToolInfo
{
	short fModeGroup;			// radio group
	short fAllowInsertGroup;	// button group
	short fAlignmentGroup;		// radio group

	// insertModeGroup choice indices
	short fRegularInsChoiceIndex;
	short fOffsetInsChoiceIndex;
	short fPickUpChoiceIndex;

	// alignmentGroup choice indices
	short fLeftChoiceIndex;
	short fCenterChoiceIndex;
	short fRightChoiceIndex;
	short fNaturalChoiceIndex;

	SDefaultToolInfo() {
		fModeGroup = fAllowInsertGroup = fAlignmentGroup = -1;
		fRegularInsChoiceIndex = fOffsetInsChoiceIndex = fPickUpChoiceIndex = -1;
		fLeftChoiceIndex = fCenterChoiceIndex = fRightChoiceIndex = fNaturalChoiceIndex = -1;
	}
};

// call back message for ISDK::CallDefaultTool for notifying the default tool
// the message expects (message1 = MCObjectHandle) to the new object preview
const ToolEventID kDefaultTool_UpdatePreviewObject	= -100;

/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
//	BEGIN Custom Editable DataBar types and constants:
//  

//---------------------------------------------------------------
//---------------------------------------------------------------
struct CustomBarEventData
//
//	For tools, the messgae1 parameter of the tool definition procedure contains a CustomBarEventData
//	type for kToolCustomBarEvent action calls.
//
{
	long 	fCustomBarEventSelector;
	long 	fData;
};


////////////////////////////////////////
//
//	kToolCustomBarEvent come with message1 data of type CustomBarEventData.
//	CustomBarEventData::fCustomBarEventSelectors:
//  
const long kCustomBarSetup = 1;			// sent when a CustomBar is installed with GS_CustomBarInstall
const long kCustomBarSetdown = 2;		// sent when a CustomBar is replaced with another databar
const long kCustomBarUpdateValues = 3;	// sent with each new cursor/mouse position so CustomBar client and provide new field values.
const long kCustomBarLockValue = 4;		// sent when a user lockes a field of a custom bar	
const long kCustomBarUnlockValue = 5;	// sent when a user unlockes a field of a custom bar	

const short kModeBarOptionsIconID = 5010;

//	END Custom Editable DataBar types and constants:
//  
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////

											
													
//////////////////////////
//
// Tool message1 constants.
const long kSetupSetdownPauseRestoreFlag = 1;		//	Sent in the Message1 parameter with kToolDoSetup and kToolDoSetDown action calls.
													//	This message allows action handling to distinguish the Setup and SetDown action calls.
													//	When tools are being paused and restored they are sent this value in the message1 
													//	parameter.
													  
const long kToolGenericStateChangeKey = 1;			//	Sent in the Message1 parameter with kToolGenericStateChange action call.
													//	A key has been pressed. See kToolGenericStateChange description above.
const long kToolGenericStateChangeView = 2;			//	Sent in the Message1 parameter with kToolGenericStateChange action call.
													//	The current view has been changed. See kToolGenericStateChange description above.

const long kClearingAllToolPoints = 1;				// ToolDef's message1 parameter when action==kToolPointRemoved.

// Tool return constants

const long kToolDidNotChangeDoc			= 1L;		//	observed after kToolHandleComplete action handler call.  It prevents 
													//	the "dirty"flag for the document from being set. 
const long kToolCouldNotInitialize		= -1L;		//	Observed after kToolInitGlobals action handler.  Return this if the tool
													//	failed to initialize. 
const long kToolCouldNotSetUp			= -1L;		//	Observed after kToolDoSetup action handler.  Return this if the tool fails to set up.
const long kToolSwitchToCursor			= 2L;		//	cancel, remove all tool points, and switch to cusor tool
const long kHandledDocumentDoubleClick 	= 4L;		// 	Observed after kToolDrawingDoubleClick action handler.  Return this if the tool's
													//	kToolDrawingDoubleClick action handler wants the second click entered as a tool point.
const long kToolWaitingForFirstPoint	= 5L;		// 	Observed after kToolGetStatus action handler.  Return this if tool is 
													//	waiting for first point.
const long kToolCollectingPoints		= 6L;		// 	Observed after kToolGetStatus action handler.  Return this if tool is still
													//	collecting points.
const long kToolWaitingForMouseUp		= 7L;		// 	Observed after kToolGetStatus action handler.  Tool returns this if it 
													//	wants the next mouse up as a tool point.  
const long kToolCompleted				= 8L;		// 	Observed after kToolGetStatus action handler.  Will cause VW to call 
													//	the plug-in with kToolHandleComplete action
const long kToolCancel					= 9L;		// 	removes all tool points

const long kToolEventHandled   = 1; 				// 	observed by kToolMoveSelection2DEvent and kOnAttributeMove2D event callers.

const long kToolHasContextualHelp		= 10L;

#ifdef SUPPORT_OBJECT_GRIPS
const long kToolProvideObjectGripsNO		= 0L;	// observed by the kToolProvideObjectGrips action caller.  THe reshape Handles/Grips WILL NOT be drawn.
const long kToolProvideObjectGripsYES		= 1L;	// observed by the kToolProvideObjectGrips action caller.  THe reshape Handles/Grips WILL not be drawn.
#endif

//
///
/////
///////
/////////       ---------------------------------------------
///////////		END TOOL DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////////	---------------------------------------------







/////////////	-----------------------------------------------
///////////		BEGIN MENU DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////		-----------------------------------------------
///////
/////
///
//
//	
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// 	Menu Definition Procedure
//														Message:					Result:
//	Action					Task							Gets						Returns
//	------------------------------------------------------------------------------------------------------------------------------
//	kMenuInitGlobals		Allocates global data				0								0
//	kMenuAddItems			Fills menu with its items			ChunkInfo Pointer				0
//	kMenuDisposeGlobals		Disposes of global data				0								0
//	kMenuDoInterface		Performs function					ChunkInfo Pointer or 0			kMenuDidNotChangeDoc if necessary
//	kMenuCheckHilite		Hilites & Checks items				ChunkInfo Pointer				true if this call is needed
//	kMenuNotify				Notify menu something has changed	statusID						0
//	kMenuItemEnabled		returns whether item is hilited		Chunk index (if it's a chunk)	0 - use Flags, kMenuItemEnabled, kMenuItemDisabled
//	kMenuAccessCheck		Internal support only
//
//
// Menu action constants
const long kMenuInitGlobals			= 1L;
const long kMenuDisposeGlobals		= 2L;
const long kMenuDoInterface			= 3L;
const long kMenuAddItems			= 4L;
const long kMenuCheckHilite			= 5L;
const long kMenuNotify				= 6L;
const long kMenuItemEnabled			= 7L;
const long kMenuAccessCheck			= 8L;
const long kMenuItemCheck			= 9L;
const long kMenuHandleToolAction	= 10L;			//	When a Menu returns kMenuRunTempTool from its kMenuDoInterface
													//	handler it will then be called with kMenuHandleToolAction actions
													//	to handle standard tool actions.  The tool actions are identical to tool
													//	actions for tool definition procedures.  The tool action parameters
													//	are contained in a MenuToolActionHandlerParams structure.
const long kMenuItemDisplayContextualHelp = 11L;


// Menu return constants
const long kMenuDidNotChangeDoc		= 1L;
const long kMenuHandledEvent		= 2L;
const long kMenuItemIsEnabled		= 3L;
const long kMenuItemIsDisabled		= 4L;
const long kMenuNoSuchItem			= 5L;
const long kMenuItemSecurity		= 6L;
const long kMenuRunTemp2DTool		= 7L;			//	Returned when Menu wants to get Interactive 2D points from the 
													//	documnet.  See kMenuHandleToolAction for more.
const long kMenuRunTemp3DTool		= 8L;			//	Returned when Menu wants to get Interactive 2D points from the 
													//	documnet
const long kMenuItemHasContextualHelp	= 9L;
//
///
/////
///////
/////////       ---------------------------------------------
///////////		END MENU DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////////	---------------------------------------------











/////////////	-----------------------------------------------
///////////		BEGIN OBJECT DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////		-----------------------------------------------
///////
/////
///
//
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// 	Object Definition Procedure (ODP) action/Event descriptions:
//
//															Message:					Result:
//	Action						Task							Gets						Returns
//	------------------------------------------------------------------------------------------------------------------------------
//	kParametricInitGlobals		Allocates global data				0								0 or kParametricSetupFailed
//	kParametricRecalculate		Regenerate objects					0								0
//	kParametricPreference		maybe pose preference dialog		0 or parmFormat					0 or kParametricNotImplemented, kParametricPrefOK, kParametricPrefCancel
//	kParametricDisposeGlobals	Disposes of global data				0								0
//	
//	
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

typedef long ObjectPropID;

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Plug-in Object Extended Properties descriptions:
//
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
//                         Property ID               //  Has Associated     //  Description:
//                                                   //     Event(s)        //
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropEditGroup = 1;           //        NO           //  Object has non-default "Enter Group" behavior.  PIO objects can enter the profile or path group 	
//                                                   //                     //  directly.  See kObjectEditGroupPropertyID property values below for more.
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropHasLayerScaleDeps = 2;   //        NO           //  Object wants to be reset with when its layer scale changes.
//                                                   //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropSpecialEdit = 3;	     //  DEPENDS on         //
//                                                   //  property value.    // Object has non-default behavior when "Edit..." command is invoked.
//                                                   //                     // Cursor double-click also invokes this "Edit..." behavior.
//                                                   //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropPreference = 4;		     //        YES          // Object Definition Procedure (ODP) handles kParametricPreference event.
//                                                   //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropDirectModeling = 5;		 //        YES          // Object Definition Procedure (ODP) handles handles Direct Modeling events.
//                                                   //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropAttributeTool = 6;		 //        YES          // Object Definition Procedure (ODP) handles handles Attribute Mapping events.
//                                                   //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropPreventWallInsertion = 7;//        NO           // Object does NOT want to be inserted into walls.  Observed by the 2D cursor tool
//                                                   //                     // to prevent dragging into a wall.
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropHasUIOverride = 8;		 //  DEPENDS on         //
//                                                   //  property value.    // Object Definition Procedure (ODP) adds widgets to Object Info Palette in kObjXPropInitXProperties event handler
//                                                   //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropCustomCursorResize = 9;	 //       YES           //
//       // boolean value                            //                     // The O
//      NNA under development                        //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropAcceptsMarkers = 10;     //                     //
//       // unsigned char                            //                     // 
//                                                   //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropDefaultPropertyUI = 11;	 //         NO          //
//       // unsigned char                            //                     // The bits in this property describe the UI displayed
//       // NNA under development                    //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXHasCustomWidgetVisibilities = 12;//      YES        // kObjOnWidgetPrep
//       // boolean                                  //                     // 
//       NNA under development                       //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXHandlesCommand = 13;	     //                     //
//       // boolean                                  //                     // 
//       NNA under development                       //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXIs2DSurfaceEligable = 14;    //                     //
//       // boolean                                  //                     // 
//       Weiler operations operate on 2D path        //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropRotatesWithVCS = 15;	 //                     //
//       // boolean                                  //                     // 
//       Plug-In objects rotates with plan rotation  //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropCustomHideFactor = 16;	 //         NO          // The parametric object provides custom scale threshold to be used to hide inner objects
//       // double                                   //                     // when displaying the object in a layer or VP
//		 Plug-in provides custom hide factor		 //                     // See documentation for more info.
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXHasCustomWidgetValues = 17;  //         YES         // kObjOnWidgetValueUpdate
//       // boolean                                  //                     // 
//       Plug-In objects rotates with plan rotation  //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropAcceptStates = 18;		 //         YES         // The parametric accpets kObjOnAddState event
//       // Boolean                                  //                     // event value is TParametricStateFlags
//		 Plug-in accepts states						 //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropAcceptStatesInternal = 19;//        NO          // The plug-in will receive about to be delete and duplicate (internal) states through kObjXPropAcceptStates
//       // Boolean                                  //                     // Mush have kObjXPropAcceptStates enabled
//		 Plug-in accepts about to be deleted state	 //                     // Note! This is isoleted option to improve speed of plug-ins that are not interested in delte events
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropPreserveContents = 20;	 //         NO          // VectorWorks will not delete the contents of the parametric
//       // Boolean                                  //                     // before reset
//		 VW wont delete contents before reset		 //                     // 
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropHasContextMenu = 21;     //         YES         // Sends kObjOnContextMenuInit and kObjOnContextMenuEvent
//       // Boolean                                  //                     // The parametric can build up context menu and respont to context menu items selection
//		 paramettric has custom context menu		 //                     // 
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropHasComponents = 22;		 //                     // The parametric defines components
//       // boolean                                  //                     // 
//		 Plug-in has components						 //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropResetBeforeExport = 23;  //         NO          // This plugin will be reset before Print or Export
//       // boolean                                  //                     // 
//		 Reset before Printing or Export			 //                     //
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kObjXPropShowOthersEditGroup = 24;//         NO          // Show others when editing the selected special group.
//       // Sint8 (kObjectEditGroupPropertyID)		 //                     // - kObjXPropEditGroupProfile - editing only the profile group shows the others;
//		 Reset before Printing or Export			 //                     // - kObjXPropEditGroupPath - editing only the path profile group shows the others;
//													 //						// - kObjXPropEditGroupCustom - editing any special group shows the others;
//													 //						// - kObjXPropEditGroupDefault - undefined (doesnt show anything)
//---------------------------------------------------//---------------------//-------------------------------------------------------------------------------------------------
const ObjectPropID kLastObjXProp = kObjXPropShowOthersEditGroup;		// last property ID

//////////////////////////////////////////////////////////////////////
//Property Values:
//

// kObjectEditGroupPropertyID property values:
const unsigned char kObjXPropEditGroupDefault = 0;
const unsigned char kObjXPropEditGroupProfile = 1;
const unsigned char kObjXPropEditGroupPath = 2;
const unsigned char kObjXPropEditGroupCustom = 3;


// kObjectSpecialEditPropertyID property values:
const unsigned char kObjXPropSpecialEditDefault = 0;
const unsigned char kObjXPropSpecialEditCustom = 1;
const unsigned char kObjXPropSpecialEditProperties = 2;
const unsigned char kObjXPropSpecialEditReshape = 3; 

//	kObjXPropDefaultPropertyUI property values:
// NNA under development   
const unsigned char kHideSymbolWidget = 1;
const unsigned char kHidePolyWidget = 2;

//  kObjXPropCustomHideFactor property values:
		// Uses document threshold value (varHideCavityFactor) to determine visibility
const double        kCustomHideFactor_DocumentThreshold = (double) -1.0;
		// Uses document threshold value (varHideCavityFactor) to determine visibility
		// Plus for viewports respects the 'Show Wall Components' setting
const double        kCustomHideFactor_ViewportDocumentThreshold = (double) -2.0;

/////////////////////////////
// kObjXPropHasUIOverride Widget constants:
enum EWidgetType {
	kWidgetLongInt			= 1,
	kWidgetBoolean			= 2,
	kWidgetReal				= 3,
	kWidgetText				= 4,
	kWidgetCalculation		= 5,
	kWidgetHandle 			= 6,
	kWidgetCoordDisp		= 7,
	kWidgetPopUp			= 8,
	kWidgetRadio			= 9,
	kWidgetCoordLocX		= 10,
	kWidgetCoordLocY		= 11,
	kWidgetButton			= 12,
	kWidgetStaticText		= 13,
	kWidgetStaticTextParam	= 14,
	kWidgetDimStdPopUp		= 16,
	kWidgetPrecisionPopUp	= 17,
};
/////////////////////////////

// kObjXPropAcceptsMarkers constants:
const unsigned char kObjXPropAcceptsMarkersNone = 0;
const unsigned char kObjXPropAcceptsMarkersBeginningOnly = 1;
const unsigned char kObjXPropAcceptsMarkersEndOnly = 2;
const unsigned char kObjXPropAcceptsMarkersBoth = 3;

////////////////////////////////////////////	Object definition procedure action/event constants:
typedef long ObjectEventID;

// Plug-in Object action/events constants 
const ObjectEventID kParametricInitGlobals			= 1;
const ObjectEventID kParametricDisposeGlobals		= 2;
const ObjectEventID kParametricRecalculate			= 3;		// The Plug-in Object code should re-create all its component objects using current parameter values.
const ObjectEventID kParametricPreference			= 4;		// Object Definition Procedure (ODP) may optionally present its own preferences dialog, or let VW pose the default dialog.
//
//	Above Actions sent to Object Definition Procedure (ODP) prior to Extended Prperties and Events introduced in VW 10.5 and expanded in VW 11.
//

//
//	Extended Events. These events can target any object type - not just parametric.
//
const ObjectEventID kObjOnInitXProperties		= 5;		// The Plug-in Object may add extended properties.	
const ObjectEventID kObjUnsupported6			= 6;		// unsupported 
const ObjectEventID kObjOnSpecialEditID			= 7;		// The Plug-in Object called with kParametricOnMove when kHasMoveDependancy extended property set 
const ObjectEventID kObjUnsupported8			= 8;		// unsupported

const ObjectEventID kObjOnReshape 				= 9;		// kObjOnDM_## events will be sent inside kObjOnReshape for VW 11.  

const ObjectEventID kObjOnDM_Select 			= 10;	
const ObjectEventID kObjOnDM_Cancel 			= 11;	
const ObjectEventID kObjOnDM_MouseDown 			= 12;	
const ObjectEventID kObjOnDM_Draw 				= 13;	
const ObjectEventID kObjOnDM_Complete 			= 14;	
const ObjectEventID kObjOnDM_GetCursor 			= 15;	
const ObjectEventID kObjOnDM_ModeEvent 			= 16;	
const ObjectEventID kObjOnDM_GetStatus 			= 17;	
const ObjectEventID kObjOnDM_CustomBarEvent		= 18;
const ObjectEventID kObjOnDM_BeginPauseEvent	= 19;
const ObjectEventID kObjOnDM_EndPauseEvent		= 20;
const ObjectEventID kObjOnDM_MouseMove 			= 21;

const ObjectEventID kObjOnAttributeSelect 		= 26;	
const ObjectEventID kObjOnAttributeCancel 		= 27;	
const ObjectEventID kObjOnAttributeMouseDown 	= 28;	
const ObjectEventID kObjOnAttributeDraw 		= 29;	
const ObjectEventID kObjOnAttributeComplete 	= 30;	
const ObjectEventID kObjOnAttributeGetCursor 	= 31;	
const ObjectEventID kObjOnAttributeMove2D 	    = 32;	
const ObjectEventID kObjOnAttributeGetStatus 	= 33;	
const ObjectEventID kObjOnAttributeModeEvent 	= 34;

const ObjectEventID kObjOnObjectUIButtonHit		= 35;	// The user has pressed a button in the Properties UI of an object

const ObjectEventID kObjOnCursor_MouseDown 		= 36;	
const ObjectEventID kObjOnCursor_Complete 		= 37;	
const ObjectEventID kObjOnCursor_MouseMove 		= 38;	
const ObjectEventID kObjOnCursor_Draw 			= 39;	
const ObjectEventID kObjOnCursor_Cancel 		= 40;	

const ObjectEventID kObjOnWidgetPrep 			= 41;	
const ObjectEventID kObjOnCommand 		    	= 42;	

const ObjectEventID kObjOnGetToolName			= 43;
const ObjectEventID kObjOnAddState 		    	= 44;

const ObjectEventID kObjOnContextMenuInit		= 45;
const ObjectEventID kObjOnContextMenuEvent		= 46;

const ObjectEventID kObjOnWidgetValueUpdate		= 47;

const ObjectEventID kObjOnEyedropperPrepareCopy	= 48;

const ObjectEventID kObjLastEventID = kObjOnEyedropperPrepareCopy;		// last property ID


// Plug-in Object return constants
const long kParametricNoErr					= 0;		// 
const long kParametricSetupFailed			= -1;
const long kParametricError					= -2;
const long kParametricNotImplemented		= -3;		// The Plug-in did not present its own preference dialog, it is up to the VW application to do it.
const long kParametricPrefOK				= -4;		// The Plug-in presented its own preferences dialog, and the user hit OK.
const long kParametricPrefCancel			= -5;		// The Plug-in presented its own preferences dialog, and the user hit Cancel.
const long kParametricHadError				= -6;		// The Plug-in compiled but had an error during execution.
const long kParametricHadWarning			= -7;		// The Plug-in compiled but had a warning during execution.

const long kObjectEventHandled			  	 = -8;		//
const long kObjectEventFinalized            = -9;       // The event was handled by the plug-in, and the parametric code should not make further changes to the object parameters 
const long kObjectEventNotHandled		    = 0;		// 

const long kObjectOnSpecialOK			   	= 0;		// observed by kObjOnObjectUIButtonHit caller - Undo event is ended
const long kObjectOnSpecialCancel		    = -5;		// observed by kObjOnObjectUIButtonHit caller - Undo event is removed

const long kObjectUIButtonHitOK			   	= 0;		// observed by kObjOnObjectUIButtonHit caller - Undo event is ended
const long kObjectUIButtonHitCancel		    = -5;		// observed by kObjOnObjectUIButtonHit caller - Undo event is removed


//----------------------------------------------------------
//
//	 NNA under development  
//
//	Many object events use ObjectEventCall hierarchy to pass event data
//	in the message parameter of the object definition procedure.
//

//----------------------------------------------------------
struct ObjectEventCall 
//
//	Many events use a ObjectEventCall to supply event data.  For these events the message parameter
//	is a pointer to a  ObjectEventCall structure.
//
//	return kParametricHandledEvent if ODP handled the event, kParametricEventNotHandled if not
{	
	long 	fSpecifier;
	void* 	fData;
};

//----------------------------------------------------------
struct OnObjectWidgetPrepCall : public ObjectEventCall
//
//	Objects with the kObjXHasCustomWidgetVisibilities property have their Object definition procedure called with
//	the kObjOnWidgetPrep event.  The message parameter is a pointer to this structure.  
//
//	fData is a pointer to an array of WidgetInfoType (s)
//	fSpecifier contains the number of WidgetInfoType (s) in the fData
//	fpWidgetProvider is (IWidgetsProvider*) for widget update
//
//	return kParametricHandledEvent if ODP handled the event, kParametricEventNotHandled if not.
{	
	void*	fpWidgetProvider;
};

//----------------------------------------------------------
struct OnObjectWidgetValueCall : public ObjectEventCall
//
//	Objects with the kObjXHasCustomWidgetValues property have their Object definition procedure called with
//	the kObjOnWidgetValueUpdate event.  The message parameter is a pointer to this structure. 
//
//	fData - is (IWidgetsProvider*) 
//	fSpecifier - 0
//	fChangedWidgetID - the ID of the widget that has cahged if it is kOnTranslateToData, otherwise = 0
//	fTranslateType - determine the reason of call
//	fResult - is the result of the event; determine if VW should execute the default translating of the values
{
	enum ETranslateype {
		kOnTranslateToView,		// values are moved from data to the view
		kOnTranslateToData,		// values are moved from view to the data
	};

	Sint32			fChangedWidgetID;
	ETranslateype	fTranslateType;
};

//----------------------------------------------------------
struct ObjectCommand : public ObjectEventCall
//
//	Objects with the kObjXHandlesCommand property have their Object definition procedure called with
//	the kObjOnCommand event.  The message parameter is a pointer to this ObjectCommand structure.  
//	Use the fSubtype to determine the type of data in  fData.
//
//	return kParametricHandledEvent if ODP handled the event, kParametricEventNotHandled if not
{	
	enum ECommandType { 	
	
		kOnSymetricScale = 0, 	//	for this fSubtype fData is a double* that is the scale
								// 	being applied to the object.
								
		kOnMatrixTransform = 1, //	for this fSubtype fData is a TransformMatrix* that is the
								//	transform being applied to the object
		
		kOnDrawSelected = 2,	// for this fSubtype fData is zero
		
		//	The object is selected and the multiple reshape tool has completed the 
		//	marquee drag.
		kOnMultipleReshapeComplete = 3,	// for this fSubtype fData is a pointer to
								// a MultipleReshapeEventData strucutre

		//	The object is selected and the multiple reshape tool is in the middle of
		//	a marquee drag.
		kOnMultipleReshapeDraw = 4	// for this fSubtype fData is a pointer to
								// a MultipleReshapeEventData strucutre
	};
};

//----------------------------------------------------------
struct ObjectState : public ObjectEventCall
// 
//	Objects with the kObjXPropAcceptStates property have their Object definition procedure called with
//	the kObjOnAddState event.  The message parameter is a pointer to this ObjectState structure.  
//	Use the fSpecifier to determine the type of data in  fData.
//
{
	enum EStateType {
		kCreatedReset,				// fData => NULL
		kMovedReset,				// fData => (const ObjectStateData_Position*)
		kRotatedReset,				// fData => (const ObjectStateData_Position*)
		kParameterChangedReset,		// fData => (const ObjectStateData_ParamChanged*)
		kObjectChangedReset,		// fData => (const ObjectStateData_ObjectChanged*)
		kLayerChangedReset,			// fData => (const ObjectStateData_LayerChanged*)
		kExitFromEditGroup,			// fData => (const ObjectStateData_ExitFromEditGroup*)
		kNameChanged,				// fData => (const ObjectStateData_ObjectNameChanged*)
		kObjectUndoRestore,			// fData => NULL
		kObjectUndoRemove,			// fData => NULL
		kPlanarRefChanged,			// fData => (const ObjectStateData_ObjectPlanarRefChanged*)
		kBeforeExportReset,			// fData => NULL
	};
};

//----------------------------------------------------------
struct ObjectContextMenuEvent : public ObjectEventCall
// 
//	Objects with the kObjXPropHasContextMenu property have their Object definition procedure called with
//	kObjOnContextMenuInit  or kObjOnContextMenuEvent event.  The message parameter is a pointer to this ObjectContextMenuEvent structure.  
//
//	fData => (IContextMenuProvider*)
//	fSpecifier = 0;
//	fActiveMenuID is the active menu identifier when the menu item is selected
//
{
	long 	fActiveMenuID;
};


///
/////
///////
/////////       -------------------------------------------------------
///////////		END OBJECT DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////////	------------------------------------------------------




/////////////	-----------------------------------------------------------------
///////////		BEGIN PLUGIN LIBRARY DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////		-----------------------------------------------------------------
///////
/////
///
//
//	Action constants
//	Actions >= 0 are reserved for the Plug-in routine implementation calls.
//
const long kPluginLIBInitGlobals = -1;
const long kPluginLIBDisposeGlobals = -2;
const long kVCOMRegisterInterfaces = -3;
const long kVCOMQueryInterface = -4;
const long kVCOMReleaseInterface = -5;

//	Return Flags for kPluginLIBInitGlobals action returns
//
enum PluginLibraryInitFlags { 			
	kFailedToInitLibFlag = 1,
	kDoNotOpenRsrcFileWithCallFlag = 2,
	kUseSingleUserDataFlag = 4,
	kAddCodeReference = 8,	// This plugin library remains loaded until until reference count drops to zero.
	kProvidesInterfacePtrs = 16	// 
						
};
//	Return Flags for kPluginLIBDisposeGlobals action returns
//
enum PluginLibraryDisposeFlags { 			
	kReleaseCodeReference = 8	// This plugin library returned kAddCodeReference from its kPluginLIBInitGlobals handler. 					
};

//	Return constants for kPluginLIBInitGlobals action returns
//
const long kPluginLIBDefaultReturnVal = 0;
const long kPluginLIBFailedToInitialize = kFailedToInitLibFlag;
const long kPluginLIBDoNotOpenRsrcFile = kDoNotOpenRsrcFileWithCallFlag;
const long kPluginLIBDUseSingleUserData = kUseSingleUserDataFlag;
//
///
/////
///////
/////////       ---------------------------------------------------------------
///////////		END PLUGIN LIBRARY DEFINITION PROCEDURE PARAMETERS DESCRIPTIONS -------------------------------------------------
/////////////	---------------------------------------------------------------






/////////////	-----------------------------------------------------------------
///////////		BEGIN PLUGIN LIBRARY VCOM SUPPORT -------------------------------------------------
/////////		-----------------------------------------------------------------
///////
/////
///
//

// ---------------------------------------------------------------------------------------------------
#ifdef _WINDOWS
# define VCOM_CALLTYPE			__stdcall
#else
# define VCOM_CALLTYPE
#endif

// ---------------------------------------------------------------------------------------------------
struct VWIID
{
    unsigned long  data1;
    unsigned short data2;
    unsigned short data3;
    unsigned char  data4[8];

	VWIID& operator=(const VWIID& iid) {
		memcpy( this, &iid, sizeof(VWIID) );
		return *this;
	}

	bool operator==(const VWIID& iid) const {
		return memcmp( this, &iid, sizeof(VWIID) ) == 0;
	}
};

// ---------------------------------------------------------------------------------------------------
typedef	VWIID	VWGroupID;

// ---------------------------------------------------------------------------------------------------
// We define Dynamic Attribute modificator so VCOM and other C++ interfaces
//		could participate in dynamic_cast operator on Mac.
// This is a bug (or issue) in Mac compiler that causes dynamic_cast operator to fail
//		if the interface instance is from local memory of a DLL!
#ifdef _WINDOWS
# define DYNAMIC_ATTRIBUTE
#else
# define DYNAMIC_ATTRIBUTE __attribute__((visibility("default")))
#endif

// ---------------------------------------------------------------------------------------------------
// Base interface for all interfaces in VCOM
class DYNAMIC_ATTRIBUTE IVWUnknown
{
public:
	virtual							~IVWUnknown( void )		{}
	virtual long VCOM_CALLTYPE		AddRef() = 0;
	virtual long VCOM_CALLTYPE		Release() = 0;
	
};

// ---------------------------------------------------------------------------------------------------
// Base interface for single instance interfaces in VCOM
class DYNAMIC_ATTRIBUTE IVWSingletonUnknown : public IVWUnknown
{
public:
};

// ---------------------------------------------------------------------------------------------------
// VCOM errors
typedef	long		VCOMError;

const VCOMError		kVCOMError_NoError			= 0;
const VCOMError		kVCOMError_Failed			= 1;
const VCOMError		kVCOMError_False			= 2;
const VCOMError		kVCOMError_OutOfMemory		= 3;
const VCOMError		kVCOMError_NotInitialized	= 4;
const VCOMError		kVCOMError_NoInterface		= 5;
const VCOMError		kVCOMError_NotImplemented	= 6;
const VCOMError		kVCOMError_DuplicateIID		= 10;
const VCOMError		kVCOMError_NoModule			= 11;
const VCOMError		kVCOMError_NoInstance		= 12;
const VCOMError		kVCOMError_Unexpected		= 13;
const VCOMError		kVCOMError_InvalidArg		= 15;

#define		VCOM_SUCCEEDED(x)		(x == kVCOMError_NoError)
#define		VCOM_FAILED(x)			(x != kVCOMError_NoError)

// ---------------------------------------------------------------------------------------------------
// working with interfaces
VCOMError	GS_InitializeVCOM(void* cbpParam);
VCOMError	GS_VWRegisterInterface(const VWIID& iid, void* argTable);
VCOMError	GS_VWRegisterInterface(const VWIID& iid, const VWIID& iidContainer, void* argTable);
VCOMError	GS_VWQueryInterface(const VWIID& iid, IVWUnknown** ppInterface);
void		GS_VWNotifyDeleteInterface(IVWUnknown* pInterface);
size_t		GS_VWGetContainerInterfacesCount(const VWIID& iidContainer);
VWIID		GS_VWGetContainerInterface(const VWIID& iidContainer, size_t index);

// ---------------------------------------------------------------------------------------------------
// tools
template<class T> class VCOMPtr
{
public:
				VCOMPtr()						{ fPtr = NULL; }
				VCOMPtr(T* ptr)					{ fPtr = ptr;						if ( fPtr ) { fPtr->AddRef(); } }
				VCOMPtr(const VWIID& iid)		{ fPtr = NULL;						this->Query( iid ); }
				VCOMPtr(const VCOMPtr& p)		{ fPtr = p.fPtr;					if ( fPtr ) { fPtr->AddRef(); } }
				~VCOMPtr()						{ this->Release(); }

	VCOMError	Query(const VWIID& iid)			{ 
													this->Release();
													IVWUnknown*	pInterface		= NULL;
													VCOMError err = ::GS_VWQueryInterface( iid, & pInterface );
													if ( VCOM_SUCCEEDED( err ) ) {
														// Vlado: Temporally removed 'dynamic_cast'
														// because on new Mac OS it is failing to cast properly
														//fPtr = dynamic_cast<T*>( pInterface );
														fPtr = (T*)( pInterface );
														if ( fPtr == NULL ) {
															if ( pInterface ) {
																pInterface->Release();
																pInterface	= NULL;
															}
															// the passed 'iid' is not from the extected type 'T'
															err			= kVCOMError_InvalidArg;
														}
													}
													return err;
												}
	long		Release()						{ long res = 0; if ( fPtr ) { res = fPtr->Release(); } fPtr = NULL; return res; }

	VCOMPtr&	operator=(T* ptr)				{ T* pOld = fPtr; fPtr = ptr;						if ( fPtr ) { fPtr->AddRef(); } if ( pOld ) { pOld->Release(); } return *this; }
	VCOMPtr&	operator=(const VCOMPtr& p)		{ T* pOld = fPtr; fPtr = p.fPtr;					if ( fPtr ) { fPtr->AddRef(); } if ( pOld ) { pOld->Release(); } return *this; }

	T*			operator->() const				{ return fPtr; }
	T**			operator&()						{ return & fPtr; }
				operator T*() const 			{ return fPtr; }

private:
	T*		fPtr;
};

typedef VCOMPtr<IVWUnknown>		IVWUnknownPtr;

// VCOM interface implementation with late destruction
template<class Interface> class VCOMImpl : public Interface
{
public:
				VCOMImpl()						{ fRefCnt = 0; }
	virtual		~VCOMImpl()						{ }

// IVWUnknown
public:
	virtual long VCOM_CALLTYPE		AddRef()	{ fRefCnt++; return fRefCnt; }
	virtual long VCOM_CALLTYPE		Release()
									{
										ASSERTN( kEveryone, fRefCnt > 0 );
										if ( fRefCnt > 0 ) {
											fRefCnt --;
										}
										return fRefCnt;
									}

protected:
	long		fRefCnt;
};

// VCOM interface implementation with immediate destruction
template<class Interface> class VCOMImmediateImpl : public Interface
{
public:
				VCOMImmediateImpl()				{ fRefCnt = 0; }
	virtual		~VCOMImmediateImpl()			{ }

// IVWUnknown
public:
	virtual long VCOM_CALLTYPE		AddRef()	{ fRefCnt++; return fRefCnt; }
	virtual long VCOM_CALLTYPE		Release()
									{
										ASSERTN( kEveryone, fRefCnt > 0 );
										if ( fRefCnt > 0 ) {
											fRefCnt --;

											// mechanizm for immediate delete of the interface instance
											if ( fRefCnt == 0 ) {
												::GS_VWNotifyDeleteInterface( this );
												// EXIT IMMEDIATELY! 'this' no longer exist!!!
												return 0;
											}
										}
										return fRefCnt;
									}
protected:
	long		fRefCnt;
};


//
///
/////
///////
/////////       ---------------------------------------------------------------
///////////		END PLUGIN LIBRARY LIBRARY VCOM SUPPORT -------------------------------------------------
/////////////	---------------------------------------------------------------


/////////////	---------------------------------------------------------------
/////////////	---------------------------------------------------------------
/////////////	---------------------------------------------------------------
/////////////	---------------------------------------------------------------

#ifdef __cplusplus
extern "C" {
#endif
	typedef void GS_API_PTR(GenericFunctionPtr)(void);
	typedef GenericFunctionPtr GS_API_PTR(RetrieverPtr)(long id);
#ifdef __cplusplus
}
#endif

	typedef RetrieverPtr RetrieverProcUPP;

	#define CallRetrieverProc(userRoutine, id)		\
			(*(userRoutine))((id))
	#define NewRetrieverProc(userRoutine)		\
			(RetrieverProcUPP) (userRoutine)

#ifdef _MINICAD_
	extern "C" GenericFunctionPtr GS_API FIDToPtr(long id);
	extern RetrieverProcUPP gFIDToPtrUPP;
#endif

	struct GS_API CallBackBlock {
		RetrieverProcUPP	rPtr;
		#ifndef _WINDOWS
		long				a4store;	// *** JAK *** We dont need this. Remove it soon.
		#endif
		
		#ifdef _MINICAD_
		CallBackBlock()
			{ rPtr = gFIDToPtrUPP; }
		#endif
		CallBackBlock(const CallBackBlock *cbp)
			{ this->rPtr = cbp ? cbp->rPtr : NULL; }
	};
	typedef CallBackBlock *CallBackPtr;


////////////////////////
// GLOBAL CallBackPtr
//   In VectorWorks, this should be passed to all GS_ calls and does nothing.
//   In externals, this should be used as the global callback pointer.
////////////////////////

extern CallBackPtr gCBP;

////////////////////////
// GLOBAL pointer to the SDK VCOM funtion interface
//   In VectorWorks, this is initialized during start up
//   In externals, this should be queried in the main.
////////////////////////
namespace VectorWorks { class ISDK; }

extern VectorWorks::ISDK*	gSDK;

////////////////////////
// GSCharsHandle
//   Used in VectorWorks objects which maintain a handle to characters
////////////////////////

typedef char **GSCharsHandle;


////////////////////////
// MCObjectHandle
//   In VectorWorks, this allows access to BlankHandle
//   In externals, this provides opaque access
//   The VectorWorks internal version is in InitGlobals.h
////////////////////////

#ifndef _MINICAD_
	typedef GSHandle MCObjectHandle;
#endif


// MenuChunkInfo structure
#ifdef __cplusplus
struct MenuChunkInfo {			// used by menu definition functions
	short menuID;
	short itemID;
	short modifiers;
	union {
		short chunkIndex;		// used by kMenuDoInterface and kMenuItemDisplayContextualHelp
		short chunkSize;		// used by kMenuCheckHilite

		#ifdef GS_INTERFACE_FACTORING
		short commandID;        // used by kMenuAddItems
		#endif

	};
};

typedef MenuChunkInfo *MenuChunkInfoPtr;


/////////////////////////////
// MenuItemSpec is used by kMenuItemCheck action
//
// 0 is returned to allow execution of item
// kMenuItemSecurity is returned to disallow execution

struct MenuItemSpec {					
	short			commandID;			// if commandID < 0 then it's internal & externalName is nil
	GSStringPtr		externalName;		// if commandID == 1 then it's plug-in binary & externalName points to the name (no extension)
										// if commandID == 2 then it's plug-in VectorScript & externalName points to the name (no extension)
};

/////////////////////////////
//	ToolActionHandlerParams is a wrapper for tool event data.
//
class ToolActionHandlerParams
{
public:
	ToolActionHandlerParams(long action, long message1, long message2) :
		fToolAction(action),
		fToolMessage1(message1),
		fToolMessage2(message2)
	{}
	
	long fToolAction;
	long fToolMessage1;
	long fToolMessage2;
};

/////////////////////////////
// MenuToolActionHandlerParams is used by kMenuHandleToolAction menu action.
//
//	If a Menu wants to get points from the document it needs to return kMenuRunTempTool
//	from its kMenuDoInterface Menu action handler.  The menu will then be called with 
//	kMenuHandleToolActions actions with message1 containing a pointer to a MenuToolActionHandlerParams
//	structure.  MenuToolActionHandlerParams contains data defining standard tool actions.
//	The menu command must handle these tool actions as if it were a tool definition procedure.
//	See tool action handling above for more.
//
class MenuToolActionHandlerParams : public ToolActionHandlerParams
//
//	In kMenuHandleToolActions action calls the message1 param contains a pointer to this structure.  Use
//	fToolAction, fToolMessage1, and fToolMessage2
{
public:
	MenuToolActionHandlerParams(long action, long message1, long message2) :
		ToolActionHandlerParams(action, message1, message2)
	{}
};

// *PCP* - this may need to go back in TDQuickdraw.h
typedef long (*MenuItemDefProcPtr)(long action, long message, long& userData, CallBackPtr defData);

//-----------------------------------------------------------------
typedef MenuItemDefProcPtr MenuItemDefUPP;

#define CallMenuItemDefProc(userRoutine, action, message, userData, defData)		\
		(*(userRoutine))((action), (message), (userData), (defData))
#define New68KMenuItemDefProc(userRoutine)		\
		(MenuItemDefUPP) (userRoutine)

#endif

//-----------------------------------------------------------------
// GS_SDKPPC_JAK
// GS_SDKPPC_JAK2

////typedef ToolDefProcPtr GSPluginToolUPP;	// **************************
////#define CallGSPluginToolProc
////#define NewGSPluginToolProc



#ifndef GSEBUILDTYPES
	#define GSEBUILDTYPES
	const short kMiniCad = 1;
	const short kBlueprint = 2;
#endif

#if defined(_WINDOWS) && !defined(_MINICAD_)
	#if !defined(UNDEF_PASCAL) || (UNDEF_PASCAL != 0)
		#ifdef pascal
			#undef pascal
		#endif
		#define pascal
	#endif
#endif



// these are the most commonly used list size constants
// See LDef.h for additional size constants
#if _WINDOWS

	const short kSmallListElementHeight=	14;
	const short kLargeListElementHeight=	14;
	const short kIconListElementHeight=		32;
	const short kSICNListElementHeight=		16;
	
#else

	const short kSmallListElementHeight=	12;
	const short kLargeListElementHeight=	16;
	const short kIconListElementHeight=		32;
	const short kSICNListElementHeight=		16;

#endif

// DrawRefCon constants
typedef short TListType;
const TListType 
	refNormal = -50,
	refLayers = -49,		// obsolete.
	refMoveSymbols = -48,
	refRecFld = -47,
	refTmp= -46,			// obsolete.
	refCheck = -45,		// obsolete.
	refSICN = -44,		// obsolete.
	refTiny = -43,
	
	refLarge = -42,
	refSmall = -41,
	refLargeCheck = -40,
	refSmallCheck = -39
;


typedef short ItemStatus;
const ItemStatus
	kActive = 2,
	kCheckOn = 4;

/* Same as a Str31 but doesn't depend <MacTypes.h>
 */
typedef unsigned char TListStr[32];

typedef struct TGeneralListEntry {
	long						data;
	TListStr					name;
	ItemStatus 					status;
} TGeneralListEntry;
typedef TGeneralListEntry 	   *TPGeneralListEntry;



#if _MINICAD_EXTERNAL_ && __cplusplus

////////////////////////////////
//
//	Standard entry point functions
//
////////////////////////////////
//
// These eliminate a lot of the low level entry and exit code associated with
// implementing a VectorWorks SDK Plug-In. To use these entry points, the file
// MenuMain.cpp, ToolMain.cpp, ParametricMain.cpp or LibraryMain.cpp should be added to your
// project (Mac or Windows) and the following function(s) should be implemented 
// in your code as the entry points for your Plug-In.
//
// NOTE - these standard entry point functions use C++ calling conventions.


////////////////////////////////
//
//	Menu entry points
//
////////////////////////////////

long MenuMain(long action, long message1, long &userData);
// MenuMain gets most mainstream menu messages

long DangerousMenuMain(long action, long message1, long &userData);
// DangerousMenuMain gets called with the kMenuCheckHilite & kMenuNotify messages
// the menu's resource file is NOT OPEN when these are called, so many
// normal operations, like calling across segments can cause a crash.
//
// DangerousMenuMain should typically just return 0. If you implement DangerousMenuMain
// be aware that your resource file is NOT OPEN when this function is called. If you make
// cross-segment calls on the Mac or read resources on Mac or Windows you will crash or fail.
//


////////////////////////////////
//
//	Tool entry points
//
////////////////////////////////
//
// Similar entry point for tools. Tools have no dangerous actions, so there is no need for
// a DangerousToolMain function.
//

long ToolMain(long action, long message1, long message2, long &userData);


////////////////////////////////
//
//	Plug-in Object entry points
//
////////////////////////////////
//
// Similar entry point for parametrics. Parametrics have no dangerous actions, so there is no need for
// a DangerousParametricMain function.
//

long ParametricMain(long action, MCObjectHandle parmHand, long message, long &userData);


////////////////////////////////
//
//	Plug-in Library entry points
//
////////////////////////////////
//
// JAK 5/31/00
//
long PluginLibraryMain(long routineSelector, void* argTable, long &userData);


#endif

#endif
