/*************************************************************************

	formZ by autodessys, Inc.
	Copyright c 1994 autodessys, Inc.  All rights reserved.
	
	
	File :	fz_otyp_api.h
	
	By :	Tim Hanes
	
	Created on :  		27 March 2002
	Last Updated on :  	27 March 2002
	
	Description :	
					
***************************************************************************/

#ifndef __FORMZ_OTYP_API_H
#define __FORMZ_OTYP_API_H 1


#include "fzpl_plugin.h"

#include "fz_iost_api.h"
#include "fz_objt_api.h"
#include "fz_wind_api.h"
#include "fz_type_api.h"
#include "fz_acis_api.h"
#include "fz_cedt_api.h"
#include "fz_api.h"

#ifdef __cplusplus
extern "C" {
#endif

/* @doc EXTERNAL otyp_cbak */

/********************************************************************************************************

	@module 

	@desc	Object Type callbacks.  This section describes the callback functions for creating
			new Object Types in formZ.<nl>
			In formZ, there is a large number of object types, also called controlled objects.
			They are, for example, extrusions, enclosures, cubes, cones, cylinders, spheres, tori,
			sweeps, stairs etc. A controlled object stores its generation parameters in a data block
			that is maintained with the object. The parameters can be displayed in a dialog editing
			environment, which can be invoked form the Query dialog. The parameters of some controlled
			objects can also be edited graphically through the Edit Controls tool. It is possible to
			create custom object types in a plugin by registering a function set with a plugin class.
			The plugin with which the function set is registered is usually of type FZ_OTYP_EXTS_TYPE,
			but can be a different type as well. For example, a command or a file translator plugin may
			install the object type function set as part of the functionality added through the plugin.
			Multiple object type function sets may also be installed with a single plugin. This allows a
			plugin to offer a suite of object types, which logically belong together in a single package. 

	@toc	otyp_cbak

*********************************************************************************************************/
/********************************************************************************************************

	@module

	@desc	In formZ, there is a large number of object types, also called controlled objects.
			They are, for example, extrusions, enclosures, cubes, cones, cylinders, spheres, tori,
			sweeps, stairs etc. A controlled object stores its generation parameters in a data block
			that is maintained with the object. This section describes the functionality to create and
			edit controlled objects of existing object types.

	@toc	modl_otyp

*********************************************************************************************************/

/********************************************************************************************************

	@enum	

	@desc	Bit flags used by the flags argument of the fz_otyp_cbak_info function.
			These bits can be set to tell formZ more about the
			object type. For example :
			
	@expl	void my_otype_info_func(fzrt_UUID_td uuid, fzrt_int *size, fzrt_int *flags)
			{
				...
			
				*flags = 0;
				FZ_SETBIT(*flags,FZ_OTYP_NON_UNI_SCALE);
				FZ_SETBIT(*flags,FZ_OTYP_ALWAYS_FACET);
			}
				
			
	@avail	5.0.0.0
			
	@see	

	@toc	otyp_cbak

*********************************************************************************************************/

typedef enum fz_otyp_flags_enum
{	
	FZ_OTYP_NON_UNI_SCALE = 0,		/*	@emem	When this bit is set, the object can be scaled non uniformly without
												loosing the parameters data. If this bit is not set, the controls
												of the object will be dropped if non uniform scaling occurs. */
	FZ_OTYP_NO_RENDER,				/*	@emem	When this bit is set, the object will not be rendered in high end
												rendering modes, such as RenderZone. They will only be rendered in
												the interactive rendering modes. If the bit is not set, the object
												will always be rendered. */
	FZ_OTYP_NO_SYS_FLIP,			/*	@emem	When this bit is set, the object cannot be transformed so that
												a coordinate system changes from left hand to right hand without 
												dropping the object to a plain object. Such a transformation
												occurs, for example, when mirroring about a plane of when
												scaling with one of the scale factors being negative and the
												other ones positive. If this bit is not set, such transformations 
												are allowed and the object controls are not dropped. */
	FZ_OTYP_ALWAYS_SMOOTH,			/*	@emem	When this bit is set, the object is always a smooth object.
												In other words, it always has an ACIS representation. It is
												not allowed to have both, FZ_OTYP_ALWAYS_SMOOTH and 
												FZ_OTYP_ALWAYS_FACET set. However if none are set, the
												object may be smooth or facetted. */
	FZ_OTYP_ALWAYS_FACET,			/*	@emem	When this bit is set, the object is always a facetted object.
												In other words, it never has an ACIS representation. It is
												not allowed to have both, FZ_OTYP_ALWAYS_SMOOTH and 
												FZ_OTYP_ALWAYS_FACET set. However if none are set, the
												object may be smooth or facetted. */
	FZ_OTYP_HANDLE_RVRS,			/*	@emem	When this bit is set, the parametric representation of the
												object cannot be reversed in direction. In this case, formZ
												will reverse the object facets after a reverse operation
												occurred. If this bit is not set, it is the responsibility
												of the object type to reverse its parametric data. This is
												usually done in the fz_otyp_cbak_rvrs callback function. */
	FZ_OTYP_EXPL_PER_PART,			/*	@emem	When this bit is set, the explode operation may
												yield multiple volumes for this object. When this bit is
												not set, the object is always represented by only one volume. */
	FZ_OTYP_NESTED_CURVE_CNTRL,		/*	@emem	When this bit is set, the object is assumed to be an open
												or closed curve, and lends itself as the source for a number of 
												other derivative objects, such as sweep, helix or revovled objects. */
	FZ_OTYP_FACET_USES_REFN,		/*	@emem	When this bit is set, the object, although a facetted object, uses
												the refinement (display resolution) attribute to determine the
												density of the facetting. */
	FZ_OTYP_EDIT_DELAY_UPDATE,		/*	@emem	When this bit is set, and formZ builds the automatic edit dialog (i.e. the
												extension does not implement the fz_otyp_cbak_iface_tmpl callback, an "Update" button is added
												to the dialog. This allows the user to defer the regeneration of the form
												after changing parameters until the button is pressed. This is useful if the
												regeneration takes a fzrt_int time. */
	FZ_OTYP_PARM_REGEN_FLIP			/*	@emem	When this bit is set and a coordinate system changes from left hand to right hand without
												dropping the object to a plain object, the fz_otyp_cbak_regen function will be called. 
												This is useful when the reversal of the coordinate system causes a chnage that requires major changes to 
												the topology/structure of the parametric definition. Note that the fz_otyp_cbak_rvrs 
												function will still be called in advance */

} fz_otyp_flags_enum;

/************************************************************************

	@fsfunc_t	

	@desc		Object type info function (Required). This function is called
				at system startup. It is expected to return the size of the parameter 
				block and bit encoded flags, which tell formZ more about the object.
				The bits for the flag argument are defined by the fz_otyp_flags_enum
				type.

	@return		error

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_info_func) (
	fzrt_int					*size,		/*	@parm	<out>  	|	The size of the parametric data in # of bytes. */
	fzrt_int					*flags		/*	@parm	<out>  	|	The bit encoded flags for the object type. */
	);

