/* 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 -------------------------*/ ProError UserGuideMain(); int UserColorSetup(); int UserSketchingSetup(); int UserGraphicsSetup(); int UserUtilsSetup(); /*------------------------- External Data ----------------------------*/ extern int ProUserMenuDemo(); extern int UserMessageDemo(); extern int UserDisplayMessageDialogs(); extern int UserFeatCreatSetup(); extern int UserDraw(); extern int UserPolyline(); extern int UserEditFile(); extern int UserDrawYellow(); extern int UserDrawWithDatumAxisColor(); extern int UserDrawDefaults(); extern int UserInterfaceSetup(); extern int UserCreateImportFeatures(); /*====================================================================*\ Function : UserGuideMain Purpose : Top-level menu for user guide examples \*====================================================================*/ ProError UserGuideMain() { int menu; ProError status; int idummy; ProMode current_mode; /*---------------------------------------------------------------------*\ Set up the main demo menu \*---------------------------------------------------------------------*/ status = ProMenuFileRegister("UG Main","ugmain.mnu",&menu); ERROR_CHECK("UserGuideMain","ProMenuFileRegister()",status); /*---------------------------------------------------------------------*\ This menu will exit after an item is picked \*---------------------------------------------------------------------*/ status = ProMenubuttonActionSet("UG Main","UG Main", (ProMenubuttonAction)ProMenuDelete,NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); /*---------------------------------------------------------------------*\ Attach actions to buttons \*---------------------------------------------------------------------*/ status = ProMenubuttonActionSet("UG Main", "-Menus", (ProMenubuttonAction)ProUserMenuDemo, NULL, 0); ERROR_CHECK("UserGuideMain", "ProMenubuttonActionSet()", status); status = ProMenubuttonActionSet("UG Main","-Messages", (ProMenubuttonAction)UserMessageDemo, NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProMenubuttonActionSet("UG Main","-Message Dialogs", (ProMenubuttonAction)UserDisplayMessageDialogs, NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProMenubuttonActionSet("UG Main","-Load/Display", (ProMenubuttonAction)UserLoadPart, NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProMenubuttonActionSet("UG Main","-Interface", (ProMenubuttonAction)UserInterfaceSetup, NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProMenubuttonActionSet("UG Main","-Utilities", (ProMenubuttonAction)UserUtilsSetup, NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProMenubuttonActionSet("UG Main","-Graphics", (ProMenubuttonAction)UserGraphicsSetup, NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProModeCurrentGet( ¤t_mode ); ERROR_CHECK("UserGuideMain","ModeCurrentGet()",status); status = ProMenubuttonActionSet("UG Main","-Feature Creation", (ProMenubuttonAction)UserFeatCreatSetup, NULL, current_mode); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProMenubuttonActionSet("UG Main","-Import Feature", (ProMenubuttonAction)UserCreateImportFeatures, NULL,PRO_MODE_UNUSED); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet()",status); status = ProMenubuttonActionSet("UG Main","-Done/Return", (ProMenubuttonAction)(ProMenubuttonAction)ProMenuDelete,NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet(Done)",status); status = ProMenubuttonActionSet("UG Main","UG Main", (ProMenubuttonAction)(ProMenubuttonAction)ProMenuDelete,NULL,0); ERROR_CHECK("UserGuideMain","ProMenubuttonActionSet(Done)",status); /*---------------------------------------------------------------------*\ Put menu on screen \*---------------------------------------------------------------------*/ status = ProMenuCreate(PROMENUTYPE_MAIN,"UG Main",&menu); ERROR_CHECK("UserGuideMain","ProMenuCreate",status); /*---------------------------------------------------------------------*\ Activate the menu \*---------------------------------------------------------------------*/ ProMenuProcess("",&idummy); return(0); } /*====================================================================*\ Function : UserUtilsSetup Purpose : Set up the graphics menu \*====================================================================*/ int UserUtilsSetup() { int menu_id; int status; int action; status = ProMenuFileRegister("UGUtilities","ugutilities.mnu",&menu_id); ERROR_CHECK("UserUtilsSetup","ProMenuFileRegister",status); status = ProMenubuttonActionSet("UGUtilities","-Edit File", (ProMenubuttonAction)UserEditFile, NULL,0); ERROR_CHECK("UserUtilsSetup","ProMenubuttonActionSet",status); status = ProMenubuttonActionSet("UGUtilities","-Done/Return", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserUtilsSetup","ProMenubuttonActionSet",status); status = ProMenubuttonActionSet("UGUtilities","UGUtilities", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserUtilsSetup","ProMenubuttonActionSet",status); status = ProMenuPush(); ERROR_CHECK( "UserUtilsSetup", "ProMenuPush", status ); status = ProMenuCreate(PROMENUTYPE_MAIN,"UGUtilities",&menu_id); ERROR_CHECK("UserUtilsSetup","ProMenuCreate",status); status = ProMenuProcess("",&action); ERROR_CHECK("UserUtilsSetup","ProMenuProcess",status); return (PRO_TK_NO_ERROR); } /*====================================================================*\ Function : UserGraphicsSetup Purpose : Set up the graphics menu \*====================================================================*/ int UserGraphicsSetup() { int menu_id; int status; int action; status = ProMenuFileRegister("Graphics","uggraphics.mnu",&menu_id); ERROR_CHECK("UserGraphicsSetup","ProMenuFileRegister",status); status = ProMenubuttonActionSet("Graphics","-Sketching", (ProMenubuttonAction)UserSketchingSetup, NULL,0); ERROR_CHECK("UserGraphicsSetup","ProMenubuttonActionSet",status); status = ProMenubuttonActionSet("Graphics","-Colors", (ProMenubuttonAction)UserColorSetup,NULL,0); ERROR_CHECK("UserGraphicsSetup","ProMenubuttonActionSet",status); status = ProMenubuttonActionSet("Graphics","-Done/Return", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserGraphicsSetup","ProMenubuttonActionSet",status); status = ProMenubuttonActionSet("Graphics","Graphics", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserGraphicsSetup","ProMenubuttonActionSet",status); status = ProMenuPush(); ERROR_CHECK( "UserGraphicsSetup", "ProMenuPush", status ); status = ProMenuCreate(PROMENUTYPE_MAIN,"Graphics",&menu_id); ERROR_CHECK("UserGraphicsSetup","ProMenuCreate",status); status = ProMenuProcess("",&action); ERROR_CHECK("UserGraphicsSetup","ProMenuProcess",status); return (PRO_TK_NO_ERROR); } /*====================================================================*\ Function : UserSketchingSetup Purpose : Set up the graphics menu \*====================================================================*/ int UserSketchingSetup() { int menu_id; int action; ProError status; /*---------------------------------------------------------------------------*\ read menu file \*---------------------------------------------------------------------------*/ status=ProMenuFileRegister("Sketching","ugsketching.mnu",&menu_id); /*---------------------------------------------------------------------------*\ attach actions to menu \*---------------------------------------------------------------------------*/ status=ProMenubuttonActionSet("Sketching","Sketching", (ProMenubuttonAction)ProMenuDelete,NULL,0); ERROR_CHECK("UserSketchingSetup","ProMenubuttonActionSet(Sketching)",status); status=ProMenubuttonActionSet("Sketching","Lines/Circles", (ProMenubuttonAction)UserDraw,NULL,0); ERROR_CHECK("UserSketchingSetup","ProMenubuttonActionSet(Lines/Circles)",status); status=ProMenubuttonActionSet("Sketching","CreatePoly",UserPolyline,NULL,0); ERROR_CHECK("UserSketchingSetup","ProMenubuttonActionSet(CreatePoly)",status); status=ProMenubuttonActionSet("Sketching","Done/Return", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserSketchingSetup","ProMenubuttonActionSet(CreatePoly)",status); status=ProMenubuttonActionSet("Sketching","Sketching", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserSketchingSetup","ProMenubuttonActionSet(CreatePoly)",status); /*---------------------------------------------------------------------------*\ put menu on screen \*---------------------------------------------------------------------------*/ status = ProMenuPush(); ERROR_CHECK( "UserSketchingSetup", "ProMenuPush", status ); status=ProMenuCreate(PROMENUTYPE_MAIN,"Sketching",&menu_id); ERROR_CHECK("UserSketchingSetup","ProMenuCreate",status); /*---------------------------------------------------------------------------*\ activate menu \*---------------------------------------------------------------------------*/ status=ProMenuProcess("", &action); ERROR_CHECK("UserSketchingSetup","ProMenuProcess",status); return(0); } /*====================================================================*\ Function : UserColorSetup Purpose : set up the colors menu \*====================================================================*/ int UserColorSetup() { int menu_id; int action; ProError status; ProError UserAdjustHalftone(); /*---------------------------------------------------------------------------*\ read in menu file \*---------------------------------------------------------------------------*/ status=ProMenuFileRegister("Colors","ugcolors.mnu",&menu_id); /*---------------------------------------------------------------------------*\ attach actions to menu \*---------------------------------------------------------------------------*/ status=ProMenubuttonActionSet("Colors","LightenColor", (ProMenubuttonAction)UserAdjustHalftone,NULL,1); ERROR_CHECK("UserColorsSetup","ProMenubuttonActionSet(LightenColor)",status); status=ProMenubuttonActionSet("Colors","DarkenColor", (ProMenubuttonAction)UserAdjustHalftone,NULL,0); ERROR_CHECK("UserColorsSetup","ProMenubuttonActionSet(DarkenColor)",status); status=ProMenubuttonActionSet("Colors","DrawInYellow", (ProMenubuttonAction)UserDrawYellow,NULL,0); ERROR_CHECK("UserColorsSetup","ProMenubuttonActionSet(DrawInYellow)",status); status=ProMenubuttonActionSet("Colors","DrawAsDatumAxis", (ProMenubuttonAction)UserDrawWithDatumAxisColor,NULL,0); ERROR_CHECK("UserColorsSetup","ProMenubuttonActionSet(DrawAsDatumAxis)",status); status=ProMenubuttonActionSet("Colors","DrawInDefault", (ProMenubuttonAction)UserDrawDefaults,NULL,0); ERROR_CHECK("UserColorsSetup","ProMenubuttonActionSet(DrawInDefault)",status); status=ProMenubuttonActionSet("Colors","Done/Return", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserColorsSetup","ProMenubuttonActionSet(Colors)",status); status=ProMenubuttonActionSet("Colors","Colors", (ProMenubuttonAction)UserMenuDeleteAndPop,NULL,0); ERROR_CHECK("UserColorsSetup","ProMenubuttonActionSet(Colors)",status); /*---------------------------------------------------------------------------*\ put menu on screen \*---------------------------------------------------------------------------*/ status = ProMenuPush(); ERROR_CHECK( "UserColorsSetup", "ProMenuPush", status ); status=ProMenuCreate(PROMENUTYPE_MAIN,"Colors",&menu_id); ERROR_CHECK("UserColorsSetup","ProMenuCreate",status); /*---------------------------------------------------------------------------*\ activate menu \*---------------------------------------------------------------------------*/ status=ProMenuProcess("", &action); ERROR_CHECK("UserColorsSetup","ProMenuProcess",status); return(0); }