/*
	Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
*/

/*---------------------- Pro/Toolkit Includes ------------------------*/
#include <ProToolkit.h>
#include <ProMenu.h>
#include <ProMdl.h>
#include <ProMode.h>

/*---------------------- Application Includes ------------------------*/
#include <TestError.h>


/*---------------------- Function Prototypes -------------------------*/
int UserAssemblySetup();
int UserSimpRepSetup();
ProError UserComponentSetup();

/*------------------------- External Data ----------------------------*/
extern int UserFundSetup();
extern int UserGeometrySetup();
extern int UserAnimationSetup();
extern int UserRelationsSetup();
extern int UserAsmCompVisit();
extern int UserAsmcompAnimate();
extern int UserSimpRepCreate();
extern int UserSimpRepInfo();
extern ProError UserViewsSetup();
extern ProError UserDimensionsSetup();
extern int UserMenuDeleteAndPop();
extern ProError UserAsmcompTransfGet();
extern ProError UserAsmcompConstraintsInfo();
extern ProError UserAssemble();
extern ProError UgAssembleIntent();
extern int  UserSolidSetup();


/*====================================================================*
Function : UserAssemblySetup()
Purpose  : Set up the Assembly menu of the User's guide demo
\*====================================================================*/
int UserAssemblySetup()
{
  int menu_id, action, status;

  status = ProMenuFileRegister("UGAssembly", "ugasm.mnu", &menu_id);
  ERROR_CHECK( "UserAssemblySetup", "ProMenuFileRegister", status );

  status = ProMenubuttonActionSet("UGAssembly", "-Fundamentals",
     (ProMenubuttonAction)UserFundSetup, NULL, PRO_MODE_ASSEMBLY);
  ERROR_CHECK( "UserAssemblySetup", "ProMenubuttonActionSet", status );

    status = ProMenubuttonActionSet("UGAssembly", "-Solid",
     (ProMenubuttonAction)UserSolidSetup, NULL,PRO_MODE_ASSEMBLY);
  ERROR_CHECK( "UserAssemblySetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGAssembly", "-Geometry",
     (ProMenubuttonAction)UserGeometrySetup, NULL, PRO_MODE_ASSEMBLY);
  ERROR_CHECK( "UserAssemblySetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGAssembly","-Views",
     (ProMenubuttonAction)UserViewsSetup, NULL,0);
  ERROR_CHECK("UserAssemblySetup","ProMenubuttonActionSet()",status);

  status = ProMenubuttonActionSet("UGAssembly","-Components",
     (ProMenubuttonAction)UserComponentSetup, NULL,0);
  ERROR_CHECK("UserAssemblySetup","ProMenubuttonActionSet()",status);

  status = ProMenubuttonActionSet("UGAssembly","-Relations",
     (ProMenubuttonAction)UserRelationsSetup, NULL,0);
  ERROR_CHECK("UserAssemblySetup","ProMenubuttonActionSet()",status);
 
  status = ProMenubuttonActionSet("UGAssembly", "-Simp Rep",
     (ProMenubuttonAction)UserSimpRepSetup, NULL, PRO_MODE_ASSEMBLY);
  ERROR_CHECK( "UserAssemblySetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGAssembly", "-Animation",
     (ProMenubuttonAction)UserAnimationSetup, NULL, PRO_MODE_ASSEMBLY);
  ERROR_CHECK( "UserAssemblySetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGAssembly", "-Done/Return",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserAssemblySetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGAssembly", "UGAssembly",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserAssemblySetup", "ProMenubuttonActionSet", status );

  status = ProMenuPush();
  ERROR_CHECK( "UserAssemblySetup", "ProMenuPush", status );

  status = ProMenuCreate(PROMENUTYPE_MAIN, "UGAssembly", &menu_id);
  ERROR_CHECK( "UserAssemblySetup", "ProMenuCreate", status );

  status = ProMenuProcess("UGAssembly", &action);
  ERROR_CHECK( "UserAssemblySetup", "ProMenuProcess", status );

  return (PRO_TK_NO_ERROR);
}

