PageRenderTime 81ms CodeModel.GetById 0ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. * Panel for setting global object-editing options, specifically
  28. * grid size and spacing.
  29. */
  30. #include "llviewerprecompiledheaders.h"
  31. #include "llfloaterbuildoptions.h"
  32. #include "lluictrlfactory.h"
  33. #include "llcombobox.h"
  34. #include "llselectmgr.h"
  35. //
  36. // Methods
  37. //
  38. void commit_grid_mode(LLUICtrl *);
  39. LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key)
  40. : LLFloater(key),
  41. mComboGridMode(NULL)
  42. {
  43. mCommitCallbackRegistrar.add("GridOptions.gridMode", boost::bind(&commit_grid_mode,_1));
  44. }
  45. LLFloaterBuildOptions::~LLFloaterBuildOptions()
  46. {}
  47. BOOL LLFloaterBuildOptions::postBuild()
  48. {
  49. mComboGridMode = getChild<LLComboBox>("combobox grid mode");
  50. return TRUE;
  51. }
  52. void LLFloaterBuildOptions::setGridMode(EGridMode mode)
  53. {
  54. mComboGridMode->setCurrentByIndex((S32)mode);
  55. }
  56. void LLFloaterBuildOptions::updateGridMode()
  57. {
  58. if (mComboGridMode)
  59. {
  60. S32 index = mComboGridMode->getCurrentIndex();
  61. mComboGridMode->removeall();
  62. switch (mObjectSelection->getSelectType())
  63. {
  64. case SELECT_TYPE_HUD:
  65. mComboGridMode->add(getString("grid_screen_text"));
  66. mComboGridMode->add(getString("grid_local_text"));
  67. break;
  68. case SELECT_TYPE_WORLD:
  69. mComboGridMode->add(getString("grid_world_text"));
  70. mComboGridMode->add(getString("grid_local_text"));
  71. mComboGridMode->add(getString("grid_reference_text"));
  72. break;
  73. case SELECT_TYPE_ATTACHMENT:
  74. mComboGridMode->add(getString("grid_attachment_text"));
  75. mComboGridMode->add(getString("grid_local_text"));
  76. mComboGridMode->add(getString("grid_reference_text"));
  77. break;
  78. }
  79. mComboGridMode->setCurrentByIndex(index);
  80. }
  81. }
  82. // virtual
  83. void LLFloaterBuildOptions::onOpen(const LLSD& key)
  84. {
  85. mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
  86. }
  87. // virtual
  88. void LLFloaterBuildOptions::onClose(bool app_quitting)
  89. {
  90. mObjectSelection = NULL;
  91. }
  92. void commit_grid_mode(LLUICtrl *ctrl)
  93. {
  94. LLComboBox* combo = (LLComboBox*)ctrl;
  95. LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
  96. }