llprefsinput.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. /**
  2. * @file llprefsinput.cpp
  3. * @brief Input preferences panel
  4. *
  5. * $LicenseInfo:firstyear=2004&license=viewergpl$
  6. *
  7. * Adapted by Henri Beauchamp from llpanelinput.cpp
  8. * Copyright (c) 2004-2009 Linden Research, Inc. (c) 2011 Henri Beauchamp
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #include "llviewerprecompiledheaders.h"
  34. #include "llprefsinput.h"
  35. #include "llbutton.h"
  36. #include "llcheckboxctrl.h"
  37. #include "llnotifications.h"
  38. #include "llsliderctrl.h"
  39. #include "llspinctrl.h"
  40. #include "lltabcontainer.h"
  41. #include "lluictrlfactory.h"
  42. #include "llfloaterjoystick.h"
  43. #include "llviewercamera.h"
  44. #include "llviewercontrol.h"
  45. class LLPrefsInputImpl final : public LLPanel
  46. {
  47. public:
  48. LLPrefsInputImpl();
  49. ~LLPrefsInputImpl() override {}
  50. void refresh() override;
  51. void draw() override;
  52. void apply();
  53. void cancel();
  54. private:
  55. static void onTabChanged(void* data, bool from_click);
  56. static void onClickJoystickSetup(void* data);
  57. static void onClickResetToDefault(void* data);
  58. static void onCommitCheckPrivateLookAt(LLUICtrl* ctrl, void* user_data);
  59. static void onCommitCheckPrivatePointAt(LLUICtrl* ctrl, void* user_data);
  60. static void onCommitCheckLimitSelectDistance(LLUICtrl* ctrl, void* data);
  61. static void onCommitRadioDoubleClickAction(LLUICtrl* ctrl, void* data);
  62. static void onRearOffsetAdjust(LLUICtrl* ctrl, void* data);
  63. static void onFrontOffsetAdjust(LLUICtrl* ctrl, void* data);
  64. static void onCommitCheckNoJoystick(LLUICtrl* ctrl, void* user_data);
  65. void refreshValues();
  66. private:
  67. static bool sDirty;
  68. LLTabContainer* mTabContainer;
  69. LLSpinCtrl* mSpinRearX;
  70. LLSpinCtrl* mSpinRearY;
  71. LLSpinCtrl* mSpinRearZ;
  72. LLSpinCtrl* mSpinFrontX;
  73. LLSpinCtrl* mSpinFrontY;
  74. LLSpinCtrl* mSpinFrontZ;
  75. LLButton* mJoystickButton;
  76. F32 mMouseSensitivity;
  77. F32 mMaxSelectDistance;
  78. F32 mCameraAngle;
  79. F32 mCameraOffsetScale;
  80. U32 mCameraToPelvisRotDeviation;
  81. U32 mPrivateLookAtLimit;
  82. U32 mPrivatePointAtLimit;
  83. U32 mDoubleClickAction;
  84. LLVector3 mCameraOffsetDefault;
  85. LLVector3 mCameraOffsetFrontView;
  86. bool mDoubleClickScriptedObject;
  87. bool mJoystickNeverEnable;
  88. bool mMouseSmooth;
  89. bool mPrivateLookAt;
  90. bool mPrivatePointAt;
  91. bool mLimitSelectDistance;
  92. bool mInvertMouse;
  93. bool mShowCrosshairs;
  94. bool mFirstPersonAvatarVisible;
  95. bool mMouselookRenderRigged;
  96. bool mCameraIgnoreCollisions;
  97. bool mDisableCameraConstraints;
  98. bool mResetViewRotatesAvatar;
  99. bool mEditCameraMovement;
  100. bool mAppearanceCameraMovement;
  101. bool mThumbnailSnapshotFrontView;
  102. bool mSitCameraFrontView;
  103. bool mAutomaticFly;
  104. bool mArrowKeysMoveAvatar;
  105. bool mMouseLookUseRotDeviation;
  106. bool mEyesFollowMousePointer;
  107. bool mLeftClickSteersAvatar;
  108. bool mLeftClickToOpen;
  109. bool mLeftClickToPay;
  110. bool mLeftClickToPlay;
  111. bool mLeftClickToSit;
  112. bool mLeftClickToZoom;
  113. bool mFirstRun;
  114. };
  115. bool LLPrefsInputImpl::sDirty = false;
  116. LLPrefsInputImpl::LLPrefsInputImpl()
  117. : LLPanel(std::string("Input and Camera Preferences")),
  118. mFirstRun(true)
  119. {
  120. LLUICtrlFactory::getInstance()->buildPanel(this,
  121. "panel_preferences_input.xml");
  122. mTabContainer = getChild<LLTabContainer>("Input and Camera");
  123. LLPanel* tab = mTabContainer->getChild<LLPanel>("Input Controls");
  124. mTabContainer->setTabChangeCallback(tab, onTabChanged);
  125. mTabContainer->setTabUserData(tab, this);
  126. tab = mTabContainer->getChild<LLPanel>("Camera Controls");
  127. mTabContainer->setTabChangeCallback(tab, onTabChanged);
  128. mTabContainer->setTabUserData(tab, this);
  129. mJoystickButton = getChild<LLButton>("joystick_setup_button");
  130. mJoystickButton->setClickedCallback(onClickJoystickSetup, this);
  131. childSetAction("mouse_sensitivity_reset_button", onClickResetToDefault,
  132. (void*)"MouseSensitivity");
  133. childSetAction("camera_angle_reset_button", onClickResetToDefault,
  134. (void*)"CameraAngle");
  135. childSetAction("max_rot_reset_button", onClickResetToDefault,
  136. (void*)"CameraToPelvisRotDeviation");
  137. childSetAction("offset_scale_reset_button", onClickResetToDefault,
  138. (void*)"CameraOffsetScale");
  139. childSetAction("rear_offset_reset_button", onClickResetToDefault,
  140. (void*)"CameraOffsetDefault");
  141. childSetAction("front_offset_reset_button", onClickResetToDefault,
  142. (void*)"CameraOffsetFrontView");
  143. childSetCommitCallback("private_look_at_check",
  144. onCommitCheckPrivateLookAt, this);
  145. childSetCommitCallback("private_point_at_check",
  146. onCommitCheckPrivatePointAt, this);
  147. childSetCommitCallback("limit_select_distance",
  148. onCommitCheckLimitSelectDistance, this);
  149. childSetCommitCallback("double_click_action",
  150. onCommitRadioDoubleClickAction, this);
  151. childSetCommitCallback("no_joystick_check",
  152. onCommitCheckNoJoystick, this);
  153. LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_angle");
  154. fov_slider->setMinValue(gViewerCamera.getMinView());
  155. fov_slider->setMaxValue(gViewerCamera.getMaxView());
  156. fov_slider->setValue(gViewerCamera.getView());
  157. mSpinRearX = getChild<LLSpinCtrl>("rear_offset_x");
  158. mSpinRearX->setCommitCallback(onRearOffsetAdjust);
  159. mSpinRearX->setCallbackUserData(this);
  160. mSpinRearY = getChild<LLSpinCtrl>("rear_offset_y");
  161. mSpinRearY->setCommitCallback(onRearOffsetAdjust);
  162. mSpinRearY->setCallbackUserData(this);
  163. mSpinRearZ = getChild<LLSpinCtrl>("rear_offset_z");
  164. mSpinRearZ->setCommitCallback(onRearOffsetAdjust);
  165. mSpinRearZ->setCallbackUserData(this);
  166. mSpinFrontX = getChild<LLSpinCtrl>("front_offset_x");
  167. mSpinFrontX->setCommitCallback(onFrontOffsetAdjust);
  168. mSpinFrontX->setCallbackUserData(this);
  169. mSpinFrontY = getChild<LLSpinCtrl>("front_offset_y");
  170. mSpinFrontY->setCommitCallback(onFrontOffsetAdjust);
  171. mSpinFrontY->setCallbackUserData(this);
  172. mSpinFrontZ = getChild<LLSpinCtrl>("front_offset_z");
  173. mSpinFrontZ->setCommitCallback(onFrontOffsetAdjust);
  174. mSpinFrontZ->setCallbackUserData(this);
  175. refresh();
  176. }
  177. void LLPrefsInputImpl::draw()
  178. {
  179. if (mFirstRun)
  180. {
  181. mFirstRun = false;
  182. mTabContainer->selectTab(gSavedSettings.getS32("LastInputPrefTab"));
  183. }
  184. if (sDirty)
  185. {
  186. sDirty = false;
  187. LLVector3 offset = gSavedSettings.getVector3("CameraOffsetDefault");
  188. mSpinRearX->set(offset.mV[VX]);
  189. mSpinRearY->set(offset.mV[VY]);
  190. mSpinRearZ->set(offset.mV[VZ]);
  191. offset = gSavedSettings.getVector3("CameraOffsetFrontView");
  192. mSpinFrontX->set(offset.mV[VX]);
  193. mSpinFrontY->set(offset.mV[VY]);
  194. mSpinFrontZ->set(offset.mV[VZ]);
  195. }
  196. LLPanel::draw();
  197. }
  198. void LLPrefsInputImpl::refreshValues()
  199. {
  200. mCameraAngle = gSavedSettings.getF32("CameraAngle");
  201. mCameraOffsetScale = gSavedSettings.getF32("CameraOffsetScale");
  202. mMouseSensitivity = gSavedSettings.getF32("MouseSensitivity");
  203. mMaxSelectDistance = gSavedSettings.getF32("MaxSelectDistance");
  204. mCameraToPelvisRotDeviation = gSavedSettings.getU32("CameraToPelvisRotDeviation");
  205. mPrivateLookAtLimit = gSavedSettings.getU32("PrivateLookAtLimit");
  206. mPrivatePointAtLimit = gSavedSettings.getU32("PrivatePointAtLimit");
  207. mDoubleClickAction = gSavedSettings.getU32("DoubleClickAction");
  208. mDoubleClickScriptedObject = gSavedSettings.getBool("DoubleClickScriptedObject");
  209. mJoystickNeverEnable = gSavedSettings.getBool("JoystickNeverEnable");
  210. mMouseSmooth = gSavedSettings.getBool("MouseSmooth");
  211. mPrivateLookAt = gSavedSettings.getBool("PrivateLookAt");
  212. mPrivatePointAt = gSavedSettings.getBool("PrivatePointAt");
  213. mLimitSelectDistance = gSavedSettings.getBool("LimitSelectDistance");
  214. mInvertMouse = gSavedSettings.getBool("InvertMouse");
  215. mShowCrosshairs = gSavedSettings.getBool("ShowCrosshairs");
  216. mFirstPersonAvatarVisible = gSavedSettings.getBool("FirstPersonAvatarVisible");
  217. mMouselookRenderRigged = gSavedSettings.getBool("MouselookRenderRigged");
  218. mCameraIgnoreCollisions = gSavedSettings.getBool("CameraIgnoreCollisions");
  219. mDisableCameraConstraints = gSavedSettings.getBool("DisableCameraConstraints");
  220. mResetViewRotatesAvatar = gSavedSettings.getBool("ResetViewRotatesAvatar");
  221. mEditCameraMovement = gSavedSettings.getBool("EditCameraMovement");
  222. mAppearanceCameraMovement = gSavedSettings.getBool("AppearanceCameraMovement");
  223. mThumbnailSnapshotFrontView = gSavedSettings.getBool("ThumbnailSnapshotFrontView");
  224. mSitCameraFrontView = gSavedSettings.getBool("SitCameraFrontView");
  225. mAutomaticFly = gSavedSettings.getBool("AutomaticFly");
  226. mArrowKeysMoveAvatar = gSavedSettings.getBool("ArrowKeysMoveAvatar");
  227. mMouseLookUseRotDeviation = gSavedSettings.getBool("MouseLookUseRotDeviation");
  228. mEyesFollowMousePointer = gSavedSettings.getBool("EyesFollowMousePointer");
  229. mLeftClickSteersAvatar = gSavedSettings.getBool("LeftClickSteersAvatar");
  230. mLeftClickToOpen = gSavedSettings.getBool("LeftClickToOpen");
  231. mLeftClickToPay = gSavedSettings.getBool("LeftClickToPay");
  232. mLeftClickToPlay = gSavedSettings.getBool("LeftClickToPlay");
  233. mLeftClickToSit = gSavedSettings.getBool("LeftClickToSit");
  234. mLeftClickToZoom = gSavedSettings.getBool("LeftClickToZoom");
  235. mCameraOffsetDefault = gSavedSettings.getVector3("CameraOffsetDefault");
  236. mCameraOffsetFrontView = gSavedSettings.getVector3("CameraOffsetFrontView");
  237. }
  238. void LLPrefsInputImpl::refresh()
  239. {
  240. refreshValues();
  241. childSetEnabled("private_look_at_limit", mPrivateLookAt);
  242. childSetEnabled("private_look_at_limit_meters", mPrivateLookAt);
  243. childSetEnabled("private_point_at_limit", mPrivatePointAt);
  244. childSetEnabled("private_point_at_limit_meters", mPrivatePointAt);
  245. childSetEnabled("max_select_distance", mLimitSelectDistance);
  246. childSetEnabled("select_distance_meters", mLimitSelectDistance);
  247. childSetEnabled("scripted_object_check", mDoubleClickAction != 0);
  248. mSpinRearX->set(mCameraOffsetDefault.mV[VX]);
  249. mSpinRearY->set(mCameraOffsetDefault.mV[VY]);
  250. mSpinRearZ->set(mCameraOffsetDefault.mV[VZ]);
  251. mSpinFrontX->set(mCameraOffsetFrontView.mV[VX]);
  252. mSpinFrontY->set(mCameraOffsetFrontView.mV[VY]);
  253. mSpinFrontZ->set(mCameraOffsetFrontView.mV[VZ]);
  254. mJoystickButton->setEnabled(!mJoystickNeverEnable);
  255. }
  256. void LLPrefsInputImpl::apply()
  257. {
  258. onRearOffsetAdjust(NULL, this);
  259. onFrontOffsetAdjust(NULL, this);
  260. refreshValues();
  261. }
  262. void LLPrefsInputImpl::cancel()
  263. {
  264. gViewerCamera.setDefaultFOV(mCameraAngle);
  265. gSavedSettings.setF32("CameraAngle", gViewerCamera.getView());
  266. gSavedSettings.setF32("CameraOffsetScale", mCameraOffsetScale);
  267. gSavedSettings.setF32("MouseSensitivity", mMouseSensitivity);
  268. gSavedSettings.setF32("MaxSelectDistance", mMaxSelectDistance);
  269. gSavedSettings.setU32("CameraToPelvisRotDeviation", mCameraToPelvisRotDeviation);
  270. gSavedSettings.setU32("PrivateLookAtLimit", mPrivateLookAtLimit);
  271. gSavedSettings.setU32("PrivatePointAtLimit", mPrivatePointAtLimit);
  272. gSavedSettings.setU32("DoubleClickAction", mDoubleClickAction);
  273. gSavedSettings.setBool("DoubleClickScriptedObject", mDoubleClickScriptedObject);
  274. gSavedSettings.setBool("JoystickNeverEnable", mJoystickNeverEnable);
  275. gSavedSettings.setBool("MouseSmooth", mMouseSmooth);
  276. gSavedSettings.setBool("PrivateLookAt", mPrivateLookAt);
  277. gSavedSettings.setBool("PrivatePointAt", mPrivatePointAt);
  278. gSavedSettings.setBool("LimitSelectDistance", mLimitSelectDistance);
  279. gSavedSettings.setBool("InvertMouse", mInvertMouse);
  280. gSavedSettings.setBool("ShowCrosshairs", mShowCrosshairs);
  281. gSavedSettings.setBool("FirstPersonAvatarVisible", mFirstPersonAvatarVisible);
  282. gSavedSettings.setBool("MouselookRenderRigged", mMouselookRenderRigged);
  283. gSavedSettings.setBool("CameraIgnoreCollisions", mCameraIgnoreCollisions);
  284. gSavedSettings.setBool("DisableCameraConstraints", mDisableCameraConstraints);
  285. gSavedSettings.setBool("ResetViewRotatesAvatar", mResetViewRotatesAvatar);
  286. gSavedSettings.setBool("EditCameraMovement", mEditCameraMovement);
  287. gSavedSettings.setBool("AppearanceCameraMovement", mAppearanceCameraMovement);
  288. gSavedSettings.setBool("ThumbnailSnapshotFrontView", mThumbnailSnapshotFrontView);
  289. gSavedSettings.setBool("SitCameraFrontView", mSitCameraFrontView);
  290. gSavedSettings.setBool("AutomaticFly", mAutomaticFly);
  291. gSavedSettings.setBool("ArrowKeysMoveAvatar", mArrowKeysMoveAvatar);
  292. gSavedSettings.setBool("MouseLookUseRotDeviation", mMouseLookUseRotDeviation);
  293. gSavedSettings.setBool("EyesFollowMousePointer", mEyesFollowMousePointer);
  294. gSavedSettings.setBool("LeftClickSteersAvatar", mLeftClickSteersAvatar);
  295. gSavedSettings.setBool("LeftClickToOpen", mLeftClickToOpen);
  296. gSavedSettings.setBool("LeftClickToPay", mLeftClickToPay);
  297. gSavedSettings.setBool("LeftClickToPlay", mLeftClickToPlay);
  298. gSavedSettings.setBool("LeftClickToSit", mLeftClickToSit);
  299. gSavedSettings.setBool("LeftClickToZoom", mLeftClickToZoom);
  300. gSavedSettings.setVector3("CameraOffsetDefault", mCameraOffsetDefault);
  301. gSavedSettings.setVector3("CameraOffsetFrontView", mCameraOffsetFrontView);
  302. }
  303. //static
  304. void LLPrefsInputImpl::onTabChanged(void* data, bool from_click)
  305. {
  306. LLPrefsInputImpl* self = (LLPrefsInputImpl*)data;
  307. if (self && self->mTabContainer)
  308. {
  309. gSavedSettings.setS32("LastInputPrefTab",
  310. self->mTabContainer->getCurrentPanelIndex());
  311. }
  312. }
  313. //static
  314. void LLPrefsInputImpl::onClickJoystickSetup(void* data)
  315. {
  316. LLPrefsInputImpl* prefs = (LLPrefsInputImpl*)data;
  317. LLFloaterJoystick* floaterp = LLFloaterJoystick::showInstance();
  318. LLFloater* parentp = gFloaterViewp->getParentFloater(prefs);
  319. if (parentp)
  320. {
  321. parentp->addDependentFloater(floaterp, false);
  322. }
  323. }
  324. //static
  325. void LLPrefsInputImpl::onClickResetToDefault(void* data)
  326. {
  327. std::string setting(static_cast<char*>(data));
  328. LLControlVariable* controlp = gSavedSettings.getControl(setting.c_str());
  329. if (controlp)
  330. {
  331. controlp->resetToDefault(true);
  332. }
  333. if (setting == "CameraAngle")
  334. {
  335. // Get the value that was just reset to default
  336. F32 fov = gSavedSettings.getF32("CameraAngle");
  337. // Attempt to set the camera with it
  338. gViewerCamera.setDefaultFOV(fov);
  339. // Recover the actual value
  340. fov = gViewerCamera.getView();
  341. // Store it
  342. gSavedSettings.setF32("CameraAngle", fov);
  343. }
  344. else if (setting == "CameraOffsetDefault" ||
  345. setting == "CameraOffsetFrontView")
  346. {
  347. sDirty = true;
  348. }
  349. }
  350. //static
  351. void LLPrefsInputImpl::onCommitCheckPrivateLookAt(LLUICtrl* ctrl,
  352. void* user_data)
  353. {
  354. LLPrefsInputImpl* self = (LLPrefsInputImpl*)user_data;
  355. LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
  356. if (self && check)
  357. {
  358. bool enabled = check->get();
  359. self->childSetEnabled("private_look_at_limit", enabled);
  360. self->childSetEnabled("private_look_at_limit_meters", enabled);
  361. }
  362. }
  363. //static
  364. void LLPrefsInputImpl::onCommitCheckPrivatePointAt(LLUICtrl* ctrl,
  365. void* user_data)
  366. {
  367. LLPrefsInputImpl* self = (LLPrefsInputImpl*)user_data;
  368. LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
  369. if (self && check)
  370. {
  371. bool enabled = check->get();
  372. self->childSetEnabled("private_point_at_limit", enabled);
  373. self->childSetEnabled("private_point_at_limit_meters", enabled);
  374. }
  375. }
  376. //static
  377. void LLPrefsInputImpl::onCommitCheckLimitSelectDistance(LLUICtrl* ctrl,
  378. void* data)
  379. {
  380. LLPrefsInputImpl* self = (LLPrefsInputImpl*)data;
  381. LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
  382. if (self && check)
  383. {
  384. bool enable = check->get();
  385. self->childSetEnabled("max_select_distance", enable);
  386. self->childSetEnabled("select_distance_meters", enable);
  387. }
  388. }
  389. //static
  390. void LLPrefsInputImpl::onCommitRadioDoubleClickAction(LLUICtrl* ctrl,
  391. void* data)
  392. {
  393. LLPrefsInputImpl* self = (LLPrefsInputImpl*)data;
  394. if (!self) return;
  395. bool enable = gSavedSettings.getU32("DoubleClickAction") != 0;
  396. self->childSetEnabled("scripted_object_check", enable);
  397. }
  398. //static
  399. void LLPrefsInputImpl::onRearOffsetAdjust(LLUICtrl* ctrl, void* data)
  400. {
  401. LLPrefsInputImpl* self = (LLPrefsInputImpl*)data;
  402. if (self)
  403. {
  404. LLVector3 value = LLVector3(self->mSpinRearX->get(),
  405. self->mSpinRearY->get(),
  406. self->mSpinRearZ->get());
  407. gSavedSettings.setVector3("CameraOffsetDefault", value);
  408. }
  409. }
  410. //static
  411. void LLPrefsInputImpl::onFrontOffsetAdjust(LLUICtrl* ctrl, void* data)
  412. {
  413. LLPrefsInputImpl* self = (LLPrefsInputImpl*)data;
  414. if (self)
  415. {
  416. LLVector3 value = LLVector3(self->mSpinFrontX->get(),
  417. self->mSpinFrontY->get(),
  418. self->mSpinFrontZ->get());
  419. gSavedSettings.setVector3("CameraOffsetFrontView", value);
  420. }
  421. }
  422. //static
  423. void LLPrefsInputImpl::onCommitCheckNoJoystick(LLUICtrl* ctrl,
  424. void* user_data)
  425. {
  426. LLPrefsInputImpl* self = (LLPrefsInputImpl*)user_data;
  427. LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
  428. if (!self || !check) return;
  429. bool enabled = check->get();
  430. self->mJoystickButton->setEnabled(!enabled);
  431. if (self->mJoystickNeverEnable != enabled)
  432. {
  433. gNotifications.add("InEffectAfterRestart");
  434. }
  435. }
  436. //---------------------------------------------------------------------------
  437. LLPrefsInput::LLPrefsInput()
  438. : impl(* new LLPrefsInputImpl())
  439. {
  440. }
  441. LLPrefsInput::~LLPrefsInput()
  442. {
  443. delete &impl;
  444. }
  445. void LLPrefsInput::apply()
  446. {
  447. impl.apply();
  448. }
  449. void LLPrefsInput::cancel()
  450. {
  451. impl.cancel();
  452. }
  453. LLPanel* LLPrefsInput::getPanel()
  454. {
  455. return &impl;
  456. }