diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloatertools.cpp | 182 |
1 files changed, 181 insertions, 1 deletions
diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index a33b495..443f684 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "llfloateropenobject.h" | 47 | #include "llfloateropenobject.h" |
48 | #include "llfocusmgr.h" | 48 | #include "llfocusmgr.h" |
49 | #include "llmenugl.h" | 49 | #include "llmenugl.h" |
50 | #include "llnotify.h" | ||
50 | #include "llpanelcontents.h" | 51 | #include "llpanelcontents.h" |
51 | #include "llpanelface.h" | 52 | #include "llpanelface.h" |
52 | #include "llpanelland.h" | 53 | #include "llpanelland.h" |
@@ -79,6 +80,8 @@ | |||
79 | #include "llviewerwindow.h" | 80 | #include "llviewerwindow.h" |
80 | #include "llviewercontrol.h" | 81 | #include "llviewercontrol.h" |
81 | #include "llviewerjoystick.h" | 82 | #include "llviewerjoystick.h" |
83 | #include "llvograss.h" | ||
84 | #include "llvotree.h" | ||
82 | #include "lluictrlfactory.h" | 85 | #include "lluictrlfactory.h" |
83 | 86 | ||
84 | // Globals | 87 | // Globals |
@@ -235,6 +238,11 @@ BOOL LLFloaterTools::postBuild() | |||
235 | mTextGridMode = getChild<LLTextBox>("text ruler mode"); | 238 | mTextGridMode = getChild<LLTextBox>("text ruler mode"); |
236 | mComboGridMode = getChild<LLComboBox>("combobox grid mode"); | 239 | mComboGridMode = getChild<LLComboBox>("combobox grid mode"); |
237 | childSetCommitCallback("combobox grid mode",commit_grid_mode, this); | 240 | childSetCommitCallback("combobox grid mode",commit_grid_mode, this); |
241 | mBtnLink = getChild<LLButton>("link_btn"); | ||
242 | childSetAction("link_btn",onClickLink, this); | ||
243 | mBtnUnlink = getChild<LLButton>("unlink_btn"); | ||
244 | childSetAction("unlink_btn",onClickUnlink, this); | ||
245 | |||
238 | // | 246 | // |
239 | // Create Buttons | 247 | // Create Buttons |
240 | // | 248 | // |
@@ -278,10 +286,14 @@ BOOL LLFloaterTools::postBuild() | |||
278 | { | 286 | { |
279 | found->setClickedCallback(setObjectType,toolData[t]); | 287 | found->setClickedCallback(setObjectType,toolData[t]); |
280 | mButtons.push_back( found ); | 288 | mButtons.push_back( found ); |
281 | }else{ | 289 | } |
290 | else | ||
291 | { | ||
282 | llwarns << "Tool button not found! DOA Pending." << llendl; | 292 | llwarns << "Tool button not found! DOA Pending." << llendl; |
283 | } | 293 | } |
284 | } | 294 | } |
295 | mComboTreesGrass = getChild<LLComboBox>("trees_grass"); | ||
296 | childSetCommitCallback("trees_grass", onSelectTreesGrass, (void*)0); | ||
285 | mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); | 297 | mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); |
286 | childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); | 298 | childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); |
287 | mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky"); | 299 | mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky"); |
@@ -376,6 +388,10 @@ LLFloaterTools::LLFloaterTools() | |||
376 | mBtnDuplicate(NULL), | 388 | mBtnDuplicate(NULL), |
377 | mBtnDuplicateInPlace(NULL), | 389 | mBtnDuplicateInPlace(NULL), |
378 | 390 | ||
391 | mBtnLink(NULL), | ||
392 | mBtnUnlink(NULL), | ||
393 | |||
394 | mComboTreesGrass(NULL), | ||
379 | mCheckSticky(NULL), | 395 | mCheckSticky(NULL), |
380 | mCheckCopySelection(NULL), | 396 | mCheckCopySelection(NULL), |
381 | mCheckCopyCenters(NULL), | 397 | mCheckCopyCenters(NULL), |
@@ -644,11 +660,51 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) | |||
644 | if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible ); | 660 | if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible ); |
645 | if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible ); | 661 | if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible ); |
646 | 662 | ||
663 | if (mBtnLink) mBtnLink->setVisible( edit_visible ); | ||
664 | if (mBtnUnlink) mBtnUnlink->setVisible( edit_visible ); | ||
665 | |||
666 | // Check to see if we can link things | ||
667 | bool can_link = false; | ||
668 | if (!gSavedSettings.getBOOL("EditLinkedParts")) | ||
669 | { | ||
670 | if(LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() >= 2) | ||
671 | { | ||
672 | struct f : public LLSelectedObjectFunctor | ||
673 | { | ||
674 | virtual bool apply(LLViewerObject* object) | ||
675 | { | ||
676 | return object->permModify(); | ||
677 | } | ||
678 | } | ||
679 | func; | ||
680 | const bool firstonly = true; | ||
681 | can_link = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); | ||
682 | } | ||
683 | } | ||
684 | mBtnLink->setEnabled(can_link); | ||
685 | |||
686 | // Check to see if we can unlink things | ||
687 | bool can_unlink = false; | ||
688 | if (LLSelectMgr::getInstance()->selectGetAllRootsValid() && | ||
689 | LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && | ||
690 | !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment()) | ||
691 | { | ||
692 | if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != | ||
693 | LLSelectMgr::getInstance()->getSelection()->getObjectCount()) | ||
694 | { | ||
695 | can_unlink = true; | ||
696 | } | ||
697 | } | ||
698 | mBtnUnlink->setEnabled(can_unlink); | ||
699 | |||
700 | |||
647 | // Create buttons | 701 | // Create buttons |
648 | BOOL create_visible = (tool == LLToolCompCreate::getInstance()); | 702 | BOOL create_visible = (tool == LLToolCompCreate::getInstance()); |
649 | 703 | ||
650 | mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); | 704 | mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); |
651 | 705 | ||
706 | updateTreeGrassCombo(create_visible); | ||
707 | |||
652 | if (mCheckCopySelection | 708 | if (mCheckCopySelection |
653 | && mCheckCopySelection->get()) | 709 | && mCheckCopySelection->get()) |
654 | { | 710 | { |
@@ -953,6 +1009,7 @@ void LLFloaterTools::setObjectType( void* data ) | |||
953 | LLPCode pcode = *(LLPCode*) data; | 1009 | LLPCode pcode = *(LLPCode*) data; |
954 | LLToolPlacer::setObjectType( pcode ); | 1010 | LLToolPlacer::setObjectType( pcode ); |
955 | gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); | 1011 | gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); |
1012 | gFloaterTools->updateTreeGrassCombo(true); | ||
956 | gFocusMgr.setMouseCapture(NULL); | 1013 | gFocusMgr.setMouseCapture(NULL); |
957 | } | 1014 | } |
958 | 1015 | ||
@@ -975,3 +1032,126 @@ void LLFloaterTools::onFocusReceived() | |||
975 | LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); | 1032 | LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); |
976 | LLFloater::onFocusReceived(); | 1033 | LLFloater::onFocusReceived(); |
977 | } | 1034 | } |
1035 | |||
1036 | void LLFloaterTools::updateTreeGrassCombo(bool visible) | ||
1037 | { | ||
1038 | if (visible) | ||
1039 | { | ||
1040 | LLPCode pcode = LLToolPlacer::getObjectType(); | ||
1041 | std::map<std::string, S32>::iterator it, end; | ||
1042 | std::string selected; | ||
1043 | LLTextBox* tree_grass_label = getChild<LLTextBox>("tree_grass_label"); | ||
1044 | if (pcode == LLToolPlacerPanel::sTree) | ||
1045 | { | ||
1046 | tree_grass_label->setVisible(true); | ||
1047 | LLButton* button = getChild<LLButton>("ToolTree"); | ||
1048 | tree_grass_label->setText(button->getToolTip()); | ||
1049 | |||
1050 | selected = gSavedSettings.getString("LastTree"); | ||
1051 | it = LLVOTree::sSpeciesNames.begin(); | ||
1052 | end = LLVOTree::sSpeciesNames.end(); | ||
1053 | } | ||
1054 | else if (pcode == LLToolPlacerPanel::sGrass) | ||
1055 | { | ||
1056 | tree_grass_label->setVisible(true); | ||
1057 | LLButton* button = getChild<LLButton>("ToolGrass"); | ||
1058 | tree_grass_label->setText(button->getToolTip()); | ||
1059 | |||
1060 | selected = gSavedSettings.getString("LastGrass"); | ||
1061 | it = LLVOGrass::sSpeciesNames.begin(); | ||
1062 | end = LLVOGrass::sSpeciesNames.end(); | ||
1063 | } | ||
1064 | else | ||
1065 | { | ||
1066 | mComboTreesGrass->removeall(); | ||
1067 | mComboTreesGrass->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label | ||
1068 | mComboTreesGrass->setEnabled(false); | ||
1069 | mComboTreesGrass->setVisible(false); | ||
1070 | tree_grass_label->setVisible(false); | ||
1071 | return; | ||
1072 | } | ||
1073 | |||
1074 | mComboTreesGrass->removeall(); | ||
1075 | mComboTreesGrass->add("Random"); | ||
1076 | |||
1077 | int select = 0, i = 0; | ||
1078 | |||
1079 | while (it != end) | ||
1080 | { | ||
1081 | const std::string &species = it->first; | ||
1082 | mComboTreesGrass->add(species); ++i; | ||
1083 | if (species == selected) select = i; | ||
1084 | ++it; | ||
1085 | } | ||
1086 | // if saved species not found, default to "Random" | ||
1087 | mComboTreesGrass->selectNthItem(select); | ||
1088 | mComboTreesGrass->setEnabled(true); | ||
1089 | } | ||
1090 | |||
1091 | mComboTreesGrass->setVisible(visible); | ||
1092 | } | ||
1093 | |||
1094 | // static | ||
1095 | void LLFloaterTools::onSelectTreesGrass(LLUICtrl*, void*) | ||
1096 | { | ||
1097 | const std::string &selected = gFloaterTools->mComboTreesGrass->getValue(); | ||
1098 | LLPCode pcode = LLToolPlacer::getObjectType(); | ||
1099 | if (pcode == LLToolPlacerPanel::sTree) | ||
1100 | { | ||
1101 | gSavedSettings.setString("LastTree", selected); | ||
1102 | } | ||
1103 | else if (pcode == LLToolPlacerPanel::sGrass) | ||
1104 | { | ||
1105 | gSavedSettings.setString("LastGrass", selected); | ||
1106 | } | ||
1107 | } | ||
1108 | |||
1109 | // static | ||
1110 | void LLFloaterTools::onClickLink(void* data) | ||
1111 | { | ||
1112 | if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) | ||
1113 | { | ||
1114 | LLNotifyBox::showXml("UnableToLinkWhileDownloading"); | ||
1115 | return; | ||
1116 | } | ||
1117 | |||
1118 | S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); | ||
1119 | if (object_count > MAX_CHILDREN_PER_TASK + 1) | ||
1120 | { | ||
1121 | LLStringUtil::format_map_t args; | ||
1122 | args["[COUNT]"] = llformat("%d", object_count); | ||
1123 | int max = MAX_CHILDREN_PER_TASK+1; | ||
1124 | args["[MAX]"] = llformat("%d", max); | ||
1125 | gViewerWindow->alertXml("UnableToLinkObjects", args); | ||
1126 | return; | ||
1127 | } | ||
1128 | |||
1129 | if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() < 2) | ||
1130 | { | ||
1131 | gViewerWindow->alertXml("CannotLinkIncompleteSet"); | ||
1132 | return; | ||
1133 | } | ||
1134 | if(!LLSelectMgr::getInstance()->selectGetRootsModify()) | ||
1135 | { | ||
1136 | gViewerWindow->alertXml("CannotLinkModify"); | ||
1137 | return; | ||
1138 | } | ||
1139 | LLUUID owner_id; | ||
1140 | std::string owner_name; | ||
1141 | if(!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) | ||
1142 | { | ||
1143 | // we don't actually care if you're the owner, but novices are | ||
1144 | // the most likely to be stumped by this one, so offer the | ||
1145 | // easiest and most likely solution. | ||
1146 | gViewerWindow->alertXml("CannotLinkDifferentOwners"); | ||
1147 | return; | ||
1148 | } | ||
1149 | LLSelectMgr::getInstance()->sendLink(); | ||
1150 | return; | ||
1151 | } | ||
1152 | |||
1153 | // static | ||
1154 | void LLFloaterTools::onClickUnlink(void* data) | ||
1155 | { | ||
1156 | LLSelectMgr::getInstance()->sendDelink(); | ||
1157 | } | ||