/*
	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 UserPartSetup();
int UserXsecSetup();

/*------------------------- External Data ----------------------------*/
extern int user_List_Xsecs();
extern int user_Neutral_Axis();
extern int UserMenuDeleteAndPop();
extern ProError UserViewsSetup();
extern ProError UserDimensionsSetup();
extern int UserSectionSetup();
extern int UserExtObjSetup();
extern int UserFeatCreatSetup();
extern int UserRelationsSetup();
extern int UserSolidSetup();

/*====================================================================*
Function : UserPartSetup()
Purpose  : Set up the UGPart menu or the User's guide demo
\*====================================================================*/
int UserPartSetup()
{
  int menu_id, action, status;
       
  status = ProMenuFileRegister("UGPart", "ugpart.mnu", &menu_id );
  ERROR_CHECK( "UserPartSetup", "ProMenuFileRegister", status );

  status = ProMenubuttonActionSet("UGPart", "-Load/Display",
     (ProMenubuttonAction)UserLoadPart, NULL,PRO_MODE_PART);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGPart", "-Fundamentals",
     (ProMenubuttonAction)UserFundSetup, NULL,PRO_MODE_PART);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGPart", "-Solid",
     (ProMenubuttonAction)UserSolidSetup, NULL,PRO_MODE_PART);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGPart", "-Geometry",
     (ProMenubuttonAction)UserGeometrySetup, NULL,PRO_MODE_PART);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGPart","-Dimensions",
     (ProMenubuttonAction)UserDimensionsSetup, NULL,0);
  ERROR_CHECK("UserPartSetup","ProMenubuttonActionSet()",status);

  status = ProMenubuttonActionSet("UGPart", "-Parameters",
     (ProMenubuttonAction)UserParamSetup, NULL,PRO_MODE_PART);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGPart", "-Relations",
     (ProMenubuttonAction)UserRelationsSetup, NULL,0);
  ERROR_CHECK("UserPartSetup","ProMenubuttonActionSet()",status);

  status = ProMenubuttonActionSet("UGPart", "-Layer",
     (ProMenubuttonAction)UserLayerSetup, NULL,PRO_MODE_PART);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGPart","-Views",
     (ProMenubuttonAction)UserViewsSetup, NULL,0);
  ERROR_CHECK("UserPartSetup","ProMenubuttonActionSet()",status);

  status = ProMenubuttonActionSet("UGPart","-Feature Creation",
      (ProMenubuttonAction)UserFeatCreatSetup, NULL,PRO_MODE_PART);
  ERROR_CHECK("UserPartSetup","ProMenubuttonActionSet()",status);
 
  status = ProMenubuttonActionSet("UGPart","-Ext Objects",
     (ProMenubuttonAction)UserExtObjSetup, NULL,0);
  ERROR_CHECK("UserPartSetup","ProMenubuttonActionSet()",status);

  status = ProMenubuttonActionSet("UGPart", "-XSections",
     (ProMenubuttonAction)UserXsecSetup, NULL,PRO_MODE_PART);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );
  status = ProMenubuttonActionSet("UGPart", "-Done/Return",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL,0);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGPart", "UGPart",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL,0);
  ERROR_CHECK( "UserPartSetup", "ProMenubuttonActionSet", status );

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

  status = ProMenuCreate(PROMENUTYPE_MAIN,"UGPart", &menu_id);
  ERROR_CHECK( "UserPartSetup", "ProMenuCreate", status );

  status = ProMenuProcess("UGPart", &action);
  ERROR_CHECK( "UserPartSetup", "ProMenuProcess", status );

  return(PRO_TK_NO_ERROR);
}

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

  status = ProMenuFileRegister("UGXSEC", "ugxsec.mnu", &menu_id);
  ERROR_CHECK( "UserXsecSetup", "ProMenuFileRegister", status );

  status = ProMenubuttonActionSet("UGXSEC","-List Xsecs",
     (ProMenubuttonAction)user_List_Xsecs, NULL, 0);
  ERROR_CHECK( "UserXsecSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGXSEC","-Mass Props",
     (ProMenubuttonAction)user_Neutral_Axis, NULL, 0);
  ERROR_CHECK( "UserXsecSetup", "ProMenubuttonActionSet", status );

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

  status = ProMenubuttonActionSet("UGXSEC", "UGXSEC",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserXsecSetup", "ProMenubuttonActionSet", status );

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

  status = ProMenuCreate(PROMENUTYPE_MAIN, "UGXSEC", &menu_id);
  ERROR_CHECK( "UserXsecSetup", "ProMenuCreate", status );

  status = ProMenuProcess("UGXSEC", &action);
  ERROR_CHECK( "UserXsecSetup", "ProMenuProcess", status );

  return(PRO_TK_NO_ERROR);
}