/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ /*---------------------- Pro/Toolkit Includes ------------------------*/ #include <ProToolkit.h> #include <ProPlotdriver.h> #include <ProArray.h> #include <ProColor.h> #include "ProMenu.h" #include <PTApplsUnicodeUtils.h> #include <ProMessage.h> #include <ProUtil.h> /*---------------------- Application Includes ------------------------*/ #include <TestError.h> #include <string.h> /*---------------------- Function Prototypes -------------------------*/ int user_Demo_Plot(); /*------------------------- External Data ----------------------------*/ extern int UserMenuDeleteAndPop(); extern ProError user_plot(FILE *fp, char *driver_name); /*------------------------- Global Data -----------------------------*/ static FILE *demo_plot_file; /*====================================================================* Function : UserPlotSetup() Purpose : Set up the Customized Plot Menu \*====================================================================*/ int UserPlotSetup() { int menu_id, action; ProMdl model; ProError status; status = ProMenuFileRegister("UGPLOT", "ugplot.mnu", &menu_id); ERROR_CHECK( "UserPlotSetup", "ProMenuFileRegister", status ); status = ProMenubuttonActionSet("UGPLOT","-Plot Demo", user_Demo_Plot, NULL, 0); ERROR_CHECK( "UserPlotSetup", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UGPLOT", "-Done/Return", (ProMenubuttonAction)UserMenuDeleteAndPop, NULL,0); ERROR_CHECK( "UserPlotSetup", "ProMenubuttonActionSet", status ); status = ProMenubuttonActionSet("UGPLOT", "UGPLOT", (ProMenubuttonAction)UserMenuDeleteAndPop, NULL, 0); ERROR_CHECK( "UserPlotSetup", "ProMenubuttonActionSet", status ); status = ProMenuCreate(PROMENUTYPE_MAIN, "UGPLOT", &menu_id); ERROR_CHECK( "UserPlotSetup", "ProMenuCreate", status ); status = ProMenuProcess("UGPLOT", &action); ERROR_CHECK( "UserPlotSetup", "ProMenuProcess", status ); return(PRO_TK_NO_ERROR); } /*===========================================================*\ Command function to invoke a plot of type "demo" \*===========================================================*/ int user_Demo_Plot() { int status; wchar_t w_fname[PRO_NAME_SIZE]; char fname[PRO_NAME_SIZE]; ProFileName msgfil; /*-----------------------------------------------------------*\ Get the output plot file name. \*-----------------------------------------------------------*/ ProStringToWstring( msgfil, "msg_ugfund.txt" ); status = ProMessageDisplay (msgfil, "USER Demo plot filename [QUIT] : "); ERROR_CHECK("user_Demo_Plot","ProMessageDisplay",status); status = ProMessageStringRead (PRO_NAME_SIZE, w_fname) ; ERROR_CHECK("user_Demo_Plot","ProMessageStringRead",status); if (status != PRO_TK_NO_ERROR) return(status); ProWstringToString (fname, w_fname); demo_plot_file = PTApplsUnicodeFopen (fname, "w"); status = user_plot(demo_plot_file, "MY DRIVER"); /*-----------------------------------------------------------*\ Close the plot file. \*-----------------------------------------------------------*/ fclose (demo_plot_file); /*-----------------------------------------------------------*\ Display the plot file. \*-----------------------------------------------------------*/ status = ProInfoWindowDisplay (w_fname, NULL, NULL); ERROR_CHECK("user_Demo_Plot","ProInfoWindowDisplay",status); return (PRO_TK_NO_ERROR); }