/*----------------------------------------------------------------------------- File: basic.c Description: basic minimal Pro/TOOLKIT app PTC File Date Version Author Vers Comment --------- ------- -------- ----- --------------------------------------------- 04-Dec-97 H-02-02 Philippe $$1 setup -----------------------------------------------------------------------------*/ #include "ProToolkit.h" #include "user_tk_error.h" #include "ProMdl.h" #include "ProMenu.h" #include "ProMessage.h" #include "ProNotify.h" #include "ProObjects.h" #include "ProUtil.h" static wchar_t msgfil[20]; /*===========================================================================*\ The user_part_status() function reports the current part name and whether it has been modified since last saved. \*===========================================================================*/ UserPartStatus() { ProMdl p_part; ProMdldata info; ProBoolean is_modified; ProError err; err=ProMdlCurrentGet(&p_part); ERROR_CHECK("UserPartStatus","ProMdlCurrentGet",err); err=ProMdlDataGet(p_part,&info); ERROR_CHECK("UserPartStatus","ProMdlDataGet",err); ProMdlModificationVerify(p_part,&is_modified); ERROR_CHECK("UserPartStatus","ProMdlModificationVerify",err); if (is_modified==PRO_B_TRUE) ProMessageDisplay(msgfil,"USER Current object: %0w.%1w (MODIFIED)", info.name,info.type); else ProMessageDisplay(msgfil,"USER Current object: %0w.%1w",info.name, info.type); } /*===========================================================================*\ The UserCheckPart() function checks the validity of a part before saving it. \*===========================================================================*/ ProError UserCheckPart() { /*---------------------------------------------------------------------------*\ user's checks go here \*---------------------------------------------------------------------------*/ return(PRO_TK_NO_ERROR); } /*===========================================================================*\ The function user_initialize() sets up the message file name, the Pro/TOOLKIT menu buttons, and the notify options. \*===========================================================================*/ int user_initialize() { int menu_id; /*---------------------------------------------------------------------------*\ Set up the message file name. \*---------------------------------------------------------------------------*/ ProStringToWstring(msgfil,"usermsg.txt"); /*---------------------------------------------------------------------------*\ Set up the new button, "Status", on the PART menu. \*---------------------------------------------------------------------------*/ ProMenuFileRegister("part","part.mnu",&menu_id); ProMenuAuxfileRegister("part","part.aux",&menu_id); ProMenubuttonActionSet("part","Status", (ProMenubuttonAction)UserPartStatus,NULL,0); /*---------------------------------------------------------------------------*\ Set up the notify option to call the CHECK PART function before saving an object. \*---------------------------------------------------------------------------*/ ProNotificationSet(PRO_MDL_SAVE_PRE,UserCheckPart); return (0); } /*---------------------------------------------------------------------------*\ End the Pro/TOOLKIT application \*---------------------------------------------------------------------------*/ void user_terminate() { printf ("Pro/TOOLKIT application terminated successfully\n"); }