/************************************************************************
	@fsfunc_t	

	@desc		Object type init function (Required). This function is called
				whenever a new object of this type is created. The function
				is expected to fill the fields of the parameter block with
				default values. 
				For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_init_func) (
	fzrt_int			windex,		/* @parm	<in> | project window index */
	fz_objt_ptr	objt,		/* @parm	<in> | object									*/
	fzrt_ptr		parm		/* @parm	<in> | generic pointer to the parameter block	*/
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Object type finit function (Optional). This function is called
				whenever a object of this type is deleted. The function
				is expected to free any dynamic memory or take whatever
				action is necessary, when an object of this type ceases
				to exist.
				For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_finit_func) (
	fzrt_int			windex,		/* @parm	<in> | project window index */
	fz_objt_ptr	objt,		/* @parm	<in> | object									*/
	fzrt_ptr		parm		/* @parm	<in_out> | generic pointer to the parameter block	*/
	);
	

/************************************************************************

	@fsfunc_t	

	@desc		Object type name function (Required). This function is called
				whenever the name of the object type is needed. The
				objt and parm parameters may be passed as NULL. In this 
				case a name for all objects of this type should be returned.
				If objt and parm are passed in, a particular object of 
				this type exists, and the type name may be further specified
				based on the parameters of the object. For example, the
				sweep object type in formZ works this way. When its name
				function is called with NULL, it returns "Sweep". However,
				if it is called with a particular object as the parameter,
				the returned name contains which type of sweep it is, for
				example, "Axial Sweep", or "Two Source Sweep". Other
				object types do not make such a distinction and always 
				return the same name, such as spheres, nurbz or symbols.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_name_func) (
	fzrt_int			windex,		/* @parm	<in> 	 | project window index */
	fz_objt_ptr	objt,		/* @parm	<in_opt> | object									*/
	fzrt_ptr		parm,		/* @parm	<in_opt> | generic pointer to the parameter block	*/
	char			*str,		/* @parm	<out> 	 | the name of the object type 				*/
	fzrt_int			max_str		/* @parm	<in> 	 | the maximum number of character which can be copied into the str argument. */
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Object type uuid function (Required). This function is called
				at system startup. It is expected to return a unique identifier
				for the object type.

	@return		error

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td	 (FZRT_SPEC *fz_otyp_cbak_uuid_func) (
	fzrt_UUID_td			uuid 		/*	@parm	<out> |	The uuid of the object type. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type transformation function (Optional). This
				function is called whenever an object of this type
				is transformed (i.e. moved, rotated, scaled, mirrored ...). 
				When an object contains positional geometric
				properties, such as an origin, 3d points or even a
				complete nested control object, they need to be transformed
				as well. This function type is intended to do that.
				For convenience, both the object and a 
				pointer to the parameter block are passed in.
				For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_tform_func) (
	fzrt_int			windex,		/* @parm	<in> | project window index */
	fz_objt_ptr	objt,		/* @parm	<in> | object									*/
	fzrt_ptr		parm,		/* @parm	<in> | generic pointer to the parameter block	*/
	fz_mat4x4_td	*tform		/* @parm	<in> | the 4 by 4 transformation matrix			*/
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Object type reverse function (Optional). This
				function is called whenever an object of this type
				needs to be reversed (turned inside out). This
				is the case, for example, after applying the Reverse tool
				or after executing a mirror transformation. This function
				gives the object type the opportunity to reverse its
				parametric data. If the parametric data is defined in
				such a way, that it cannot be reversed, the FZ_OTYP_HANDLE_RVRS
				in the flags parameter of the fz_otyp_cbak_info function
				call should be set. formZ will then handle the reversal
				of the objects facets when necessary.
				For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_rvrs_func) (
	fzrt_int			windex,				/* @parm	<in> | project window index */
	fz_objt_ptr	objt,				/* @parm	<in> | object									*/
	fzrt_ptr		parm				/* @parm	<in> | generic pointer to the parameter block	*/
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Object type copy function (Optional). This
				function is called whenever an object of this type
				is copied. This function should be implemented
				when the parametric data contains dynamically
				allocated arrays. These can be copied from the 
				source parameter block to the destination parameter
				block after the function allocates the space in the
				destination parameter block. All other fields need
				to be copied from the source parameter block
				to the destination parameter block as well.
				if this function is not implemented, formZ will copy
				all the bytes from the source parameter block to the
				the destination parameter block.
				For convenience, both the object and a 
				pointer to the parameter block of the source and destination 
				are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_copy_func) (
	fzrt_int			src_windex,			/* @parm	<in> | source project										*/
	fz_objt_ptr	src_objt,			/* @parm	<in> | source object										*/
	fzrt_ptr		src_parm,			/* @parm	<in> | generic pointer to the source parameter block		*/
	fzrt_int			dst_windex,			/* @parm	<in> | destination project									*/
	fz_objt_ptr	dst_objt,			/* @parm	<in> | destination object									*/
	fzrt_ptr		dst_parm			/* @parm	<in> | generic pointer to the destination parameter block	*/
	);
	

