llviewercontrol.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:29k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file llviewercontrol.cpp
  3.  * @brief Viewer configuration
  4.  * @author Richard Nelson
  5.  *
  6.  * $LicenseInfo:firstyear=2001&license=viewergpl$
  7.  * 
  8.  * Copyright (c) 2001-2010, Linden Research, Inc.
  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 "llviewercontrol.h"
  35. // Library includes
  36. #include "llwindow.h" // getGamma()
  37. // For Listeners
  38. #include "llaudioengine.h"
  39. #include "llagent.h"
  40. #include "llconsole.h"
  41. #include "lldrawpoolterrain.h"
  42. #include "llflexibleobject.h"
  43. #include "llfeaturemanager.h"
  44. #include "llviewershadermgr.h"
  45. #include "llsky.h"
  46. #include "llvieweraudio.h"
  47. #include "llviewermenu.h"
  48. #include "llviewertexturelist.h"
  49. #include "llviewerthrottle.h"
  50. #include "llviewerwindow.h"
  51. #include "llvoavatarself.h"
  52. #include "llvoiceclient.h"
  53. #include "llvosky.h"
  54. #include "llvotree.h"
  55. #include "llvovolume.h"
  56. #include "llworld.h"
  57. #include "pipeline.h"
  58. #include "llviewerjoystick.h"
  59. #include "llviewerparcelmgr.h"
  60. #include "llparcel.h"
  61. #include "llkeyboard.h"
  62. #include "llerrorcontrol.h"
  63. #include "llappviewer.h"
  64. #include "llvosurfacepatch.h"
  65. #include "llvowlsky.h"
  66. #include "llrender.h"
  67. #include "llbottomtray.h"
  68. #include "llnavigationbar.h"
  69. #include "llfloatertools.h"
  70. #include "llpaneloutfitsinventory.h"
  71. #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
  72. BOOL  gHackGodmode = FALSE;
  73. #endif
  74. LLControlGroup gSavedSettings("Global"); // saved at end of session
  75. LLControlGroup gSavedPerAccountSettings("PerAccount"); // saved at end of session
  76. LLControlGroup gCrashSettings("CrashSettings"); // saved at end of session
  77. LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warnings
  78. std::string gLastRunVersion;
  79. std::string gCurrentVersion;
  80. extern BOOL gResizeScreenTexture;
  81. extern BOOL gDebugGL;
  82. extern BOOL gAuditTexture;
  83. ////////////////////////////////////////////////////////////////////////////
  84. // Listeners
  85. static bool handleRenderAvatarMouselookChanged(const LLSD& newvalue)
  86. {
  87. LLVOAvatar::sVisibleInFirstPerson = newvalue.asBoolean();
  88. return true;
  89. }
  90. static bool handleRenderFarClipChanged(const LLSD& newvalue)
  91. {
  92. F32 draw_distance = (F32) newvalue.asReal();
  93. gAgent.mDrawDistance = draw_distance;
  94. LLWorld::getInstance()->setLandFarClip(draw_distance);
  95. return true;
  96. }
  97. static bool handleTerrainDetailChanged(const LLSD& newvalue)
  98. {
  99. LLDrawPoolTerrain::sDetailMode = newvalue.asInteger();
  100. return true;
  101. }
  102. static bool handleSetShaderChanged(const LLSD& newvalue)
  103. {
  104. LLViewerShaderMgr::instance()->setShaders();
  105. return true;
  106. }
  107. static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
  108. {
  109. if (gPipeline.isInit())
  110. {
  111. gPipeline.releaseGLBuffers();
  112. gPipeline.createGLBuffers();
  113. }
  114. return true;
  115. }
  116. static bool handleVolumeLODChanged(const LLSD& newvalue)
  117. {
  118. LLVOVolume::sLODFactor = (F32) newvalue.asReal();
  119. LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
  120. return true;
  121. }
  122. static bool handleAvatarLODChanged(const LLSD& newvalue)
  123. {
  124. LLVOAvatar::sLODFactor = (F32) newvalue.asReal();
  125. return true;
  126. }
  127. static bool handleAvatarMaxVisibleChanged(const LLSD& newvalue)
  128. {
  129. LLVOAvatar::sMaxVisible = (U32) newvalue.asInteger();
  130. return true;
  131. }
  132. static bool handleTerrainLODChanged(const LLSD& newvalue)
  133. {
  134. LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
  135. //sqaure lod factor to get exponential range of [0,4] and keep
  136. //a value of 1 in the middle of the detail slider for consistency
  137. //with other detail sliders (see panel_preferences_graphics1.xml)
  138. LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
  139. return true;
  140. }
  141. static bool handleTreeLODChanged(const LLSD& newvalue)
  142. {
  143. LLVOTree::sTreeFactor = (F32) newvalue.asReal();
  144. return true;
  145. }
  146. static bool handleFlexLODChanged(const LLSD& newvalue)
  147. {
  148. LLVolumeImplFlexible::sUpdateFactor = (F32) newvalue.asReal();
  149. return true;
  150. }
  151. static bool handleGammaChanged(const LLSD& newvalue)
  152. {
  153. F32 gamma = (F32) newvalue.asReal();
  154. if (gamma == 0.0f)
  155. {
  156. gamma = 1.0f; // restore normal gamma
  157. }
  158. if (gViewerWindow && gViewerWindow->getWindow() && gamma != gViewerWindow->getWindow()->getGamma())
  159. {
  160. // Only save it if it's changed
  161. if (!gViewerWindow->getWindow()->setGamma(gamma))
  162. {
  163. llwarns << "setGamma failed!" << llendl;
  164. }
  165. }
  166. return true;
  167. }
  168. const F32 MAX_USER_FOG_RATIO = 10.f;
  169. const F32 MIN_USER_FOG_RATIO = 0.5f;
  170. static bool handleFogRatioChanged(const LLSD& newvalue)
  171. {
  172. F32 fog_ratio = llmax(MIN_USER_FOG_RATIO, llmin((F32) newvalue.asReal(), MAX_USER_FOG_RATIO));
  173. gSky.setFogRatio(fog_ratio);
  174. return true;
  175. }
  176. static bool handleMaxPartCountChanged(const LLSD& newvalue)
  177. {
  178. LLViewerPartSim::setMaxPartCount(newvalue.asInteger());
  179. return true;
  180. }
  181. static bool handleVideoMemoryChanged(const LLSD& newvalue)
  182. {
  183. gTextureList.updateMaxResidentTexMem(newvalue.asInteger());
  184. return true;
  185. }
  186. static bool handleBandwidthChanged(const LLSD& newvalue)
  187. {
  188. gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
  189. return true;
  190. }
  191. static bool handleChatFontSizeChanged(const LLSD& newvalue)
  192. {
  193. if(gConsole)
  194. {
  195. gConsole->setFontSize(newvalue.asInteger());
  196. }
  197. return true;
  198. }
  199. static bool handleChatPersistTimeChanged(const LLSD& newvalue)
  200. {
  201. if(gConsole)
  202. {
  203. gConsole->setLinePersistTime((F32) newvalue.asReal());
  204. }
  205. return true;
  206. }
  207. static bool handleConsoleMaxLinesChanged(const LLSD& newvalue)
  208. {
  209. if(gConsole)
  210. {
  211. gConsole->setMaxLines(newvalue.asInteger());
  212. }
  213. return true;
  214. }
  215. static void handleAudioVolumeChanged(const LLSD& newvalue)
  216. {
  217. audio_update_volume(true);
  218. }
  219. static bool handleJoystickChanged(const LLSD& newvalue)
  220. {
  221. LLViewerJoystick::getInstance()->setCameraNeedsUpdate(TRUE);
  222. return true;
  223. }
  224. static bool handleUseOcclusionChanged(const LLSD& newvalue)
  225. {
  226. LLPipeline::sUseOcclusion = (newvalue.asBoolean() && gGLManager.mHasOcclusionQuery 
  227. && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0;
  228. return true;
  229. }
  230. static bool handleUploadBakedTexOldChanged(const LLSD& newvalue)
  231. {
  232. LLPipeline::sForceOldBakedUpload = newvalue.asBoolean();
  233. return true;
  234. }
  235. static bool handleNumpadControlChanged(const LLSD& newvalue)
  236. {
  237. if (gKeyboard)
  238. {
  239. gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(newvalue.asInteger()));
  240. }
  241. return true;
  242. }
  243. static bool handleRenderUseVBOChanged(const LLSD& newvalue)
  244. {
  245. if (gPipeline.isInit())
  246. {
  247. gPipeline.setUseVBO(newvalue.asBoolean());
  248. }
  249. return true;
  250. }
  251. static bool handleWLSkyDetailChanged(const LLSD&)
  252. {
  253. if (gSky.mVOWLSkyp.notNull())
  254. {
  255. gSky.mVOWLSkyp->updateGeometry(gSky.mVOWLSkyp->mDrawable);
  256. }
  257. return true;
  258. }
  259. static bool handleRenderLightingDetailChanged(const LLSD& newvalue)
  260. {
  261. if (gPipeline.isInit())
  262. {
  263. gPipeline.setLightingDetail(newvalue.asInteger());
  264. }
  265. return true;
  266. }
  267. static bool handleResetVertexBuffersChanged(const LLSD&)
  268. {
  269. if (gPipeline.isInit())
  270. {
  271. gPipeline.resetVertexBuffers();
  272. }
  273. return true;
  274. }
  275. static bool handleRenderDynamicLODChanged(const LLSD& newvalue)
  276. {
  277. LLPipeline::sDynamicLOD = newvalue.asBoolean();
  278. return true;
  279. }
  280. static bool handleRenderUseFBOChanged(const LLSD& newvalue)
  281. {
  282. LLRenderTarget::sUseFBO = newvalue.asBoolean();
  283. if (gPipeline.isInit())
  284. {
  285. gPipeline.releaseGLBuffers();
  286. gPipeline.createGLBuffers();
  287. if (LLPipeline::sRenderDeferred && LLRenderTarget::sUseFBO)
  288. {
  289. LLViewerShaderMgr::instance()->setShaders();
  290. }
  291. }
  292. return true;
  293. }
  294. static bool handleRenderUseImpostorsChanged(const LLSD& newvalue)
  295. {
  296. LLVOAvatar::sUseImpostors = newvalue.asBoolean();
  297. return true;
  298. }
  299. static bool handleAuditTextureChanged(const LLSD& newvalue)
  300. {
  301. gAuditTexture = newvalue.asBoolean();
  302. return true;
  303. }
  304. static bool handleRenderDebugGLChanged(const LLSD& newvalue)
  305. {
  306. gDebugGL = newvalue.asBoolean() || gDebugSession;
  307. gGL.clearErrors();
  308. return true;
  309. }
  310. static bool handleRenderDebugPipelineChanged(const LLSD& newvalue)
  311. {
  312. gDebugPipeline = newvalue.asBoolean();
  313. return true;
  314. }
  315. static bool handleRenderResolutionDivisorChanged(const LLSD&)
  316. {
  317. gResizeScreenTexture = TRUE;
  318. return true;
  319. }
  320. static bool handleDebugViewsChanged(const LLSD& newvalue)
  321. {
  322. LLView::sDebugRects = newvalue.asBoolean();
  323. return true;
  324. }
  325. static bool handleLogFileChanged(const LLSD& newvalue)
  326. {
  327. std::string log_filename = newvalue.asString();
  328. LLFile::remove(log_filename);
  329. LLError::logToFile(log_filename);
  330. return true;
  331. }
  332. bool handleHideGroupTitleChanged(const LLSD& newvalue)
  333. {
  334. gAgent.setHideGroupTitle(newvalue);
  335. return true;
  336. }
  337. bool handleEffectColorChanged(const LLSD& newvalue)
  338. {
  339. gAgent.setEffectColor(LLColor4(newvalue));
  340. return true;
  341. }
  342. bool handleVectorizeChanged(const LLSD& newvalue)
  343. {
  344. LLViewerJointMesh::updateVectorize();
  345. return true;
  346. }
  347. bool handleHighResSnapshotChanged(const LLSD& newvalue)
  348. {
  349. // High Res Snapshot active, must uncheck RenderUIInSnapshot
  350. if (newvalue.asBoolean())
  351. {
  352. gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE );
  353. }
  354. return true;
  355. }
  356. bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
  357. {
  358. if(gVoiceClient)
  359. {
  360. gVoiceClient->updateSettings();
  361. }
  362. return true;
  363. }
  364. bool handleVelocityInterpolate(const LLSD& newvalue)
  365. {
  366. LLMessageSystem* msg = gMessageSystem;
  367. if ( newvalue.asBoolean() )
  368. {
  369. msg->newMessageFast(_PREHASH_VelocityInterpolateOn);
  370. msg->nextBlockFast(_PREHASH_AgentData);
  371. msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
  372. msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
  373. gAgent.sendReliableMessage();
  374. llinfos << "Velocity Interpolation On" << llendl;
  375. }
  376. else
  377. {
  378. msg->newMessageFast(_PREHASH_VelocityInterpolateOff);
  379. msg->nextBlockFast(_PREHASH_AgentData);
  380. msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
  381. msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
  382. gAgent.sendReliableMessage();
  383. llinfos << "Velocity Interpolation Off" << llendl;
  384. }
  385. return true;
  386. }
  387. bool toggle_agent_pause(const LLSD& newvalue)
  388. {
  389. if ( newvalue.asBoolean() )
  390. {
  391. send_agent_pause();
  392. }
  393. else
  394. {
  395. send_agent_resume();
  396. }
  397. return true;
  398. }
  399. bool toggle_show_gesture_button(const LLSD& newvalue)
  400. {
  401. LLBottomTray::getInstance()->showGestureButton(newvalue.asBoolean());
  402. return true;
  403. }
  404. bool toggle_show_move_button(const LLSD& newvalue)
  405. {
  406. LLBottomTray::getInstance()->showMoveButton(newvalue.asBoolean());
  407. return true;
  408. }
  409. bool toggle_show_camera_button(const LLSD& newvalue)
  410. {
  411. LLBottomTray::getInstance()->showCameraButton(newvalue.asBoolean());
  412. return true;
  413. }
  414. bool toggle_show_snapshot_button(const LLSD& newvalue)
  415. {
  416. LLBottomTray::getInstance()->showSnapshotButton(newvalue.asBoolean());
  417. return true;
  418. }
  419. bool toggle_show_navigation_panel(const LLSD& newvalue)
  420. {
  421. LLNavigationBar::getInstance()->showNavigationPanel(newvalue.asBoolean());
  422. return true;
  423. }
  424. bool toggle_show_favorites_panel(const LLSD& newvalue)
  425. {
  426. LLNavigationBar::getInstance()->showFavoritesPanel(newvalue.asBoolean());
  427. return true;
  428. }
  429. bool toggle_show_appearance_editor(const LLSD& newvalue)
  430. {
  431. LLPanelOutfitsInventory::sShowDebugEditor = newvalue.asBoolean();
  432. return true;
  433. }
  434. bool toggle_show_object_render_cost(const LLSD& newvalue)
  435. {
  436. LLFloaterTools::sShowObjectCost = newvalue.asBoolean();
  437. return true;
  438. }
  439. ////////////////////////////////////////////////////////////////////////////
  440. void settings_setup_listeners()
  441. {
  442. gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _2));
  443. gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _2));
  444. gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2));
  445. gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  446. gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  447. gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  448. gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  449. gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  450. gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  451. gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  452. gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  453. gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  454. gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  455. gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  456. gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  457. gSavedSettings.getControl("RenderAvatarMaxVisible")->getSignal()->connect(boost::bind(&handleAvatarMaxVisibleChanged, _2));
  458. gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2));
  459. gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2));
  460. gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2));
  461. gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _2));
  462. gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _2));
  463. gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _2));
  464. gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _2));
  465. gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _2));
  466. gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _2));
  467. gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _2));
  468. gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  469. gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  470. gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  471. gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  472. gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _2));
  473. gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  474. gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _2));
  475. gSavedSettings.getControl("RenderDebugGL")->getSignal()->connect(boost::bind(&handleRenderDebugGLChanged, _2));
  476. gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2));
  477. gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _2));
  478. gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  479. gSavedSettings.getControl("RenderDeferredShadow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  480. gSavedSettings.getControl("RenderDeferredGI")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  481. gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _2));
  482. gSavedSettings.getControl("AuditTexture")->getSignal()->connect(boost::bind(&handleAuditTextureChanged, _2));
  483. gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&handleChatFontSizeChanged, _2));
  484. gSavedSettings.getControl("ChatPersistTime")->getSignal()->connect(boost::bind(&handleChatPersistTimeChanged, _2));
  485. gSavedSettings.getControl("ConsoleMaxLines")->getSignal()->connect(boost::bind(&handleConsoleMaxLinesChanged, _2));
  486. gSavedSettings.getControl("UploadBakedTexOld")->getSignal()->connect(boost::bind(&handleUploadBakedTexOldChanged, _2));
  487. gSavedSettings.getControl("UseOcclusion")->getSignal()->connect(boost::bind(&handleUseOcclusionChanged, _2));
  488. gSavedSettings.getControl("AudioLevelMaster")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  489. gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  490. gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  491. gSavedSettings.getControl("AudioLevelAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  492. gSavedSettings.getControl("AudioLevelMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  493. gSavedSettings.getControl("AudioLevelMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  494. gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  495. gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  496. gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  497. gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  498. gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  499. gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  500. gSavedSettings.getControl("MuteVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  501. gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  502. gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  503. gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleRenderUseVBOChanged, _2));
  504. gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _2));
  505. gSavedSettings.getControl("RenderLightingDetail")->getSignal()->connect(boost::bind(&handleRenderLightingDetailChanged, _2));
  506. gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _2));
  507. gSavedSettings.getControl("JoystickAxis0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  508. gSavedSettings.getControl("JoystickAxis1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  509. gSavedSettings.getControl("JoystickAxis2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  510. gSavedSettings.getControl("JoystickAxis3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  511. gSavedSettings.getControl("JoystickAxis4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  512. gSavedSettings.getControl("JoystickAxis5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  513. gSavedSettings.getControl("JoystickAxis6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  514. gSavedSettings.getControl("FlycamAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  515. gSavedSettings.getControl("FlycamAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  516. gSavedSettings.getControl("FlycamAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  517. gSavedSettings.getControl("FlycamAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  518. gSavedSettings.getControl("FlycamAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  519. gSavedSettings.getControl("FlycamAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  520. gSavedSettings.getControl("FlycamAxisScale6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  521. gSavedSettings.getControl("FlycamAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  522. gSavedSettings.getControl("FlycamAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  523. gSavedSettings.getControl("FlycamAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  524. gSavedSettings.getControl("FlycamAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  525. gSavedSettings.getControl("FlycamAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  526. gSavedSettings.getControl("FlycamAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  527. gSavedSettings.getControl("FlycamAxisDeadZone6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  528. gSavedSettings.getControl("AvatarAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  529. gSavedSettings.getControl("AvatarAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  530. gSavedSettings.getControl("AvatarAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  531. gSavedSettings.getControl("AvatarAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  532. gSavedSettings.getControl("AvatarAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  533. gSavedSettings.getControl("AvatarAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  534. gSavedSettings.getControl("AvatarAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  535. gSavedSettings.getControl("AvatarAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  536. gSavedSettings.getControl("AvatarAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  537. gSavedSettings.getControl("AvatarAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  538. gSavedSettings.getControl("AvatarAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  539. gSavedSettings.getControl("AvatarAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  540. gSavedSettings.getControl("BuildAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  541. gSavedSettings.getControl("BuildAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  542. gSavedSettings.getControl("BuildAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  543. gSavedSettings.getControl("BuildAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  544. gSavedSettings.getControl("BuildAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  545. gSavedSettings.getControl("BuildAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  546. gSavedSettings.getControl("BuildAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  547. gSavedSettings.getControl("BuildAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  548. gSavedSettings.getControl("BuildAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  549. gSavedSettings.getControl("BuildAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  550. gSavedSettings.getControl("BuildAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  551. gSavedSettings.getControl("BuildAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  552. gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _2));
  553. gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _2));
  554. gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _2));
  555. gSavedSettings.getControl("HighResSnapshot")->getSignal()->connect(boost::bind(handleHighResSnapshotChanged, _2));
  556. gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
  557. gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
  558. gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
  559. gSavedSettings.getControl("VectorizeSkin")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2));
  560. gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  561. gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  562. gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  563. gSavedSettings.getControl("PushToTalkToggle")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  564. gSavedSettings.getControl("VoiceEarLocation")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  565. gSavedSettings.getControl("VoiceInputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  566. gSavedSettings.getControl("VoiceOutputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  567. gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  568. gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  569. gSavedSettings.getControl("VelocityInterpolate")->getSignal()->connect(boost::bind(&handleVelocityInterpolate, _2));
  570. gSavedSettings.getControl("QAMode")->getSignal()->connect(boost::bind(&show_debug_menus));
  571. gSavedSettings.getControl("UseDebugMenus")->getSignal()->connect(boost::bind(&show_debug_menus));
  572. gSavedSettings.getControl("AgentPause")->getSignal()->connect(boost::bind(&toggle_agent_pause, _2));
  573. gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&toggle_show_gesture_button, _2));
  574. gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&toggle_show_move_button, _2));
  575. gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&toggle_show_camera_button, _2));
  576. gSavedSettings.getControl("ShowSnapshotButton")->getSignal()->connect(boost::bind(&toggle_show_snapshot_button, _2));
  577. gSavedSettings.getControl("ShowNavbarNavigationPanel")->getSignal()->connect(boost::bind(&toggle_show_navigation_panel, _2));
  578. gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2));
  579. gSavedSettings.getControl("ShowDebugAppearanceEditor")->getSignal()->connect(boost::bind(&toggle_show_appearance_editor, _2));
  580. gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2));
  581. }
  582. #if TEST_CACHED_CONTROL
  583. #define DECL_LLCC(T, V) static LLCachedControl<T> mySetting_##T("TestCachedControl"#T, V)
  584. DECL_LLCC(U32, (U32)666);
  585. DECL_LLCC(S32, (S32)-666);
  586. DECL_LLCC(F32, (F32)-666.666);
  587. DECL_LLCC(bool, true);
  588. DECL_LLCC(BOOL, FALSE);
  589. static LLCachedControl<std::string> mySetting_string("TestCachedControlstring", "Default String Value");
  590. DECL_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
  591. DECL_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
  592. DECL_LLCC(LLRect, LLRect(0, 0, 100, 500));
  593. DECL_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f));
  594. DECL_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f));
  595. DECL_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255));
  596. LLSD test_llsd = LLSD()["testing1"] = LLSD()["testing2"];
  597. DECL_LLCC(LLSD, test_llsd);
  598. static LLCachedControl<std::string> test_BrowserHomePage("BrowserHomePage", "hahahahahha", "Not the real comment");
  599. void test_cached_control()
  600. {
  601. #define do { TEST_LLCC(T, V) if((T)mySetting_##T != V) llerrs << "Fail "#T << llendl; } while(0)
  602. TEST_LLCC(U32, 666);
  603. TEST_LLCC(S32, (S32)-666);
  604. TEST_LLCC(F32, (F32)-666.666);
  605. TEST_LLCC(bool, true);
  606. TEST_LLCC(BOOL, FALSE);
  607. if((std::string)mySetting_string != "Default String Value") llerrs << "Fail string" << llendl;
  608. TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
  609. TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
  610. TEST_LLCC(LLRect, LLRect(0, 0, 100, 500));
  611. TEST_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f));
  612. TEST_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f));
  613. TEST_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255));
  614. //There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd); 
  615. if((std::string)test_BrowserHomePage != "http://www.secondlife.com") llerrs << "Fail BrowserHomePage" << llendl;
  616. }
  617. #endif // TEST_CACHED_CONTROL