// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: Nov 25 1998 // // Description: // Supports context sensitive menu items. // // Procs: // addContextHelpProc() // removeContextHelpProc() // doContextHelpProc() // hasContextHelpProc() // global proc addContextHelpProc(string $object, string $procName) // // Description: // addContextHelpProc - creates an array of maps // from the window or panel name to the // procedure that is responsible to display // context sensitive help. // // Arguments: // $object - is the name of the panel or window. // $procName - then name of the procedure that calls // window or panel specific context sensitive help. // { global string $gHelpObjectArray[]; global string $gHelpProcNameArray[]; int $i; int $present; int $numItems = size($gHelpObjectArray); for ($i = 0; $i < $numItems; $i++) { if ($gHelpObjectArray[$i] == $object) { $present = true; break; } } if (!$present) { $gHelpObjectArray[$numItems] = $object; $gHelpProcNameArray[$numItems] = $procName; } } global proc removeContextHelpProc(string $object) // // Description: // removeContextHelpProc - removes the specified map // from the array. Main usage is for plugins. // // Arguments: // $object - is the name of the panel or window. // { global string $gHelpObjectArray[]; global string $gHelpProcNameArray[]; int $i; int $numItems = size($gHelpObjectArray); for ($i = 0; $i < $numItems; $i++) { if ($gHelpObjectArray[$i] == $object) { // When context sensitive help is removed // for now it will be replaced by "xxxx" // in the array to suggest removal. // Later, it could be modified to properly remove the item. // $gHelpObjectArray[$i] = "xxxx"; $gHelpProcNameArray[$i] = "xxxx"; break; } } } global proc doContextHelpProc(string $object, string $menuParent) // // Description: // doContextHelpProc - given the window or panel name // it finds the corresponding procedure and calls // the menu's context sensitive help. // // Arguments: // $object - is the name of the panel or window. // $menuParent - the parent of the menu. // { global string $gHelpObjectArray[]; global string $gHelpProcNameArray[]; if ($object != "" && $menuParent != "") { int $i; int $numItems = size($gHelpObjectArray); for ($i = 0; $i < $numItems; $i++) { if ($gHelpObjectArray[$i] == $object) { eval ($gHelpProcNameArray[$i] + " \"" + $object + "\" \"" + $menuParent + "\""); break; }//if }//for }//if } global proc int hasContextHelpProc(string $object) // // Description: // hasContextHelpProc - given the window or panel name // it checks if context help exists for that specific // window or panel. // // Arguments: // $object - is the name of the panel or window. // { int $contextHelpExists = false; global string $gHelpObjectArray[]; global string $gHelpProcNameArray[]; int $i; int $numItems = size($gHelpObjectArray); for ($i = 0; $i < $numItems; $i++) { if ($gHelpObjectArray[$i] == $object) { $contextHelpExists = true; break; }//if }//for return $contextHelpExists; }