aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatertools.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llfloatertools.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloatertools.cpp122
1 files changed, 32 insertions, 90 deletions
diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp
index 2b1c470..a33b495 100644
--- a/linden/indra/newview/llfloatertools.cpp
+++ b/linden/indra/newview/llfloatertools.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -53,6 +54,7 @@
53#include "llpanelobject.h" 54#include "llpanelobject.h"
54#include "llpanelvolume.h" 55#include "llpanelvolume.h"
55#include "llpanelpermissions.h" 56#include "llpanelpermissions.h"
57#include "llresmgr.h"
56#include "llselectmgr.h" 58#include "llselectmgr.h"
57#include "llslider.h" 59#include "llslider.h"
58#include "llstatusbar.h" 60#include "llstatusbar.h"
@@ -106,9 +108,8 @@ void click_popup_rotate_left(void*);
106void click_popup_rotate_reset(void*); 108void click_popup_rotate_reset(void*);
107void click_popup_rotate_right(void*); 109void click_popup_rotate_right(void*);
108void click_popup_dozer_mode(LLUICtrl *, void *user); 110void click_popup_dozer_mode(LLUICtrl *, void *user);
109void click_popup_dozer_size(LLUICtrl *, void *user); 111void commit_slider_dozer_size(LLUICtrl *, void*);
110void commit_slider_dozer_force(LLUICtrl *, void*); 112void commit_slider_dozer_force(LLUICtrl *, void*);
111void click_dozer_size(LLUICtrl *, void*);
112void click_apply_to_selection(void*); 113void click_apply_to_selection(void*);
113void commit_radio_zoom(LLUICtrl *, void*); 114void commit_radio_zoom(LLUICtrl *, void*);
114void commit_radio_orbit(LLUICtrl *, void*); 115void commit_radio_orbit(LLUICtrl *, void*);
@@ -270,7 +271,7 @@ BOOL LLFloaterTools::postBuild()
270 &LLToolPlacerPanel::sTriangleTorus, 271 &LLToolPlacerPanel::sTriangleTorus,
271 &LLToolPlacerPanel::sTree, 272 &LLToolPlacerPanel::sTree,
272 &LLToolPlacerPanel::sGrass}; 273 &LLToolPlacerPanel::sGrass};
273 for(size_t t=0; t<sizeof(toolNames)/sizeof(toolNames[0]); ++t) 274 for(size_t t=0; t<LL_ARRAY_SIZE(toolNames); ++t)
274 { 275 {
275 LLButton *found = getChild<LLButton>(toolNames[t]); 276 LLButton *found = getChild<LLButton>(toolNames[t]);
276 if(found) 277 if(found)
@@ -303,27 +304,22 @@ BOOL LLFloaterTools::postBuild()
303 childSetCommitCallback("radio noise",click_popup_dozer_mode, (void*)4); 304 childSetCommitCallback("radio noise",click_popup_dozer_mode, (void*)4);
304 mRadioDozerRevert = getChild<LLCheckBoxCtrl>("radio revert"); 305 mRadioDozerRevert = getChild<LLCheckBoxCtrl>("radio revert");
305 childSetCommitCallback("radio revert",click_popup_dozer_mode, (void*)5); 306 childSetCommitCallback("radio revert",click_popup_dozer_mode, (void*)5);
306 mComboDozerSize = getChild<LLComboBox>("combobox brush size");
307 childSetCommitCallback("combobox brush size",click_dozer_size, (void*)0);
308 if(mComboDozerSize) mComboDozerSize->setCurrentByIndex(0);
309 mBtnApplyToSelection = getChild<LLButton>("button apply to selection"); 307 mBtnApplyToSelection = getChild<LLButton>("button apply to selection");
310 childSetAction("button apply to selection",click_apply_to_selection, (void*)0); 308 childSetAction("button apply to selection",click_apply_to_selection, (void*)0);
311 mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners");
312 childSetValue("checkbox show owners",gSavedSettings.getBOOL("ShowParcelOwners"));
313 309
310 mSliderDozerSize = getChild<LLSlider>("slider brush size");
311 childSetCommitCallback("slider brush size", commit_slider_dozer_size, (void*)0);
312 childSetValue( "slider brush size", gSavedSettings.getF32("LandBrushSize"));
313
314 mSliderDozerForce = getChild<LLSlider>("slider force"); 314 mSliderDozerForce = getChild<LLSlider>("slider force");
315 childSetCommitCallback("slider force",commit_slider_dozer_force, (void*)0); 315 childSetCommitCallback("slider force",commit_slider_dozer_force, (void*)0);
316 // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here 316 // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here
317 childSetValue( "slider force", log10(gSavedSettings.getF32("LandBrushForce"))); 317 childSetValue( "slider force", log10(gSavedSettings.getF32("LandBrushForce")));
318 318
319 childSetAction("button more", click_show_more, this);
320 childSetAction("button less", click_show_more, this);
321 mTab = getChild<LLTabContainer>("Object Info Tabs"); 319 mTab = getChild<LLTabContainer>("Object Info Tabs");
322 if(mTab) 320 if(mTab)
323 { 321 {
324 mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") );
325 mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); 322 mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
326 mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") );
327 mTab->setBorderVisible(FALSE); 323 mTab->setBorderVisible(FALSE);
328 mTab->selectFirstTab(); 324 mTab->selectFirstTab();
329 } 325 }
@@ -391,10 +387,9 @@ LLFloaterTools::LLFloaterTools()
391 mRadioDozerSmooth(NULL), 387 mRadioDozerSmooth(NULL),
392 mRadioDozerNoise(NULL), 388 mRadioDozerNoise(NULL),
393 mRadioDozerRevert(NULL), 389 mRadioDozerRevert(NULL),
394 mComboDozerSize(NULL), 390 mSliderDozerSize(NULL),
391 mSliderDozerForce(NULL),
395 mBtnApplyToSelection(NULL), 392 mBtnApplyToSelection(NULL),
396 mCheckShowOwners(NULL),
397
398 393
399 mTab(NULL), 394 mTab(NULL),
400 mPanelPermissions(NULL), 395 mPanelPermissions(NULL),
@@ -418,19 +413,6 @@ LLFloaterTools::LLFloaterTools()
418 factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo 413 factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo
419 414
420 LLUICtrlFactory::getInstance()->buildFloater(this,"floater_tools.xml",&factory_map,FALSE); 415 LLUICtrlFactory::getInstance()->buildFloater(this,"floater_tools.xml",&factory_map,FALSE);
421
422 mLargeHeight = getRect().getHeight();
423 mSmallHeight = mLargeHeight;
424 if (mTab) mSmallHeight -= mTab->getRect().getHeight();
425
426 // force a toggle initially. seems to be needed to correctly initialize
427 // both "more" and "less" cases. it also seems to be important to begin
428 // with the user's preference first so that it's initial position will
429 // be correct (SL-51192) -MG
430 BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore"); // get user's preference
431 gSavedSettings.setBOOL("ToolboxShowMore", show_more); // sets up forced toggle below
432 showMore( !show_more ); // does the toggle
433 showMore( show_more ); // reset the real user's preference
434} 416}
435 417
436LLFloaterTools::~LLFloaterTools() 418LLFloaterTools::~LLFloaterTools()
@@ -474,6 +456,16 @@ void LLFloaterTools::refresh()
474 mTab->enableTabButton(idx_face, all_volume); 456 mTab->enableTabButton(idx_face, all_volume);
475 mTab->enableTabButton(idx_contents, all_volume); 457 mTab->enableTabButton(idx_contents, all_volume);
476 458
459 // Refresh object and prim count labels
460 LLLocale locale(LLLocale::USER_LOCALE);
461 std::string obj_count_string;
462 LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
463 childSetTextArg("obj_count", "[COUNT]", obj_count_string);
464 std::string prim_count_string;
465 LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount());
466 childSetTextArg("prim_count", "[COUNT]", prim_count_string);
467
468 // Refresh child tabs
477 mPanelPermissions->refresh(); 469 mPanelPermissions->refresh();
478 mPanelObject->refresh(); 470 mPanelObject->refresh();
479 mPanelVolume->refresh(); 471 mPanelVolume->refresh();
@@ -702,7 +694,6 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
702 if (mRadioSelectLand) mRadioSelectLand->setVisible( land_visible ); 694 if (mRadioSelectLand) mRadioSelectLand->setVisible( land_visible );
703 695
704 S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction"); 696 S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction");
705 S32 dozer_size = gSavedSettings.getS32("RadioLandBrushSize");
706 697
707 if (mRadioDozerFlatten) 698 if (mRadioDozerFlatten)
708 { 699 {
@@ -734,20 +725,16 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
734 mRadioDozerRevert ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 5); 725 mRadioDozerRevert ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 5);
735 mRadioDozerRevert ->setVisible( land_visible ); 726 mRadioDozerRevert ->setVisible( land_visible );
736 } 727 }
737 if (mComboDozerSize)
738 {
739 mComboDozerSize ->setCurrentByIndex(dozer_size);
740 mComboDozerSize ->setVisible( land_visible );
741 mComboDozerSize ->setEnabled( tool == LLToolBrushLand::getInstance() );
742 }
743 if (mBtnApplyToSelection) 728 if (mBtnApplyToSelection)
744 { 729 {
745 mBtnApplyToSelection->setVisible( land_visible ); 730 mBtnApplyToSelection->setVisible( land_visible );
746 mBtnApplyToSelection->setEnabled( land_visible && !LLViewerParcelMgr::getInstance()->selectionEmpty() && tool != LLToolSelectLand::getInstance()); 731 mBtnApplyToSelection->setEnabled( land_visible && !LLViewerParcelMgr::getInstance()->selectionEmpty() && tool != LLToolSelectLand::getInstance());
747 } 732 }
748 if (mCheckShowOwners) 733 if (mSliderDozerSize)
749 { 734 {
750 mCheckShowOwners ->setVisible( land_visible ); 735 mSliderDozerSize ->setVisible( land_visible );
736 childSetVisible("Bulldozer:", land_visible);
737 childSetVisible("Dozer Size:", land_visible);
751 } 738 }
752 if (mSliderDozerForce) 739 if (mSliderDozerForce)
753 { 740 {
@@ -755,13 +742,10 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
755 childSetVisible("Strength:", land_visible); 742 childSetVisible("Strength:", land_visible);
756 } 743 }
757 744
758 // 745 childSetVisible("obj_count", !land_visible);
759 // More panel visibility 746 childSetVisible("prim_count", !land_visible);
760 // 747 mTab->setVisible(!land_visible);
761 BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore"); 748 mPanelLandInfo->setVisible(land_visible);
762
763 mTab->setVisible(show_more && tool != LLToolBrushLand::getInstance() && tool != LLToolSelectLand::getInstance());
764 mPanelLandInfo->setVisible(show_more && (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance()));
765} 749}
766 750
767 751
@@ -816,46 +800,12 @@ void LLFloaterTools::onClose(bool app_quitting)
816 // gMenuBarView->arrange(); 800 // gMenuBarView->arrange();
817} 801}
818 802
819void LLFloaterTools::showMore(BOOL show_more)
820{
821 BOOL showing_more = gSavedSettings.getBOOL("ToolboxShowMore");
822 if (show_more == showing_more)
823 {
824 return;
825 }
826
827 gSavedSettings.setBOOL("ToolboxShowMore", show_more);
828
829 // Visibility updated next frame - JC
830 // mTab->setVisible(show_more);
831
832 if (show_more)
833 {
834 reshape( getRect().getWidth(), mLargeHeight, TRUE);
835 translate( 0, mSmallHeight - mLargeHeight );
836 }
837 else
838 {
839 reshape( getRect().getWidth(), mSmallHeight, TRUE);
840 translate( 0, mLargeHeight - mSmallHeight );
841 }
842 childSetVisible("button less", show_more);
843 childSetVisible("button more", !show_more);
844}
845
846void LLFloaterTools::showPanel(EInfoPanel panel) 803void LLFloaterTools::showPanel(EInfoPanel panel)
847{ 804{
848 llassert(panel >= 0 && panel < PANEL_COUNT); 805 llassert(panel >= 0 && panel < PANEL_COUNT);
849 mTab->selectTabByName(PANEL_NAMES[panel]); 806 mTab->selectTabByName(PANEL_NAMES[panel]);
850} 807}
851 808
852void click_show_more(void *userdata)
853{
854 LLFloaterTools *f = (LLFloaterTools *)userdata;
855 BOOL show_more = !gSavedSettings.getBOOL("ToolboxShowMore");
856 f->showMore( show_more );
857}
858
859void click_popup_info(void*) 809void click_popup_info(void*)
860{ 810{
861// gBuildView->setPropertiesPanelOpen(TRUE); 811// gBuildView->setPropertiesPanelOpen(TRUE);
@@ -933,23 +883,15 @@ void click_popup_rotate_right(void*)
933 883
934void click_popup_dozer_mode(LLUICtrl *, void *user) 884void click_popup_dozer_mode(LLUICtrl *, void *user)
935{ 885{
936 S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners");
937 S32 mode = (S32)(intptr_t) user; 886 S32 mode = (S32)(intptr_t) user;
938 gFloaterTools->setEditTool( LLToolBrushLand::getInstance() ); 887 gFloaterTools->setEditTool( LLToolBrushLand::getInstance() );
939 gSavedSettings.setS32("RadioLandBrushAction", mode); 888 gSavedSettings.setS32("RadioLandBrushAction", mode);
940 gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
941}
942
943void click_popup_dozer_size(LLUICtrl *, void *user)
944{
945 S32 size = (S32)(intptr_t) user;
946 gSavedSettings.setS32("RadioLandBrushSize", size);
947} 889}
948 890
949void click_dozer_size(LLUICtrl *ctrl, void *user) 891void commit_slider_dozer_size(LLUICtrl *ctrl, void*)
950{ 892{
951 S32 size = ((LLComboBox*) ctrl)->getCurrentIndex(); 893 F32 size = (F32)ctrl->getValue().asReal();
952 gSavedSettings.setS32("RadioLandBrushSize", size); 894 gSavedSettings.setF32("LandBrushSize", size);
953} 895}
954 896
955void commit_slider_dozer_force(LLUICtrl *ctrl, void*) 897void commit_slider_dozer_force(LLUICtrl *ctrl, void*)