Short Description: Workspace Context Menu: Add Link to Link Group, plus... Bug Number: n/a Release notes (y/n): YES For Release Nums: 6.1 ... plus similar operations for SimObjs and Accounts. SEE: https://cadswes2.colorado.edu/~philw/2010/6p1/WsAddLinkToGroup/ (I) Added THIRD submenu to (physical-) Link context menu, in all workspaces (except for the old Qt3 Accounting workspace, soon to be dropped). (1) Delete Link >> (list of proximate links) (2) Link Group Membership >> (list of links) >> (list of link groups) (3) Add to Link Group >> (list of links) >> (list of OTHER link groups) Note that a link group is defined by ONE OR TWO sets of Slots linked by the included links. A link group is NOT defined as a set of links. Adding a link to a link group (by means of including one or both of that link's associated slots in one or both slot sets for the link group) MAY CAUSE additional links to also become part of the link group. Because these submenus are complex -- note that the names of links shown on the second menu level are LONG -- an "action" prefix was added to the third-level menu, for menus (2) and (3) above. The "action" prefix is "Edit:" or "Add To:", respectively for those menus. FOR EXAMPLE: Add to Link Group >> ... Flat River Target.Outflow <--> Flat River.Inflow >> ... ... Add To: Diversions ... ... Add To: Return Flows The two predefined, automatic Link Groups ("Default" and "Main Channel Links") are not included in the "Add To" menus. The sets of Links included in those two Link Groups are not defined by user selections. (II) Also added "Add to Object/Account Group" submenus to Object and Account context menus (on the workspace) -- BUT ONLY for instances which are not already included in an Object or Account Group. The SimObj context menu (in any of the Qt4 workspace views) includes ONLY ONE of these two menus -- depending on whether the SimObj is in a group. Add to Object Group >> (list of object groups) Object Group Membership >> (list of object groups) The Account context menu (only in the new Qt4 Accounting view) includes ONE of these two menus -- depending on whether the Account is in a group. Add to Account Group >> (list of account groups) Account Group Membership >> (list of account groups) Only the submenu items in the "Membership" menu show the editor dialog for the group. ----------------- Sim/LinkGroup.hpp Sim/LinkGroup.cpp ----------------- Added method: // Note: This is not the normal way of having a Link be inside this // group, since Link Groups are defined by one or both Slots of a Link // being referred to by the Link Group. This operation may cause OTHER // links to also be included in this group. // void forceAddLink (Link*); ... care is taken to minimally impact the ONE or TWO Slot RootSelections which define the content of the LinkGroup ... (1) If the LinkGroup is non-empty and defined in terms of ONLY ONE Slot RootSelection, then only one of the Link's two "end" Slots are put into that RootSelection. And if either of the Link's two Slots are already in that RootSelection, then no change is made. (2) If the LinkGroup is empty OR is defined in terms of TWO Slot RootSelections, then BOTH of the Link's two "end" Slots are put into the two Slot RootSelections. But if either "end" Slot is already in one of the two Slot RootSelections, then that Slot-RootSelection "association" is "preferred". ------------------------------ QtUtils/WorkspaceGfxScene.hpp QtUtils/WorkspaceGfxScene.cpp ------------------------------ New data members: QSignalMapper _addToLinkGroupCtxSignalMapper; QMap _ctxSubmenuLinkMap; Link* _ctxLastLinkSubmenuShown; New methods: void insertAddToLinkGroupActions (QMenu*, const QPointF& refScenePos); void linkSubmenuAboutToShow(); void addToLinkGroupActivated (const QString& groupName); void simObjGfxItem_contextAddToObjGroupSelected (const QString& groupName); void simObjGfxItem_contextAddToAcctGroupSelected (const QString& groupName); ----------------------- QtUtils/LinkGfxItem.hpp QtUtils/LinkGfxItem.cpp ----------------------- New method: int insertAddToDspGroupActions (QMenu*, QSignalMapper*); ------------------------- QtUtils/SimObjGfxItem.hpp QtUtils/SimObjGfxItem.cpp ------------------------- New data members: QSignalMapper _contextAddToObjGroupActionMapper; QSignalMapper _contextAddToAcctGroupActionMapper; ... Note: Those two QSignalMappers are connected to Qt "slots" in WorkspaceGfxScene: (1) simObjGfxItem_contextAddToObjGroupSelected (const QString&) (2) simObjGfxItem_contextAddToAcctGroupSelected (const QString&) New methods: int insertAddToObjDspGroupActions (QMenu*); int insertAddToAcctDspGroupActions (QMenu*, Account*); ------------------------- Q3GUI/AccountGroupDlg.cpp Q3GUI/AccountGroupDlg.hpp Q3GUI/LinkGroupDlg.cpp Q3GUI/LinkGroupDlg.hpp Q3GUI/ObjectGroupDlg.cpp Q3GUI/ObjectGroupDlg.hpp ------------------------- When the user edits a RootSelection from any of these Display Group dialogs, the "live" RootSelection is modified by GUS. But if, after doing so, the user clicks "Cancel" without first clicking "Apply", those RootSelection changes are not represented in the GUI. Now, when there are un-Applied RootSelection changes, the "Cancel" button is disabled. See new members: void updateSensitivity(); bool _unAppliedRootSelChanges; cwSlist _saveSelObjects; cwSlist _saveSelAccounts; cwSlist _saveSlot1SelSlots; cwSlist _saveSlot2SelSlots; ---