/*====================================================================*
Function : UserComponentSetup()
Purpose  : Set up the component menu of the user guide examples
\*====================================================================*/
ProError UserComponentSetup ()
{
  int menu_id, action, status;

  status = ProMenuFileRegister("AssComp","ugasmcomp.mnu",&menu_id);
  ERROR_CHECK("UserComponentSetup","ProMenuFileRegister",status);

  status = ProMenubuttonActionSet("AssComp","-List Components",
		(ProMenubuttonAction)UserAsmCompVisit, NULL, 0);
  ERROR_CHECK("UserComponentSetup","ProMenubuttonActionSet",status);

  status = ProMenubuttonActionSet("AssComp","-Component Transfm",
		(ProMenubuttonAction)UserAsmcompTransfGet, NULL, 0);
  ERROR_CHECK("UserComponentSetup","ProMenubuttonActionSet",status);

  status = ProMenubuttonActionSet("AssComp","-Assemble By Datums",
		(ProMenubuttonAction)UserAssemble, NULL, 0);
  ERROR_CHECK("UserComponentSetup","ProMenubuttonActionSet",status);

  status = ProMenubuttonActionSet("AssComp","-Constraint Info",
		(ProMenubuttonAction)UserAsmcompConstraintsInfo, NULL, 0);
  ERROR_CHECK("UserComponentSetup","ProMenubuttonActionSet",status);

  status = ProMenubuttonActionSet("AssComp","-Done/Return", 
		(ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK("UserComponentSetup","ProMenubuttonActionSet",status);

  status = ProMenubuttonActionSet("AssComp","AssComp", 
                (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK("UserComponentSetup","ProMenubuttonActionSet",status);
  
  status = ProMenubuttonActionSet("AssComp","-Assemble By Intent Datums",
		(ProMenubuttonAction)UgAssembleIntent, NULL, 0);
  ERROR_CHECK("UserComponentSetup","ProMenubuttonActionSet",status); 

  status = ProMenuPush();
  ERROR_CHECK( "UserComponentSetup", "ProMenuPush", status );

  status = ProMenuCreate(PROMENUTYPE_MAIN,"AssComp", &menu_id);
  ERROR_CHECK("UserComponentSetup","ProMenuCreate",status);

  status = ProMenuProcess("AssComp", &action);
  ERROR_CHECK( "UserComponentSetup", "ProMenuProcess", status );

  return (PRO_TK_NO_ERROR);
}

/*====================================================================*
Function : UserSimpRepSetup()
Purpose  : Set up the Simplified Rep menu or the User's guide demo
\*====================================================================*/
int UserSimpRepSetup()
{
  int menu_id, action, status;

  status = ProMenuFileRegister("UGSimpRep", "ugsrep.mnu", &menu_id);
  ERROR_CHECK( "UserSimpRepSetup", "ProMenuFileRegister", status );

  status = ProMenubuttonActionSet("UGSimpRep","-Create",
     (ProMenubuttonAction)UserSimpRepCreate, NULL, 0);
  ERROR_CHECK( "UserSimpRepSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGSimpRep","-Info",
                                  UserSimpRepInfo, NULL, 0);
  ERROR_CHECK( "UserSimpRepSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGSimpRep","-Done/Return",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserSimpRepSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGSimpRep","UGSimpRep",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserSimpRepSetup", "ProMenubuttonActionSet", status );

  status = ProMenuPush();
  ERROR_CHECK( "UserSimpRepSetup", "ProMenuPush", status );

  status = ProMenuCreate(PROMENUTYPE_MAIN, "UGSimpRep", &menu_id);
  ERROR_CHECK( "UserSimpRepSetup", "ProMenuCreate", status );

  status = ProMenuProcess("UGSimpRep", &action);
  ERROR_CHECK( "UserSimpRepSetup", "ProMenuProcess", status );

  return(PRO_TK_NO_ERROR);
}

/*====================================================================*
Function : UserAnimationSetup()
Purpose  : Set up the Animation Menu
\*====================================================================*/
int UserAnimationSetup()
{
  int menu_id, action, status;

  status = ProMenuFileRegister("UGAnim", "uganim.mnu", &menu_id);
  ERROR_CHECK( "UserAnimationSetup", "ProMenuFileRegister", status );

  status = ProMenubuttonActionSet("UGAnim","-Anim Comp",
     (ProMenubuttonAction)UserAsmcompAnimate, NULL, 0);
  ERROR_CHECK( "UserAnimationSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGAnim","-Done/Return",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserAnimationSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGAnim","UGAnim",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserAnimationSetup", "ProMenubuttonActionSet", status );

  status = ProMenuPush();
  ERROR_CHECK( "UserAnimationSetup", "ProMenuPush", status );

  status = ProMenuCreate(PROMENUTYPE_MAIN, "UGAnim", &menu_id);
  ERROR_CHECK( "UserAnimationSetup", "ProMenuCreate", status );

  status = ProMenuProcess("UGAnim", &action);
  ERROR_CHECK( "UserAnimationSetup", "ProMenuProcess", status );

  return(PRO_TK_NO_ERROR);
}