PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llfloatereditdaycycle.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 137 lines | 73 code | 28 blank | 36 comment | 0 complexity | f68e7981fd1092eed49a739cc885f9b6 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llfloatereditdaycycle.h
  3. * @brief Floater to create or edit a day cycle
  4. *
  5. * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2011, 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_LLFLOATEREDITDAYCYCLE_H
  27. #define LL_LLFLOATEREDITDAYCYCLE_H
  28. #include "llfloater.h"
  29. #include "llwlparammanager.h" // for LLWLParamKey
  30. class LLCheckBoxCtrl;
  31. class LLComboBox;
  32. class LLLineEditor;
  33. class LLMultiSliderCtrl;
  34. class LLTimeCtrl;
  35. /**
  36. * Floater for creating or editing a day cycle.
  37. */
  38. class LLFloaterEditDayCycle : public LLFloater
  39. {
  40. LOG_CLASS(LLFloaterEditDayCycle);
  41. public:
  42. LLFloaterEditDayCycle(const LLSD &key);
  43. /*virtual*/ BOOL postBuild();
  44. /*virtual*/ void onOpen(const LLSD& key);
  45. /*virtual*/ void onClose(bool app_quitting);
  46. /*virtual*/ void draw();
  47. private:
  48. /// sync the time slider with day cycle structure
  49. void syncTimeSlider();
  50. // makes sure key slider has what's in day cycle
  51. void loadTrack();
  52. /// makes sure day cycle data structure has what's in menu
  53. void applyTrack();
  54. /// refresh the sky presets combobox
  55. void refreshSkyPresetsList();
  56. /// refresh the day cycle combobox
  57. void refreshDayCyclesList();
  58. /// add a slider to the track
  59. void addSliderKey(F32 time, LLWLParamKey keyframe);
  60. void initCallbacks();
  61. LLWLParamKey getSelectedDayCycle();
  62. bool isNewDay() const;
  63. void dumpTrack();
  64. void enableEditing(bool enable);
  65. void reset();
  66. void saveRegionDayCycle();
  67. void setApplyProgress(bool started);
  68. bool getApplyProgress() const;
  69. void onTimeSliderMoved(); /// time slider moved
  70. void onKeyTimeMoved(); /// a key frame moved
  71. void onKeyTimeChanged(); /// a key frame's time changed
  72. void onKeyPresetChanged(); /// sky preset selected
  73. void onAddKey(); /// new key added on slider
  74. void onDeleteKey(); /// a key frame deleted
  75. void onRegionSettingsChange();
  76. void onRegionChange();
  77. void onRegionSettingsApplied(bool success);
  78. void onRegionInfoUpdate();
  79. void onDayCycleNameEdited();
  80. void onDayCycleSelected();
  81. void onBtnSave();
  82. void onBtnCancel();
  83. bool onSaveAnswer(const LLSD& notification, const LLSD& response);
  84. void onSaveConfirmed();
  85. void onDayCycleListChange();
  86. void onSkyPresetListChange();
  87. static std::string getRegionName();
  88. /// convenience class for holding keyframes mapped to sliders
  89. struct SliderKey
  90. {
  91. public:
  92. SliderKey(LLWLParamKey kf, F32 t) : keyframe(kf), time(t) {}
  93. SliderKey() : keyframe(), time(0.f) {} // Don't use this default constructor
  94. LLWLParamKey keyframe;
  95. F32 time;
  96. };
  97. static const F32 sHoursPerDay;
  98. LLLineEditor* mDayCycleNameEditor;
  99. LLComboBox* mDayCyclesCombo;
  100. LLMultiSliderCtrl* mTimeSlider;
  101. LLMultiSliderCtrl* mKeysSlider;
  102. LLComboBox* mSkyPresetsCombo;
  103. LLTimeCtrl* mTimeCtrl;
  104. LLCheckBoxCtrl* mMakeDefaultCheckBox;
  105. LLButton* mSaveButton;
  106. // map of sliders to parameters
  107. std::map<std::string, SliderKey> mSliderToKey;
  108. };
  109. #endif // LL_LLFLOATEREDITDAYCYCLE_H