/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ /*---------------------- Pro/Toolkit Includes ------------------------*/ #include <ProToolkit.h> #include <ProMenu.h> /*---------------------- Function Prototypes -------------------------*/ ProError ProUserJValueGet(); int ProUserValueSet(); int ProUserJustificationSet(); /*------------------------------------------------------------*\ Declare the values for the justification options, and for Done and Quit. \*------------------------------------------------------------*/ #define EX9_TOP 0 #define EX9_BOTTOM 1 #define EX9_LEFT 0 #define EX9_RIGHT 1 #define EX9_QUIT 0 #define EX9_DONE 1 /*------------------------------------------------------------*\ Command-function to close a menu, returning the selected value \*------------------------------------------------------------*/ ProError ProUserJValueGet(void *dummy, int value) { ProMenuDeleteWithStatus(value); return(0); } /*------------------------------------------------------------*\ Command function to set a given variable with a given value \*------------------------------------------------------------*/ int ProUserValueSet(int *option, int value) { *option = value; } /*------------------------------------------------------------*\ Function to set the vertical and horizontal justification options. \*------------------------------------------------------------*/ int ProUserJustificationSet(int *vert, int *horz) { int menuId; int action; ProError status; /*------------------------------------------------------------*\ Set the new value to be the old by default \*------------------------------------------------------------*/ int new_vert = *vert, new_horz = *horz; /*------------------------------------------------------------*\ Set up the vertical justification menu \*------------------------------------------------------------*/ status = ProMenuFileRegister("vert_just","vert_just.mnu", &menuId); status = ProMenubuttonActionSet("vert_just", "Top", (ProMenubuttonAction)ProUserValueSet, &new_vert, EX9_TOP); status = ProMenubuttonActionSet("vert_just", "Bottom", (ProMenubuttonAction)ProUserValueSet, &new_vert, EX9_BOTTOM); status = ProMenubuttonActionSet("vert_just", "vert_just", (ProMenubuttonAction)ProMenuHold, NULL, 0); status = ProMenuCreate(PROMENUTYPE_MAIN,"vert_just", &menuId); status = ProMenubuttonHighlight("vert_just", (new_vert == EX9_TOP) ? "Top" : "Bottom"); /*------------------------------------------------------------*\ Set up the horizontal justification menu \*------------------------------------------------------------*/ status = ProMenuFileRegister("horz_just","horz_just.mnu", &menuId); status = ProMenubuttonActionSet("horz_just", "Left", (ProMenubuttonAction)ProUserValueSet, &new_horz, EX9_LEFT); status = ProMenubuttonActionSet("horz_just", "Right", (ProMenubuttonAction)ProUserValueSet, &new_horz, EX9_RIGHT); status = ProMenubuttonActionSet("horz_just", "horz_just", (ProMenubuttonAction)ProMenuHold, NULL, 0); status = ProMenuCreate(PROMENUTYPE_SUB, "horz_just", &menuId); status = ProMenubuttonHighlight("horz_just", (new_horz == EX9_LEFT) ? "Left" : "Right"); /*------------------------------------------------------------*\ Set up the Done/Quit menu \*------------------------------------------------------------*/ status = ProMenuFileRegister("done_quit","donequit.mnu", &menuId); status = ProMenubuttonActionSet("done_quit", "Done", (ProMenubuttonAction)ProUserJValueGet, NULL, EX9_DONE); status = ProMenubuttonActionSet("done_quit", "Quit", (ProMenubuttonAction)ProUserJValueGet, NULL, EX9_QUIT); status = ProMenubuttonActionSet("done_quit", "done_quit", (ProMenubuttonAction)ProUserJValueGet, NULL, EX9_QUIT); status = ProMenuCreate(PROMENUTYPE_SUB, "done_quit", &menuId); /*------------------------------------------------------------*\ If the user selected Done, set the values to be the new ones \*------------------------------------------------------------*/ if(ProMenuProcess("", &action) == EX9_DONE) { *vert = new_vert; *horz = new_horz; } /*------------------------------------------------------------*\ Close the other two menus \*------------------------------------------------------------*/ ProMenuDelete(); ProMenuDelete(); return(0); }