PageRenderTime 31ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/lltoolmgr.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 124 lines | 67 code | 26 blank | 31 comment | 0 complexity | bafe8c5096f826db8e49b7e908fb412e MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltoolmgr.h
  3. * @brief LLToolMgr class header file
  4. *
  5. * $LicenseInfo:firstyear=2001&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. #ifndef LL_TOOLMGR_H
  27. #define LL_TOOLMGR_H
  28. #include "llkeyboard.h"
  29. class LLTool;
  30. class LLToolset;
  31. // Key bindings for common operations
  32. const MASK MASK_VERTICAL = MASK_CONTROL;
  33. const MASK MASK_SPIN = MASK_CONTROL | MASK_SHIFT;
  34. const MASK MASK_ZOOM = MASK_NONE;
  35. const MASK MASK_ORBIT = MASK_CONTROL;
  36. const MASK MASK_PAN = MASK_CONTROL | MASK_SHIFT;
  37. const MASK MASK_COPY = MASK_SHIFT;
  38. class LLToolMgr : public LLSingleton<LLToolMgr>
  39. {
  40. public:
  41. LLToolMgr();
  42. ~LLToolMgr();
  43. // Must be called after gSavedSettings set up.
  44. void initTools();
  45. LLTool* getCurrentTool(); // returns active tool, taking into account keyboard state
  46. LLTool* getBaseTool(); // returns active tool when overrides are deactivated
  47. bool inEdit();
  48. bool canEdit();
  49. void toggleBuildMode();
  50. /* Determines if we are in Build mode or not. */
  51. bool inBuildMode();
  52. void setTransientTool(LLTool* tool);
  53. void clearTransientTool();
  54. BOOL usingTransientTool();
  55. void setCurrentToolset(LLToolset* current);
  56. LLToolset* getCurrentToolset();
  57. void onAppFocusGained();
  58. void onAppFocusLost();
  59. void clearSavedTool();
  60. protected:
  61. friend class LLToolset; // to allow access to setCurrentTool();
  62. void setCurrentTool(LLTool* tool);
  63. void updateToolStatus();
  64. protected:
  65. LLTool* mBaseTool;
  66. LLTool* mSavedTool; // The current tool at the time application focus was lost.
  67. LLTool* mTransientTool;
  68. LLTool* mOverrideTool; // Tool triggered by keyboard override
  69. LLTool* mSelectedTool; // last known active tool
  70. LLToolset* mCurrentToolset;
  71. };
  72. // Sets of tools for various modes
  73. class LLToolset
  74. {
  75. public:
  76. LLToolset() : mSelectedTool(NULL) {}
  77. LLTool* getSelectedTool() { return mSelectedTool; }
  78. void addTool(LLTool* tool);
  79. void selectTool( LLTool* tool );
  80. void selectToolByIndex( S32 index );
  81. void selectFirstTool();
  82. void selectNextTool();
  83. void selectPrevTool();
  84. void handleScrollWheel(S32 clicks);
  85. BOOL isToolSelected( S32 index );
  86. protected:
  87. LLTool* mSelectedTool;
  88. typedef std::vector<LLTool*> tool_list_t;
  89. tool_list_t mToolList;
  90. };
  91. // Globals
  92. extern LLToolset* gBasicToolset;
  93. extern LLToolset *gCameraToolset;
  94. //extern LLToolset *gLandToolset;
  95. extern LLToolset* gMouselookToolset;
  96. extern LLToolset* gFaceEditToolset;
  97. extern LLTool* gToolNull;
  98. #endif