aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatertools.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloatertools.cpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp
index 73b6061..84a1edc 100644
--- a/linden/indra/newview/llfloatertools.cpp
+++ b/linden/indra/newview/llfloatertools.cpp
@@ -46,6 +46,7 @@
46#include "llfloateropenobject.h" 46#include "llfloateropenobject.h"
47#include "llfocusmgr.h" 47#include "llfocusmgr.h"
48#include "llmenugl.h" 48#include "llmenugl.h"
49#include "llnotify.h"
49#include "llpanelcontents.h" 50#include "llpanelcontents.h"
50#include "llpanelface.h" 51#include "llpanelface.h"
51#include "llpanelland.h" 52#include "llpanelland.h"
@@ -235,6 +236,11 @@ BOOL LLFloaterTools::postBuild()
235 mTextGridMode = getChild<LLTextBox>("text ruler mode"); 236 mTextGridMode = getChild<LLTextBox>("text ruler mode");
236 mComboGridMode = getChild<LLComboBox>("combobox grid mode"); 237 mComboGridMode = getChild<LLComboBox>("combobox grid mode");
237 childSetCommitCallback("combobox grid mode",commit_grid_mode, this); 238 childSetCommitCallback("combobox grid mode",commit_grid_mode, this);
239 mBtnLink = getChild<LLButton>("link_btn");
240 childSetAction("link_btn",onClickLink, this);
241 mBtnUnlink = getChild<LLButton>("unlink_btn");
242 childSetAction("unlink_btn",onClickUnlink, this);
243
238 // 244 //
239 // Create Buttons 245 // Create Buttons
240 // 246 //
@@ -387,6 +393,9 @@ LLFloaterTools::LLFloaterTools()
387 mBtnDuplicate(NULL), 393 mBtnDuplicate(NULL),
388 mBtnDuplicateInPlace(NULL), 394 mBtnDuplicateInPlace(NULL),
389 395
396 mBtnLink(NULL),
397 mBtnUnlink(NULL),
398
390 mComboTreesGrass(NULL), 399 mComboTreesGrass(NULL),
391 mCheckSticky(NULL), 400 mCheckSticky(NULL),
392 mCheckCopySelection(NULL), 401 mCheckCopySelection(NULL),
@@ -661,6 +670,44 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
661 if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible ); 670 if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible );
662 if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible ); 671 if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible );
663 672
673 if (mBtnLink) mBtnLink->setVisible( edit_visible );
674 if (mBtnUnlink) mBtnUnlink->setVisible( edit_visible );
675
676 // Check to see if we can link things
677 bool can_link = false;
678 if (!gSavedSettings.getBOOL("EditLinkedParts"))
679 {
680 if(LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() >= 2)
681 {
682 struct f : public LLSelectedObjectFunctor
683 {
684 virtual bool apply(LLViewerObject* object)
685 {
686 return object->permModify();
687 }
688 }
689 func;
690 const bool firstonly = true;
691 can_link = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly);
692 }
693 }
694 mBtnLink->setEnabled(can_link);
695
696 // Check to see if we can unlink things
697 bool can_unlink = false;
698 if (LLSelectMgr::getInstance()->selectGetAllRootsValid() &&
699 LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() &&
700 !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment())
701 {
702 if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() !=
703 LLSelectMgr::getInstance()->getSelection()->getObjectCount())
704 {
705 can_unlink = true;
706 }
707 }
708 mBtnUnlink->setEnabled(can_unlink);
709
710
664 // Create buttons 711 // Create buttons
665 BOOL create_visible = (tool == LLToolCompCreate::getInstance()); 712 BOOL create_visible = (tool == LLToolCompCreate::getInstance());
666 713
@@ -1109,3 +1156,53 @@ void LLFloaterTools::onSelectTreesGrass(LLUICtrl*, void*)
1109 gSavedSettings.setString("LastGrass", selected); 1156 gSavedSettings.setString("LastGrass", selected);
1110 } 1157 }
1111} 1158}
1159
1160// static
1161void LLFloaterTools::onClickLink(void* data)
1162{
1163 if(!LLSelectMgr::getInstance()->selectGetAllRootsValid())
1164 {
1165 LLNotifyBox::showXml("UnableToLinkWhileDownloading");
1166 return;
1167 }
1168
1169 S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
1170 if (object_count > MAX_CHILDREN_PER_TASK + 1)
1171 {
1172 LLStringUtil::format_map_t args;
1173 args["[COUNT]"] = llformat("%d", object_count);
1174 int max = MAX_CHILDREN_PER_TASK+1;
1175 args["[MAX]"] = llformat("%d", max);
1176 gViewerWindow->alertXml("UnableToLinkObjects", args);
1177 return;
1178 }
1179
1180 if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() < 2)
1181 {
1182 gViewerWindow->alertXml("CannotLinkIncompleteSet");
1183 return;
1184 }
1185 if(!LLSelectMgr::getInstance()->selectGetRootsModify())
1186 {
1187 gViewerWindow->alertXml("CannotLinkModify");
1188 return;
1189 }
1190 LLUUID owner_id;
1191 std::string owner_name;
1192 if(!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name))
1193 {
1194 // we don't actually care if you're the owner, but novices are
1195 // the most likely to be stumped by this one, so offer the
1196 // easiest and most likely solution.
1197 gViewerWindow->alertXml("CannotLinkDifferentOwners");
1198 return;
1199 }
1200 LLSelectMgr::getInstance()->sendLink();
1201 return;
1202}
1203
1204// static
1205void LLFloaterTools::onClickUnlink(void* data)
1206{
1207 LLSelectMgr::getInstance()->sendDelink();
1208}