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

#include "ProToolkit.h"
#include "ProMenu.h"
#include "ProUtil.h" 
#include "ProMessage.h"
#include <ProANSI.h>
#include <ProView.h>
#include <ProWindows.h>
#include <ProMdl.h>
#include <ProSolid.h>
#include <ProSelection.h>
#include <ProUICmd.h>
#include <ProParameter.h>
#include <ProStdSection.h>
#include <ProExtrude.h>
#include <ProCollect.h>
#include <ProSrfcollection.h>
#include <ProCrvcollection.h>
#include <ProAnnotationFeat.h>
#include <ProAnnotationElem.h>
#include <ProReference.h>
#include <ProFeatType.h>
#include <ProNote.h>
#include <ProLayer.h>
#include <ProPopupmenu.h>
#include <ProSelbuffer.h>
#include <ProSurface.h>
#include <ProGtol.h>

#include <PTAFExamples.h>
#include <PTApplsUnicodeUtils.h>



ProFileName  message_file;

/*====================================================================*\
  FUNCTION :   user_initialize()
  PURPOSE  :   Application initialization	
\*====================================================================*/
user_initialize()
{
  uiCmdCmdId cmd_id;

  ProStringToWstring (message_file_init, "pt_menubar.txt" ); 

/*---------------------------------------------------------------------*\
Add the application main menu
\*---------------------------------------------------------------------*/
  status = ProMenubarMenuAdd ("PTAFExamples", "PTDemoLabel", "Info",
			      PRO_B_TRUE, message_file_init );


/*---------------------------------------------------------------------*\
Add the button for Converting the note to annotation plane
\*---------------------------------------------------------------------*/
  status = ProCmdActionAdd("PTAFExamples.NoteConvert", (uiCmdCmdActFn)PTNoteConvert,
			   uiProe2ndImmediate, PTTestAccessNotesSelected,
			   PRO_B_TRUE, PRO_B_TRUE, &cmd_id);
  
  status = ProMenubarmenuPushbuttonAdd(
				       "PTAFExamples", "NoteConvert", 
				       "PTNC-Note Convert", 
				       "PTNC Add or change the note annotation plane",
				       NULL, PRO_B_TRUE, cmd_id, message_file_init);
  
  
/*---------------------------------------------------------------------*\
Add the button for Update Pattern Note
\*---------------------------------------------------------------------*/
  status = ProCmdActionAdd("PTAFExamples.UpdateNote",
			   (uiCmdCmdActFn)PTAFExUpdateNotePattern,
			   uiProe2ndImmediate, TestPTAFExUpdatePatternNotes,
			   PRO_B_TRUE, PRO_B_TRUE, &cmd_id);

  
  status = ProMenubarmenuPushbuttonAdd("PTAFExamples", "PTDemoUpdateLabel",
				       "PTDemoUpdateLabel",
				       "PTDemoUpdateLabelHelp", NULL,
				       PRO_B_TRUE, cmd_id,  message_file_init);


/*---------------------------------------------------------------------*\
Add the submenu for feature creation from annotations
\*---------------------------------------------------------------------*/
  status = ProMenubarmenuMenuAdd ("PTAFExamples", "PTDemoFeature", "PTDemoFeatureLabel", NULL, PRO_B_TRUE,  message_file_init);

/*---------------------------------------------------------------------*\
Add the button for Round Creation
\*---------------------------------------------------------------------*/
  status = ProCmdActionAdd("PTAFExamples.Round",
			   (uiCmdCmdActFn)PTAFExCreateRoundfromAE,
			   uiProe2ndImmediate, TestPTAFExCreateRoundFeatureAccess,
			   PRO_B_TRUE, PRO_B_TRUE, &cmd_id);

  
  status = ProMenubarmenuPushbuttonAdd("PTDemoFeature", "PTTestCreateRound",
				       "PTTestCreateRoundLabel",
				       "PTTestCreateRoundHelp", NULL,
				       PRO_B_TRUE, cmd_id,  message_file_init);

/*---------------------------------------------------------------------*\
Add the icon for the Round Feature and designate this button to be available 
as a toolbar command
\*---------------------------------------------------------------------*/
  status = ProCmdIconSet(cmd_id, "annotation_round");

  status = ProCmdDesignate(cmd_id, "PTAFEX Button Round", "PTAFEX Button Round Help", "PTAFEX Button Round Help", message_file_init);

/*---------------------------------------------------------------------*\
Add the button for Draft Creation
\*---------------------------------------------------------------------*/
  status = ProCmdActionAdd("PTAFExamples.Draft",
			   (uiCmdCmdActFn)PTAFExCreateDraftfromAE,
			   uiProe2ndImmediate, TestPTAFExCreateDraftFeatureAccess,
			   PRO_B_TRUE, PRO_B_TRUE, &cmd_id);
  
  status = ProMenubarmenuPushbuttonAdd("PTDemoFeature", "PTTestCreateDraft",
				       "PTTestCreateDraftLabel",
				       "PTTestCreateDraftHelp", NULL,
				       PRO_B_TRUE, cmd_id,  message_file_init);

/*---------------------------------------------------------------------*\
Add the icon for the Draft Feature and designate this button to be available 
as a toolbar command
\*---------------------------------------------------------------------*/
  status = ProCmdIconSet(cmd_id, "annotation_draft");
  status = ProCmdDesignate(cmd_id, "PTAFEX Button Draft", "PTAFEX Button Draft Help", "PTAFEX Button Draft Help", message_file_init);


/*---------------------------------------------------------------------*\
Add the button for Chamfer Creation
\*---------------------------------------------------------------------*/
  status = ProCmdActionAdd("PTAFExamples.Chamfer",
			   (uiCmdCmdActFn)PTAFExCreateChamferfromAE,
			   uiProe2ndImmediate, TestPTAFExCreateChamferFeatureAccess,
			   PRO_B_TRUE, PRO_B_TRUE, &cmd_id);
  
  status = ProMenubarmenuPushbuttonAdd("PTDemoFeature", "PTTestCreateChamfer",
				       "PTTestCreateChamferLabel",
				       "PTTestCreateChamferHelp", NULL,
				       PRO_B_TRUE, cmd_id,  message_file_init);

/*---------------------------------------------------------------------*\
Add the icon for the Chamfer Feature and designate this button to be available 
as a toolbar command
\*---------------------------------------------------------------------*/
  status = ProCmdIconSet(cmd_id, "annotation_chamfer");

  status = ProCmdDesignate(cmd_id, "PTAFEX Button Chamfer", "PTAFEX Button Chamfer Help", "PTAFEX Button Chamfer Help", message_file_init);

/*---------------------------------------------------------------------*\
Add the button for outputting info for the manufacturing template BOM's
to the Info menu
\*---------------------------------------------------------------------*/
  status = ProCmdActionAdd("PTAFExamples.MfgTemplateBOM", 
			   (uiCmdCmdActFn)PTMfgTemplateAEWriteBOM,
			   uiProe2ndImmediate, PTTestAccessInfoMfgTemplate,
			   PRO_B_TRUE, PRO_B_TRUE, &cmd_id);
  PT_TEST_LOG_SUCC ("ProCmdActionAdd");
	
  status = ProMenubarmenuPushbuttonAdd(
				       "Info", "MfgTemplateBOM", 
				       "PTMTBOM-Manfuacturing templates", 
				       "PTMTBOM-Output BOM of manufacturing template annotations",
				       NULL, PRO_B_TRUE, cmd_id, message_file_init);
  PT_TEST_LOG_SUCC("ProMenubarmenuPushbuttonAdd");

  return(0);
}

void user_terminate()
{
}