diff options
Diffstat (limited to 'linden/indra/newview/llviewermenu.cpp')
-rw-r--r-- | linden/indra/newview/llviewermenu.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index c403700..c5964d5 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp | |||
@@ -4534,6 +4534,97 @@ class LLToolsSnapObjectXY : public view_listener_t | |||
4534 | } | 4534 | } |
4535 | }; | 4535 | }; |
4536 | 4536 | ||
4537 | // Determine if the option to cycle between linked prims is shown | ||
4538 | class LLToolsEnableSelectNextPart : public view_listener_t | ||
4539 | { | ||
4540 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
4541 | { | ||
4542 | bool new_value = (gSavedSettings.getBOOL("EditLinkedParts") && | ||
4543 | !LLSelectMgr::getInstance()->getSelection()->isEmpty()); | ||
4544 | gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); | ||
4545 | return true; | ||
4546 | } | ||
4547 | }; | ||
4548 | |||
4549 | // Cycle selection through linked children in selected object. | ||
4550 | // FIXME: Order of children list is not always the same as sim's idea of link order. This may confuse | ||
4551 | // resis. Need link position added to sim messages to address this. | ||
4552 | class LLToolsSelectNextPart : public view_listener_t | ||
4553 | { | ||
4554 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
4555 | { | ||
4556 | S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); | ||
4557 | if (gSavedSettings.getBOOL("EditLinkedParts") && object_count) | ||
4558 | { | ||
4559 | LLViewerObject* selected = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); | ||
4560 | if (selected && selected->getRootEdit()) | ||
4561 | { | ||
4562 | bool fwd = (userdata.asString() == "next"); | ||
4563 | bool prev = (userdata.asString() == "previous"); | ||
4564 | bool ifwd = (userdata.asString() == "includenext"); | ||
4565 | bool iprev = (userdata.asString() == "includeprevious"); | ||
4566 | LLViewerObject* to_select = NULL; | ||
4567 | LLViewerObject::child_list_t children = selected->getRootEdit()->getChildren(); | ||
4568 | children.push_front(selected->getRootEdit()); // need root in the list too | ||
4569 | |||
4570 | for (LLViewerObject::child_list_t::iterator iter = children.begin(); iter != children.end(); ++iter) | ||
4571 | { | ||
4572 | if ((*iter)->isSelected()) | ||
4573 | { | ||
4574 | if (object_count > 1 && (fwd || prev)) // multiple selection, find first or last selected if not include | ||
4575 | { | ||
4576 | to_select = *iter; | ||
4577 | if (fwd) | ||
4578 | { | ||
4579 | // stop searching if going forward; repeat to get last hit if backward | ||
4580 | break; | ||
4581 | } | ||
4582 | } | ||
4583 | else if ((object_count == 1) || (ifwd || iprev)) // single selection or include | ||
4584 | { | ||
4585 | if (fwd || ifwd) | ||
4586 | { | ||
4587 | ++iter; | ||
4588 | while (iter != children.end() && ((*iter)->isAvatar() || (ifwd && (*iter)->isSelected()))) | ||
4589 | { | ||
4590 | ++iter; // skip sitting avatars and selected if include | ||
4591 | } | ||
4592 | } | ||
4593 | else // backward | ||
4594 | { | ||
4595 | iter = (iter == children.begin() ? children.end() : iter); | ||
4596 | --iter; | ||
4597 | while (iter != children.begin() && ((*iter)->isAvatar() || (iprev && (*iter)->isSelected()))) | ||
4598 | { | ||
4599 | --iter; // skip sitting avatars and selected if include | ||
4600 | } | ||
4601 | } | ||
4602 | iter = (iter == children.end() ? children.begin() : iter); | ||
4603 | to_select = *iter; | ||
4604 | break; | ||
4605 | } | ||
4606 | } | ||
4607 | } | ||
4608 | |||
4609 | if (to_select) | ||
4610 | { | ||
4611 | if (gFocusMgr.childHasKeyboardFocus(gFloaterTools)) | ||
4612 | { | ||
4613 | gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes | ||
4614 | } | ||
4615 | if (fwd || prev) | ||
4616 | { | ||
4617 | LLSelectMgr::getInstance()->deselectAll(); | ||
4618 | } | ||
4619 | LLSelectMgr::getInstance()->selectObjectOnly(to_select); | ||
4620 | return true; | ||
4621 | } | ||
4622 | } | ||
4623 | } | ||
4624 | return true; | ||
4625 | } | ||
4626 | }; | ||
4627 | |||
4537 | // in order to link, all objects must have the same owner, and the | 4628 | // in order to link, all objects must have the same owner, and the |
4538 | // agent must have the ability to modify all of the objects. However, | 4629 | // agent must have the ability to modify all of the objects. However, |
4539 | // we're not answering that question with this method. The question | 4630 | // we're not answering that question with this method. The question |
@@ -10666,6 +10757,7 @@ void initialize_menus() | |||
10666 | addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); | 10757 | addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); |
10667 | addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY"); | 10758 | addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY"); |
10668 | addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid"); | 10759 | addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid"); |
10760 | addMenu(new LLToolsSelectNextPart(), "Tools.SelectNextPart"); | ||
10669 | addMenu(new LLToolsLink(), "Tools.Link"); | 10761 | addMenu(new LLToolsLink(), "Tools.Link"); |
10670 | addMenu(new LLToolsUnlink(), "Tools.Unlink"); | 10762 | addMenu(new LLToolsUnlink(), "Tools.Unlink"); |
10671 | addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations"); | 10763 | addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations"); |
@@ -10679,6 +10771,7 @@ void initialize_menus() | |||
10679 | addMenu(new LLToolsSetBulkPerms(), "Tools.SetBulkPerms"); | 10771 | addMenu(new LLToolsSetBulkPerms(), "Tools.SetBulkPerms"); |
10680 | 10772 | ||
10681 | addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie"); | 10773 | addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie"); |
10774 | addMenu(new LLToolsEnableSelectNextPart(), "Tools.EnableSelectNextPart"); | ||
10682 | addMenu(new LLToolsEnableLink(), "Tools.EnableLink"); | 10775 | addMenu(new LLToolsEnableLink(), "Tools.EnableLink"); |
10683 | addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink"); | 10776 | addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink"); |
10684 | addMenu(new LLToolsEnableTake(), "Tools.EnableTake"); | 10777 | addMenu(new LLToolsEnableTake(), "Tools.EnableTake"); |