/************************************************************************

	@fsfunc_t	

	@desc		Object type geometry function (Optional). This
				function is called to retrieve basic geometric
				information about the object. It should be implemented
				if the object has its own coordinate system. For example,
				a sphere has its own x, y and z axis, which describe the
				location and orientation of the sphere in 3d space. The plane parameter
				returns the origin and rotation of the object's
				coordinate system in world space. This
				information is used, for example, to draw the object
				axes in Wire Frame. The center parameter returns the
				object's origin in the coordinate space of
				the object. Usually the center would be set to
				{0.0, 0.0, 0.0}, but may have different values, depending
				on the nature of the object. The bbox parameter returns
				the extent of the object along its x, y and z axis.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_geom_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm,			/* @parm	<in> | generic pointer to the parameter block	*/
	fz_map_plane_td 	*plane,			/* @parm	<out_opt> | 3d mapping plane. This defines the origin and rotation of the object */
	fz_xyz_td				*center,		/* @parm	<out_opt> | A point identifying the origin of the object, 
																expressed in the coordinate system of the object.  */
	fz_xyz_mm_td			*bbox			/* @parm	<out_opt> | A 3d bounding box which encloses the object. The extent is
																measured along the axes of the object's coordinate system. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type cvsl function (Optional). This
				function is called to retrieve extended geometric
				information about the object : center of gravity,
				volume, surface area and perimeter length (hence the
				abbreviation cvsl). Since not all of these properties
				can be calculated for an object, the result parameter
				returned to formZ tells which properties were calculated
				by the function, by setting certain bits to on. <nl><nl> 
				
				bit 0 : center of gravity was calculated <nl>
				bit 1 : volume was calculated <nl>
				bit 2 : surface area was calculated <nl>
				bit 3 : perimeter length was calculated <nl><nl>
				
				For example, the perimeter length can only be calculated for curve like
				objects but not for solids. Therefore, for solids, bit #3 should not
				be set. For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_cvsl_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm,			/* @parm	<in> | generic pointer to the parameter block	*/
	fz_xyz_td				*cog,			/* @parm	<in_opt> | the object's center of gravity */
	double				*volume,		/* @parm	<in_opt> | the object's volume */
	double				*surf_area,		/* @parm	<in_opt> | the object's surface area */
	double				*length,		/* @parm	<in_opt> | the object's perimeter length */
	fzrt_int				*result			/* @parm	<in> 	 | bits, indicating which parameters were actually calculated. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type regen function (Required). This
				function is called when it is necessary to
				regenerate the smooth or facetted topology and
				geometry of an object. In other words, this function
				needs to build all the faces of an object using
				its parametric data.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_regen_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm			/* @parm	<in> | generic pointer to the parameter block	*/
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type convert to patch function (Optional). When
				this function is implemented, it needs to convert
				its shape to a formZ Bezier or coons patch. It should
				only be implemented when the shape of the object can
				be preserved when constructing the patches. This
				function can get called in two ways. When the
				action parameter is 0, the function only needs to
				check whether the particular object can be converted.
				It may be possible, that depending on the parametric data,
				an object can or cannot be converted to patches. When
				the action parameter is 1, the object needs to be
				converted. Note, that this function does not create
				a new object, but needs to change the object passed in.
				For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_cvrt_ptch_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm,			/* @parm	<in> | generic pointer to the parameter block	*/
	fzrt_int				action,			/* @parm	<in> | if set to 0, the function only checks whether the
														   object passed in can be converted to patches. If set
														   to 1, the object needs to be converted. */
	fzrt_boolean		*can_cvrt		/* @parm	<out> | Needs to be set to TRUE, if the object can
															be converted and to FALSE otherwise. This parameter 
															needs to be set for both, the 0 and 1 action. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type get nurbs curve function (Optional). When
				this function is implemented, it needs to create a
				nurbs curve from its parametric data. The nurbs curve
				must have the same shape as the original object.
				This function can get called in two ways. When the
				action parameter is 0, the function only needs to
				check whether a nurbs curve can be created from the parametric data,
				as it may be possible, that depending on the parametric data,
				a nurbs curve can or cannot be created. When
				the action parameter is 1, the nurbs curve needs to be
				created. For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_get_ncur_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm,			/* @parm	<in> | generic pointer to the parameter block	*/
	fzrt_boolean		clamp_closed,	/* @parm	<in> | If set to TRUE, a closed nurbs curve needs to be created
														   with knot multiplicity at the start and end (clamped). Otherwise
														   a closed curve needs to be created without knot
														   multiplicity but with overlapping control points. */
	fzrt_int				action,			/* @parm	<in> | if set to 0, the function only checks whether a
														   nurbs curve can be created. If set
														   to 1, the nurbs curve needs to be created. */
	fzrt_boolean		*can_cvrt,		/* @parm	<out> | Needs to be set to TRUE, if the nurbs curve can
															be created and to FALSE otherwise. This parameter 
															needs to be set for both, the 0 and 1 action. */
	fz_nurbs_cur_ptr		*ncur			/* @parm	<out> | The new nurbs curve. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type get nurbs surface function (Optional). When
				this function is implemented, it needs to create a
				nurbs surface from its parametric data. The nurbs surface
				must have the same shape as the original object.
				This function can get called in two ways. When the
				action parameter is 0, the function only needs to
				check whether a nurbs surface can be created from the parametric data,
				as it may be possible, that depending on the parametric data,
				a nurbs surface can or cannot be created. When
				the action parameter is 1, the nurbs surface needs to be
				created. For convenience, both the object and a 
				pointer to the parameter block are passed in.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_get_nsrf_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm,			/* @parm	<in> | generic pointer to the parameter block	*/
	fzrt_int				action,			/* @parm	<in> | if set to 0, the function only checks whether a
														   nurbs surface can be created. If set
														   to 1, the nurbs surface needs to be created. */
	fzrt_boolean		*can_cvrt,		/* @parm	<out> | Needs to be set to TRUE, if the nurbs surface can
															be created and to FALSE otherwise. This parameter 
															needs to be set for both, the 0 and 1 action. */
	fz_nurbs_srf_ptr		*nsrf			/* @parm	<out> | The new nurbs surface. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type construct smooth entity (ACIS) function (Required if
				the object has both, a smooth and a facetted representation. 
				Not required otherwise).
				This function  needs construct the smooth version of the object. 
				It is usually called, when the object is facetted, but
				the smooth equivalent is required. This is the case, for example, 
				when exporting to the SAT file format.

	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_cnstr_smod_func)(
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm			/* @parm	<in> | generic pointer to the parameter block	*/
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type edit function (Optional).
				This function needs to create an edit dialog to
				display the parameters of the object. This can be
				done using the functions in the fz_fuim_fset
				function set defined in "fz_fuim_api.h". This dialog
				may just present the parameters in simple text edit fields
				or go as far as offering a graphic preview window
				that shows the effects of the edited parameters.
				When this function is defined, the Edit button in
				the Query dialog is enabled and, when clicked, causes
				this function to be called. If this function is not 
				defined, the Edit button stays dimmed.
				This function retrieves the object as an argument. The 
				object parameter data can be acquired with the API call
				fz_objt_parm_get_data.
				
	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_iface_tmpl_func) (
	fzrt_int				windex,					/* @parm	<in> | project window index 				*/
	fz_fuim_tmpl_ptr	fuim_tmpl, 				/* @parm	<in> | pointer to the dialog template. 		*/
	fzrt_ptr			obj_ptr					/* @parm	<in> | the object to be edited				*/
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type copy control objects function (Optional).
				if the parametric data of the object has one or more nested control objects,
				this function needs to be implemented to extract 
				copies of the nested control objects. The function
				can be called in two modes. The cntrl_objs parameter may
				be passed in as NULL. In this case, the function only
				needs to determine how many nested control object
				there are and pass that value back in the nobj
				parameter. If cntrl_objs is passed in, it is an
				array of pointers to already allocated, empty objects,
				which are ready to be copied into. This MUST be done
				with the function call :<nl><nl>
				
				fz_objt_parm_nested_extract(windex,obj,obj->nested_obj1,cntrl_objs[0]);<nl>
				fz_objt_parm_nested_extract(windex,obj,obj->nested_obj2,cntrl_objs[1]);<nl>
				etc.<nl><nl>
				
				It is not permitted to copy nested control objects with any of
				the standard copy API calls, as nested control objects must be
				independent objects.<nl><nl>
				
				Note, that the empty objects are created by formZ and the
				cntrl_objs array is also allocated by formZ, based on
				the value of the nobj parameter when this function is called
				with cntrl_objs passed as NULL.
				
	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_copy_cntl_objts_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm,			/* @parm	<in> | generic pointer to the parameter block	*/
	fzrt_int				*nobj,			/* @parm	<out> | The number of nested control objects in the parametric object passed in. */
	fz_objt_ptr		*cntrl_objs		/* @parm	<in_out> | An array with pointers to empty objects, into which the nested
															   control objects need to be copied. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type key points function (Optional).
				When this function is implemented, it is expected
				to define on or more important (key) points that
				represent the object. For example, the key points
				of an arc are its center, its start and end point. 
				This function is called in two modes. If pnts is passed as NULL
				the function only needs to determine how many key points
				there are and pass that value back in the knt parameter.
				If pnts is passed in, it is an array, allocated by formZ,
				ready to receive the key points. "knt" needs to be set in
				both cases.
				
	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_get_key_pnts_func) (
	fzrt_int				windex,			/* @parm	<in> | project window index */
	fz_objt_ptr		obj,			/* @parm	<in> | object									*/
	fzrt_ptr			parm,			/* @parm	<in> | generic pointer to the parameter block	*/
	fzrt_int				*knt,			/* @parm	<out> | The number of key points for this object */
	fz_xyz_td				*pnts			/* @parm	<out> | An array of points, allocated by formZ, ready
															to receive the key points. */
	);
	
