PageRenderTime 245ms CodeModel.GetById 121ms app.highlight 8ms RepoModel.GetById 113ms app.codeStats 0ms

/indra/newview/llfloaterbuildoptions.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 114 lines | 62 code | 18 blank | 34 comment | 2 complexity | eadaae5ed0aa7322b2ed274d1cd3cb28 MD5 | raw file
  1/** 
  2 * @file llfloaterbuildoptions.cpp
  3 * @brief LLFloaterBuildOptions class implementation
  4 *
  5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27/**
 28 * Panel for setting global object-editing options, specifically
 29 * grid size and spacing.
 30 */ 
 31
 32#include "llviewerprecompiledheaders.h"
 33
 34#include "llfloaterbuildoptions.h"
 35#include "lluictrlfactory.h"
 36
 37#include "llcombobox.h"
 38#include "llselectmgr.h"
 39
 40//
 41// Methods
 42//
 43
 44void commit_grid_mode(LLUICtrl *);
 45
 46LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key)
 47  : LLFloater(key),
 48    mComboGridMode(NULL)
 49{
 50	mCommitCallbackRegistrar.add("GridOptions.gridMode", boost::bind(&commit_grid_mode,_1));
 51}
 52
 53LLFloaterBuildOptions::~LLFloaterBuildOptions()
 54{}
 55
 56BOOL LLFloaterBuildOptions::postBuild()
 57{
 58	mComboGridMode = getChild<LLComboBox>("combobox grid mode");
 59
 60	return TRUE;
 61}
 62
 63void LLFloaterBuildOptions::setGridMode(EGridMode mode)
 64{
 65	mComboGridMode->setCurrentByIndex((S32)mode);
 66}
 67
 68void LLFloaterBuildOptions::updateGridMode()
 69{
 70	if (mComboGridMode)
 71	{
 72		S32 index = mComboGridMode->getCurrentIndex();
 73		mComboGridMode->removeall();
 74
 75		switch (mObjectSelection->getSelectType())
 76		{
 77		case SELECT_TYPE_HUD:
 78		  mComboGridMode->add(getString("grid_screen_text"));
 79		  mComboGridMode->add(getString("grid_local_text"));
 80		  break;
 81		case SELECT_TYPE_WORLD:
 82		  mComboGridMode->add(getString("grid_world_text"));
 83		  mComboGridMode->add(getString("grid_local_text"));
 84		  mComboGridMode->add(getString("grid_reference_text"));
 85		  break;
 86		case SELECT_TYPE_ATTACHMENT:
 87		  mComboGridMode->add(getString("grid_attachment_text"));
 88		  mComboGridMode->add(getString("grid_local_text"));
 89		  mComboGridMode->add(getString("grid_reference_text"));
 90		  break;
 91		}
 92
 93		mComboGridMode->setCurrentByIndex(index);
 94	}
 95}
 96
 97// virtual
 98void LLFloaterBuildOptions::onOpen(const LLSD& key)
 99{
100	mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
101}
102
103// virtual
104void LLFloaterBuildOptions::onClose(bool app_quitting)
105{
106	mObjectSelection = NULL;
107}
108
109void commit_grid_mode(LLUICtrl *ctrl)
110{
111	LLComboBox* combo = (LLComboBox*)ctrl;
112
113	LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
114}