aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatertools.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-06-10 10:53:54 -0700
committerMcCabe Maxsted2009-06-10 10:53:54 -0700
commit074acc412548c29729f1782f2803e426507d7115 (patch)
treead797d7113df1a77d3604248dab044a8abcad037 /linden/indra/newview/llfloatertools.cpp
parentFixed Communicate window not toggling from menu (diff)
downloadmeta-impy-074acc412548c29729f1782f2803e426507d7115.zip
meta-impy-074acc412548c29729f1782f2803e426507d7115.tar.gz
meta-impy-074acc412548c29729f1782f2803e426507d7115.tar.bz2
meta-impy-074acc412548c29729f1782f2803e426507d7115.tar.xz
Applied MJM's tree and grass pulldown list from the Hippo Viewer
Diffstat (limited to 'linden/indra/newview/llfloatertools.cpp')
-rw-r--r--linden/indra/newview/llfloatertools.cpp74
1 files changed, 73 insertions, 1 deletions
diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp
index e723ba1..2fc4c71 100644
--- a/linden/indra/newview/llfloatertools.cpp
+++ b/linden/indra/newview/llfloatertools.cpp
@@ -77,6 +77,8 @@
77#include "llviewerwindow.h" 77#include "llviewerwindow.h"
78#include "llviewercontrol.h" 78#include "llviewercontrol.h"
79#include "llviewerjoystick.h" 79#include "llviewerjoystick.h"
80#include "llvograss.h"
81#include "llvotree.h"
80#include "lluictrlfactory.h" 82#include "lluictrlfactory.h"
81 83
82// Globals 84// Globals
@@ -276,10 +278,14 @@ BOOL LLFloaterTools::postBuild()
276 { 278 {
277 found->setClickedCallback(setObjectType,toolData[t]); 279 found->setClickedCallback(setObjectType,toolData[t]);
278 mButtons.push_back( found ); 280 mButtons.push_back( found );
279 }else{ 281 }
282 else
283 {
280 llwarns << "Tool button not found! DOA Pending." << llendl; 284 llwarns << "Tool button not found! DOA Pending." << llendl;
281 } 285 }
282 } 286 }
287 mComboTreesGrass = getChild<LLComboBox>("trees_grass");
288 childSetCommitCallback("trees_grass", onSelectTreesGrass, (void*)0);
283 mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); 289 mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection");
284 childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); 290 childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
285 mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky"); 291 mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky");
@@ -381,6 +387,7 @@ LLFloaterTools::LLFloaterTools()
381 mBtnDuplicate(NULL), 387 mBtnDuplicate(NULL),
382 mBtnDuplicateInPlace(NULL), 388 mBtnDuplicateInPlace(NULL),
383 389
390 mComboTreesGrass(NULL),
384 mCheckSticky(NULL), 391 mCheckSticky(NULL),
385 mCheckCopySelection(NULL), 392 mCheckCopySelection(NULL),
386 mCheckCopyCenters(NULL), 393 mCheckCopyCenters(NULL),
@@ -659,6 +666,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
659 666
660 mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); 667 mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() );
661 668
669 updateTreeGrassCombo(create_visible);
670
662 if (mCheckCopySelection 671 if (mCheckCopySelection
663 && mCheckCopySelection->get()) 672 && mCheckCopySelection->get())
664 { 673 {
@@ -1004,6 +1013,7 @@ void LLFloaterTools::setObjectType( void* data )
1004 LLPCode pcode = *(LLPCode*) data; 1013 LLPCode pcode = *(LLPCode*) data;
1005 LLToolPlacer::setObjectType( pcode ); 1014 LLToolPlacer::setObjectType( pcode );
1006 gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); 1015 gSavedSettings.setBOOL("CreateToolCopySelection", FALSE);
1016 gFloaterTools->updateTreeGrassCombo(true);
1007 gFocusMgr.setMouseCapture(NULL); 1017 gFocusMgr.setMouseCapture(NULL);
1008} 1018}
1009 1019
@@ -1026,3 +1036,65 @@ void LLFloaterTools::onFocusReceived()
1026 LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); 1036 LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
1027 LLFloater::onFocusReceived(); 1037 LLFloater::onFocusReceived();
1028} 1038}
1039
1040void LLFloaterTools::updateTreeGrassCombo(bool visible)
1041{
1042 if (visible)
1043 {
1044 LLPCode pcode = LLToolPlacer::getObjectType();
1045 std::map<std::string, S32>::iterator it, end;
1046 std::string selected;
1047 if (pcode == LLToolPlacerPanel::sTree)
1048 {
1049 selected = gSavedSettings.getString("LastTree");
1050 it = LLVOTree::sSpeciesNames.begin();
1051 end = LLVOTree::sSpeciesNames.end();
1052 }
1053 else if (pcode == LLToolPlacerPanel::sGrass)
1054 {
1055 selected = gSavedSettings.getString("LastGrass");
1056 it = LLVOGrass::sSpeciesNames.begin();
1057 end = LLVOGrass::sSpeciesNames.end();
1058 }
1059 else
1060 {
1061 mComboTreesGrass->removeall();
1062 mComboTreesGrass->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label
1063 mComboTreesGrass->setEnabled(false);
1064 return;
1065 }
1066
1067 mComboTreesGrass->removeall();
1068 mComboTreesGrass->add("Random");
1069
1070 int select = 0, i = 0;
1071
1072 while (it != end)
1073 {
1074 const std::string &species = it->first;
1075 mComboTreesGrass->add(species); ++i;
1076 if (species == selected) select = i;
1077 ++it;
1078 }
1079 // if saved species not found, default to "Random"
1080 mComboTreesGrass->selectNthItem(select);
1081 mComboTreesGrass->setEnabled(true);
1082 }
1083
1084 mComboTreesGrass->setVisible(visible);
1085}
1086
1087// static
1088void LLFloaterTools::onSelectTreesGrass(LLUICtrl*, void*)
1089{
1090 const std::string &selected = gFloaterTools->mComboTreesGrass->getValue();
1091 LLPCode pcode = LLToolPlacer::getObjectType();
1092 if (pcode == LLToolPlacerPanel::sTree)
1093 {
1094 gSavedSettings.setString("LastTree", selected);
1095 }
1096 else if (pcode == LLToolPlacerPanel::sGrass)
1097 {
1098 gSavedSettings.setString("LastGrass", selected);
1099 }
1100}