/************************************************************************

	@fsfunc_t	

	@desc		Object type io function (Required).
				This function is called whenever the parametric data
				of the object needs to be written to or read from
				file. Individual fields of the parametric data can 
				be read and written using the io stream functions
				in the fz_iost_fset function set, defined in
				"fz_iost_api.h".
				
	@return		Error codes

	@avail		5.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_io_func) (	
	fzrt_int					windex,		/*	@parm	<in> | 		project window index */
	fz_objt_ptr			obj,		/*	@parm	<in> | 		object									*/
	fzrt_ptr				parm,		/*	@parm	<in> | 		generic pointer to the parameter block	*/
	fz_iost_ptr				iost, 		/*	@parm	<in> |		The io stream pointer. 					*/
	fz_iost_dir_td_enum			dir,		/*	@parm	<in> |		Reading or writing indicator. 			*/
	fzpl_vers_td * const version, 	/*	@parm	<in_out> |	When reading, this is the version with which the object data was written.
																When writing, the parameter needs to be set to the object data's
																current version. It is up to the plugin to keep track of the
																data's version.   */
	fzrt_unsigned_int 			size		/*	@parm	<in> |		When reading, this parameter is the size of the object data when it was
																written. When writing, this parameter is unused. */
	);



/************************************************************************

	@fsfunc_t	

	@desc		Object type parameter count function (Optional or plugins, required for scripts).
				Returns the number of parameters of the object
				type.
				
	@return		Error codes

	@avail		6.0.0.0

	@see		fz_otyp_cbak_parm_get_info, fz_otyp_cbak_parm_get_state_str,
				fz_otyp_cbak_parm_get, fz_otyp_cbak_parm_set

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_parm_count_func)(
	fzrt_int			*count		/* @parm <out> | number of parameters of the object type. */
	);


