00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034 #include "llfloatertools.h"
00035
00036 #include "llfontgl.h"
00037 #include "llcoord.h"
00038 #include "llgl.h"
00039
00040 #include "llagent.h"
00041 #include "llbutton.h"
00042 #include "llcheckboxctrl.h"
00043 #include "llcombobox.h"
00044 #include "lldraghandle.h"
00045 #include "llfloaterbuildoptions.h"
00046 #include "llfloateropenobject.h"
00047 #include "llfocusmgr.h"
00048 #include "llmenugl.h"
00049 #include "llpanelcontents.h"
00050 #include "llpanelface.h"
00051 #include "llpanelland.h"
00052 #include "llpanelinventory.h"
00053 #include "llpanelobject.h"
00054 #include "llpanelvolume.h"
00055 #include "llpanelpermissions.h"
00056 #include "llselectmgr.h"
00057 #include "llstatusbar.h"
00058 #include "lltabcontainer.h"
00059 #include "lltextbox.h"
00060 #include "lltoolbrush.h"
00061 #include "lltoolcomp.h"
00062 #include "lltooldraganddrop.h"
00063 #include "lltoolface.h"
00064 #include "lltoolfocus.h"
00065 #include "lltoolgrab.h"
00066 #include "lltoolgrab.h"
00067 #include "lltoolindividual.h"
00068 #include "lltoolmgr.h"
00069 #include "lltoolpie.h"
00070 #include "lltoolpipette.h"
00071 #include "lltoolplacer.h"
00072 #include "lltoolselect.h"
00073 #include "lltoolselectland.h"
00074 #include "llui.h"
00075 #include "llviewermenu.h"
00076 #include "llviewerparcelmgr.h"
00077 #include "llviewerwindow.h"
00078 #include "llviewercontrol.h"
00079 #include "viewer.h"
00080
00081 #include "llvieweruictrlfactory.h"
00082
00083
00084 LLFloaterTools *gFloaterTools = NULL;
00085
00086
00087 const LLString PANEL_NAMES[LLFloaterTools::PANEL_COUNT] =
00088 {
00089 LLString("General"),
00090 LLString("Object"),
00091 LLString("Features"),
00092 LLString("Texture"),
00093 LLString("Content"),
00094 };
00095
00096
00097 void commit_select_tool(LLUICtrl *ctrl, void *data);
00098 void commit_select_component(LLUICtrl *ctrl, void *data);
00099 void click_show_more(void*);
00100 void click_popup_info(void*);
00101 void click_popup_done(void*);
00102 void click_popup_minimize(void*);
00103 void click_popup_grab_drag(LLUICtrl *, void*);
00104 void click_popup_grab_lift(LLUICtrl *, void*);
00105 void click_popup_grab_spin(LLUICtrl *, void*);
00106 void click_popup_rotate_left(void*);
00107 void click_popup_rotate_reset(void*);
00108 void click_popup_rotate_right(void*);
00109 void click_popup_dozer_mode(LLUICtrl *, void *user);
00110 void click_popup_dozer_size(LLUICtrl *, void *user);
00111 void click_dozer_size(LLUICtrl *, void*);
00112 void click_apply_to_selection(void*);
00113 void commit_radio_zoom(LLUICtrl *, void*);
00114 void commit_radio_orbit(LLUICtrl *, void*);
00115 void commit_radio_pan(LLUICtrl *, void*);
00116 void commit_grid_mode(LLUICtrl *, void*);
00117 void commit_slider_zoom(LLUICtrl *, void*);
00118
00119
00120
00121 void* LLFloaterTools::createPanelPermissions(void* data)
00122 {
00123 LLFloaterTools* floater = (LLFloaterTools*)data;
00124 floater->mPanelPermissions = new LLPanelPermissions("General");
00125 return floater->mPanelPermissions;
00126 }
00127
00128 void* LLFloaterTools::createPanelObject(void* data)
00129 {
00130 LLFloaterTools* floater = (LLFloaterTools*)data;
00131 floater->mPanelObject = new LLPanelObject("Object");
00132 return floater->mPanelObject;
00133 }
00134
00135
00136 void* LLFloaterTools::createPanelVolume(void* data)
00137 {
00138 LLFloaterTools* floater = (LLFloaterTools*)data;
00139 floater->mPanelVolume = new LLPanelVolume("Features");
00140 return floater->mPanelVolume;
00141 }
00142
00143
00144 void* LLFloaterTools::createPanelFace(void* data)
00145 {
00146 LLFloaterTools* floater = (LLFloaterTools*)data;
00147 floater->mPanelFace = new LLPanelFace("Texture");
00148 return floater->mPanelFace;
00149 }
00150
00151
00152 void* LLFloaterTools::createPanelContents(void* data)
00153 {
00154 LLFloaterTools* floater = (LLFloaterTools*)data;
00155 floater->mPanelContents = new LLPanelContents("Contents");
00156 return floater->mPanelContents;
00157 }
00158
00159
00160 void* LLFloaterTools::createPanelContentsInventory(void* data)
00161 {
00162 LLFloaterTools* floater = (LLFloaterTools*)data;
00163 floater->mPanelContents->mPanelInventory = new LLPanelInventory("ContentsInventory", LLRect());
00164 return floater->mPanelContents->mPanelInventory;
00165 }
00166
00167
00168 void* LLFloaterTools::createPanelLandInfo(void* data)
00169 {
00170 LLFloaterTools* floater = (LLFloaterTools*)data;
00171 floater->mPanelLandInfo = new LLPanelLandInfo("land info panel");
00172 return floater->mPanelLandInfo;
00173 }
00174
00175 BOOL LLFloaterTools::postBuild()
00176 {
00177
00178
00179 setVisible(FALSE);
00180
00181
00182
00183 setSoundFlags(LLView::SILENT);
00184
00185 mDragHandle->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") );
00186
00187 LLRect rect;
00188 mBtnFocus = LLUICtrlFactory::getButtonByName(this,"button focus");
00189 childSetAction("button focus",LLFloaterTools::setEditTool, (void*)gToolCamera);
00190 mBtnMove = LLUICtrlFactory::getButtonByName(this,"button move");
00191 childSetAction("button move",LLFloaterTools::setEditTool, (void*)gToolGrab);
00192 mBtnEdit = LLUICtrlFactory::getButtonByName(this,"button edit");
00193 childSetAction("button edit",LLFloaterTools::setEditTool, (void*)gToolTranslate);
00194 mBtnCreate = LLUICtrlFactory::getButtonByName(this,"button create");
00195 childSetAction("button create",LLFloaterTools::setEditTool, (void*)gToolCreate);
00196 mBtnLand = LLUICtrlFactory::getButtonByName(this, "button land" );
00197 childSetAction("button land",LLFloaterTools::setEditTool, (void*)gToolParcel);
00198 mTextStatus = LLUICtrlFactory::getTextBoxByName(this,"text status");
00199 mRadioZoom = LLUICtrlFactory::getCheckBoxByName(this,"radio zoom");
00200 childSetCommitCallback("slider zoom",commit_slider_zoom,this);
00201 mRadioOrbit = LLUICtrlFactory::getCheckBoxByName(this,"radio orbit");
00202 childSetCommitCallback("radio orbit",commit_radio_orbit,this);
00203 mRadioPan = LLUICtrlFactory::getCheckBoxByName(this,"radio pan");
00204 childSetCommitCallback("radio pan",commit_radio_pan,this);
00205 mRadioMove = LLUICtrlFactory::getCheckBoxByName(this,"radio move");
00206 childSetCommitCallback("radio move",click_popup_grab_drag,this);
00207 mRadioLift = LLUICtrlFactory::getCheckBoxByName(this,"radio lift");
00208 childSetCommitCallback("radio lift",click_popup_grab_lift,this);
00209 mRadioSpin = LLUICtrlFactory::getCheckBoxByName(this,"radio spin");
00210 childSetCommitCallback("radio spin",click_popup_grab_spin,NULL);
00211 mRadioPosition = LLUICtrlFactory::getCheckBoxByName(this,"radio position");
00212 childSetCommitCallback("radio position",commit_select_tool,gToolTranslate);
00213 mRadioRotate = LLUICtrlFactory::getCheckBoxByName(this,"radio rotate");
00214 childSetCommitCallback("radio rotate",commit_select_tool,gToolRotate);
00215 mRadioStretch = LLUICtrlFactory::getCheckBoxByName(this,"radio stretch");
00216 childSetCommitCallback("radio stretch",commit_select_tool,gToolStretch);
00217 mRadioSelectFace = LLUICtrlFactory::getCheckBoxByName(this,"radio select face");
00218 childSetCommitCallback("radio select face",commit_select_tool,gToolFace);
00219 mCheckSelectIndividual = LLUICtrlFactory::getCheckBoxByName(this,"checkbox edit linked parts");
00220 childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts"));
00221 childSetCommitCallback("checkbox edit linked parts",commit_select_component,this);
00222 mCheckSnapToGrid = LLUICtrlFactory::getCheckBoxByName(this,"checkbox snap to grid");
00223 childSetValue("checkbox snap to grid",(BOOL)gSavedSettings.getBOOL("SnapEnabled"));
00224 mBtnGridOptions = LLUICtrlFactory::getButtonByName(this,"Options...");
00225 childSetAction("Options...",onClickGridOptions, this);
00226 mCheckStretchUniform = LLUICtrlFactory::getCheckBoxByName(this,"checkbox uniform");
00227 childSetValue("checkbox uniform",(BOOL)gSavedSettings.getBOOL("ScaleUniform"));
00228 mCheckStretchTexture = LLUICtrlFactory::getCheckBoxByName(this,"checkbox stretch textures");
00229 childSetValue("checkbox stretch textures",(BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
00230 mTextGridMode = LLUICtrlFactory::getTextBoxByName(this,"text ruler mode");
00231 mComboGridMode = LLUICtrlFactory::getComboBoxByName(this,"combobox grid mode");
00232 childSetCommitCallback("combobox grid mode",commit_grid_mode, this);
00233
00234
00235
00236
00237 static const LLString toolNames[]={
00238 "ToolCube",
00239 "ToolPrism",
00240 "ToolPyramid",
00241 "ToolTetrahedron",
00242 "ToolCylinder",
00243 "ToolHemiCylinder",
00244 "ToolCone",
00245 "ToolHemiCone",
00246 "ToolSphere",
00247 "ToolHemiSphere",
00248 "ToolTorus",
00249 "ToolTube",
00250 "ToolRing",
00251 "ToolTree",
00252 "ToolGrass"};
00253 void* toolData[]={
00254 &LLToolPlacerPanel::sCube,
00255 &LLToolPlacerPanel::sPrism,
00256 &LLToolPlacerPanel::sPyramid,
00257 &LLToolPlacerPanel::sTetrahedron,
00258 &LLToolPlacerPanel::sCylinder,
00259 &LLToolPlacerPanel::sCylinderHemi,
00260 &LLToolPlacerPanel::sCone,
00261 &LLToolPlacerPanel::sConeHemi,
00262 &LLToolPlacerPanel::sSphere,
00263 &LLToolPlacerPanel::sSphereHemi,
00264 &LLToolPlacerPanel::sTorus,
00265 &LLToolPlacerPanel::sSquareTorus,
00266 &LLToolPlacerPanel::sTriangleTorus,
00267 &LLToolPlacerPanel::sTree,
00268 &LLToolPlacerPanel::sGrass};
00269 for(size_t t=0; t<sizeof(toolNames)/sizeof(toolNames[0]); ++t)
00270 {
00271 LLButton *found = LLViewerUICtrlFactory::getButtonByName(this,toolNames[t]);
00272 if(found)
00273 {
00274 found->setClickedCallback(setObjectType,toolData[t]);
00275 mButtons.push_back( found );
00276 }else{
00277 llwarns << "Tool button not found! DOA Pending." << llendl;
00278 }
00279 }
00280 mCheckCopySelection = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy selection");
00281 childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
00282 mCheckSticky = LLUICtrlFactory::getCheckBoxByName(this,"checkbox sticky");
00283 childSetValue("checkbox sticky",(BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected"));
00284 mCheckCopyCenters = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy centers");
00285 childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
00286 mCheckCopyRotates = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy rotates");
00287 childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
00288 mRadioSelectLand = LLUICtrlFactory::getCheckBoxByName(this,"radio select land");
00289 childSetCommitCallback("radio select land",commit_select_tool, gToolParcel);
00290 mRadioDozerFlatten = LLUICtrlFactory::getCheckBoxByName(this,"radio flatten");
00291 childSetCommitCallback("radio flatten",click_popup_dozer_mode, (void*)0);
00292 mRadioDozerRaise = LLUICtrlFactory::getCheckBoxByName(this,"radio raise");
00293 childSetCommitCallback("radio raise",click_popup_dozer_mode, (void*)1);
00294 mRadioDozerLower = LLUICtrlFactory::getCheckBoxByName(this,"radio lower");
00295 childSetCommitCallback("radio lower",click_popup_dozer_mode, (void*)2);
00296 mRadioDozerSmooth = LLUICtrlFactory::getCheckBoxByName(this,"radio smooth");
00297 childSetCommitCallback("radio smooth",click_popup_dozer_mode, (void*)3);
00298 mRadioDozerNoise = LLUICtrlFactory::getCheckBoxByName(this,"radio noise");
00299 childSetCommitCallback("radio noise",click_popup_dozer_mode, (void*)4);
00300 mRadioDozerRevert = LLUICtrlFactory::getCheckBoxByName(this,"radio revert");
00301 childSetCommitCallback("radio revert",click_popup_dozer_mode, (void*)5);
00302 mComboDozerSize = LLUICtrlFactory::getComboBoxByName(this,"combobox brush size");
00303 childSetCommitCallback("combobox brush size",click_dozer_size, (void*)0);
00304 if(mComboDozerSize) mComboDozerSize->setCurrentByIndex(0);
00305 mBtnApplyToSelection = LLUICtrlFactory::getButtonByName(this,"button apply to selection");
00306 childSetAction("button apply to selection",click_apply_to_selection, (void*)0);
00307 mCheckShowOwners = LLUICtrlFactory::getCheckBoxByName(this,"checkbox show owners");
00308 childSetValue("checkbox show owners",gSavedSettings.getBOOL("ShowParcelOwners"));
00309 childSetAction("button more", click_show_more, this);
00310 childSetAction("button less", click_show_more, this);
00311 mTab = LLUICtrlFactory::getTabContainerByName(this,"Object Info Tabs");
00312 if(mTab)
00313 {
00314 mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") );
00315 mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
00316 mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") );
00317 mTab->setBorderVisible(FALSE);
00318 mTab->selectFirstTab();
00319 }
00320
00321 mStatusText["rotate"] = childGetText("status_rotate");
00322 mStatusText["scale"] = childGetText("status_scale");
00323 mStatusText["move"] = childGetText("status_move");
00324 mStatusText["modifyland"] = childGetText("status_modifyland");
00325 mStatusText["camera"] = childGetText("status_camera");
00326 mStatusText["grab"] = childGetText("status_grab");
00327 mStatusText["place"] = childGetText("status_place");
00328 mStatusText["selectland"] = childGetText("status_selectland");
00329
00330 return TRUE;
00331 }
00332
00333
00334
00335 LLFloaterTools::LLFloaterTools()
00336 : LLFloater("toolbox floater"),
00337 mBtnFocus(NULL),
00338 mBtnMove(NULL),
00339 mBtnEdit(NULL),
00340 mBtnCreate(NULL),
00341 mBtnLand(NULL),
00342 mTextStatus(NULL),
00343
00344 mRadioOrbit(NULL),
00345 mRadioZoom(NULL),
00346 mRadioPan(NULL),
00347
00348 mRadioMove(NULL),
00349 mRadioLift(NULL),
00350 mRadioSpin(NULL),
00351
00352 mRadioPosition(NULL),
00353 mRadioRotate(NULL),
00354 mRadioStretch(NULL),
00355 mRadioSelectFace(NULL),
00356 mCheckSelectIndividual(NULL),
00357
00358 mCheckSnapToGrid(NULL),
00359 mBtnGridOptions(NULL),
00360 mTextGridMode(NULL),
00361 mComboGridMode(NULL),
00362 mCheckStretchUniform(NULL),
00363 mCheckStretchTexture(NULL),
00364
00365 mBtnRotateLeft(NULL),
00366 mBtnRotateReset(NULL),
00367 mBtnRotateRight(NULL),
00368
00369 mBtnDelete(NULL),
00370 mBtnDuplicate(NULL),
00371 mBtnDuplicateInPlace(NULL),
00372
00373 mCheckSticky(NULL),
00374 mCheckCopySelection(NULL),
00375 mCheckCopyCenters(NULL),
00376 mCheckCopyRotates(NULL),
00377 mRadioSelectLand(NULL),
00378 mRadioDozerFlatten(NULL),
00379 mRadioDozerRaise(NULL),
00380 mRadioDozerLower(NULL),
00381 mRadioDozerSmooth(NULL),
00382 mRadioDozerNoise(NULL),
00383 mRadioDozerRevert(NULL),
00384 mComboDozerSize(NULL),
00385 mBtnApplyToSelection(NULL),
00386 mCheckShowOwners(NULL),
00387
00388
00389 mTab(NULL),
00390 mPanelPermissions(NULL),
00391 mPanelObject(NULL),
00392 mPanelVolume(NULL),
00393 mPanelContents(NULL),
00394 mPanelFace(NULL),
00395 mPanelLandInfo(NULL),
00396
00397 mTabLand(NULL),
00398 mDirty(TRUE)
00399 {
00400 mAutoFocus = FALSE;
00401 LLCallbackMap::map_t factory_map;
00402 factory_map["General"] = LLCallbackMap(createPanelPermissions, this);
00403 factory_map["Object"] = LLCallbackMap(createPanelObject, this);
00404 factory_map["Features"] = LLCallbackMap(createPanelVolume, this);
00405 factory_map["Texture"] = LLCallbackMap(createPanelFace, this);
00406 factory_map["Contents"] = LLCallbackMap(createPanelContents, this);
00407 factory_map["ContentsInventory"] = LLCallbackMap(createPanelContentsInventory, this);
00408 factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);
00409
00410 gUICtrlFactory->buildFloater(this,"floater_tools.xml",&factory_map,FALSE);
00411
00412 mLargeHeight = getRect().getHeight();
00413 mSmallHeight = mLargeHeight;
00414 if (mTab) mSmallHeight -= mTab->getRect().getHeight();
00415
00416
00417
00418
00419
00420 BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore");
00421 gSavedSettings.setBOOL("ToolboxShowMore", show_more);
00422 showMore( !show_more );
00423 showMore( show_more );
00424 }
00425
00426 LLFloaterTools::~LLFloaterTools()
00427 {
00428
00429 }
00430
00431 void LLFloaterTools::setStatusText(const std::string& text)
00432 {
00433 std::map<std::string, std::string>::iterator iter = mStatusText.find(text);
00434 if (iter != mStatusText.end())
00435 {
00436 mTextStatus->setText(iter->second);
00437 }
00438 else
00439 {
00440 mTextStatus->setText(text);
00441 }
00442 }
00443
00444 void LLFloaterTools::refresh()
00445 {
00446 const S32 INFO_WIDTH = mRect.getWidth();
00447 const S32 INFO_HEIGHT = 384;
00448 LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT);
00449 BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME );
00450
00451 S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]);
00452 S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]);
00453 S32 idx_contents = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_CONTENTS]);
00454
00455 S32 selected_index = mTab->getCurrentPanelIndex();
00456
00457 if (!all_volume && (selected_index == idx_features || selected_index == idx_face ||
00458 selected_index == idx_contents))
00459 {
00460 mTab->selectFirstTab();
00461 }
00462
00463 mTab->enableTabButton(idx_features, all_volume);
00464 mTab->enableTabButton(idx_face, all_volume);
00465 mTab->enableTabButton(idx_contents, all_volume);
00466
00467 mPanelPermissions->refresh();
00468 mPanelObject->refresh();
00469 mPanelVolume->refresh();
00470 mPanelFace->refresh();
00471 mPanelContents->refresh();
00472 mPanelLandInfo->refresh();
00473 }
00474
00475 void LLFloaterTools::draw()
00476 {
00477 if (mDirty)
00478 {
00479 refresh();
00480 mDirty = FALSE;
00481 }
00482
00483
00484 LLFloater::draw();
00485 }
00486
00487 void LLFloaterTools::dirty()
00488 {
00489 mDirty = TRUE;
00490 LLFloaterOpenObject::dirty();
00491 }
00492
00493
00494
00495 void LLFloaterTools::resetToolState()
00496 {
00497 gCameraBtnOrbit = FALSE;
00498 gCameraBtnPan = FALSE;
00499
00500 gGrabBtnSpin = FALSE;
00501 gGrabBtnVertical = FALSE;
00502 }
00503
00504 void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
00505 {
00506 LLTool *tool = gToolMgr->getCurrentTool();
00507
00508
00509
00510 if (tool == gToolNull)
00511 {
00512 return;
00513 }
00514
00515 if ( isMinimized() )
00516 {
00517 return;
00518 }
00519
00520
00521 BOOL focus_visible = ( tool == gToolCamera );
00522
00523 mBtnFocus ->setToggleState( focus_visible );
00524
00525 mRadioZoom ->setVisible( focus_visible );
00526 mRadioOrbit ->setVisible( focus_visible );
00527 mRadioPan ->setVisible( focus_visible );
00528 childSetVisible("slider zoom", focus_visible);
00529
00530 mRadioZoom ->set( !gCameraBtnOrbit &&
00531 !gCameraBtnPan &&
00532 !(mask == MASK_ORBIT) &&
00533 !(mask == (MASK_ORBIT | MASK_ALT)) &&
00534 !(mask == MASK_PAN) &&
00535 !(mask == (MASK_PAN | MASK_ALT)) );
00536
00537 mRadioOrbit ->set( gCameraBtnOrbit ||
00538 (mask == MASK_ORBIT) ||
00539 (mask == (MASK_ORBIT | MASK_ALT)) );
00540
00541 mRadioPan ->set( gCameraBtnPan ||
00542 (mask == MASK_PAN) ||
00543 (mask == (MASK_PAN | MASK_ALT)) );
00544
00545
00546 childSetValue( "slider zoom", gAgent.getCameraZoomFraction() * 0.5f);
00547
00548
00549 BOOL move_visible = (tool == gToolGrab);
00550
00551 if (mBtnMove) mBtnMove ->setToggleState( move_visible );
00552
00553
00554 if (mRadioMove)
00555 {
00556 mRadioMove ->setVisible( move_visible );
00557 mRadioMove ->set( !gGrabBtnSpin &&
00558 !gGrabBtnVertical &&
00559 !(mask == MASK_VERTICAL) &&
00560 !(mask == MASK_SPIN) );
00561 }
00562
00563 if (mRadioLift)
00564 {
00565 mRadioLift ->setVisible( move_visible );
00566 mRadioLift ->set( gGrabBtnVertical ||
00567 (mask == MASK_VERTICAL) );
00568 }
00569
00570 if (mRadioSpin)
00571 {
00572 mRadioSpin ->setVisible( move_visible );
00573 mRadioSpin ->set( gGrabBtnSpin ||
00574 (mask == MASK_SPIN) );
00575 }
00576
00577
00578 BOOL edit_visible = tool == gToolTranslate ||
00579 tool == gToolRotate ||
00580 tool == gToolStretch ||
00581 tool == gToolFace ||
00582 tool == gToolIndividual ||
00583 tool == gToolPipette;
00584
00585 mBtnEdit ->setToggleState( edit_visible );
00586
00587 mRadioPosition ->setVisible( edit_visible );
00588 mRadioRotate ->setVisible( edit_visible );
00589 mRadioStretch ->setVisible( edit_visible );
00590 if (mRadioSelectFace)
00591 {
00592 mRadioSelectFace->setVisible( edit_visible );
00593 mRadioSelectFace->set( tool == gToolFace );
00594 }
00595
00596 if (mCheckSelectIndividual)
00597 {
00598 mCheckSelectIndividual->setVisible(edit_visible);
00599
00600 }
00601
00602 mRadioPosition ->set( tool == gToolTranslate );
00603 mRadioRotate ->set( tool == gToolRotate );
00604 mRadioStretch ->set( tool == gToolStretch );
00605
00606 if (mComboGridMode)
00607 {
00608 mComboGridMode->setVisible( edit_visible );
00609 S32 index = mComboGridMode->getCurrentIndex();
00610 mComboGridMode->removeall();
00611
00612 switch (mObjectSelection->getSelectType())
00613 {
00614 case SELECT_TYPE_HUD:
00615 mComboGridMode->add(childGetText("grid_screen_text"));
00616 mComboGridMode->add(childGetText("grid_local_text"));
00617
00618 break;
00619 case SELECT_TYPE_WORLD:
00620 mComboGridMode->add(childGetText("grid_world_text"));
00621 mComboGridMode->add(childGetText("grid_local_text"));
00622 mComboGridMode->add(childGetText("grid_reference_text"));
00623 break;
00624 case SELECT_TYPE_ATTACHMENT:
00625 mComboGridMode->add(childGetText("grid_attachment_text"));
00626 mComboGridMode->add(childGetText("grid_local_text"));
00627 mComboGridMode->add(childGetText("grid_reference_text"));
00628 break;
00629 }
00630
00631 mComboGridMode->setCurrentByIndex(index);
00632 }
00633 if (mTextGridMode) mTextGridMode->setVisible( edit_visible );
00634
00635
00636 if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible );
00637 if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible );
00638
00639
00640 if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible );
00641 if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible );
00642
00643
00644 BOOL create_visible = (tool == gToolCreate);
00645
00646 mBtnCreate ->setToggleState( tool == gToolCreate );
00647
00648 if (mCheckCopySelection
00649 && mCheckCopySelection->get())
00650 {
00651
00652 for (std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++)
00653 {
00654 mButtons[i]->setToggleState(FALSE);
00655 mButtons[i]->setVisible( create_visible );
00656 }
00657 }
00658 else
00659 {
00660
00661 for( std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++ )
00662 {
00663 LLPCode pcode = LLToolPlacer::getObjectType();
00664 void *userdata = mButtons[i]->getCallbackUserData();
00665 LLPCode *cur = (LLPCode*) userdata;
00666
00667 BOOL state = (pcode == *cur);
00668 mButtons[i]->setToggleState( state );
00669 mButtons[i]->setVisible( create_visible );
00670 }
00671 }
00672
00673 if (mCheckSticky) mCheckSticky ->setVisible( create_visible );
00674 if (mCheckCopySelection) mCheckCopySelection ->setVisible( create_visible );
00675 if (mCheckCopyCenters) mCheckCopyCenters ->setVisible( create_visible );
00676 if (mCheckCopyRotates) mCheckCopyRotates ->setVisible( create_visible );
00677
00678 if (mCheckCopyCenters) mCheckCopyCenters->setEnabled( mCheckCopySelection->get() );
00679 if (mCheckCopyRotates) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() );
00680
00681
00682 BOOL land_visible = (tool == gToolLand || tool == gToolParcel );
00683
00684 if (mBtnLand) mBtnLand ->setToggleState( land_visible );
00685
00686
00687 if (mRadioSelectLand) mRadioSelectLand->set( tool == gToolParcel );
00688
00689
00690 if (mRadioSelectLand) mRadioSelectLand->setVisible( land_visible );
00691
00692 S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction");
00693 S32 dozer_size = gSavedSettings.getS32("RadioLandBrushSize");
00694
00695 if (mRadioDozerFlatten)
00696 {
00697 mRadioDozerFlatten ->set( tool == gToolLand && dozer_mode == 0);
00698 mRadioDozerFlatten ->setVisible( land_visible );
00699 }
00700 if (mRadioDozerRaise)
00701 {
00702 mRadioDozerRaise ->set( tool == gToolLand && dozer_mode == 1);
00703 mRadioDozerRaise ->setVisible( land_visible );
00704 }
00705 if (mRadioDozerLower)
00706 {
00707 mRadioDozerLower ->set( tool == gToolLand && dozer_mode == 2);
00708 mRadioDozerLower ->setVisible( land_visible );
00709 }
00710 if (mRadioDozerSmooth)
00711 {
00712 mRadioDozerSmooth ->set( tool == gToolLand && dozer_mode == 3);
00713 mRadioDozerSmooth ->setVisible( land_visible );
00714 }
00715 if (mRadioDozerNoise)
00716 {
00717 mRadioDozerNoise ->set( tool == gToolLand && dozer_mode == 4);
00718 mRadioDozerNoise ->setVisible( land_visible );
00719 }
00720 if (mRadioDozerRevert)
00721 {
00722 mRadioDozerRevert ->set( tool == gToolLand && dozer_mode == 5);
00723 mRadioDozerRevert ->setVisible( land_visible );
00724 }
00725 if (mComboDozerSize)
00726 {
00727 mComboDozerSize ->setCurrentByIndex(dozer_size);
00728 mComboDozerSize ->setVisible( land_visible );
00729 mComboDozerSize ->setEnabled( tool == gToolLand );
00730 }
00731 if (mBtnApplyToSelection)
00732 {
00733 mBtnApplyToSelection->setVisible( land_visible );
00734 mBtnApplyToSelection->setEnabled( land_visible && !gParcelMgr->selectionEmpty() && tool != gToolParcel);
00735 }
00736 if (mCheckShowOwners)
00737 {
00738 mCheckShowOwners ->setVisible( land_visible );
00739 }
00740
00741
00742
00743
00744 BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore");
00745
00746 mTab->setVisible(show_more && tool != gToolLand && tool != gToolParcel);
00747 mPanelLandInfo->setVisible(show_more && (tool == gToolLand || tool == gToolParcel));
00748 }
00749
00750
00751
00752 BOOL LLFloaterTools::canClose()
00753 {
00754
00755 return !gQuit;
00756 }
00757
00758
00759 void LLFloaterTools::onOpen()
00760 {
00761 mParcelSelection = gParcelMgr->getFloatingParcelSelection();
00762 mObjectSelection = gSelectMgr->getEditSelection();
00763 }
00764
00765
00766 void LLFloaterTools::onClose(bool app_quitting)
00767 {
00768 setMinimized(FALSE);
00769 setVisible(FALSE);
00770 mTab->setVisible(FALSE);
00771
00772
00773
00774 gAgent.resetView(gSavedSettings.getBOOL("EditCameraMovement"));
00775
00776
00777 gSelectMgr->promoteSelectionToRoot();
00778 gSavedSettings.setBOOL("EditLinkedParts", FALSE);
00779
00780 gViewerWindow->showCursor();
00781
00782 resetToolState();
00783
00784 mParcelSelection = NULL;
00785 mObjectSelection = NULL;
00786
00787
00788 gToolMgr->setCurrentToolset(gBasicToolset);
00789
00790
00791 gToolMgr->getCurrentToolset()->selectFirstTool();
00792 }
00793
00794 void LLFloaterTools::showMore(BOOL show_more)
00795 {
00796 BOOL showing_more = gSavedSettings.getBOOL("ToolboxShowMore");
00797 if (show_more == showing_more)
00798 {
00799 return;
00800 }
00801
00802 gSavedSettings.setBOOL("ToolboxShowMore", show_more);
00803
00804
00805
00806
00807 if (show_more)
00808 {
00809 reshape( mRect.getWidth(), mLargeHeight, TRUE);
00810 translate( 0, mSmallHeight - mLargeHeight );
00811 }
00812 else
00813 {
00814 reshape( mRect.getWidth(), mSmallHeight, TRUE);
00815 translate( 0, mLargeHeight - mSmallHeight );
00816 }
00817 childSetVisible("button less", show_more);
00818 childSetVisible("button more", !show_more);
00819 }
00820
00821 void LLFloaterTools::showPanel(EInfoPanel panel)
00822 {
00823 llassert(panel >= 0 && panel < PANEL_COUNT);
00824 mTab->selectTabByName(PANEL_NAMES[panel]);
00825 }
00826
00827 void click_show_more(void *userdata)
00828 {
00829 LLFloaterTools *f = (LLFloaterTools *)userdata;
00830 BOOL show_more = !gSavedSettings.getBOOL("ToolboxShowMore");
00831 f->showMore( show_more );
00832 }
00833
00834 void click_popup_info(void*)
00835 {
00836
00837 }
00838
00839 void click_popup_done(void*)
00840 {
00841 handle_reset_view();
00842 }
00843
00844 void click_popup_grab_drag(LLUICtrl*, void*)
00845 {
00846 gGrabBtnVertical = FALSE;
00847 gGrabBtnSpin = FALSE;
00848 }
00849
00850 void click_popup_grab_lift(LLUICtrl*, void*)
00851 {
00852 gGrabBtnVertical = TRUE;
00853 gGrabBtnSpin = FALSE;
00854 }
00855
00856 void click_popup_grab_spin(LLUICtrl*, void*)
00857 {
00858 gGrabBtnVertical = FALSE;
00859 gGrabBtnSpin = TRUE;
00860 }
00861
00862 void commit_radio_zoom(LLUICtrl *, void*)
00863 {
00864 gCameraBtnOrbit = FALSE;
00865 gCameraBtnPan = FALSE;
00866 }
00867
00868 void commit_radio_orbit(LLUICtrl *, void*)
00869 {
00870 gCameraBtnOrbit = TRUE;
00871 gCameraBtnPan = FALSE;
00872 }
00873
00874 void commit_radio_pan(LLUICtrl *, void*)
00875 {
00876 gCameraBtnOrbit = FALSE;
00877 gCameraBtnPan = TRUE;
00878 }
00879
00880 void commit_slider_zoom(LLUICtrl *ctrl, void*)
00881 {
00882
00883 F32 zoom_level = (F32)ctrl->getValue().asReal() * 2.f;
00884 gAgent.setCameraZoomFraction(zoom_level);
00885 }
00886
00887 void click_popup_rotate_left(void*)
00888 {
00889 gSelectMgr->selectionRotateAroundZ( 45.f );
00890 dialog_refresh_all();
00891 }
00892
00893 void click_popup_rotate_reset(void*)
00894 {
00895 gSelectMgr->selectionResetRotation();
00896 dialog_refresh_all();
00897 }
00898
00899 void click_popup_rotate_right(void*)
00900 {
00901 gSelectMgr->selectionRotateAroundZ( -45.f );
00902 dialog_refresh_all();
00903 }
00904
00905
00906 void click_popup_dozer_mode(LLUICtrl *, void *user)
00907 {
00908 S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners");
00909 S32 mode = (S32)(intptr_t) user;
00910 gFloaterTools->setEditTool( gToolLand );
00911 gSavedSettings.setS32("RadioLandBrushAction", mode);
00912 gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
00913 }
00914
00915 void click_popup_dozer_size(LLUICtrl *, void *user)
00916 {
00917 S32 size = (S32)(intptr_t) user;
00918 gSavedSettings.setS32("RadioLandBrushSize", size);
00919 }
00920
00921 void click_dozer_size(LLUICtrl *ctrl, void *user)
00922 {
00923 S32 size = ((LLComboBox*) ctrl)->getCurrentIndex();
00924 gSavedSettings.setS32("RadioLandBrushSize", size);
00925 }
00926
00927 void click_apply_to_selection(void* user)
00928 {
00929 gToolLand->modifyLandInSelectionGlobal();
00930 }
00931
00932 void commit_select_tool(LLUICtrl *ctrl, void *data)
00933 {
00934 S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners");
00935 gFloaterTools->setEditTool(data);
00936 gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
00937 }
00938
00939 void commit_select_component(LLUICtrl *ctrl, void *data)
00940 {
00941 LLFloaterTools* floaterp = (LLFloaterTools*)data;
00942
00943
00944 if (gFocusMgr.childHasKeyboardFocus(floaterp))
00945 {
00946 gFocusMgr.setKeyboardFocus(NULL, NULL);
00947 }
00948
00949 BOOL select_individuals = floaterp->mCheckSelectIndividual->get();
00950 gSavedSettings.setBOOL("EditLinkedParts", select_individuals);
00951 floaterp->dirty();
00952
00953 if (select_individuals)
00954 {
00955 gSelectMgr->demoteSelectionToIndividuals();
00956 }
00957 else
00958 {
00959 gSelectMgr->promoteSelectionToRoot();
00960 }
00961 }
00962
00963 void commit_grid_mode(LLUICtrl *ctrl, void *data)
00964 {
00965 LLComboBox* combo = (LLComboBox*)ctrl;
00966
00967 gSelectMgr->setGridMode((EGridMode)combo->getCurrentIndex());
00968 }
00969
00970
00971 void LLFloaterTools::setObjectType( void* data )
00972 {
00973 LLPCode pcode = *(LLPCode*) data;
00974 LLToolPlacer::setObjectType( pcode );
00975 gSavedSettings.setBOOL("CreateToolCopySelection", FALSE);
00976 gViewerWindow->setMouseCapture(NULL);
00977 }
00978
00979
00980 void LLFloaterTools::onClickGridOptions(void* data)
00981 {
00982
00983 LLFloaterBuildOptions::show(NULL);
00984
00985
00986 }
00987
00988 void LLFloaterTools::setEditTool(void* tool_pointer)
00989 {
00990 select_tool(tool_pointer);
00991 }
00992
00993 void LLFloaterTools::onFocusReceived()
00994 {
00995 gToolMgr->setCurrentToolset(gBasicToolset);
00996 }