/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ /*--------------------------------------------------------------------*\ Pro/TOOLKIT includes \*--------------------------------------------------------------------*/ #include <ProToolkit.h> #include <ProMdl.h> #include <ProMenu.h> #include <ProWindows.h> #include <ProView.h> #include <ProUtil.h> /*--------------------------------------------------------------------*\ C System includes \*--------------------------------------------------------------------*/ #if (PRO_MACHINE == SUN4 || PRO_MACHINE == SOLARISx64 || PRO_MACHINE == HP8000) #include <unistd.h> #endif /*--------------------------------------------------------------------*\ Application includes \*--------------------------------------------------------------------*/ #include "TestError.h" #include "TestSleep.h" #include "TestMenu.h" #include "UtilFiles.h" #include "UtilCollect.h" #include <time.h> #include <ProTKRunTime.h> #include <PTApplsUnicodeUtils.h> #include <UtilMessage.h> /*====================================================================*\ FUNCTION : ProTestObjWinMenu() PURPOSE : Set view test menu. \*====================================================================*/ int ProTestObjWinMenu() { ProMdl mdl; ProMatrix matrix; ProError err; int *w_id, i, j, k, l, cur_win, num_win; char name[PRO_MDLNAME_SIZE]; double scale[3] = {0.5, 0.5, 4}; ProMdlName w_name; ProPath w_path; FILE *fp; err = ProUtilCollectWindowIds(&w_id); if (err != PRO_TK_NO_ERROR) { ProUtilMsgPrint("gen", "TEST %0s", "No windows found"); return (0); } err = ProWindowCurrentGet(&cur_win); TEST_CALL_REPORT("ProWindowCurrentGet()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); fp = PTApplsUnicodeFopen("win_info.log", "w"); ProStringToWstring(w_path, (char*)"win_info.log"); err = ProArraySizeGet((ProArray)w_id, &num_win); for (i=0; i<num_win; i++) { #ifndef PT_PRODUCTS_BUILD err = ProWindowCurrentSet(w_id[i]); TEST_CALL_REPORT("ProWindowCurrentSet()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); #endif ProTKFprintf(fp ,"Window Id %d (%s)\n\n", w_id[i], w_id[i] == cur_win ? "active" : "not active"); err = ProWindowMdlGet(w_id[i], &mdl); TEST_CALL_REPORT("ProWindowMdlGet()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); if (err == PRO_TK_NO_ERROR) { err = ProMdlMdlnameGet(mdl, w_name); TEST_CALL_REPORT("ProMdlMdlnameGet()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); ProWstringToString(name, w_name); ProTKFprintf(fp, "Contains model %s\n", name); err = ProWindowCurrentMatrixGet(matrix); TEST_CALL_REPORT("ProWindowCurrentMatrixGet()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); for (k=0; k<3; k++) { /* Change model scale to check window matrix functions */ for (j=0; j<3; j++) for (l=0; l<3; l++) matrix[j][l] *= scale[k]; err = ProWindowPanZoomMatrixSet(w_id[i], matrix); TEST_CALL_REPORT("ProWindowPanZoomMatrixSet()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); err = ProWindowRepaint( w_id[i]); TEST_CALL_REPORT("ProWindowRepaint()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); ProTestSleep(1); } ProTKFprintf(fp, "Window matrix:\n"); for (j=0; j<4; j++) ProTKFprintf(fp, "%8.4f %8.4f %8.4f\n", matrix[j][0], matrix[j][1], matrix[j][2]); ProTKFprintf(fp, "\n\n"); } } fclose(fp); #ifndef PT_PRODUCTS_BUILD err = ProWindowCurrentSet(cur_win); TEST_CALL_REPORT("ProWindowCurrentSet()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); #endif err = ProInfoWindowDisplay(w_path, NULL, NULL); TEST_CALL_REPORT("ProInfoWindowDisplay()", "ProTestObjWinMenu()", err, err != PRO_TK_NO_ERROR); return (0); }