/********************************************************************************************************

	@enum	

	@desc	Bit flags used by the flags argument of the fz_otyp_cbak_parm_get_info function.
						
	@expl	
			
	@avail	6.0.0.0
			
	@see		fz_otyp_cbak_parm_get_info, fz_otyp_cbak_parm_get_state_str,
				fz_otyp_cbak_parm_get, fz_otyp_cbak_parm_set, fz_otyp_cbak_parm_count

	@toc	otyp_cbak

*********************************************************************************************************/

typedef enum fz_otyp_parm_flags_enum
{	
	FZ_OTYP_PARM_NO_ANIM_BIT = 0,	/*	@emem	When this bit is set, formZ cannot animate this parameter. */
	FZ_OTYP_PARM_READ_ONLY_BIT,		/*	@emem	When this bit is set, this parameter cannot be changed through the otyp_parm get and set functions. */
	FZ_OTYP_PARM_ANIM_LEVEL1_BIT,	/*  @emem   When this bit is set, the parameter is considered a good parameter for animation. The parameter usually represents
												a fluid state. That is, a small change in the parameter causes a small change in the object. This makes it
												meaningful for animation. It is therefore added to the object's track list, by default, when keyframing the 
												object. An example for such a parameter would be the radius of a sphere.
										@pavail	6.0.0.0 */
	FZ_OTYP_PARM_HIDDEN_BIT,		/*  @emem   When this bit is set, this parameter is considered hidden, when an automatic dialog interface is built. 
												This may be the case, for example, when a parameter is used for storage of data only, but not for
												modification by the user.
										@pavail	6.0.0.0 */
	FZ_OTYP_PARM_ANIM_LEVEL2_BIT,	/*  @emem   When this bit is set, the parameter is considered a secondary parameter for animation. Usually, the parameter represents a state, that is not fluid. That is,
												a change in the paramter causes the object to take on a significantly different shape. While such a parameter
												can be animated, it is not added to the object's track list, by default, when keyframing the object. An example
												for such a parameter would be the type of a spherical object (tetrahedron, hexahedron, octahedron ...).
										@pavail	6.0.0.0 */

}fz_otyp_parm_flags_enum;


