aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatertools.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloatertools.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llfloatertools.cpp')
-rw-r--r--linden/indra/newview/llfloatertools.cpp969
1 files changed, 969 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp
new file mode 100644
index 0000000..c9edf98
--- /dev/null
+++ b/linden/indra/newview/llfloatertools.cpp
@@ -0,0 +1,969 @@
1/**
2 * @file llfloatertools.cpp
3 * @brief The edit tools, including move, position, land, etc.
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#include "llviewerprecompiledheaders.h"
29
30#include "llfloatertools.h"
31
32#include "llfontgl.h"
33#include "llcoord.h"
34#include "llgl.h"
35
36#include "llagent.h"
37#include "llbutton.h"
38#include "llcheckboxctrl.h"
39#include "llcombobox.h"
40#include "lldraghandle.h"
41#include "llfloaterbuildoptions.h"
42#include "llfloateropenobject.h"
43#include "llfocusmgr.h"
44#include "llmenugl.h"
45#include "llpanelcontents.h"
46#include "llpanelface.h"
47#include "llpanelland.h"
48#include "llpanelinventory.h"
49#include "llpanelobject.h"
50#include "llpanelvolume.h"
51#include "llpanelpermissions.h"
52#include "llselectmgr.h"
53#include "llstatusbar.h"
54#include "lltabcontainer.h"
55#include "lltextbox.h"
56#include "lltoolbrush.h"
57#include "lltoolcomp.h"
58#include "lltooldraganddrop.h"
59#include "lltoolface.h"
60#include "lltoolfocus.h"
61#include "lltoolgrab.h"
62#include "lltoolgrab.h"
63#include "lltoolindividual.h"
64#include "lltoolmgr.h"
65#include "lltoolpie.h"
66#include "lltoolpipette.h"
67#include "lltoolplacer.h"
68#include "lltoolselect.h"
69#include "lltoolselectland.h"
70#include "llui.h"
71#include "llviewermenu.h"
72#include "llviewerparcelmgr.h"
73#include "llviewerwindow.h"
74#include "llviewercontrol.h"
75#include "llvolumesliderctrl.h"
76#include "viewer.h"
77
78#include "llvieweruictrlfactory.h"
79
80// Globals
81LLFloaterTools *gFloaterTools = NULL;
82
83
84const LLString PANEL_NAMES[LLFloaterTools::PANEL_COUNT] =
85{
86 LLString("General"), // PANEL_GENERAL,
87 LLString("Object"), // PANEL_OBJECT,
88 LLString("Features"), // PANEL_FEATURES,
89 LLString("Texture"), // PANEL_FACE,
90 LLString("Content"), // PANEL_CONTENTS,
91};
92
93// Local prototypes
94void commit_select_tool(LLUICtrl *ctrl, void *data);
95void commit_select_component(LLUICtrl *ctrl, void *data);
96void click_show_more(void*);
97void click_popup_info(void*);
98void click_popup_done(void*);
99void click_popup_minimize(void*);
100void click_popup_grab_drag(LLUICtrl *, void*);
101void click_popup_grab_lift(LLUICtrl *, void*);
102void click_popup_grab_spin(LLUICtrl *, void*);
103void click_popup_rotate_left(void*);
104void click_popup_rotate_reset(void*);
105void click_popup_rotate_right(void*);
106void click_popup_dozer_mode(LLUICtrl *, void *user);
107void click_popup_dozer_size(LLUICtrl *, void *user);
108void click_dozer_size(LLUICtrl *, void*);
109void click_apply_to_selection(void*);
110void commit_radio_zoom(LLUICtrl *, void*);
111void commit_radio_orbit(LLUICtrl *, void*);
112void commit_radio_pan(LLUICtrl *, void*);
113void commit_grid_mode(LLUICtrl *, void*);
114void commit_slider_zoom(LLUICtrl *, void*);
115
116
117//static
118void* LLFloaterTools::createPanelPermissions(void* data)
119{
120 LLFloaterTools* floater = (LLFloaterTools*)data;
121 floater->mPanelPermissions = new LLPanelPermissions("General");
122 return floater->mPanelPermissions;
123}
124//static
125void* LLFloaterTools::createPanelObject(void* data)
126{
127 LLFloaterTools* floater = (LLFloaterTools*)data;
128 floater->mPanelObject = new LLPanelObject("Object");
129 return floater->mPanelObject;
130}
131
132//static
133void* LLFloaterTools::createPanelVolume(void* data)
134{
135 LLFloaterTools* floater = (LLFloaterTools*)data;
136 floater->mPanelVolume = new LLPanelVolume("Features");
137 return floater->mPanelVolume;
138}
139
140//static
141void* LLFloaterTools::createPanelFace(void* data)
142{
143 LLFloaterTools* floater = (LLFloaterTools*)data;
144 floater->mPanelFace = new LLPanelFace("Texture");
145 return floater->mPanelFace;
146}
147
148//static
149void* LLFloaterTools::createPanelContents(void* data)
150{
151 LLFloaterTools* floater = (LLFloaterTools*)data;
152 floater->mPanelContents = new LLPanelContents("Contents");
153 return floater->mPanelContents;
154}
155
156//static
157void* LLFloaterTools::createPanelContentsInventory(void* data)
158{
159 LLFloaterTools* floater = (LLFloaterTools*)data;
160 floater->mPanelContents->mPanelInventory = new LLPanelInventory("ContentsInventory", LLRect());
161 return floater->mPanelContents->mPanelInventory;
162}
163
164//static
165void* LLFloaterTools::createPanelLandInfo(void* data)
166{
167 LLFloaterTools* floater = (LLFloaterTools*)data;
168 floater->mPanelLandInfo = new LLPanelLandInfo("land info panel");
169 return floater->mPanelLandInfo;
170}
171
172BOOL LLFloaterTools::postBuild()
173{
174
175 // Hide until tool selected
176 setVisible(FALSE);
177
178 // Since we constantly show and hide this during drags, don't
179 // make sounds on visibility changes.
180 setSoundFlags(LLView::SILENT);
181
182 mDragHandle->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") );
183
184 LLRect rect;
185 mBtnFocus = LLUICtrlFactory::getButtonByName(this,"button focus");//btn;
186 childSetAction("button focus",LLFloaterTools::setEditTool, (void*)gToolCamera);
187 mBtnMove = LLUICtrlFactory::getButtonByName(this,"button move");
188 childSetAction("button move",LLFloaterTools::setEditTool, (void*)gToolGrab);
189 mBtnEdit = LLUICtrlFactory::getButtonByName(this,"button edit");
190 childSetAction("button edit",LLFloaterTools::setEditTool, (void*)gToolTranslate);
191 mBtnCreate = LLUICtrlFactory::getButtonByName(this,"button create");
192 childSetAction("button create",LLFloaterTools::setEditTool, (void*)gToolCreate);
193 mBtnLand = LLUICtrlFactory::getButtonByName(this, "button land" );
194 childSetAction("button land",LLFloaterTools::setEditTool, (void*)gToolParcel);
195 mTextStatus = LLUICtrlFactory::getTextBoxByName(this,"text status");
196 mRadioZoom = LLUICtrlFactory::getCheckBoxByName(this,"radio zoom");
197 mSliderZoom = LLViewerUICtrlFactory::getVolumeSliderByName(this,"slider zoom");
198 childSetCommitCallback("slider zoom",commit_slider_zoom,this);
199 mRadioOrbit = LLUICtrlFactory::getCheckBoxByName(this,"radio orbit");
200 childSetCommitCallback("radio orbit",commit_radio_orbit,this);
201 mRadioPan = LLUICtrlFactory::getCheckBoxByName(this,"radio pan");
202 childSetCommitCallback("radio pan",commit_radio_pan,this);
203 mRadioMove = LLUICtrlFactory::getCheckBoxByName(this,"radio move");
204 childSetCommitCallback("radio move",click_popup_grab_drag,this);
205 mRadioLift = LLUICtrlFactory::getCheckBoxByName(this,"radio lift");
206 childSetCommitCallback("radio lift",click_popup_grab_lift,this);
207 mRadioSpin = LLUICtrlFactory::getCheckBoxByName(this,"radio spin");
208 childSetCommitCallback("radio spin",click_popup_grab_spin,NULL);
209 mRadioPosition = LLUICtrlFactory::getCheckBoxByName(this,"radio position");
210 childSetCommitCallback("radio position",commit_select_tool,gToolTranslate);
211 mRadioRotate = LLUICtrlFactory::getCheckBoxByName(this,"radio rotate");
212 childSetCommitCallback("radio rotate",commit_select_tool,gToolRotate);
213 mRadioStretch = LLUICtrlFactory::getCheckBoxByName(this,"radio stretch");
214 childSetCommitCallback("radio stretch",commit_select_tool,gToolStretch);
215 mRadioSelectFace = LLUICtrlFactory::getCheckBoxByName(this,"radio select face");
216 childSetCommitCallback("radio select face",commit_select_tool,gToolFace);
217 mCheckSelectIndividual = LLUICtrlFactory::getCheckBoxByName(this,"checkbox edit linked parts");
218 childSetValue("checkbox edit linked parts",(BOOL)!gSavedSettings.getBOOL("SelectLinkedSet"));
219 childSetCommitCallback("checkbox edit linked parts",commit_select_component,this);
220 mCheckSnapToGrid = LLUICtrlFactory::getCheckBoxByName(this,"checkbox snap to grid");
221 childSetValue("checkbox snap to grid",(BOOL)gSavedSettings.getBOOL("SnapEnabled"));
222 mBtnGridOptions = LLUICtrlFactory::getButtonByName(this,"Options...");
223 childSetAction("Options...",onClickGridOptions, this);
224 mCheckStretchUniform = LLUICtrlFactory::getCheckBoxByName(this,"checkbox uniform");
225 childSetValue("checkbox uniform",(BOOL)gSavedSettings.getBOOL("ScaleUniform"));
226 mCheckStretchTexture = LLUICtrlFactory::getCheckBoxByName(this,"checkbox stretch textures");
227 childSetValue("checkbox stretch textures",(BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
228 mTextGridMode = LLUICtrlFactory::getTextBoxByName(this,"text ruler mode");
229 mComboGridMode = LLUICtrlFactory::getComboBoxByName(this,"combobox grid mode");
230 childSetCommitCallback("combobox grid mode",commit_grid_mode, this);
231 //
232 // Create Buttons
233 //
234
235 static const LLString toolNames[]={
236 "ToolCube",
237 "ToolPrism",
238 "ToolPyramid",
239 "ToolTetrahedron",
240 "ToolCylinder",
241 "ToolHemiCylinder",
242 "ToolCone",
243 "ToolHemiCone",
244 "ToolSphere",
245 "ToolHemiSphere",
246 "ToolTorus",
247 "ToolTube",
248 "ToolRing",
249 "ToolTree",
250 "ToolGrass"};
251 void* toolData[]={
252 &LLToolPlacerPanel::sCube,
253 &LLToolPlacerPanel::sPrism,
254 &LLToolPlacerPanel::sPyramid,
255 &LLToolPlacerPanel::sTetrahedron,
256 &LLToolPlacerPanel::sCylinder,
257 &LLToolPlacerPanel::sCylinderHemi,
258 &LLToolPlacerPanel::sCone,
259 &LLToolPlacerPanel::sConeHemi,
260 &LLToolPlacerPanel::sSphere,
261 &LLToolPlacerPanel::sSphereHemi,
262 &LLToolPlacerPanel::sTorus,
263 &LLToolPlacerPanel::sSquareTorus,
264 &LLToolPlacerPanel::sTriangleTorus,
265 &LLToolPlacerPanel::sTree,
266 &LLToolPlacerPanel::sGrass};
267 for(int t=0;t<sizeof(toolNames)/sizeof(toolNames[0]);t++)
268 {
269 LLButton *found = LLViewerUICtrlFactory::getButtonByName(this,toolNames[t]);
270 if(found)
271 {
272 found->setClickedCallback(setObjectType,toolData[t]);
273 mButtons.push_back( found );
274 }else{
275 llwarns << "Tool button not found! DOA Pending." << llendl;
276 }
277 }
278 mCheckCopySelection = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy selection");
279 childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
280 mCheckSticky = LLUICtrlFactory::getCheckBoxByName(this,"checkbox sticky");
281 childSetValue("checkbox sticky",(BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected"));
282 mCheckCopyCenters = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy centers");
283 childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
284 mCheckCopyRotates = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy rotates");
285 childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
286 mRadioSelectLand = LLUICtrlFactory::getCheckBoxByName(this,"radio select land");
287 childSetCommitCallback("radio select land",commit_select_tool, gToolParcel);
288 mRadioDozerFlatten = LLUICtrlFactory::getCheckBoxByName(this,"radio flatten");
289 childSetCommitCallback("radio flatten",click_popup_dozer_mode, (void*)0);
290 mRadioDozerRaise = LLUICtrlFactory::getCheckBoxByName(this,"radio raise");
291 childSetCommitCallback("radio raise",click_popup_dozer_mode, (void*)1);
292 mRadioDozerLower = LLUICtrlFactory::getCheckBoxByName(this,"radio lower");
293 childSetCommitCallback("radio lower",click_popup_dozer_mode, (void*)2);
294 mRadioDozerSmooth = LLUICtrlFactory::getCheckBoxByName(this,"radio smooth");
295 childSetCommitCallback("radio smooth",click_popup_dozer_mode, (void*)3);
296 mRadioDozerNoise = LLUICtrlFactory::getCheckBoxByName(this,"radio noise");
297 childSetCommitCallback("radio noise",click_popup_dozer_mode, (void*)4);
298 mRadioDozerRevert = LLUICtrlFactory::getCheckBoxByName(this,"radio revert");
299 childSetCommitCallback("radio revert",click_popup_dozer_mode, (void*)5);
300 mComboDozerSize = LLUICtrlFactory::getComboBoxByName(this,"combobox brush size");
301 childSetCommitCallback("combobox brush size",click_dozer_size, (void*)0);
302 if(mComboDozerSize) mComboDozerSize->setCurrentByIndex(0);
303 mBtnApplyToSelection = LLUICtrlFactory::getButtonByName(this,"button apply to selection");
304 childSetAction("button apply to selection",click_apply_to_selection, (void*)0);
305 mCheckShowOwners = LLUICtrlFactory::getCheckBoxByName(this,"checkbox show owners");
306 childSetValue("checkbox show owners",gSavedSettings.getBOOL("ShowParcelOwners"));
307 childSetAction("button more", click_show_more, this);
308 childSetAction("button less", click_show_more, this);
309 mTab = LLUICtrlFactory::getTabContainerByName(this,"Object Info Tabs");
310 if(mTab)
311 {
312 mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") );
313 mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
314 mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") );
315 mTab->setBorderVisible(FALSE);
316 }
317 mTab->selectFirstTab();
318 return TRUE;
319}
320
321// Create the popupview with a dummy center. It will be moved into place
322// during LLViewerWindow's per-frame hover processing.
323LLFloaterTools::LLFloaterTools()
324: LLFloater("toolbox floater"),
325 mBtnFocus(NULL),
326 mBtnMove(NULL),
327 mBtnEdit(NULL),
328 mBtnCreate(NULL),
329 mBtnLand(NULL),
330 mTextStatus(NULL),
331
332 mRadioOrbit(NULL),
333 mRadioZoom(NULL),
334 mRadioPan(NULL),
335
336 mRadioMove(NULL),
337 mRadioLift(NULL),
338 mRadioSpin(NULL),
339
340 mRadioPosition(NULL),
341 mRadioRotate(NULL),
342 mRadioStretch(NULL),
343 mRadioSelectFace(NULL),
344 mCheckSelectIndividual(NULL),
345
346 mCheckSnapToGrid(NULL),
347 mBtnGridOptions(NULL),
348 mTextGridMode(NULL),
349 mComboGridMode(NULL),
350 mCheckStretchUniform(NULL),
351 mCheckStretchTexture(NULL),
352
353 mBtnRotateLeft(NULL),
354 mBtnRotateReset(NULL),
355 mBtnRotateRight(NULL),
356
357 mBtnDelete(NULL),
358 mBtnDuplicate(NULL),
359 mBtnDuplicateInPlace(NULL),
360
361 mCheckSticky(NULL),
362 mCheckCopySelection(NULL),
363 mCheckCopyCenters(NULL),
364 mCheckCopyRotates(NULL),
365 mRadioSelectLand(NULL),
366 mRadioDozerFlatten(NULL),
367 mRadioDozerRaise(NULL),
368 mRadioDozerLower(NULL),
369 mRadioDozerSmooth(NULL),
370 mRadioDozerNoise(NULL),
371 mRadioDozerRevert(NULL),
372 mComboDozerSize(NULL),
373 mBtnApplyToSelection(NULL),
374 mCheckShowOwners(NULL),
375
376
377 mTab(NULL),
378 mPanelPermissions(NULL),
379 mPanelObject(NULL),
380 mPanelVolume(NULL),
381 mPanelContents(NULL),
382 mPanelFace(NULL),
383 mPanelLandInfo(NULL),
384
385 mTabLand(NULL),
386 mDirty(TRUE),
387 mLastTool(gToolNull)
388{
389 mAutoFocus = FALSE;
390 LLCallbackMap::map_t factory_map;
391 factory_map["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions
392 factory_map["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject
393 factory_map["Features"] = LLCallbackMap(createPanelVolume, this);//LLPanelVolume
394 factory_map["Texture"] = LLCallbackMap(createPanelFace, this);//LLPanelFace
395 factory_map["Contents"] = LLCallbackMap(createPanelContents, this);//LLPanelContents
396 factory_map["ContentsInventory"] = LLCallbackMap(createPanelContentsInventory, this);//LLPanelContents
397 factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo
398
399 gUICtrlFactory->buildFloater(this,"floater_tools.xml",&factory_map);
400
401 mLargeHeight = getRect().getHeight();
402 mSmallHeight = mLargeHeight;
403 if (mTab) mSmallHeight -= mTab->getRect().getHeight();
404
405 gSavedSettings.setBOOL("ToolboxShowMore", TRUE); // force a toggle initially
406 showMore(FALSE);
407}
408
409LLFloaterTools::~LLFloaterTools()
410{
411 showMore(FALSE);
412 // children automatically deleted
413}
414
415void LLFloaterTools::setStatusText(const LLString& text)
416{
417 mTextStatus->setText(text);
418}
419
420void LLFloaterTools::refresh()
421{
422 const S32 INFO_WIDTH = mRect.getWidth();
423 const S32 INFO_HEIGHT = 384;
424 LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT);
425 BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME );
426
427 S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]);
428 S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]);
429 S32 idx_contents = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_CONTENTS]);
430
431 S32 selected_index = mTab->getCurrentPanelIndex();
432
433 if (!all_volume && (selected_index == idx_features || selected_index == idx_face ||
434 selected_index == idx_contents))
435 {
436 mTab->selectFirstTab();
437 }
438
439 mTab->enableTabButton(idx_features, all_volume);
440 mTab->enableTabButton(idx_face, all_volume);
441 mTab->enableTabButton(idx_contents, all_volume);
442
443 mPanelPermissions->refresh();
444 mPanelObject->refresh();
445 mPanelVolume->refresh();
446 mPanelFace->refresh();
447 mPanelContents->refresh();
448 mPanelLandInfo->refresh();
449}
450
451void LLFloaterTools::draw()
452{
453 if (mDirty)
454 {
455 refresh();
456 mDirty = FALSE;
457 }
458
459 mCheckSelectIndividual->set(!gSavedSettings.getBOOL("SelectLinkedSet"));
460 LLFloater::draw();
461}
462
463void LLFloaterTools::dirty()
464{
465 mDirty = TRUE;
466 LLFloaterOpenObject::dirty();
467}
468
469// Clean up any tool state that should not persist when the
470// floater is closed.
471void LLFloaterTools::resetToolState()
472{
473 gCameraBtnOrbit = FALSE;
474 gCameraBtnPan = FALSE;
475
476 gGrabBtnSpin = FALSE;
477 gGrabBtnVertical = FALSE;
478}
479
480void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
481{
482 LLTool *tool = gToolMgr->getCurrentTool( mask );
483
484 // HACK to allow seeing the buttons when you have the app in a window.
485 // Keep the visibility the same as it
486 if (tool == gToolNull)
487 {
488 return;
489 }
490
491 // Focus buttons
492 BOOL focus_visible = ( tool == gToolCamera );
493
494 mBtnFocus ->setToggleState( focus_visible );
495
496 mRadioZoom ->setVisible( focus_visible );
497 mRadioOrbit ->setVisible( focus_visible );
498 mRadioPan ->setVisible( focus_visible );
499 mSliderZoom ->setVisible( focus_visible );
500
501 mRadioZoom ->set( !gCameraBtnOrbit &&
502 !gCameraBtnPan &&
503 !(mask == MASK_ORBIT) &&
504 !(mask == (MASK_ORBIT | MASK_ALT)) &&
505 !(mask == MASK_PAN) &&
506 !(mask == (MASK_PAN | MASK_ALT)) );
507
508 mRadioOrbit ->set( gCameraBtnOrbit ||
509 (mask == MASK_ORBIT) ||
510 (mask == (MASK_ORBIT | MASK_ALT)) );
511
512 mRadioPan ->set( gCameraBtnPan ||
513 (mask == MASK_PAN) ||
514 (mask == (MASK_PAN | MASK_ALT)) );
515
516 // multiply by correction factor because volume sliders go [0, 0.5]
517 mSliderZoom ->setValue( gAgent.getCameraZoomFraction() * 0.5f);
518
519 // Move buttons
520 BOOL move_visible = (tool == gToolGrab);
521
522 if (mBtnMove) mBtnMove ->setToggleState( move_visible );
523
524 // HACK - highlight buttons for next click
525 if (mRadioMove)
526 {
527 mRadioMove ->setVisible( move_visible );
528 mRadioMove ->set( !gGrabBtnSpin &&
529 !gGrabBtnVertical &&
530 !(mask == MASK_VERTICAL) &&
531 !(mask == MASK_SPIN) );
532 }
533
534 if (mRadioLift)
535 {
536 mRadioLift ->setVisible( move_visible );
537 mRadioLift ->set( gGrabBtnVertical ||
538 (mask == MASK_VERTICAL) );
539 }
540
541 if (mRadioSpin)
542 {
543 mRadioSpin ->setVisible( move_visible );
544 mRadioSpin ->set( gGrabBtnSpin ||
545 (mask == MASK_SPIN) );
546 }
547
548 // Edit buttons
549 BOOL edit_visible = tool == gToolTranslate ||
550 tool == gToolRotate ||
551 tool == gToolStretch ||
552 tool == gToolFace ||
553 tool == gToolIndividual ||
554 tool == gToolPipette;
555
556 mBtnEdit ->setToggleState( edit_visible );
557
558 mRadioPosition ->setVisible( edit_visible );
559 mRadioRotate ->setVisible( edit_visible );
560 mRadioStretch ->setVisible( edit_visible );
561 if (mRadioSelectFace)
562 {
563 mRadioSelectFace->setVisible( edit_visible );
564 mRadioSelectFace->set( tool == gToolFace );
565 }
566
567 if (mCheckSelectIndividual)
568 {
569 mCheckSelectIndividual->setVisible(edit_visible);
570 mCheckSelectIndividual->set(!gSavedSettings.getBOOL("SelectLinkedSet"));
571 }
572
573 mRadioPosition ->set( tool == gToolTranslate );
574 mRadioRotate ->set( tool == gToolRotate );
575 mRadioStretch ->set( tool == gToolStretch );
576
577 if (mComboGridMode)
578 {
579 mComboGridMode ->setVisible( edit_visible );
580 S32 index = mComboGridMode->getCurrentIndex();
581 mComboGridMode->removeall();
582
583 switch (gSelectMgr->getSelectType())
584 {
585 case SELECT_TYPE_HUD:
586 mComboGridMode->add("Screen");
587 mComboGridMode->add("Local");
588 //mComboGridMode->add("Reference");
589 break;
590 case SELECT_TYPE_WORLD:
591 mComboGridMode->add("World");
592 mComboGridMode->add("Local");
593 mComboGridMode->add("Reference");
594 break;
595 case SELECT_TYPE_ATTACHMENT:
596 mComboGridMode->add("Attachment");
597 mComboGridMode->add("Local");
598 mComboGridMode->add("Reference");
599 break;
600 }
601
602 mComboGridMode->setCurrentByIndex(index);
603 }
604 if (mTextGridMode) mTextGridMode->setVisible( edit_visible );
605
606 // Snap to grid disabled for grab tool - very confusing
607 if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == gToolGrab */ );
608 if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == gToolGrab */ );
609
610 //mCheckSelectLinked ->setVisible( edit_visible );
611 if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible );
612 if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible );
613
614 // Create buttons
615 BOOL create_visible = (tool == gToolCreate);
616
617 mBtnCreate ->setToggleState( tool == gToolCreate );
618
619 if (mCheckCopySelection
620 && mCheckCopySelection->get())
621 {
622 // don't highlight any placer button
623 for (std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++)
624 {
625 mButtons[i]->setToggleState(FALSE);
626 mButtons[i]->setVisible( create_visible );
627 }
628 }
629 else
630 {
631 // Highlight the correct placer button
632 for( std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++ )
633 {
634 LLPCode pcode = LLToolPlacer::getObjectType();
635 void *userdata = mButtons[i]->getCallbackUserData();
636 LLPCode *cur = (LLPCode*) userdata;
637
638 BOOL state = (pcode == *cur);
639 mButtons[i]->setToggleState( state );
640 mButtons[i]->setVisible( create_visible );
641 }
642 }
643
644 if (mCheckSticky) mCheckSticky ->setVisible( create_visible );
645 if (mCheckCopySelection) mCheckCopySelection ->setVisible( create_visible );
646 if (mCheckCopyCenters) mCheckCopyCenters ->setVisible( create_visible );
647 if (mCheckCopyRotates) mCheckCopyRotates ->setVisible( create_visible );
648
649 if (mCheckCopyCenters) mCheckCopyCenters->setEnabled( mCheckCopySelection->get() );
650 if (mCheckCopyRotates) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() );
651
652 // Land buttons
653 BOOL land_visible = (tool == gToolLand || tool == gToolParcel );
654
655 if (mBtnLand) mBtnLand ->setToggleState( land_visible );
656
657 // mRadioEditLand ->set( tool == gToolLand );
658 if (mRadioSelectLand) mRadioSelectLand->set( tool == gToolParcel );
659
660 // mRadioEditLand ->setVisible( land_visible );
661 if (mRadioSelectLand) mRadioSelectLand->setVisible( land_visible );
662
663 S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction");
664 S32 dozer_size = gSavedSettings.getS32("RadioLandBrushSize");
665
666 if (mRadioDozerFlatten)
667 {
668 mRadioDozerFlatten ->set( tool == gToolLand && dozer_mode == 0);
669 mRadioDozerFlatten ->setVisible( land_visible );
670 }
671 if (mRadioDozerRaise)
672 {
673 mRadioDozerRaise ->set( tool == gToolLand && dozer_mode == 1);
674 mRadioDozerRaise ->setVisible( land_visible );
675 }
676 if (mRadioDozerLower)
677 {
678 mRadioDozerLower ->set( tool == gToolLand && dozer_mode == 2);
679 mRadioDozerLower ->setVisible( land_visible );
680 }
681 if (mRadioDozerSmooth)
682 {
683 mRadioDozerSmooth ->set( tool == gToolLand && dozer_mode == 3);
684 mRadioDozerSmooth ->setVisible( land_visible );
685 }
686 if (mRadioDozerNoise)
687 {
688 mRadioDozerNoise ->set( tool == gToolLand && dozer_mode == 4);
689 mRadioDozerNoise ->setVisible( land_visible );
690 }
691 if (mRadioDozerRevert)
692 {
693 mRadioDozerRevert ->set( tool == gToolLand && dozer_mode == 5);
694 mRadioDozerRevert ->setVisible( land_visible );
695 }
696 if (mComboDozerSize)
697 {
698 mComboDozerSize ->setCurrentByIndex(dozer_size);
699 mComboDozerSize ->setVisible( land_visible );
700 mComboDozerSize ->setEnabled( tool == gToolLand );
701 }
702 if (mBtnApplyToSelection)
703 {
704 mBtnApplyToSelection->setVisible( land_visible );
705 mBtnApplyToSelection->setEnabled( land_visible && !gParcelMgr->selectionEmpty() && tool != gToolParcel);
706 }
707 if (mCheckShowOwners)
708 {
709 mCheckShowOwners ->setVisible( land_visible );
710 }
711
712 //
713 // More panel visibility
714 //
715 BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore");
716
717 mTab->setVisible(show_more && tool != gToolLand && tool != gToolParcel);
718 mPanelLandInfo->setVisible(show_more && (tool == gToolLand || tool == gToolParcel));
719}
720
721
722// virtual
723BOOL LLFloaterTools::canClose()
724{
725 // don't close when quitting, so camera will stay put
726 return !gQuit;
727}
728
729// virtual
730void LLFloaterTools::onClose(bool app_quitting)
731{
732 setMinimized(FALSE);
733 setVisible(FALSE);
734 mTab->setVisible(FALSE);
735
736 // Different from handle_reset_view in that it doesn't actually
737 // move the camera if EditCameraMovement is not set.
738 gAgent.resetView(gSavedSettings.getBOOL("EditCameraMovement"));
739
740 // exit component selection mode
741 gSelectMgr->promoteSelectionToRoot();
742 gSavedSettings.setBOOL("SelectLinkedSet", TRUE);
743
744 gViewerWindow->showCursor();
745
746 resetToolState();
747
748 // Switch back to basic toolset
749 gCurrentToolset = gBasicToolset;
750 gBasicToolset->selectFirstTool();
751 gToolMgr->useSelectedTool( gBasicToolset );
752}
753
754void LLFloaterTools::showMore(BOOL show_more)
755{
756 BOOL showing_more = gSavedSettings.getBOOL("ToolboxShowMore");
757 if (show_more == showing_more)
758 {
759 return;
760 }
761
762 gSavedSettings.setBOOL("ToolboxShowMore", show_more);
763
764 // Visibility updated next frame - JC
765 // mTab->setVisible(show_more);
766
767 if (show_more)
768 {
769 reshape( mRect.getWidth(), mLargeHeight, TRUE);
770 translate( 0, mSmallHeight - mLargeHeight );
771 childSetVisible("button less", true);
772 childSetVisible("button more", false);
773 }
774 else
775 {
776 reshape( mRect.getWidth(), mSmallHeight, TRUE);
777 translate( 0, mLargeHeight - mSmallHeight );
778 childSetVisible("button less", false);
779 childSetVisible("button more", true);
780 }
781}
782
783void LLFloaterTools::showPanel(EInfoPanel panel)
784{
785 llassert(panel >= 0 && panel < PANEL_COUNT);
786 mTab->selectTabByName(PANEL_NAMES[panel]);
787 showMore(TRUE);
788}
789
790void click_show_more(void *userdata)
791{
792 LLFloaterTools *f = (LLFloaterTools *)userdata;
793 BOOL show_more = !gSavedSettings.getBOOL("ToolboxShowMore");
794 f->showMore( show_more );
795}
796
797void click_popup_info(void*)
798{
799// gBuildView->setPropertiesPanelOpen(TRUE);
800}
801
802void click_popup_done(void*)
803{
804 handle_reset_view();
805}
806
807void click_popup_grab_drag(LLUICtrl*, void*)
808{
809 gGrabBtnVertical = FALSE;
810 gGrabBtnSpin = FALSE;
811}
812
813void click_popup_grab_lift(LLUICtrl*, void*)
814{
815 gGrabBtnVertical = TRUE;
816 gGrabBtnSpin = FALSE;
817}
818
819void click_popup_grab_spin(LLUICtrl*, void*)
820{
821 gGrabBtnVertical = FALSE;
822 gGrabBtnSpin = TRUE;
823}
824
825void commit_radio_zoom(LLUICtrl *, void*)
826{
827 gCameraBtnOrbit = FALSE;
828 gCameraBtnPan = FALSE;
829}
830
831void commit_radio_orbit(LLUICtrl *, void*)
832{
833 gCameraBtnOrbit = TRUE;
834 gCameraBtnPan = FALSE;
835}
836
837void commit_radio_pan(LLUICtrl *, void*)
838{
839 gCameraBtnOrbit = FALSE;
840 gCameraBtnPan = TRUE;
841}
842
843void commit_slider_zoom(LLUICtrl *ctrl, void*)
844{
845 LLVolumeSliderCtrl* slider = (LLVolumeSliderCtrl*)ctrl;
846 // renormalize value, since max "volume" level is 0.5 for some reason
847 F32 zoom_level = (F32)slider->getValue().asReal() * 2.f; // / 0.5f;
848 gAgent.setCameraZoomFraction(zoom_level);
849}
850
851void click_popup_rotate_left(void*)
852{
853 gSelectMgr->selectionRotateAroundZ( 45.f );
854 dialog_refresh_all();
855}
856
857void click_popup_rotate_reset(void*)
858{
859 gSelectMgr->selectionResetRotation();
860 dialog_refresh_all();
861}
862
863void click_popup_rotate_right(void*)
864{
865 gSelectMgr->selectionRotateAroundZ( -45.f );
866 dialog_refresh_all();
867}
868
869
870void click_popup_dozer_mode(LLUICtrl *, void *user)
871{
872 S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners");
873 S32 mode = (S32)(intptr_t) user;
874 gFloaterTools->setEditTool( gToolLand );
875 gSavedSettings.setS32("RadioLandBrushAction", mode);
876 gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
877}
878
879void click_popup_dozer_size(LLUICtrl *, void *user)
880{
881 S32 size = (S32)(intptr_t) user;
882 gSavedSettings.setS32("RadioLandBrushSize", size);
883}
884
885void click_dozer_size(LLUICtrl *ctrl, void *user)
886{
887 S32 size = ((LLComboBox*) ctrl)->getCurrentIndex();
888 gSavedSettings.setS32("RadioLandBrushSize", size);
889}
890
891void click_apply_to_selection(void* user)
892{
893 gToolLand->modifyLandInSelectionGlobal();
894}
895
896void commit_select_tool(LLUICtrl *ctrl, void *data)
897{
898 S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners");
899 gFloaterTools->setEditTool(data);
900 gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
901}
902
903void commit_select_component(LLUICtrl *ctrl, void *data)
904{
905 LLFloaterTools* floaterp = (LLFloaterTools*)data;
906
907 //forfeit focus
908 if (gFocusMgr.childHasKeyboardFocus(floaterp))
909 {
910 gFocusMgr.setKeyboardFocus(NULL, NULL);
911 }
912
913 BOOL select_individuals = floaterp->mCheckSelectIndividual->get();
914 gSavedSettings.setBOOL("SelectLinkedSet", !select_individuals);
915 floaterp->dirty();
916
917 if (select_individuals)
918 {
919 gSelectMgr->demoteSelectionToIndividuals();
920 }
921 else
922 {
923 gSelectMgr->promoteSelectionToRoot();
924 }
925}
926
927void commit_grid_mode(LLUICtrl *ctrl, void *data)
928{
929 LLComboBox* combo = (LLComboBox*)ctrl;
930
931 gSelectMgr->setGridMode((EGridMode)combo->getCurrentIndex());
932}
933
934// static
935void LLFloaterTools::setObjectType( void* data )
936{
937 LLPCode pcode = *(LLPCode*) data;
938 LLToolPlacer::setObjectType( pcode );
939 gSavedSettings.setBOOL("CreateToolCopySelection", FALSE);
940 gViewerWindow->setMouseCapture(NULL, NULL);
941}
942
943// static
944void LLFloaterTools::onClickGridOptions(void* data)
945{
946 //LLFloaterTools* floaterp = (LLFloaterTools*)data;
947 LLFloaterBuildOptions::show(NULL);
948 // RN: this makes grid options dependent on build tools window
949 //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE);
950}
951
952void LLFloaterTools::saveLastTool()
953{
954 mLastTool = gToolMgr->getCurrentTool( MASK_NONE );
955}
956
957void LLFloaterTools::setEditTool(void* tool_pointer)
958{
959 select_tool(tool_pointer);
960 if(gFloaterTools && tool_pointer != gToolNull)
961 {
962 gFloaterTools->saveLastTool();
963 }
964}
965
966void LLFloaterTools::onFocusReceived()
967{
968 select_tool(mLastTool);
969} \ No newline at end of file