// =========================================================================== // 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. // =========================================================================== // // DAG or DG Level check // // Executing the actual commands for the chosen options as well as // all checking to keep the option menus and the buttons in sync // // Enable/Disable the HG Container Controls global proc enableHGContainerControls (string $editor, int $enable) { iconTextButton -edit -enable ($enable) ($editor+"createContainerButton"); iconTextButton -edit -enable ($enable) ($editor+"removeContainerButton"); iconTextButton -edit -enable ($enable) ($editor+"collapseContainerButton"); iconTextButton -edit -enable ($enable) ($editor+"expandContainerButton"); if(`menuItem -exists ($editor+"ContainerCascade")`){ menuItem -edit -enable ($enable) ($editor+"ContainerCascade"); } } // Enable/Disable the HG Depth Controls global proc enableHGDepthControls (int $enable) { iconTextButton -e -enable $enable zeroDepthButton; iconTextButton -e -enable $enable reduceDepthButton; iconTextButton -e -enable $enable increaseDepthButton; iconTextButton -e -enable $enable unlimitedDepthButton; textField -e -enable $enable hgDepthText; } // Enable/Disable the graph layout styles global proc enableHGLayoutControls (string $editor, int $enable) { if (`menuItem -exists GraphLayoutStyle`) { menuItem -edit -enable ( $enable ) GraphLayoutStyle; } } global proc checkHGControls(string $editor) { string $graphType = `hyperGraph -q -graphType $editor`; int $value, $showDGoptions; if ($graphType == "DG") { $value = 0; } if ($graphType == "DAG") { $value = 1; } $showDGoptions = !$value; // check all the buttons in the iconBar of the Hypergraph iconTextButton -e -en $value frameHierButton; iconTextButton -e -en $value frameBranchButton; iconTextCheckBox -e -en $value ($editor+"freeformButton"); iconTextCheckBox -e -en $showDGoptions ($editor+"mergeConnectionsButton"); // we don't want the DG container controls enabled when in DAG mode enableHGContainerControls($editor, $showDGoptions); // we don't want the DG depth controls enabled when in DAG mode enableHGDepthControls($showDGoptions); // we don't want the DG layout controls enabled when in DAG mode enableHGLayoutControls($editor, $showDGoptions); // we do want the DG orientation controls enabled when in DAG mode // so don't do this ... //enableHGOrientationControls($editor, $showDGoptions); // check the node PopupMenu if (`menuItem -exists FoldItem`) { menuItem -e -en $value FoldItem; }; if (`menuItem -exists UnfoldItem`) { menuItem -e -en $value UnfoldItem; }; if (`menuItem -exists UnfoldAllItem`) { menuItem -e -en $value UnfoldAllItem; }; if (`menuItem -exists FrameHierarchyItem`) { menuItem -e -en $value FrameHierarchyItem; }; if (`menuItem -exists FrameBranchItem`) { menuItem -e -en $value FrameBranchItem; }; // check for freeform mode options // $inFreeform = `hyperGraph -q -freeform $editor`; $isDG = (`hyperGraph -q -graphType $editor` == "DG"); if (`menuItem -exists adjustImageItem`) { menuItem -e -en ($inFreeform || $isDG) adjustImageItem; }; if (`menuItem -exists showImageItem`) { menuItem -e -en ($inFreeform || $isDG) -cb `hyperGraph -q -imageEnabled $editor` showImageItem; }; // check for other menus // check the View Menu if (`menuItem -exists nextViewItem`) { menuItem -e -en $value nextViewItem; }; if (`menuItem -exists previousViewItem`) { menuItem -e -en $value previousViewItem; }; if (`menuItem -exists frameHierarchyItem`) { menuItem -e -en $value frameHierarchyItem; }; if (`menuItem -exists frameBranchItem`) { menuItem -e -en $value frameBranchItem; }; // check the Edit Menu if (`menuItem -exists FoldAllItem`) { menuItem -e -en $value FoldAllItem; }; if (`menuItem -exists UnfoldSelectedItem`) { menuItem -e -en $value UnfoldSelectedItem; }; if (`menuItem -exists UnfoldAllItem`) { menuItem -e -en $value UnfoldAllItem; }; if (`menuItem -exists UnfoldHiddenItem`) { menuItem -e -en $value UnfoldHiddenItem; }; if (`menuItem -exists ResetFreeformItem`) { menuItem -e -en ($value && $inFreeform) ResetFreeformItem; }; if (`menuItem -exists ClearViewItem`) { menuItem -e -en $showDGoptions ClearViewItem; }; // check the graph menu // if (`menuItem -exists navHomeItem`) { menuItem -e -en $showDGoptions navHomeItem; }; if (`menuItem -exists DoLayoutItem`) { menuItem -e -en $showDGoptions DoLayoutItem; }; if (`menuItem -exists incrDTItem`) { menuItem -e -en $showDGoptions incrDTItem; }; if (`menuItem -exists decrDTItem`) { menuItem -e -en $showDGoptions decrDTItem; }; // check the options menu // if (`menuItem -exists LayoutCascade`) { menuItem -e -en $value LayoutCascade; }; if (`menuItem -exists FiltersItem`) { menuItem -e -en $value FiltersItem; }; if (`menuItem -exists CachedConnItem`) { menuItem -e -en (!$value) CachedConnItem; }; if (`menuItem -exists RelationshipConnItem`) { menuItem -e -enable $showDGoptions RelationshipConnItem; }; if (`menuItem -exists MergeConnItem`) { menuItem -e -enable $showDGoptions MergeConnItem; }; if (`menuItem -exists OpaqueContainersItem`) { menuItem -e -enable $showDGoptions OpaqueContainersItem; }; // update menu options so that theyr reflect the current // state of the editor. // updateOptionsState($editor); }