/************************************************************************

	@fsfunc_t	

	@desc		Obsolete. fz_otyp_cbak_parm_get_info2 should be used instead
			
	@return		Error codes

	@avail		6.0.0.0

	@see		fz_otyp_cbak_parm_get_info2

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_parm_get_info_func)(
	fzrt_int						parm_indx,			/* @parm <in> | parameter index to retrieve */
	fzrt_UUID_td				parm_uuid,			/* @parm <out_opt> | uuid of parameter */
	fz_string_td				parm_name,			/* @parm <out_opt> | name of parameter */
	fz_type_enum				*parm_type,			/* @parm <out_opt> | data type of parameter */
	fz_fuim_format_int_enum		*parm_format_int,	/* @parm <out_opt> | integer format id of data */
	fz_fuim_format_float_enum	*parm_format_float,	/* @parm <out_opt> | float format id of data */
	fzrt_int						*parm_range,		/* @parm <out_opt> | bit encoded range flags of data.  (see fz_fuim_range_enum). */
	fz_type_td					*parm_range_min,	/* @parm <out_opt> | minimum range value of data */
	fz_type_td					*parm_range_max,	/* @parm <out_opt> | maximum range value of data */
	fzrt_int						*flags				/* @parm <out_opt> | bit encoded flags.  (see fz_otyp_parm_flags_enum). */
	);


/************************************************************************

	@fsfunc_t	

	@desc		Object type parameter get info function (Optional or plugins, required for scripts).
				Returns information about the nth paramater of the
				object type, identified by "parm_indx".  Pass in NULL for
				information not desired. <nl>
				
				To get information about all parameters, iterate through
				the parameters up until the number of parameters returned
				by the fz_otyp_cbak_parm_count function.  <nl>
				
				The uuid in parm_uuid uniquely identifies the parameter, and is
				used in fz_otyp_cbak_parm_get and fz_otyp_cbak_parm_set to
				identify which parameter is being retrieved or set.
				
				The parm_fuim_item argument defines how to display a parameter
				in a dialog, such as the animation tack edit of the edit dialog
				if it is autoamtically created by formZ. Note, that only certain dialg 
				items can be used for a given data type. The are alisted below. For
				those dialog items, that require additional strings, such as menus
				and sets of radio buttons, the fz_otyp_cbak_parm_get_state_str must
				be implemented to define those strings.<nl><nl>
				
					All integer types :	<nl>
					FZ_FUIM_ITEM_TEXT<nl>
					FZ_FUIM_ITEM_MENU<nl>
					FZ_FUIM_ITEM_SLIDER<nl>
					FZ_FUIM_ITEM_SLIDER_TEXT<nl>
					FZ_FUIM_ITEM_RADIO<nl><nl>
					fzrt_boolean :<nl>			
					FZ_FUIM_ITEM_MENU<nl>
					FZ_FUIM_ITEM_RADIO<nl>
					FZ_FUIM_ITEM_CHECK<nl><nl>
					All floating point types :<nl>
					FZ_FUIM_ITEM_TEXT<nl>
					FZ_FUIM_ITEM_SLIDER<nl>
					FZ_FUIM_ITEM_SLIDER_TEXT<nl>
					fz_string_td :<nl>
					FZ_FUIM_ITEM_TEXT<nl><nl>
					fz_xy_td :<nl>
					FZ_FUIM_ITEM_TEXT<nl><nl>
					fz_xyz_td :<nl>
					FZ_FUIM_ITEM_TEXT<nl><nl>
				
				
				If an inappropriate item type is returned for a parameter, FZ_FUIM_ITEM_TEXT
				will be used instead. Parameters with data types not listed above are currently not displayed
				in a dialog.
			
	@return		Error codes

	@avail		6.0.0.0

	@see		fz_otyp_cbak_parm_get_state_str,
				fz_otyp_cbak_parm_get, fz_otyp_cbak_parm_set, fz_otyp_cbak_parm_count

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_parm_get_info2_func)(
	fzrt_int						parm_indx,			/* @parm <in> | parameter index to retrieve */
	fzrt_UUID_td				parm_uuid,			/* @parm <out_opt> | uuid of parameter */
	fz_string_td				parm_name,			/* @parm <out_opt> | name of parameter */
	fz_type_enum				*parm_type,			/* @parm <out_opt> | data type of parameter */
	fz_fuim_format_int_enum		*parm_format_int,	/* @parm <out_opt> | integer format id of data */
	fz_fuim_format_float_enum	*parm_format_float,	/* @parm <out_opt> | float format id of data */
	fz_fuim_item_type_enum		*parm_fuim_item,	/* @parm <out_opt> | The type of dialog item with which to display the parameter. Note,
																		 that only certain dialg items can be used for a given data type.  */
	fzrt_int						*parm_range,		/* @parm <out_opt> | bit encoded range flags of data.  (see fz_fuim_range_enum). */
	fz_type_td					*parm_range_min,	/* @parm <out_opt> | minimum range value of data */
	fz_type_td					*parm_range_max,	/* @parm <out_opt> | maximum range value of data */
	fzrt_int						*flags				/* @parm <out_opt> | bit encoded flags.  (see fz_otyp_parm_flags_enum). */
	);


