diff options
Diffstat (limited to 'indra/newview/llfloatertools.cpp')
-rw-r--r-- | indra/newview/llfloatertools.cpp | 185 |
1 files changed, 95 insertions, 90 deletions
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index ccecdd89f0..5fe089aec5 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -217,10 +217,10 @@ LLPCode toolData[]={ LL_PCODE_LEGACY_TREE, LL_PCODE_LEGACY_GRASS}; -BOOL LLFloaterTools::postBuild() +bool LLFloaterTools::postBuild() { // Hide until tool selected - setVisible(FALSE); + setVisible(false); // Since we constantly show and hide this during drags, don't // make sounds on visibility changes. @@ -243,13 +243,13 @@ BOOL LLFloaterTools::postBuild() mBtnUnlink = getChild<LLButton>("unlink_btn"); mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts"); - getChild<LLUICtrl>("checkbox edit linked parts")->setValue((BOOL)gSavedSettings.getBOOL("EditLinkedParts")); + getChild<LLUICtrl>("checkbox edit linked parts")->setValue((bool)gSavedSettings.getBOOL("EditLinkedParts")); mCheckSnapToGrid = getChild<LLCheckBoxCtrl>("checkbox snap to grid"); - getChild<LLUICtrl>("checkbox snap to grid")->setValue((BOOL)gSavedSettings.getBOOL("SnapEnabled")); + getChild<LLUICtrl>("checkbox snap to grid")->setValue((bool)gSavedSettings.getBOOL("SnapEnabled")); mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform"); - getChild<LLUICtrl>("checkbox uniform")->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform")); + getChild<LLUICtrl>("checkbox uniform")->setValue((bool)gSavedSettings.getBOOL("ScaleUniform")); mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures"); - getChild<LLUICtrl>("checkbox stretch textures")->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures")); + getChild<LLUICtrl>("checkbox stretch textures")->setValue((bool)gSavedSettings.getBOOL("ScaleStretchTextures")); mComboGridMode = getChild<LLComboBox>("combobox grid mode"); // @@ -268,13 +268,13 @@ BOOL LLFloaterTools::postBuild() } } mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); - getChild<LLUICtrl>("checkbox copy selection")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); + getChild<LLUICtrl>("checkbox copy selection")->setValue((bool)gSavedSettings.getBOOL("CreateToolCopySelection")); mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky"); - getChild<LLUICtrl>("checkbox sticky")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected")); + getChild<LLUICtrl>("checkbox sticky")->setValue((bool)gSavedSettings.getBOOL("CreateToolKeepSelected")); mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers"); - getChild<LLUICtrl>("checkbox copy centers")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters")); + getChild<LLUICtrl>("checkbox copy centers")->setValue((bool)gSavedSettings.getBOOL("CreateToolCopyCenters")); mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates"); - getChild<LLUICtrl>("checkbox copy rotates")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates")); + getChild<LLUICtrl>("checkbox copy rotates")->setValue((bool)gSavedSettings.getBOOL("CreateToolCopyRotates")); mRadioGroupLand = getChild<LLRadioGroup>("land_radio_group"); mBtnApplyToSelection = getChild<LLButton>("button apply to selection"); @@ -284,13 +284,22 @@ BOOL LLFloaterTools::postBuild() // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here getChild<LLUICtrl>("slider force")->setValue(log10(gSavedSettings.getF32("LandBrushForce"))); + mTextBulldozer = getChild<LLTextBox>("Bulldozer:"); + mTextDozerSize = getChild<LLTextBox>("Dozer Size:"); + mTextDozerStrength = getChild<LLTextBox>("Strength:"); + mSliderZoom = getChild<LLSlider>("slider zoom"); + + mTextSelectionCount = getChild<LLTextBox>("selection_count"); + mTextSelectionEmpty = getChild<LLTextBox>("selection_empty"); + mTextSelectionFaces = getChild<LLTextBox>("selection_faces"); + mCostTextBorder = getChild<LLViewBorder>("cost_text_border"); mTab = getChild<LLTabContainer>("Object Info Tabs"); if(mTab) { mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - mTab->setBorderVisible(FALSE); + mTab->setBorderVisible(false); mTab->selectFirstTab(); } @@ -305,7 +314,7 @@ BOOL LLFloaterTools::postBuild() sShowObjectCost = gSavedSettings.getBOOL("ShowObjectRenderingCost"); - return TRUE; + return true; } // Create the popupview with a dummy center. It will be moved into place @@ -365,12 +374,12 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mLandImpactsObserver(NULL), - mDirty(TRUE), - mHasSelection(TRUE) + mDirty(true), + mHasSelection(true) { gFloaterTools = this; - setAutoFocus(FALSE); + setAutoFocus(false); mFactoryMap["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions mFactoryMap["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject mFactoryMap["Features"] = LLCallbackMap(createPanelVolume, this);//LLPanelVolume @@ -378,21 +387,21 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mFactoryMap["Contents"] = LLCallbackMap(createPanelContents, this);//LLPanelContents mFactoryMap["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo - mCommitCallbackRegistrar.add("BuildTool.setTool", boost::bind(&LLFloaterTools::setTool,this, _2)); - mCommitCallbackRegistrar.add("BuildTool.commitZoom", boost::bind(&commit_slider_zoom, _1)); - mCommitCallbackRegistrar.add("BuildTool.commitRadioFocus", boost::bind(&commit_radio_group_focus, _1)); - mCommitCallbackRegistrar.add("BuildTool.commitRadioMove", boost::bind(&commit_radio_group_move,_1)); - mCommitCallbackRegistrar.add("BuildTool.commitRadioEdit", boost::bind(&commit_radio_group_edit,_1)); + mCommitCallbackRegistrar.add("BuildTool.setTool", { boost::bind(&LLFloaterTools::setTool,this, _2) }); + mCommitCallbackRegistrar.add("BuildTool.commitZoom", { boost::bind(&commit_slider_zoom, _1), cb_info::UNTRUSTED_BLOCK }); + mCommitCallbackRegistrar.add("BuildTool.commitRadioFocus", { boost::bind(&commit_radio_group_focus, _1), cb_info::UNTRUSTED_BLOCK }); + mCommitCallbackRegistrar.add("BuildTool.commitRadioMove", { boost::bind(&commit_radio_group_move,_1), cb_info::UNTRUSTED_BLOCK }); + mCommitCallbackRegistrar.add("BuildTool.commitRadioEdit", { boost::bind(&commit_radio_group_edit,_1), cb_info::UNTRUSTED_BLOCK }); - mCommitCallbackRegistrar.add("BuildTool.gridMode", boost::bind(&commit_grid_mode,_1)); - mCommitCallbackRegistrar.add("BuildTool.selectComponent", boost::bind(&commit_select_component, this)); - mCommitCallbackRegistrar.add("BuildTool.gridOptions", boost::bind(&LLFloaterTools::onClickGridOptions,this)); - mCommitCallbackRegistrar.add("BuildTool.applyToSelection", boost::bind(&click_apply_to_selection, this)); - mCommitCallbackRegistrar.add("BuildTool.commitRadioLand", boost::bind(&commit_radio_group_land,_1)); - mCommitCallbackRegistrar.add("BuildTool.LandBrushForce", boost::bind(&commit_slider_dozer_force,_1)); + mCommitCallbackRegistrar.add("BuildTool.gridMode", { boost::bind(&commit_grid_mode,_1), cb_info::UNTRUSTED_BLOCK }); + mCommitCallbackRegistrar.add("BuildTool.selectComponent", { boost::bind(&commit_select_component, this), cb_info::UNTRUSTED_BLOCK }); + mCommitCallbackRegistrar.add("BuildTool.gridOptions", { boost::bind(&LLFloaterTools::onClickGridOptions,this) }); + mCommitCallbackRegistrar.add("BuildTool.applyToSelection", { boost::bind(&click_apply_to_selection, this), cb_info::UNTRUSTED_BLOCK }); + mCommitCallbackRegistrar.add("BuildTool.commitRadioLand", { boost::bind(&commit_radio_group_land,_1), cb_info::UNTRUSTED_BLOCK }); + mCommitCallbackRegistrar.add("BuildTool.LandBrushForce", { boost::bind(&commit_slider_dozer_force,_1), cb_info::UNTRUSTED_BLOCK }); - mCommitCallbackRegistrar.add("BuildTool.LinkObjects", boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance())); - mCommitCallbackRegistrar.add("BuildTool.UnlinkObjects", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance())); + mCommitCallbackRegistrar.add("BuildTool.LinkObjects", { boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance()) }); + mCommitCallbackRegistrar.add("BuildTool.UnlinkObjects", { boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()) }); mLandImpactsObserver = new LLLandImpactsObserver(); LLViewerParcelMgr::getInstance()->addObserver(mLandImpactsObserver); @@ -425,7 +434,7 @@ void LLFloaterTools::refresh() const S32 INFO_WIDTH = getRect().getWidth(); const S32 INFO_HEIGHT = 384; LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT); - BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + bool all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]); S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]); @@ -450,10 +459,10 @@ void LLFloaterTools::refresh() { std::string obj_count_string; LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string); + mTextSelectionCount->setTextArg("[OBJ_COUNT]", obj_count_string); std::string prim_count_string; LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string); + mTextSelectionCount->setTextArg("[PRIM_COUNT]", prim_count_string); // calculate selection rendering cost if (sShowObjectCost) @@ -521,23 +530,18 @@ void LLFloaterTools::refresh() } } } - - childSetTextArg("selection_faces", "[FACES_STRING]", faces_str); + mTextSelectionFaces->setTextArg("[FACES_STRING]", faces_str); } bool show_faces = (object_count == 1) && LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool(); - getChildView("selection_faces")->setVisible(show_faces); + mTextSelectionFaces->setVisible(show_faces); LLStringUtil::format_map_t selection_args; selection_args["OBJ_COUNT"] = llformat("%.1d", link_count); selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost); - std::ostringstream selection_info; - - selection_info << getString("status_selectcount", selection_args); - - getChild<LLTextBox>("selection_count")->setText(selection_info.str()); + mTextSelectionCount->setText(getString("status_selectcount", selection_args)); } @@ -560,17 +564,17 @@ void LLFloaterTools::refresh() void LLFloaterTools::draw() { - BOOL has_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); + bool has_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); if(!has_selection && (mHasSelection != has_selection)) { - mDirty = TRUE; + mDirty = true; } mHasSelection = has_selection; if (mDirty) { refresh(); - mDirty = FALSE; + mDirty = false; } // mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); @@ -579,7 +583,7 @@ void LLFloaterTools::draw() void LLFloaterTools::dirty() { - mDirty = TRUE; + mDirty = true; LLFloaterOpenObject* instance = LLFloaterReg::findTypedInstance<LLFloaterOpenObject>("openobject"); if (instance) instance->dirty(); } @@ -588,12 +592,12 @@ void LLFloaterTools::dirty() // floater is closed. void LLFloaterTools::resetToolState() { - gCameraBtnZoom = TRUE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = FALSE; + gCameraBtnZoom = true; + gCameraBtnOrbit = false; + gCameraBtnPan = false; - gGrabBtnSpin = FALSE; - gGrabBtnVertical = FALSE; + gGrabBtnSpin = false; + gGrabBtnVertical = false; } void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) @@ -613,13 +617,14 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // Focus buttons - BOOL focus_visible = ( tool == LLToolCamera::getInstance() ); + bool focus_visible = ( tool == LLToolCamera::getInstance() ); mBtnFocus ->setToggleState( focus_visible ); mRadioGroupFocus->setVisible( focus_visible ); - getChildView("slider zoom")->setVisible( focus_visible); - getChildView("slider zoom")->setEnabled(gCameraBtnZoom); + + mSliderZoom->setVisible( focus_visible); + mSliderZoom->setEnabled(gCameraBtnZoom); if (!gCameraBtnOrbit && !gCameraBtnPan && @@ -644,10 +649,10 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // multiply by correction factor because volume sliders go [0, 0.5] - getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); + mSliderZoom->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); // Move buttons - BOOL move_visible = (tool == LLToolGrab::getInstance()); + bool move_visible = (tool == LLToolGrab::getInstance()); if (mBtnMove) mBtnMove ->setToggleState( move_visible ); @@ -672,7 +677,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // Edit buttons - BOOL edit_visible = tool == LLToolCompTranslate::getInstance() || + bool edit_visible = tool == LLToolCompTranslate::getInstance() || tool == LLToolCompRotate::getInstance() || tool == LLToolCompScale::getInstance() || tool == LLToolFace::getInstance() || @@ -750,7 +755,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mCheckStretchUniformLabel) mCheckStretchUniformLabel->setVisible( edit_visible ); // Create buttons - BOOL create_visible = (tool == LLToolCompCreate::getInstance()); + bool create_visible = (tool == LLToolCompCreate::getInstance()); mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); @@ -760,7 +765,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) // don't highlight any placer button for (std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++) { - mButtons[i]->setToggleState(FALSE); + mButtons[i]->setToggleState(false); mButtons[i]->setVisible( create_visible ); } } @@ -771,7 +776,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) { LLPCode pcode = LLToolPlacer::getObjectType(); LLPCode button_pcode = toolData[t]; - BOOL state = (pcode == button_pcode); + bool state = (pcode == button_pcode); mButtons[t]->setToggleState( state ); mButtons[t]->setVisible( create_visible ); } @@ -786,7 +791,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mCheckCopyRotates && mCheckCopySelection) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() ); // Land buttons - BOOL land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() ); + bool land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() ); mCostTextBorder->setVisible(!land_visible); @@ -832,22 +837,22 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } if (mSliderDozerSize) { - mSliderDozerSize ->setVisible( land_visible ); - getChildView("Bulldozer:")->setVisible( land_visible); - getChildView("Dozer Size:")->setVisible( land_visible); + mSliderDozerSize->setVisible( land_visible ); + mTextBulldozer->setVisible( land_visible); + mTextDozerSize->setVisible( land_visible); } if (mSliderDozerForce) { - mSliderDozerForce ->setVisible( land_visible ); - getChildView("Strength:")->setVisible( land_visible); + mSliderDozerForce->setVisible( land_visible ); + mTextDozerStrength->setVisible( land_visible); } bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); - getChildView("selection_count")->setVisible(!land_visible && have_selection); - getChildView("selection_faces")->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() + mTextSelectionCount->setVisible(!land_visible && have_selection); + mTextSelectionFaces->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1); - getChildView("selection_empty")->setVisible(!land_visible && !have_selection); + mTextSelectionEmpty->setVisible(!land_visible && !have_selection); mTab->setVisible(!land_visible); mPanelLandInfo->setVisible(land_visible); @@ -855,7 +860,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) // virtual -BOOL LLFloaterTools::canClose() +bool LLFloaterTools::canClose() { // don't close when quitting, so camera will stay put return !LLApp::isExiting(); @@ -881,17 +886,17 @@ void LLFloaterTools::onOpen(const LLSD& key) // so it won't be getting any layout or visibility updates, update once // further updates will come from updateLayout() LLCoordGL select_center_screen; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); updatePopup(select_center_screen, mask); } - //gMenuBarView->setItemVisible("BuildTools", TRUE); + //gMenuBarView->setItemVisible("BuildTools", true); } // virtual void LLFloaterTools::onClose(bool app_quitting) { - mTab->setVisible(FALSE); + mTab->setVisible(false); LLViewerJoystick::getInstance()->moveAvatar(false); @@ -904,7 +909,7 @@ void LLFloaterTools::onClose(bool app_quitting) // exit component selection mode LLSelectMgr::getInstance()->promoteSelectionToRoot(); - gSavedSettings.setBOOL("EditLinkedParts", FALSE); + gSavedSettings.setBOOL("EditLinkedParts", false); gViewerWindow->showCursor(); @@ -919,7 +924,7 @@ void LLFloaterTools::onClose(bool app_quitting) // so manually reset tool to default (pie menu tool) LLToolMgr::getInstance()->getCurrentToolset()->selectFirstTool(); - //gMenuBarView->setItemVisible("BuildTools", FALSE); + //gMenuBarView->setItemVisible("BuildTools", false); LLFloaterReg::hideInstance("media_settings"); // hide the advanced object weights floater @@ -934,7 +939,7 @@ void LLFloaterTools::onClose(bool app_quitting) if(sPreviousFocusOnAvatar) { sPreviousFocusOnAvatar = false; - gAgentCamera.setAllowChangeToFollow(TRUE); + gAgentCamera.setAllowChangeToFollow(true); } } @@ -953,18 +958,18 @@ void commit_radio_group_move(LLUICtrl* ctrl) std::string selected = group->getValue().asString(); if (selected == "radio move") { - gGrabBtnVertical = FALSE; - gGrabBtnSpin = FALSE; + gGrabBtnVertical = false; + gGrabBtnSpin = false; } else if (selected == "radio lift") { - gGrabBtnVertical = TRUE; - gGrabBtnSpin = FALSE; + gGrabBtnVertical = true; + gGrabBtnSpin = false; } else if (selected == "radio spin") { - gGrabBtnVertical = FALSE; - gGrabBtnSpin = TRUE; + gGrabBtnVertical = false; + gGrabBtnSpin = true; } } @@ -974,21 +979,21 @@ void commit_radio_group_focus(LLUICtrl* ctrl) std::string selected = group->getValue().asString(); if (selected == "radio zoom") { - gCameraBtnZoom = TRUE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = FALSE; + gCameraBtnZoom = true; + gCameraBtnOrbit = false; + gCameraBtnPan = false; } else if (selected == "radio orbit") { - gCameraBtnZoom = FALSE; - gCameraBtnOrbit = TRUE; - gCameraBtnPan = FALSE; + gCameraBtnZoom = false; + gCameraBtnOrbit = true; + gCameraBtnPan = false; } else if (selected == "radio pan") { - gCameraBtnZoom = FALSE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = TRUE; + gCameraBtnZoom = false; + gCameraBtnOrbit = false; + gCameraBtnPan = true; } } @@ -1074,7 +1079,7 @@ void commit_select_component(void *data) gFocusMgr.setKeyboardFocus(NULL); } - BOOL select_individuals = floaterp->mCheckSelectIndividual->get(); + bool select_individuals = floaterp->mCheckSelectIndividual->get(); gSavedSettings.setBOOL("EditLinkedParts", select_individuals); floaterp->dirty(); @@ -1092,7 +1097,7 @@ void commit_select_component(void *data) void LLFloaterTools::setObjectType( LLPCode pcode ) { LLToolPlacer::setObjectType( pcode ); - gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); + gSavedSettings.setBOOL("CreateToolCopySelection", false); gFocusMgr.setMouseCapture(NULL); } |