/*
	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 UserManufactureSetup();
int UserMFGSetup();

/*------------------------- External Data ----------------------------*/
extern int UserMfgWcellList();
extern int UserWorkcellCreate();
extern int UserOperCreate();
extern int UserNcsequenceCreate();
extern int UserMenuDeleteAndPop();


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

  status = ProMenuFileRegister("UGManufacture", "ugmfg.mnu", &menu_id);
  ERROR_CHECK( "UserManufactureSetup", "ProMenuFileRegister", status );

  status = ProMenubuttonActionSet("UGManufacture", "-Geometry",
     (ProMenubuttonAction)UserGeometrySetup, NULL, PRO_MODE_MANUFACTURE);
  ERROR_CHECK( "UserManufactureSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGManufacture", "-Parameters",
     (ProMenubuttonAction)UserParamSetup, NULL, PRO_MODE_MANUFACTURE);
  ERROR_CHECK( "UserManufactureSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGManufacture", "-Manufacture",
     (ProMenubuttonAction)UserMFGSetup, NULL,PRO_MODE_MANUFACTURE );
  ERROR_CHECK( "UserManufactureSetup", "ProMenubuttonActionSet", status );

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

  status = ProMenubuttonActionSet("UGManufacture", "UGManufacture",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserManufactureSetup", "ProMenubuttonActionSet", status );

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

  status = ProMenuCreate(PROMENUTYPE_MAIN, "UGManufacture", &menu_id);
  ERROR_CHECK( "UserManufactureSetup", "ProMenuCreate", status );

  status = ProMenuProcess("UGManufacture", &action);
  ERROR_CHECK( "UserManufactureSetup", "ProMenuProcess", status );

  return (PRO_TK_NO_ERROR);
}

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

  status = ProMenuFileRegister("UGMFG", "ugmfgsub.mnu", &menu_id);
  ERROR_CHECK( "UserMFGSetup", "ProMenuFileRegister", status );

  status = ProMenubuttonActionSet("UGMFG","-Visit Wcell",
     (ProMenubuttonAction)UserMfgWcellList, NULL, 0);
  ERROR_CHECK( "UserMFGSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGMFG","-Create Wcell",
     (ProMenubuttonAction)UserWorkcellCreate, NULL, 0);
  ERROR_CHECK( "UserMFGSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGMFG","-Create Oper",
     (ProMenubuttonAction)UserOperCreate, NULL, 0);
  ERROR_CHECK( "UserMFGSetup", "ProMenubuttonActionSet", status );

  status = ProMenubuttonActionSet("UGMFG","-Create Ncseq",
     (ProMenubuttonAction)UserNcsequenceCreate, NULL, 0);
  ERROR_CHECK( "UserMFGSetup", "ProMenubuttonActionSet", status );

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

  status = ProMenubuttonActionSet("UGMFG","UGMFG",
     (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0);
  ERROR_CHECK( "UserMFGSetup", "ProMenubuttonActionSet", status );

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

  status = ProMenuCreate(PROMENUTYPE_MAIN, "UGMFG", &menu_id);
  ERROR_CHECK( "UserMFGSetup", "ProMenuCreate", status );

  status = ProMenuProcess("UGMFG", &action);
  ERROR_CHECK( "UserMFGSetup", "ProMenuProcess", status );

  return(PRO_TK_NO_ERROR);
}