/************************************************************************

	@fsfunc_t	

	@desc		Object type state parameter get string function (Optional).
				Given a parameter identified by its uuid, this
				function returns the nth string associated with the nth state
				of that variable.  This is useful for integer or boolean
				parameters that have various strings associated with their
				values, as opposed to just the raw values.  For example, a
				menu parameter may have strings for each menu item, and these
				would be useful when displaying this parameter data in other
				dialog interface contexts.
				
	@return		Error codes

	@avail		6.0.0.0

	@see		fz_otyp_cbak_parm_get_info,
				fz_otyp_cbak_parm_get, fz_otyp_cbak_parm_set, fz_otyp_cbak_parm_count

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_parm_get_state_str_func)(
	fzrt_UUID_td		parm_uuid,		/* @parm <in> | uuid of parameter */
	fzrt_int				which_state,	/* @parm <in> | index of which state string of parameter to retrieve */
	fz_string_td		str				/* @parm <out> | string of the nth state of the given parameter */
	);
	

/************************************************************************

	@fsfunc_t	

	@desc		Object type parameter get function (Optional).
				Given an object, and a parameter identified by its uuid, this
				function retrieves the data currently stored in the object
				for the given parameter.
				
	@return		Error codes

	@avail		6.0.0.0

	@see		fz_otyp_cbak_parm_get_info, fz_otyp_cbak_parm_get_state_str,
				fz_otyp_cbak_parm_set, fz_otyp_cbak_parm_count

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_parm_get_func)(
	fzrt_int				windex,			/* @parm <in> | project window index */
	fz_objt_ptr			objt,			/* @parm <in> | object */
	fzrt_UUID_td		parm_uuid,		/* @parm <in> | uuid of parameter */
	fz_type_td			*data			/* @parm <out> | data retrieved from the object for the given parameter */
	);
	

/************************************************************************

	@fsfunc_t	

	@desc		Object type parameter set function (Optional).
				Given an object, and a parameter identified by its uuid, this
				function stores the data into the object for the given parameter.
				
	@return		Error codes

	@avail		6.0.0.0

	@see		fz_otyp_cbak_parm_get_info, fz_otyp_cbak_parm_get_state_str,
				fz_otyp_cbak_parm_get, fz_otyp_cbak_parm_count

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_parm_set_func)(
	fzrt_int				windex,			/* @parm <in> | project window index */
	fz_objt_ptr			objt,			/* @parm <in> | object */
	fzrt_UUID_td		parm_uuid,		/* @parm <in> | uuid of parameter */
	fz_type_td			*data			/* @parm <in> | data to be stored into the object for the given parameter */
	);
	

/************************************************************************

	@fsfunc_t	

	@desc		Object type parameter edit function (Optional).
				This function will be invoked when one or mroe objects of this
				type are picked (with one of the pick tools) and their parameters
				displayed in the Tool Options palette. This function is responsible
				to follow a certain format to handle the editing of multiple
				objects simultaneously. See code of one the sample object type
				plugins (frame, star ...)
				
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_prop_palt_func)(
	fzrt_int				windex,		/* @parm <in> | project window index */
	fz_objt_ptr			*objts,		/* @parm <in> | array of objects, whose parameters to show in the palette */
	fzrt_int				nobjt,		/* @parm <in> | number of objects in the array */
	fz_fuim_tmpl_ptr	fuim_tmpl,	/* @parm <in> | pointer to the palette template. */
	short				parent		/* @parm <in> | Parent group, under which all palette items must be created. */
	);

/************************************************************************

	@fsfunc_t	

	@desc		Object type parameter cedt function (Optional).
	
	@return		Error codes

	@avail		7.0.0.0

	@see		

	@exfile

	@toc		otyp_cbak

*************************************************************************/
typedef fzrt_error_td  (FZRT_SPEC *fz_otyp_cbak_cedt_func)(
	fzrt_int				windex,			/* @parm <in> | project window index */
	fz_objt_ptr				objt,			/* @parm <in> | array of objects, whose parameters to show in the palette */
	fzrt_ptr				parm,			/* @parm <in> | number of objects in the array */
	fz_cedt_item_ptr		parent_item		/* @parm <in> | Parent group, under which all cedt items must be created. */
	);

/************************************************************************

	@plfset	fz_otyp_cbak_fset

	@desc	Function set for a custom object type. The functions in this set need to
			be supplied by the plugin to implement a custom object type.
			Required function are :
				fz_otyp_cbak_name
				fz_otyp_cbak_uuid
				fz_otyp_cbak_info
				fz_otyp_cbak_init
				fz_otyp_cbak_regen
				fz_otyp_cbak_io
			All other functions are optional. However for certain functionality
			to occur, more functions need to be implemented. For example, to
			edit the parameters of an object of this type through an edit dialog
			invoked from the Query dialog, the fz_otyp_cbak_iface_tmpl function must be
			implemented. If not, the Edit button in the Query dialog will stay
			disabled.			
						
			
	@avail	5.0.0.0

	@toc	otyp_cbak

*************************************************************************/

