Annotation of /trunk/linden/indra/newview/lltoolindividual.cpp
Parent Directory
|
Revision Log
Revision 61 - (view) (download)
| 1 : | mjm | 57 | /** |
| 2 : | * @file lltoolindividual.cpp | ||
| 3 : | * @brief LLToolIndividual class implementation | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | * Copyright (c) 2002-2008, Linden Research, Inc. | ||
| 8 : | * | ||
| 9 : | * Second Life Viewer Source Code | ||
| 10 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 11 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 12 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 13 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 14 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 15 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 16 : | * | ||
| 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 | ||
| 19 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 20 : | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 21 : | * | ||
| 22 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 23 : | * that you have read and understood your obligations described above, | ||
| 24 : | * and agree to abide by those obligations. | ||
| 25 : | * | ||
| 26 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 27 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 28 : | * COMPLETENESS OR PERFORMANCE. | ||
| 29 : | * $/LicenseInfo$ | ||
| 30 : | */ | ||
| 31 : | |||
| 32 : | //***************************************************************************** | ||
| 33 : | // | ||
| 34 : | // This is a tool for selecting individual object from the | ||
| 35 : | // toolbox. Handy for when you want to deal with child object | ||
| 36 : | // inventory... | ||
| 37 : | // | ||
| 38 : | //***************************************************************************** | ||
| 39 : | |||
| 40 : | #include "llviewerprecompiledheaders.h" | ||
| 41 : | #include "lltoolindividual.h" | ||
| 42 : | |||
| 43 : | #include "llselectmgr.h" | ||
| 44 : | #include "llviewerobject.h" | ||
| 45 : | #include "llviewerwindow.h" | ||
| 46 : | #include "llfloatertools.h" | ||
| 47 : | |||
| 48 : | ///---------------------------------------------------------------------------- | ||
| 49 : | /// Globals | ||
| 50 : | ///---------------------------------------------------------------------------- | ||
| 51 : | |||
| 52 : | |||
| 53 : | ///---------------------------------------------------------------------------- | ||
| 54 : | /// Local function declarations, constants, enums, and typedefs | ||
| 55 : | ///---------------------------------------------------------------------------- | ||
| 56 : | |||
| 57 : | |||
| 58 : | ///---------------------------------------------------------------------------- | ||
| 59 : | /// Class LLToolIndividual | ||
| 60 : | ///---------------------------------------------------------------------------- | ||
| 61 : | |||
| 62 : | // Default constructor | ||
| 63 : | LLToolIndividual::LLToolIndividual() | ||
| 64 : | : LLTool(std::string("Individual")) | ||
| 65 : | { | ||
| 66 : | } | ||
| 67 : | |||
| 68 : | // Destroys the object | ||
| 69 : | LLToolIndividual::~LLToolIndividual() | ||
| 70 : | { | ||
| 71 : | } | ||
| 72 : | |||
| 73 : | BOOL LLToolIndividual::handleMouseDown(S32 x, S32 y, MASK mask) | ||
| 74 : | { | ||
| 75 : | gViewerWindow->pickAsync(x, y, mask, pickCallback); | ||
| 76 : | return TRUE; | ||
| 77 : | } | ||
| 78 : | |||
| 79 : | void LLToolIndividual::pickCallback(const LLPickInfo& pick_info) | ||
| 80 : | { | ||
| 81 : | LLViewerObject* obj = pick_info.getObject(); | ||
| 82 : | LLSelectMgr::getInstance()->deselectAll(); | ||
| 83 : | if(obj) | ||
| 84 : | { | ||
| 85 : | LLSelectMgr::getInstance()->selectObjectOnly(obj); | ||
| 86 : | } | ||
| 87 : | } | ||
| 88 : | |||
| 89 : | BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask) | ||
| 90 : | { | ||
| 91 : | if(!LLSelectMgr::getInstance()->getSelection()->isEmpty()) | ||
| 92 : | { | ||
| 93 : | // You should already have an object selected from the mousedown. | ||
| 94 : | // If so, show its inventory. | ||
| 95 : | //gBuildView->showInventoryPanel(); | ||
| 96 : | //gBuildView->showPanel(LLBuildView::PANEL_CONTENTS); | ||
| 97 : | gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); | ||
| 98 : | return TRUE; | ||
| 99 : | } | ||
| 100 : | else | ||
| 101 : | { | ||
| 102 : | // Nothing selected means the first mouse click was probably | ||
| 103 : | // bad, so try again. | ||
| 104 : | return FALSE; | ||
| 105 : | } | ||
| 106 : | } | ||
| 107 : | |||
| 108 : | void LLToolIndividual::handleSelect() | ||
| 109 : | { | ||
| 110 : | const BOOL children_ok = TRUE; | ||
| 111 : | LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); | ||
| 112 : | LLSelectMgr::getInstance()->deselectAll(); | ||
| 113 : | if(obj) | ||
| 114 : | { | ||
| 115 : | LLSelectMgr::getInstance()->selectObjectOnly(obj); | ||
| 116 : | } | ||
| 117 : | } | ||
| 118 : | |||
| 119 : | ///---------------------------------------------------------------------------- | ||
| 120 : | /// Local function definitions | ||
| 121 : | ///---------------------------------------------------------------------------- |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

