/*------------------------------------------------------------------------*
  Filename....: view_commands_plugin.c
  Scope.......: File Translator Plugin for tool (cmds) plugin.

  Last Change.:

  Version      Date                Description      Author
	 1.0        06/17/02           New				Tim Hanes


			  COPYRIGHT (C) 2001.  All Rights Reserved.
		 auto*des*sys, Inc., Columbus, Ohio, USA.
 *------------------------------------------------------------------------*/

#include "view_commands.h"

#include "fz_plugin_glue_api.h"

#include "fz_cmnd_api.h"

#include "fz_plugin_glue_api.h"


/************************************************************************
*************************************************************************/
static fzrt_error_td view_axonometric_info(fz_proj_level_enum *level)
/************************************************************************/
{
	*level = FZ_PROJ_LEVEL_MODEL;
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_axonometric_name(char *name, fzrt_int max_len)
/************************************************************************/
{
	char				str[256];
	
	fzrt_base_funcs.fzrt_fzr_get_string(rsrc_ref, STRINGS, STRING_AXONOMETRIC, str);
	strncpy(name, str, max_len);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_axonometric_uuid(fzrt_UUID_td uuid)
/************************************************************************/
{

	fzrt_base_funcs.fzrt_UUID_copy(VIEW_AXONOMETRIC_ID, uuid);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_axonometric_menu(fz_fuim_menu_ptr menu_ptr, const fzrt_UUID_td menu_uuid, fzrt_UUID_td group_uuid, fzrt_int *position)
{		

	fuim_funcs.fz_fuim_exts_menu(menu_ptr, menu_uuid, "My View Commands - SDK Sample", VIEW_MENU_GROUP_ID);
	
	fzrt_base_funcs.fzrt_UUID_copy(VIEW_MENU_GROUP_ID, group_uuid);
	*position = 1;
	
	return(FZRT_NOERR);
}

/************************************************************************
*************************************************************************/
static fzrt_error_td view_axonometric_active(fzrt_int windex, fzrt_int *rv)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	if((err = view_funcs.fz_view_get_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type)) == FZRT_NOERR)
	{
		err = type_funcs.fz_type_get_int(&type, (fzrt_int *)&vtype);
		if(vtype == FZ_VIEW_TYPE_AXONOMETRIC)	*rv = TRUE;
		else									*rv = FALSE;
	}
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_axonometric_select(fzrt_int windex)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	vtype = FZ_VIEW_TYPE_AXONOMETRIC;
	err = type_funcs.fz_type_set_int((fzrt_int *)&vtype, &type);
	err = view_funcs.fz_view_set_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type);
	
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_axonometric_fill ( const fzpl_fset_def_ptr fset_def, fzpl_fset_td * const fset )
/************************************************************************/
{
	fzrt_error_td						err = FZRT_NOERR;
	fz_cmnd_cbak_proj_fset 		*cmds_func;

	if ( fset_def && fset )
	{
		fset_glue->fzpl_fset_def_check ( fset_def, FZ_CMND_CBAK_PROJ_FSET_VERSION, FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( cmds_func ), FZPL_VERSION_OP_NEWER );
		if ( !err )
		{
			cmds_func = (fz_cmnd_cbak_proj_fset *)fset;

			cmds_func->fz_cmnd_cbak_proj_init				= NULL;
			cmds_func->fz_cmnd_cbak_proj_finit				= NULL;
			cmds_func->fz_cmnd_cbak_proj_info				= view_axonometric_info;
			cmds_func->fz_cmnd_cbak_proj_name				= view_axonometric_name;
			cmds_func->fz_cmnd_cbak_proj_uuid				= view_axonometric_uuid;
			cmds_func->fz_cmnd_cbak_proj_help				= NULL;

			cmds_func->fz_cmnd_cbak_proj_avail				= NULL;
			cmds_func->fz_cmnd_cbak_proj_select				= view_axonometric_select;
			cmds_func->fz_cmnd_cbak_proj_active				= view_axonometric_active;
	
			cmds_func->fz_cmnd_cbak_proj_menu				= view_axonometric_menu;
			cmds_func->fz_cmnd_cbak_proj_icon_menu			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_menu_adjacent	= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_rsrc			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_file			= NULL;
	
			cmds_func->fz_cmnd_cbak_proj_pref_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_data_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_wind_data_io		= NULL;	
		}
	}
	else
	{
		err = fzrt_base_funcs.fzrt_error_set_with_detail ( FZRT_BAD_PARAM_ERROR, FZRT_ERROR_SEVERITY_ERROR, FZRT_ERROR_CONTEXT_FZRT, 0, 3001 );
	}

	return err;
}

/************************************************************************
*************************************************************************/
static fzrt_error_td view_isometric_info(fz_proj_level_enum *level)
/************************************************************************/
{
	*level = FZ_PROJ_LEVEL_MODEL;
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_isometric_name(char *name, fzrt_int max_len)
/************************************************************************/
{
	char				str[256];
	
	fzrt_base_funcs.fzrt_fzr_get_string(rsrc_ref, STRINGS, STRING_ISOMETRIC, str);
	strncpy(name, str, max_len);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_isometric_uuid(fzrt_UUID_td uuid)
/************************************************************************/
{

	fzrt_base_funcs.fzrt_UUID_copy(VIEW_ISOMETRIC_ID, uuid);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_isometric_menu(fz_fuim_menu_ptr menu_ptr, const fzrt_UUID_td menu_uuid, fzrt_UUID_td group_uuid, fzrt_int *position)
{		

	fuim_funcs.fz_fuim_exts_menu(menu_ptr, menu_uuid, "My View Commands - SDK Sample", VIEW_MENU_GROUP_ID);
	
	fzrt_base_funcs.fzrt_UUID_copy(VIEW_MENU_GROUP_ID, group_uuid);
	*position = 2;
	
	return(FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_isometric_active(fzrt_int windex, fzrt_int *rv)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	if((err = view_funcs.fz_view_get_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type)) == FZRT_NOERR)
	{
		err = type_funcs.fz_type_get_int(&type, (fzrt_int *)&vtype);
		if(vtype == FZ_VIEW_TYPE_ISOMETRIC)	*rv = TRUE;
		else									*rv = FALSE;
	}
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_isometric_select(fzrt_int windex)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	vtype = FZ_VIEW_TYPE_ISOMETRIC;
	err = type_funcs.fz_type_set_int((fzrt_int *)&vtype, &type);
	err = view_funcs.fz_view_set_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type);
	
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_isometric_fill ( const fzpl_fset_def_ptr fset_def, fzpl_fset_td * const fset )
/************************************************************************/
{
	fzrt_error_td						err = FZRT_NOERR;
	fz_cmnd_cbak_proj_fset 		*cmds_func;

	if ( fset_def && fset )
	{
		fset_glue->fzpl_fset_def_check ( fset_def, FZ_CMND_CBAK_PROJ_FSET_VERSION, FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( cmds_func ), FZPL_VERSION_OP_NEWER );
		if ( !err )
		{
			cmds_func = (fz_cmnd_cbak_proj_fset *)fset;

			cmds_func->fz_cmnd_cbak_proj_init				= NULL;
			cmds_func->fz_cmnd_cbak_proj_finit				= NULL;
			cmds_func->fz_cmnd_cbak_proj_info				= view_isometric_info;
			cmds_func->fz_cmnd_cbak_proj_name				= view_isometric_name;
			cmds_func->fz_cmnd_cbak_proj_uuid				= view_isometric_uuid;
			cmds_func->fz_cmnd_cbak_proj_help				= NULL;

			cmds_func->fz_cmnd_cbak_proj_avail				= NULL;
			cmds_func->fz_cmnd_cbak_proj_select				= view_isometric_select;
			cmds_func->fz_cmnd_cbak_proj_active				= view_isometric_active;
	
			cmds_func->fz_cmnd_cbak_proj_menu				= view_isometric_menu;
			cmds_func->fz_cmnd_cbak_proj_icon_menu			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_menu_adjacent	= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_rsrc			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_file			= NULL;
	
			cmds_func->fz_cmnd_cbak_proj_pref_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_data_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_wind_data_io		= NULL;	
		}
	}
	else
	{
		err = fzrt_base_funcs.fzrt_error_set_with_detail ( FZRT_BAD_PARAM_ERROR, FZRT_ERROR_SEVERITY_ERROR, FZRT_ERROR_CONTEXT_FZRT, 0, 3001 );
	}

	return err;
}

/************************************************************************
*************************************************************************/
static fzrt_error_td view_oblique_info(fz_proj_level_enum *level)
/************************************************************************/
{
	*level = FZ_PROJ_LEVEL_MODEL;
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_oblique_name(char *name, fzrt_int max_len)
/************************************************************************/
{
	char				str[256];
	
	fzrt_base_funcs.fzrt_fzr_get_string(rsrc_ref, STRINGS, STRING_OBLIQUE, str);
	strncpy(name, str, max_len);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_oblique_uuid(fzrt_UUID_td uuid)
/************************************************************************/
{

	fzrt_base_funcs.fzrt_UUID_copy(VIEW_OBLIQUE_ID, uuid);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_oblique_menu(fz_fuim_menu_ptr menu_ptr, const fzrt_UUID_td menu_uuid, fzrt_UUID_td group_uuid, fzrt_int *position)
{		

	fuim_funcs.fz_fuim_exts_menu(menu_ptr, menu_uuid, "My View Commands - SDK Sample", VIEW_MENU_GROUP_ID);
	
	fzrt_base_funcs.fzrt_UUID_copy(VIEW_MENU_GROUP_ID, group_uuid);
	*position = 3;
	
	return(FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_oblique_active(fzrt_int windex, fzrt_int *rv)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	if((err = view_funcs.fz_view_get_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type)) == FZRT_NOERR)
	{
		err = type_funcs.fz_type_get_int(&type, (fzrt_int *)&vtype);
		if(vtype == FZ_VIEW_TYPE_OBLIQUE)	*rv = TRUE;
		else								*rv = FALSE;
	}
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_oblique_select(fzrt_int windex)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	vtype = FZ_VIEW_TYPE_OBLIQUE;
	err = type_funcs.fz_type_set_int((fzrt_int *)&vtype, &type);
	err = view_funcs.fz_view_set_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type);
	
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_oblique_fill ( const fzpl_fset_def_ptr fset_def, fzpl_fset_td * const fset )
/************************************************************************/
{
	fzrt_error_td						err = FZRT_NOERR;
	fz_cmnd_cbak_proj_fset 		*cmds_func;

	if ( fset_def && fset )
	{
		fset_glue->fzpl_fset_def_check ( fset_def, FZ_CMND_CBAK_PROJ_FSET_VERSION, FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( cmds_func ), FZPL_VERSION_OP_NEWER );
		if ( !err )
		{
			cmds_func = (fz_cmnd_cbak_proj_fset *)fset;

			cmds_func->fz_cmnd_cbak_proj_init				= NULL;
			cmds_func->fz_cmnd_cbak_proj_finit				= NULL;
			cmds_func->fz_cmnd_cbak_proj_info				= view_oblique_info;
			cmds_func->fz_cmnd_cbak_proj_name				= view_oblique_name;
			cmds_func->fz_cmnd_cbak_proj_uuid				= view_oblique_uuid;
			cmds_func->fz_cmnd_cbak_proj_help				= NULL;

			cmds_func->fz_cmnd_cbak_proj_avail				= NULL;
			cmds_func->fz_cmnd_cbak_proj_select				= view_oblique_select;
			cmds_func->fz_cmnd_cbak_proj_active				= view_oblique_active;
	
			cmds_func->fz_cmnd_cbak_proj_menu				= view_oblique_menu;
			cmds_func->fz_cmnd_cbak_proj_icon_menu			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_menu_adjacent	= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_rsrc			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_file			= NULL;
	
			cmds_func->fz_cmnd_cbak_proj_pref_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_data_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_wind_data_io		= NULL;	
		}
	}
	else
	{
		err = fzrt_base_funcs.fzrt_error_set_with_detail ( FZRT_BAD_PARAM_ERROR, FZRT_ERROR_SEVERITY_ERROR, FZRT_ERROR_CONTEXT_FZRT, 0, 3001 );
	}

	return err;
}

/************************************************************************
*************************************************************************/
static fzrt_error_td view_perspective_info(fz_proj_level_enum *level)
/************************************************************************/
{
	*level = FZ_PROJ_LEVEL_MODEL;
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_perspective_name(char *name, fzrt_int max_len)
/************************************************************************/
{
	char				str[256];
	
	fzrt_base_funcs.fzrt_fzr_get_string(rsrc_ref, STRINGS, STRING_PERSPECTIVE, str);
	strncpy(name, str, max_len);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_perspective_uuid(fzrt_UUID_td uuid)
/************************************************************************/
{

	fzrt_base_funcs.fzrt_UUID_copy(VIEW_PERSPECTIVE_ID, uuid);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_perspective_menu(fz_fuim_menu_ptr menu_ptr, const fzrt_UUID_td menu_uuid, fzrt_UUID_td group_uuid, fzrt_int *position)
{		

	fuim_funcs.fz_fuim_exts_menu(menu_ptr, menu_uuid, "My View Commands - SDK Sample", VIEW_MENU_GROUP_ID);
	
	fzrt_base_funcs.fzrt_UUID_copy(VIEW_MENU_GROUP_ID, group_uuid);
	*position = 4;
	
	return(FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_perspective_active(fzrt_int windex, fzrt_int *rv)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	if((err = view_funcs.fz_view_get_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type)) == FZRT_NOERR)
	{
		err = type_funcs.fz_type_get_int(&type, (fzrt_int *)&vtype);
		if(vtype == FZ_VIEW_TYPE_PERSPECTIVE)	*rv = TRUE;
		else								*rv = FALSE;
	}
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_perspective_select(fzrt_int windex)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	vtype = FZ_VIEW_TYPE_PERSPECTIVE;
	err = type_funcs.fz_type_set_int((fzrt_int *)&vtype, &type);
	err = view_funcs.fz_view_set_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type);
	
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_perspective_fill ( const fzpl_fset_def_ptr fset_def, fzpl_fset_td * const fset )
/************************************************************************/
{
	fzrt_error_td						err = FZRT_NOERR;
	fz_cmnd_cbak_proj_fset 		*cmds_func;

	if ( fset_def && fset )
	{
		fset_glue->fzpl_fset_def_check ( fset_def, FZ_CMND_CBAK_PROJ_FSET_VERSION, FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( cmds_func ), FZPL_VERSION_OP_NEWER );
		if ( !err )
		{
			cmds_func = (fz_cmnd_cbak_proj_fset *)fset;

			cmds_func->fz_cmnd_cbak_proj_init				= NULL;
			cmds_func->fz_cmnd_cbak_proj_finit				= NULL;
			cmds_func->fz_cmnd_cbak_proj_info				= view_perspective_info;
			cmds_func->fz_cmnd_cbak_proj_name				= view_perspective_name;
			cmds_func->fz_cmnd_cbak_proj_uuid				= view_perspective_uuid;
			cmds_func->fz_cmnd_cbak_proj_help				= NULL;

			cmds_func->fz_cmnd_cbak_proj_avail				= NULL;
			cmds_func->fz_cmnd_cbak_proj_select				= view_perspective_select;
			cmds_func->fz_cmnd_cbak_proj_active				= view_perspective_active;
	
			cmds_func->fz_cmnd_cbak_proj_menu				= view_perspective_menu;
			cmds_func->fz_cmnd_cbak_proj_icon_menu			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_menu_adjacent	= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_rsrc			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_file			= NULL;
	
			cmds_func->fz_cmnd_cbak_proj_pref_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_data_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_wind_data_io		= NULL;	
		}
	}
	else
	{
		err = fzrt_base_funcs.fzrt_error_set_with_detail ( FZRT_BAD_PARAM_ERROR, FZRT_ERROR_SEVERITY_ERROR, FZRT_ERROR_CONTEXT_FZRT, 0, 3001 );
	}

	return err;
}

/************************************************************************
*************************************************************************/
static fzrt_error_td view_panoramic_info(fz_proj_level_enum *level)
/************************************************************************/
{
	*level = FZ_PROJ_LEVEL_MODEL;
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_panoramic_name(char *name, fzrt_int max_len)
/************************************************************************/
{
	char				str[256];
	
	fzrt_base_funcs.fzrt_fzr_get_string(rsrc_ref, STRINGS, STRING_PANORAMIC, str);
	strncpy(name, str, max_len);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_panoramic_uuid(fzrt_UUID_td uuid)
/************************************************************************/
{

	fzrt_base_funcs.fzrt_UUID_copy(VIEW_PANORAMIC_ID, uuid);
	
	return (FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_panoramic_menu(fz_fuim_menu_ptr menu_ptr, const fzrt_UUID_td menu_uuid, fzrt_UUID_td group_uuid, fzrt_int *position)
{		

	fuim_funcs.fz_fuim_exts_menu(menu_ptr, menu_uuid, "My View Commands - SDK Sample", VIEW_MENU_GROUP_ID);
	
	fzrt_base_funcs.fzrt_UUID_copy(VIEW_MENU_GROUP_ID, group_uuid);
	*position = 5;
	
	return(FZRT_NOERR);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_panoramic_active(fzrt_int windex, fzrt_int *rv)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	if((err = view_funcs.fz_view_get_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type)) == FZRT_NOERR)
	{
		err = type_funcs.fz_type_get_int(&type, (fzrt_int *)&vtype);
		if(vtype == FZ_VIEW_TYPE_PANORAMIC)	*rv = TRUE;
		else								*rv = FALSE;
	}
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_panoramic_select(fzrt_int windex)
/************************************************************************/
{
	fzrt_error_td 		err = FZRT_NOERR;
	fz_view_type_enum	vtype;
	fz_type_td 			type;

	vtype = FZ_VIEW_TYPE_PANORAMIC;
	err = type_funcs.fz_type_set_int((fzrt_int *)&vtype, &type);
	err = view_funcs.fz_view_set_parm_data(windex, NULL, FZ_VIEW_PARM_TYPE, &type);
	
	return (err);
}
/************************************************************************
*************************************************************************/
static fzrt_error_td view_panoramic_fill ( const fzpl_fset_def_ptr fset_def, fzpl_fset_td * const fset )
/************************************************************************/
{
	fzrt_error_td						err = FZRT_NOERR;
	fz_cmnd_cbak_proj_fset 		*cmds_func;

	if ( fset_def && fset )
	{
		fset_glue->fzpl_fset_def_check ( fset_def, FZ_CMND_CBAK_PROJ_FSET_VERSION, FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( cmds_func ), FZPL_VERSION_OP_NEWER );
		if ( !err )
		{
			cmds_func = (fz_cmnd_cbak_proj_fset *)fset;

			cmds_func->fz_cmnd_cbak_proj_init				= NULL;
			cmds_func->fz_cmnd_cbak_proj_finit				= NULL;
			cmds_func->fz_cmnd_cbak_proj_info				= view_panoramic_info;
			cmds_func->fz_cmnd_cbak_proj_name				= view_panoramic_name;
			cmds_func->fz_cmnd_cbak_proj_uuid				= view_panoramic_uuid;
			cmds_func->fz_cmnd_cbak_proj_help				= NULL;

			cmds_func->fz_cmnd_cbak_proj_avail				= NULL;
			cmds_func->fz_cmnd_cbak_proj_select				= view_panoramic_select;
			cmds_func->fz_cmnd_cbak_proj_active				= view_panoramic_active;
	
			cmds_func->fz_cmnd_cbak_proj_menu				= view_panoramic_menu;
			cmds_func->fz_cmnd_cbak_proj_icon_menu			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_menu_adjacent	= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_rsrc			= NULL;
			cmds_func->fz_cmnd_cbak_proj_icon_file			= NULL;
	
			cmds_func->fz_cmnd_cbak_proj_pref_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_data_io			= NULL;	
			cmds_func->fz_cmnd_cbak_proj_wind_data_io		= NULL;	
		}
	}
	else
	{
		err = fzrt_base_funcs.fzrt_error_set_with_detail ( FZRT_BAD_PARAM_ERROR, FZRT_ERROR_SEVERITY_ERROR, FZRT_ERROR_CONTEXT_FZRT, 0, 3001 );
	}

	return err;
}


/************************************************************************
	view_commands_acquire_fsets:
			acquires all application provided service function sets.
*************************************************************************/
static fzrt_error_td view_commands_acquire_fsets ( void )
/************************************************************************/
{
	fzrt_error_td err = FZRT_NOERR;


	
	if(err == FZRT_NOERR)
	{
		err = (*fset_glue->fzpl_fset_acquire) ( FZ_MATH_FSET_TYPE, FZ_MATH_FSET_VERSION, FZRT_UUID_NULL,
									 FZPL_TYPE_STRING(fz_math_fset), sizeof(math_funcs),
									 (fzpl_fset_td *)&math_funcs );
	}
	
	if(err == FZRT_NOERR)
	{
		err =(*fset_glue->fzpl_fset_acquire)(FZ_MODEL_FSET_TYPE, FZ_MODEL_FSET_VERSION, FZRT_UUID_NULL,
									 FZPL_TYPE_STRING(fz_model_fset), sizeof(model_funcs),
									(fzpl_fset_td *)&model_funcs);
	}

	if ( !err )
	{
		err = (*fset_glue->fzpl_fset_acquire) ( FZ_TYPE_FSET_TYPE, FZ_TYPE_FSET_VERSION, FZRT_UUID_NULL,
									 FZPL_TYPE_STRING(fz_type_fset), sizeof(type_funcs),
									 (fzpl_fset_td *)&type_funcs );
	}

	if ( !err )
	{
		err = (*fset_glue->fzpl_fset_acquire) ( FZ_FUIM_FSET_TYPE, FZ_FUIM_FSET_VERSION, FZRT_UUID_NULL,
									 FZPL_TYPE_STRING(fz_fuim_fset), sizeof(fuim_funcs),
									 (fzpl_fset_td *)&fuim_funcs );
	}
	if(err == FZRT_NOERR)
	{
		err = (*fset_glue->fzpl_fset_acquire) ( FZ_FZRT_BASE_FSET_TYPE, FZ_FZRT_BASE_FSET_VERSION, FZRT_UUID_NULL,
									 FZPL_TYPE_STRING(fz_fzrt_base_fset), sizeof(fzrt_base_funcs),
									 (fzpl_fset_td *)&fzrt_base_funcs );
	}
	if(err == FZRT_NOERR)
	{
		err = (*fset_glue->fzpl_fset_acquire) ( FZ_FZRT_FILE_FSET_TYPE, FZ_FZRT_FILE_FSET_VERSION, FZRT_UUID_NULL,
									 FZPL_TYPE_STRING(fz_fzrt_file_fset), sizeof(fzrt_file_funcs),
									 (fzpl_fset_td *)&fzrt_file_funcs );
	}
	if(err == FZRT_NOERR)
	{
		err = (*fset_glue->fzpl_fset_acquire) ( FZ_VIEW_FSET_TYPE, FZ_VIEW_FSET_VERSION, FZRT_UUID_NULL,
									 FZPL_TYPE_STRING(fz_view_fset), sizeof(view_funcs),
									 (fzpl_fset_td *)&view_funcs );
	}
	
	return err;
}

/************************************************************************
	view_commands_release_fsets:
			releases all application provided service function sets.

	TAH 06/17/02: NEW FUNCTION
*************************************************************************/

static void view_commands_release_fsets ( void )
/************************************************************************/
{
	(*fset_glue->fzpl_fset_release) ( (fzpl_fset_td *)&fuim_funcs );
	(*fset_glue->fzpl_fset_release) ( (fzpl_fset_td *)&type_funcs );
	(*fset_glue->fzpl_fset_release) ( (fzpl_fset_td *)&model_funcs );
	(*fset_glue->fzpl_fset_release) ( (fzpl_fset_td *)&math_funcs );
	(*fset_glue->fzpl_fset_release) ( (fzpl_fset_td *)&fzrt_base_funcs );
	(*fset_glue->fzpl_fset_release) ( (fzpl_fset_td *)&fzrt_file_funcs );
	(*fset_glue->fzpl_fset_release) ( (fzpl_fset_td *)&view_funcs );
}


/************************************************************************
	view_commands_check_config:
			A first pass check to see if the plugin can be loaded.
			Checks licensing.
			Checks that application defined function sets which are
				needed by the plugins are available.
			Verifies that plugin and application are compatible.
			Verifies that plugin type is expected by application.
			Informs the application if this plugin is dependent on
				function sets from other plugins.


	TAH 06/17/02: NEW FUNCTION
*************************************************************************/

static fzrt_error_td view_commands_check_config ( const fzpl_fset_glue_fset * const fzpl_fset_glue, const fzpl_host_config_td * const hostConfig )
/************************************************************************/
{
	fzrt_error_td					err = FZRT_NOERR;

	fset_glue = fzpl_fset_glue;

	// TODO : Check License

	/*  Make sure required application defined function sets are available */
	/*  Release the function sets at unload. */

	err = view_commands_acquire_fsets();

	/* TODO : Tell the plugin manager what plugins this plugins are dependent on */

	/* Tell the plugin manager how many plugins and what types we'll be loading */

	if ( !err )
	{
		fzrt_file_funcs.fzrt_file_floc_init(&floc);
		err = (*fset_glue->fzpl_plugin_file_get_floc)(floc);
		if(err == FZRT_NOERR)
		{
			err = fzrt_base_funcs.fzrt_fzr_open(floc,"view_commands", &rsrc_ref);
		}
	}
	
	if ( err )
	{
		view_commands_release_fsets();
	}
	
	return err;
}
/************************************************************************
*************************************************************************/
static fzrt_boolean view_commands_error_str_func(fzrt_int err, char *str, short str_len)
/************************************************************************/
{
	char	msg[256];

	fzrt_base_funcs.fzrt_fzr_get_string(rsrc_ref, 1, err, msg);
	strncpy(str, msg, str_len);
	
	return(msg[0] == '\0' ? FALSE : TRUE);
}

/************************************************************************
	view_commands_register_plugins:
		Registers plugins and their assocoated function sets.

	TAH 06/17/02: NEW FUNCTION
*************************************************************************/

static fzrt_error_td view_commands_register_plugins ( const fzpl_fset_glue_fset * const fsf, const fzpl_host_config_td * const hostConfig )
/************************************************************************/
{
	fzrt_error_td					err = FZRT_NOERR;
	fzpl_plugin_query_fset		plugin_query_funcs;
	char							str[256];
	
	fzrt_base_funcs.fzrt_fzr_get_string(rsrc_ref, STRINGS, STRING_NAME, str);

	err = (*fset_glue->fzpl_plugin_register)(
						VIEW_COMMANDS_PLUGIN_ID,
						str, 
						VIEW_COMMANDS_PLUGIN_VERSION, 
						VIEW_COMMANDS_PLUGIN_VENDOR,
						VIEW_COMMANDS_PLUGIN_URL,
						FZ_CMND_EXTS_TYPE, 
						FZ_CMND_EXTS_VERSION,
						view_commands_error_str_func, 0, NULL,
						&plugin_runtime_id);

	if ( err == FZRT_NOERR )
	{
		err = (*fset_glue->fzpl_plugin_add_fset)( plugin_runtime_id, FZ_CMND_CBAK_PROJ_FSET_TYPE,
											FZ_CMND_CBAK_PROJ_FSET_VERSION, FZ_CMND_CBAK_PROJ_FSET_NAME,
											FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( fz_cmnd_cbak_proj_fset ),
											view_axonometric_fill, FALSE );

		err = (*fset_glue->fzpl_plugin_add_fset)( plugin_runtime_id, FZ_CMND_CBAK_PROJ_FSET_TYPE,
											FZ_CMND_CBAK_PROJ_FSET_VERSION, FZ_CMND_CBAK_PROJ_FSET_NAME,
											FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( fz_cmnd_cbak_proj_fset ),
											view_isometric_fill, FALSE );

		err = (*fset_glue->fzpl_plugin_add_fset)( plugin_runtime_id, FZ_CMND_CBAK_PROJ_FSET_TYPE,
											FZ_CMND_CBAK_PROJ_FSET_VERSION, FZ_CMND_CBAK_PROJ_FSET_NAME,
											FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( fz_cmnd_cbak_proj_fset ),
											view_oblique_fill, FALSE );

		err = (*fset_glue->fzpl_plugin_add_fset)( plugin_runtime_id, FZ_CMND_CBAK_PROJ_FSET_TYPE,
											FZ_CMND_CBAK_PROJ_FSET_VERSION, FZ_CMND_CBAK_PROJ_FSET_NAME,
											FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( fz_cmnd_cbak_proj_fset ),
											view_perspective_fill, FALSE );

		err = (*fset_glue->fzpl_plugin_add_fset)( plugin_runtime_id, FZ_CMND_CBAK_PROJ_FSET_TYPE,
											FZ_CMND_CBAK_PROJ_FSET_VERSION, FZ_CMND_CBAK_PROJ_FSET_NAME,
											FZPL_TYPE_STRING(fz_cmnd_cbak_proj_fset), sizeof ( fz_cmnd_cbak_proj_fset ),
											view_panoramic_fill, FALSE );

		if(err == FZRT_NOERR)
		{	if((err = (fset_glue->fzpl_fset_acquire) ( FZPL_PLUGIN_QUERY_FSET_TYPE, FZPL_PLUGIN_QUERY_FSET_VERSION, FZRT_UUID_NULL,
						  FZPL_TYPE_STRING(fzpl_plugin_query_fset), sizeof(fzpl_plugin_query_fset),
						  (fzpl_fset_td *)&plugin_query_funcs)) == FZRT_NOERR )
			{
				plugin_query_funcs.fzpl_plugin_get_rlib_idx(plugin_runtime_id, &rlib_index);
				
				fzrt_file_funcs.fzrt_file_floc_init(&floc);
				plugin_query_funcs.fzpl_plugin_get_floc(plugin_runtime_id, floc);
				
				fset_glue->fzpl_fset_release( (fzpl_fset_td *)&plugin_query_funcs );

			}
		}				

		if ( err != FZRT_NOERR )
		{
			view_commands_release_fsets();
			err = fzrt_base_funcs.fzrt_error_set ( FZRT_UNKNOWN_ERROR, FZRT_ERROR_SEVERITY_ERROR, FZRT_ERROR_CONTEXT_FZRT, 0 );
		}
	}

	return err;
}

/************************************************************************
	view_commands_unregister_plugins:
		Unregisters plugins.

	TAH 06/17/02: NEW FUNCTION
*************************************************************************/

static fzrt_error_td view_commands_unregister_plugins ( const fzpl_fset_glue_fset * const fset_glue )
/************************************************************************/
{
	fzrt_error_td					err = FZRT_NOERR;

	if ( !err )
	{
		err = (*fset_glue->fzpl_plugin_unregister)( plugin_runtime_id );

	}

	view_commands_release_fsets();

	return err;
}

/************************************************************************
	fz_plugin_entry:
		The main plugin file entry point.  Plugin initialization
			happens via this function.

	TAH 06/17/02: NEW FUNCTION
*************************************************************************/

FZPL_PLUGIN_FUNC(fzrt_error_td) fz_plugin_entry( const fzpl_fset_glue_fset * const fsf, fzpl_command_td cmd, const fzpl_host_config_td * const hostConfig )
/************************************************************************/
{
	fzrt_error_td err = FZRT_NOERR;

	switch ( cmd )
	{
		case FZPL_PLUGIN_CHECK:
			err = view_commands_check_config ( fsf, hostConfig );
		break;
		
		case FZPL_PLUGIN_INITIALIZE:
			err = view_commands_register_plugins ( fsf, hostConfig );
		break;
		
		case FZPL_PLUGIN_EXIT:
			err = view_commands_unregister_plugins ( fsf );
		break;
	}

	return ( err );
}