/* UUID : {af8a7a56-0191-4d72-853b-33461e4d2a86} *//* Reference 142 */
/********************************************************************************************************

	@fsdef	formZ object type callbacks function set id.

*********************************************************************************************************/
#define FZ_OTYP_CBAK_FSET_TYPE			"\xaf\x8a\x7a\x56\x01\x91\x4d\x72\x85\x3b\x33\x46\x1e\x4d\x2a\x86"
/********************************************************************************************************

	@fsdef	formZ object type callbacks function set name.

*********************************************************************************************************/
#define FZ_OTYP_CBAK_FSET_NAME			"FormZ Object Type Callbacks"
/********************************************************************************************************

	@fsdef	formZ object type callbacks function set version.

*********************************************************************************************************/
#define FZ_OTYP_CBAK_FSET_VERSION			FZPL_VERS_MAKE(6,0,0,0)


typedef struct fz_otyp_cbak_fset
{
	fzpl_fset_prvt_data_td						prvt_data;

	fz_otyp_cbak_name_func						fz_otyp_cbak_name;					/* @fsfunc */
	fz_otyp_cbak_uuid_func						fz_otyp_cbak_uuid;					/* @fsfunc */
	fz_otyp_cbak_init_func						fz_otyp_cbak_init;					/* @fsfunc */
	fz_otyp_cbak_finit_func						fz_otyp_cbak_finit;					/* @fsfunc */
	fz_otyp_cbak_info_func						fz_otyp_cbak_info;					/* @fsfunc */
	fz_otyp_cbak_tform_func						fz_otyp_cbak_tform;					/* @fsfunc */
	fz_otyp_cbak_rvrs_func						fz_otyp_cbak_rvrs;					/* @fsfunc */
	fz_otyp_cbak_copy_func						fz_otyp_cbak_copy;					/* @fsfunc */
	fz_otyp_cbak_geom_func						fz_otyp_cbak_geom;					/* @fsfunc */
	fz_otyp_cbak_cvsl_func						fz_otyp_cbak_cvsl;					/* @fsfunc */
	fz_otyp_cbak_regen_func						fz_otyp_cbak_regen;					/* @fsfunc */
	fz_otyp_cbak_cvrt_ptch_func					fz_otyp_cbak_cvrt_ptch;				/* @fsfunc */
	fz_otyp_cbak_get_ncur_func					fz_otyp_cbak_get_ncur;				/* @fsfunc */
	fz_otyp_cbak_get_nsrf_func					fz_otyp_cbak_get_nsrf;				/* @fsfunc */
	fz_otyp_cbak_cnstr_smod_func				fz_otyp_cbak_cnstr_smod;			/* @fsfunc */
	fz_otyp_cbak_iface_tmpl_func				fz_otyp_cbak_iface_tmpl;			/* @fsfunc */
	fz_otyp_cbak_copy_cntl_objts_func			fz_otyp_cbak_copy_cntl_objts;		/* @fsfunc */
	fz_otyp_cbak_get_key_pnts_func				fz_otyp_cbak_get_key_pnts;			/* @fsfunc */
	fz_otyp_cbak_io_func						fz_otyp_cbak_io;					/* @fsfunc */
	
	/************************************************************************************
	 *																					*
	 *		DO NOT MAKE ANY CHANGES TO THE ABOVE FUNCTIONS!!!							*
	 *		DO NOT ADD ANY FUNCTION ABOVE THIS LINE!!!									*
	 *		@comm  End of version 5.0.0.0 functions.									*
	 *																					*
	 ************************************************************************************/

	fz_otyp_cbak_parm_count_func				fz_otyp_cbak_parm_count;			/* @fsfunc */
	fz_otyp_cbak_parm_get_info_func				fz_otyp_cbak_parm_get_info;			/* @fsfunc */
	fz_otyp_cbak_parm_get_state_str_func		fz_otyp_cbak_parm_get_state_str;	/* @fsfunc */
	fz_otyp_cbak_parm_get_func					fz_otyp_cbak_parm_get;				/* @fsfunc */
	fz_otyp_cbak_parm_set_func					fz_otyp_cbak_parm_set;				/* @fsfunc */
	fz_otyp_cbak_parm_get_info2_func			fz_otyp_cbak_parm_get_info2;		/* @fsfunc */

	/************************************************************************************
	 *																					*
	 *		DO NOT MAKE ANY CHANGES TO THE ABOVE FUNCTIONS!!!							*
	 *		DO NOT ADD ANY FUNCTION ABOVE THIS LINE!!!									*
	 *		@comm  End of version 5.5.0.0 functions.									*
	 *																					*
	 ************************************************************************************/
	fz_otyp_cbak_prop_palt_func					fz_otyp_cbak_prop_palt;				/* @fsfunc */
	
	/************************************************************************************
	 *																					*
	 *		DO NOT MAKE ANY CHANGES TO THE ABOVE FUNCTIONS!!!							*
	 *		DO NOT ADD ANY FUNCTION ABOVE THIS LINE!!!									*
	 *		@comm  End of version 8.0.0.0 functions.									*
	 *																					*
	 ************************************************************************************/
	fz_otyp_cbak_cedt_func						fz_otyp_cbak_cedt;				/* @fsfunc */
	
}  fz_otyp_cbak_fset;


#ifdef __cplusplus
}
#endif
		
#endif /*__FORMZ_OTYP_API_H */

